blob: 0a5f6b72b2f2f205618b6b3c364aac635f92ce4e [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,
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +02008 disable_mrg_rxbuf=0, disable_indirect_desc=0,
Stevene8fa6202017-08-30 14:36:45 -07009 custom_dev_instance=0, use_custom_mac=0, mac_address='',
10 tag=''):
11
12 """ Create VPP Vhost interface """
Klement Sekerab9ef2732018-06-24 22:49:33 +020013 super(VppVhostInterface, self).__init__(test)
Stevene8fa6202017-08-30 14:36:45 -070014 self.is_server = is_server
15 self.sock_filename = sock_filename
16 self.renumber = renumber
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +020017 self.disable_mrg_rxbuf = disable_mrg_rxbuf
18 self.disable_indirect_desc = disable_indirect_desc
Stevene8fa6202017-08-30 14:36:45 -070019 self.custom_dev_instance = custom_dev_instance
20 self.use_custom_mac = use_custom_mac
21 self.mac_address = mac_address
22 self.tag = tag
23
24 def add_vpp_config(self):
25 r = self.test.vapi.create_vhost_user_if(self.is_server,
26 self.sock_filename,
27 self.renumber,
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +020028 self.disable_mrg_rxbuf,
29 self.disable_indirect_desc,
Stevene8fa6202017-08-30 14:36:45 -070030 self.custom_dev_instance,
31 self.use_custom_mac,
32 self.mac_address,
33 self.tag)
Klement Sekerab9ef2732018-06-24 22:49:33 +020034 self.set_sw_if_index(r.sw_if_index)
Stevene8fa6202017-08-30 14:36:45 -070035
36 def remove_vpp_config(self):
37 self.test.vapi.delete_vhost_user_if(self.sw_if_index)
38
39 def is_interface_config_in_dump(self, dump):
40 for i in dump:
41 if i.sw_if_index == self.sw_if_index:
42 return True
43 else:
44 return False