Matej Klotton | 8d8a1da | 2016-12-22 11:06:56 +0100 | [diff] [blame] | 1 | from vpp_object import VppObject |
Matej Klotton | 0178d52 | 2016-11-04 11:11:44 +0100 | [diff] [blame] | 2 | from vpp_interface import VppInterface |
| 3 | |
| 4 | |
Matej Klotton | 8d8a1da | 2016-12-22 11:06:56 +0100 | [diff] [blame] | 5 | class VppLoInterface(VppInterface, VppObject): |
Matej Klotton | 86d87c4 | 2016-11-11 11:38:55 +0100 | [diff] [blame] | 6 | """VPP loopback interface.""" |
Matej Klotton | 0178d52 | 2016-11-04 11:11:44 +0100 | [diff] [blame] | 7 | |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 8 | def __init__(self, test): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 9 | """Create VPP loopback interface""" |
Ole Troan | c8efa29 | 2018-06-22 22:33:41 +0200 | [diff] [blame] | 10 | super(VppLoInterface, self).__init__(test) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 11 | self.add_vpp_config() |
Matej Klotton | 8d8a1da | 2016-12-22 11:06:56 +0100 | [diff] [blame] | 12 | |
| 13 | def add_vpp_config(self): |
| 14 | r = self.test.vapi.create_loopback() |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 15 | self.set_sw_if_index(r.sw_if_index) |
Matej Klotton | 8d8a1da | 2016-12-22 11:06:56 +0100 | [diff] [blame] | 16 | |
| 17 | def remove_vpp_config(self): |
| 18 | self.test.vapi.delete_loopback(self.sw_if_index) |
| 19 | |
Matej Klotton | 8d8a1da | 2016-12-22 11:06:56 +0100 | [diff] [blame] | 20 | def object_id(self): |
| 21 | return "loopback-%d" % self._sw_if_index |