blob: ae4111bec82a6eb9855b12dd1042ed29b7190469 [file] [log] [blame]
Matej Klotton8d8a1da2016-12-22 11:06:56 +01001from vpp_object import VppObject
Matej Klotton0178d522016-11-04 11:11:44 +01002from vpp_interface import VppInterface
3
4
Matej Klotton8d8a1da2016-12-22 11:06:56 +01005class VppLoInterface(VppInterface, VppObject):
Matej Klotton86d87c42016-11-11 11:38:55 +01006 """VPP loopback interface."""
Matej Klotton0178d522016-11-04 11:11:44 +01007
8 def __init__(self, test, lo_index):
9 """ Create VPP loopback interface """
Matej Klotton8d8a1da2016-12-22 11:06:56 +010010 self._test = test
11 self.add_vpp_config()
Matej Klottonc5bf07f2016-11-23 15:27:17 +010012 super(VppLoInterface, self).__init__(test)
13 self._lo_index = lo_index
Matej Klotton8d8a1da2016-12-22 11:06:56 +010014
15 def add_vpp_config(self):
16 r = self.test.vapi.create_loopback()
17 self._sw_if_index = r.sw_if_index
18
19 def remove_vpp_config(self):
20 self.test.vapi.delete_loopback(self.sw_if_index)
21
Matej Klotton8d8a1da2016-12-22 11:06:56 +010022 def object_id(self):
23 return "loopback-%d" % self._sw_if_index