blob: e86be5d27b5667447d4bda43f790c091d611c195 [file] [log] [blame]
Stevene8fa6202017-08-30 14:36:45 -07001from vpp_interface import VppInterface
2
3
4class VppVhostInterface(VppInterface):
5 """VPP vhost interface."""
6
7 def __init__(self, test, sock_filename, is_server=0, renumber=0,
8 custom_dev_instance=0, use_custom_mac=0, mac_address='',
9 tag=''):
10
11 """ Create VPP Vhost interface """
Klement Sekerab9ef2732018-06-24 22:49:33 +020012 super(VppVhostInterface, self).__init__(test)
Stevene8fa6202017-08-30 14:36:45 -070013 self.is_server = is_server
14 self.sock_filename = sock_filename
15 self.renumber = renumber
16 self.custom_dev_instance = custom_dev_instance
17 self.use_custom_mac = use_custom_mac
18 self.mac_address = mac_address
19 self.tag = tag
20
21 def add_vpp_config(self):
22 r = self.test.vapi.create_vhost_user_if(self.is_server,
23 self.sock_filename,
24 self.renumber,
25 self.custom_dev_instance,
26 self.use_custom_mac,
27 self.mac_address,
28 self.tag)
Klement Sekerab9ef2732018-06-24 22:49:33 +020029 self.set_sw_if_index(r.sw_if_index)
Stevene8fa6202017-08-30 14:36:45 -070030
31 def remove_vpp_config(self):
32 self.test.vapi.delete_vhost_user_if(self.sw_if_index)
33
34 def is_interface_config_in_dump(self, dump):
35 for i in dump:
36 if i.sw_if_index == self.sw_if_index:
37 return True
38 else:
39 return False