blob: 569fe36d1d64f9da7981df1e53bc682a61a02dc2 [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,
Steven Luong4208a4c2019-05-06 08:51:56 -07008 disable_mrg_rxbuf=0, disable_indirect_desc=0, gso=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
Steven Luong4208a4c2019-05-06 08:51:56 -070019 self.gso = gso
Stevene8fa6202017-08-30 14:36:45 -070020 self.custom_dev_instance = custom_dev_instance
21 self.use_custom_mac = use_custom_mac
22 self.mac_address = mac_address
23 self.tag = tag
24
25 def add_vpp_config(self):
26 r = self.test.vapi.create_vhost_user_if(self.is_server,
27 self.sock_filename,
28 self.renumber,
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +020029 self.disable_mrg_rxbuf,
30 self.disable_indirect_desc,
Steven Luong4208a4c2019-05-06 08:51:56 -070031 self.gso,
Stevene8fa6202017-08-30 14:36:45 -070032 self.custom_dev_instance,
33 self.use_custom_mac,
34 self.mac_address,
35 self.tag)
Klement Sekerab9ef2732018-06-24 22:49:33 +020036 self.set_sw_if_index(r.sw_if_index)
Stevene8fa6202017-08-30 14:36:45 -070037
38 def remove_vpp_config(self):
39 self.test.vapi.delete_vhost_user_if(self.sw_if_index)
40
41 def is_interface_config_in_dump(self, dump):
42 for i in dump:
43 if i.sw_if_index == self.sw_if_index:
44 return True
45 else:
46 return False