blob: 8fa2d7172f14eff8663c98a60d875219e4b2e78c [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 Luong27ba5002020-11-17 13:30:44 -08008 disable_mrg_rxbuf=0, disable_indirect_desc=0, enable_gso=0,
9 enable_packed_ring=0, enable_event_idx=0,
10 custom_dev_instance=0xFFFFFFFF, use_custom_mac=0,
Steven Luongbc0d9ff2020-03-23 09:34:59 -070011 mac_address='', tag=''):
Stevene8fa6202017-08-30 14:36:45 -070012
13 """ Create VPP Vhost interface """
Klement Sekerab9ef2732018-06-24 22:49:33 +020014 super(VppVhostInterface, self).__init__(test)
Stevene8fa6202017-08-30 14:36:45 -070015 self.is_server = is_server
16 self.sock_filename = sock_filename
17 self.renumber = renumber
Mohsin Kazmiee2e58f2018-08-21 16:07:03 +020018 self.disable_mrg_rxbuf = disable_mrg_rxbuf
19 self.disable_indirect_desc = disable_indirect_desc
Steven Luong27ba5002020-11-17 13:30:44 -080020 self.enable_gso = enable_gso
21 self.enable_packed_ring = enable_packed_ring
22 self.enable_event_idx = enable_event_idx
Stevene8fa6202017-08-30 14:36:45 -070023 self.custom_dev_instance = custom_dev_instance
24 self.use_custom_mac = use_custom_mac
25 self.mac_address = mac_address
26 self.tag = tag
27
28 def add_vpp_config(self):
Steven Luong27ba5002020-11-17 13:30:44 -080029 r = self.test.vapi.create_vhost_user_if_v2(self.is_server,
30 self.sock_filename,
31 self.renumber,
32 self.disable_mrg_rxbuf,
33 self.disable_indirect_desc,
34 self.enable_gso,
35 self.enable_packed_ring,
36 self.enable_event_idx,
37 self.custom_dev_instance,
38 self.use_custom_mac,
39 self.mac_address,
40 self.tag)
Klement Sekerab9ef2732018-06-24 22:49:33 +020041 self.set_sw_if_index(r.sw_if_index)
Stevene8fa6202017-08-30 14:36:45 -070042
43 def remove_vpp_config(self):
44 self.test.vapi.delete_vhost_user_if(self.sw_if_index)
45
46 def is_interface_config_in_dump(self, dump):
47 for i in dump:
48 if i.sw_if_index == self.sw_if_index:
49 return True
50 else:
51 return False