blob: fd2928eac1d38687c20ffb7ed4a0c73881a76521 [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,
Steven Luongbc0d9ff2020-03-23 09:34:59 -07009 packed_ring=0, custom_dev_instance=0, use_custom_mac=0,
10 mac_address='', tag=''):
Stevene8fa6202017-08-30 14:36:45 -070011
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
Steven Luongbc0d9ff2020-03-23 09:34:59 -070020 self.packed_ring = packed_ring
Stevene8fa6202017-08-30 14:36:45 -070021 self.custom_dev_instance = custom_dev_instance
22 self.use_custom_mac = use_custom_mac
23 self.mac_address = mac_address
24 self.tag = tag
25
26 def add_vpp_config(self):
27 r = self.test.vapi.create_vhost_user_if(self.is_server,
28 self.sock_filename,
29 self.renumber,
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +020030 self.disable_mrg_rxbuf,
31 self.disable_indirect_desc,
Steven Luong4208a4c2019-05-06 08:51:56 -070032 self.gso,
Steven Luongbc0d9ff2020-03-23 09:34:59 -070033 self.packed_ring,
Stevene8fa6202017-08-30 14:36:45 -070034 self.custom_dev_instance,
35 self.use_custom_mac,
36 self.mac_address,
37 self.tag)
Klement Sekerab9ef2732018-06-24 22:49:33 +020038 self.set_sw_if_index(r.sw_if_index)
Stevene8fa6202017-08-30 14:36:45 -070039
40 def remove_vpp_config(self):
41 self.test.vapi.delete_vhost_user_if(self.sw_if_index)
42
43 def is_interface_config_in_dump(self, dump):
44 for i in dump:
45 if i.sw_if_index == self.sw_if_index:
46 return True
47 else:
48 return False