blob: 9478689811d606415b52f7c2bd9f67ff87b632b7 [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
Klement Sekerab9ef2732018-06-24 22:49:33 +02008 def __init__(self, test):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02009 """Create VPP loopback interface"""
Ole Troanc8efa292018-06-22 22:33:41 +020010 super(VppLoInterface, self).__init__(test)
Klement Sekerab9ef2732018-06-24 22:49:33 +020011 self.add_vpp_config()
Matej Klotton8d8a1da2016-12-22 11:06:56 +010012
13 def add_vpp_config(self):
14 r = self.test.vapi.create_loopback()
Klement Sekerab9ef2732018-06-24 22:49:33 +020015 self.set_sw_if_index(r.sw_if_index)
Matej Klotton8d8a1da2016-12-22 11:06:56 +010016
17 def remove_vpp_config(self):
18 self.test.vapi.delete_loopback(self.sw_if_index)
19
Matej Klotton8d8a1da2016-12-22 11:06:56 +010020 def object_id(self):
21 return "loopback-%d" % self._sw_if_index