1 # Copyright (c) 2019. Vinci Consulting Corp. All Rights Reserved.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 class VppLbVip(vpp_object.VppObject):
19 def __init__(self, test, pfx, sfx, port, protocol):
24 self.protocol = protocol
26 def add_vpp_config(self):
27 self._test_vapi.lb_add_del_vip(
28 pfx=self.pfx, sfx=self.pfx, port=self.port, protocol=self.protocol
31 self._test.registry.register(self, self._test.logger)
33 def remove_vpp_config(self):
34 self._test.vapi.lb_add_del_vip(
35 pfx=self.pfx, sfx=self.pfx, port=self.port, protocol=self.protocol, is_del=1
38 def query_vpp_config(self):
39 details = self._test.vapi.lb_add_del_vip(
40 fx=self.pfx, sfx=self.pfx, port=self.port, protocol=self.protocol
42 return True if self == details else False
45 class VppLbAs(vpp_object.VppObject):
46 def __init__(self, test, pfx, port, protocol, app_srv, is_del, is_flush):
51 self.protocol = protocol
53 self.app_srv = app_srv
55 self.is_flush = is_flush
57 def add_vpp_config(self):
58 self._test_vapi.lb_add_del_as(
61 protocol=self.protocol,
63 is_flush=self.is_flush,
66 self._test.registry.register(self, self._test.logger)
68 def remove_vpp_config(self):
69 self._test.vapi.lb_add_del_as(
72 protocol=self.protocol,
74 is_flush=self.is_flush,
78 def query_vpp_config(self):
79 details = self._test.vapi.lb_as_dump(
80 pfx=self.pfx, port=self.port, protocol=self.protocol
82 return True if self == details else False