misc: add build_static_vppctl.sh
[vpp.git] / test / vpp_vhost_interface.py
1 from vpp_interface import VppInterface
2
3
4 class VppVhostInterface(VppInterface):
5     """VPP vhost interface."""
6
7     def __init__(self, test, sock_filename, is_server=0, renumber=0,
8                  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,
11                  mac_address='', tag=''):
12
13         """ Create VPP Vhost interface """
14         super(VppVhostInterface, self).__init__(test)
15         self.is_server = is_server
16         self.sock_filename = sock_filename
17         self.renumber = renumber
18         self.disable_mrg_rxbuf = disable_mrg_rxbuf
19         self.disable_indirect_desc = disable_indirect_desc
20         self.enable_gso = enable_gso
21         self.enable_packed_ring = enable_packed_ring
22         self.enable_event_idx = enable_event_idx
23         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):
29         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)
41         self.set_sw_if_index(r.sw_if_index)
42
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