1 from vpp_interface import VppInterface
4 class VppTAPInterface(VppInterface):
11 def __init__(self, test, tap_id=0xffffffff, mac_addr=None):
14 self._mac_addr = mac_addr
16 def get_vpp_dump(self):
17 dump = self._test.vapi.sw_interface_tap_v2_dump()
19 if entry.sw_if_index == self.sw_if_index:
22 def add_vpp_config(self):
23 use_random_mac = True if self._mac_addr else False
24 reply = self._test.vapi.tap_create_v2(
26 use_random_mac=use_random_mac,
27 mac_address=self._mac_addr)
28 self.set_sw_if_index(reply.sw_if_index)
29 self._test.registry.register(self, self.test.logger)
31 def remove_vpp_config(self):
32 self._test.vapi.tap_delete_v2(sw_if_index=self.sw_if_index)
34 def query_vpp_config(self):
35 dump = self.get_vpp_dump()
41 return "tap-%s" % self._tap_id