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):
20 def __init__(self, test, pfx, sfx, port, protocol):
25 self.protocol = protocol
27 def add_vpp_config(self):
28 self._test_vapi.lb_add_del_vip(pfx=self.pfx,
31 protocol=self.protocol)
33 self._test.registry.register(self, self._test.logger)
35 def remove_vpp_config(self):
36 self._test.vapi.lb_add_del_vip(pfx=self.pfx,
39 protocol=self.protocol,
42 def query_vpp_config(self):
43 details = self._test.vapi.lb_add_del_vip(fx=self.pfx,
46 protocol=self.protocol)
47 return True if self == details else False
50 class VppLbAs(vpp_object.VppObject):
51 def __init__(self, test, pfx, port, protocol, app_srv, is_del, is_flush):
56 self.protocol = protocol
58 self.app_srv = app_srv
60 self.is_flush = is_flush
62 def add_vpp_config(self):
63 self._test_vapi.lb_add_del_as(pfx=self.pfx,
65 protocol=self.protocol,
67 is_flush=self.is_flush,
70 self._test.registry.register(self, self._test.logger)
72 def remove_vpp_config(self):
73 self._test.vapi.lb_add_del_as(pfx=self.pfx,
75 protocol=self.protocol,
77 is_flush=self.is_flush,
80 def query_vpp_config(self):
81 details = self._test.vapi.lb_as_dump(pfx=self.pfx,
83 protocol=self.protocol)
84 return True if self == details else False