blob: 194a0c4fb32e41822551980c05eac27b51a5c9d5 [file] [log] [blame]
Klement Sekeraf62ae122016-10-11 11:47:09 +02001from abc import abstractmethod, ABCMeta
2import socket
Klement Sekeraf62ae122016-10-11 11:47:09 +02003
Neale Ranns2a3ea492017-04-19 05:24:40 -07004from util import Host, mk_ll_addr
Neale Ranns39f9d8b2017-02-16 21:57:05 -08005from vpp_neighbor import VppNeighbor
Jan65209ed2016-12-05 23:29:17 +01006
Klement Sekeraf62ae122016-10-11 11:47:09 +02007
8class VppInterface(object):
Matej Klotton86d87c42016-11-11 11:38:55 +01009 """Generic VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020010 __metaclass__ = ABCMeta
11
12 @property
13 def sw_if_index(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010014 """Interface index assigned by VPP."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020015 return self._sw_if_index
16
17 @property
18 def remote_mac(self):
Klement Sekerada505f62017-01-04 12:58:53 +010019 """MAC-address of the remote interface "connected" to this interface"""
Matej Klotton0178d522016-11-04 11:11:44 +010020 return self._remote_hosts[0].mac
Klement Sekeraf62ae122016-10-11 11:47:09 +020021
22 @property
23 def local_mac(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010024 """MAC-address of the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020025 return self._local_mac
26
27 @property
28 def local_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010029 """Local IPv4 address on VPP interface (string)."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020030 return self._local_ip4
31
32 @property
33 def local_ip4n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010034 """Local IPv4 address - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010035 return socket.inet_pton(socket.AF_INET, self._local_ip4)
Klement Sekeraf62ae122016-10-11 11:47:09 +020036
37 @property
38 def remote_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010039 """IPv4 address of remote peer "connected" to this interface."""
Matej Klotton0178d522016-11-04 11:11:44 +010040 return self._remote_hosts[0].ip4
Klement Sekeraf62ae122016-10-11 11:47:09 +020041
42 @property
43 def remote_ip4n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010044 """IPv4 address of remote peer - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010045 return socket.inet_pton(socket.AF_INET, self.remote_ip4)
Klement Sekeraf62ae122016-10-11 11:47:09 +020046
47 @property
48 def local_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010049 """Local IPv6 address on VPP interface (string)."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020050 return self._local_ip6
51
52 @property
53 def local_ip6n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010054 """Local IPv6 address - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010055 return socket.inet_pton(socket.AF_INET6, self.local_ip6)
Klement Sekeraf62ae122016-10-11 11:47:09 +020056
57 @property
58 def remote_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010059 """IPv6 address of remote peer "connected" to this interface."""
Matej Klotton0178d522016-11-04 11:11:44 +010060 return self._remote_hosts[0].ip6
Klement Sekeraf62ae122016-10-11 11:47:09 +020061
62 @property
63 def remote_ip6n(self):
64 """IPv6 address of remote peer - raw, suitable as API parameter"""
Matej Klotton0178d522016-11-04 11:11:44 +010065 return socket.inet_pton(socket.AF_INET6, self.remote_ip6)
Klement Sekeraf62ae122016-10-11 11:47:09 +020066
67 @property
Juraj Slobodac0374232018-02-01 15:18:49 +010068 def local_ip6_ll(self):
69 """Local IPv6 linnk-local address on VPP interface (string)."""
70 return self._local_ip6_ll
71
72 @property
73 def local_ip6n_ll(self):
74 """Local IPv6 link-local address - raw, suitable as API parameter."""
75 return self._local_ip6n_ll
76
77 @property
78 def remote_ip6_ll(self):
79 """Link-local IPv6 address of remote peer
80 "connected" to this interface."""
81 return self._remote_ip6_ll
82
83 @property
84 def remote_ip6n_ll(self):
85 """Link-local IPv6 address of remote peer
86 - raw, suitable as API parameter"""
87 return self._remote_ip6n_ll
88
89 @property
Klement Sekeraf62ae122016-10-11 11:47:09 +020090 def name(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010091 """Name of the interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020092 return self._name
93
94 @property
95 def dump(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010096 """RAW result of sw_interface_dump for this interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020097 return self._dump
98
99 @property
100 def test(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100101 """Test case creating this interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200102 return self._test
103
Matej Klotton0178d522016-11-04 11:11:44 +0100104 @property
105 def remote_hosts(self):
106 """Remote hosts list"""
107 return self._remote_hosts
108
109 @remote_hosts.setter
110 def remote_hosts(self, value):
Matej Klotton86d87c42016-11-11 11:38:55 +0100111 """
112 :param list value: List of remote hosts.
113 """
Matej Klotton0178d522016-11-04 11:11:44 +0100114 self._remote_hosts = value
Matej Klotton86d87c42016-11-11 11:38:55 +0100115 self._hosts_by_mac = {}
116 self._hosts_by_ip4 = {}
117 self._hosts_by_ip6 = {}
118 for host in self._remote_hosts:
119 self._hosts_by_mac[host.mac] = host
120 self._hosts_by_ip4[host.ip4] = host
121 self._hosts_by_ip6[host.ip6] = host
Matej Klotton0178d522016-11-04 11:11:44 +0100122
123 def host_by_mac(self, mac):
Matej Klotton86d87c42016-11-11 11:38:55 +0100124 """
Matej Klottonc5bf07f2016-11-23 15:27:17 +0100125 :param mac: MAC address to find host by.
Matej Klotton86d87c42016-11-11 11:38:55 +0100126 :return: Host object assigned to interface.
127 """
Matej Klotton0178d522016-11-04 11:11:44 +0100128 return self._hosts_by_mac[mac]
129
130 def host_by_ip4(self, ip):
Matej Klotton86d87c42016-11-11 11:38:55 +0100131 """
132 :param ip: IPv4 address to find host by.
133 :return: Host object assigned to interface.
134 """
Matej Klotton0178d522016-11-04 11:11:44 +0100135 return self._hosts_by_ip4[ip]
136
137 def host_by_ip6(self, ip):
Matej Klotton86d87c42016-11-11 11:38:55 +0100138 """
139 :param ip: IPv6 address to find host by.
140 :return: Host object assigned to interface.
141 """
Matej Klotton0178d522016-11-04 11:11:44 +0100142 return self._hosts_by_ip6[ip]
143
144 def generate_remote_hosts(self, count=1):
Matej Klotton86d87c42016-11-11 11:38:55 +0100145 """Generate and add remote hosts for the interface.
146
147 :param int count: Number of generated remote hosts.
148 """
Matej Klotton0178d522016-11-04 11:11:44 +0100149 self._remote_hosts = []
150 self._hosts_by_mac = {}
151 self._hosts_by_ip4 = {}
152 self._hosts_by_ip6 = {}
Klement Sekera7bb873a2016-11-18 07:38:42 +0100153 for i in range(
154 2, count + 2): # 0: network address, 1: local vpp address
Matej Klotton0178d522016-11-04 11:11:44 +0100155 mac = "02:%02x:00:00:ff:%02x" % (self.sw_if_index, i)
156 ip4 = "172.16.%u.%u" % (self.sw_if_index, i)
Klement Sekera46a87ad2017-01-02 08:22:23 +0100157 ip6 = "fd01:%x::%x" % (self.sw_if_index, i)
Neale Ranns2a3ea492017-04-19 05:24:40 -0700158 ip6_ll = mk_ll_addr(mac)
159 host = Host(mac, ip4, ip6, ip6_ll)
Matej Klotton0178d522016-11-04 11:11:44 +0100160 self._remote_hosts.append(host)
161 self._hosts_by_mac[mac] = host
162 self._hosts_by_ip4[ip4] = host
163 self._hosts_by_ip6[ip6] = host
164
Matej Klottonc5bf07f2016-11-23 15:27:17 +0100165 @abstractmethod
166 def __init__(self, test):
167 self._test = test
168
169 self._remote_hosts = []
170 self._hosts_by_mac = {}
171 self._hosts_by_ip4 = {}
172 self._hosts_by_ip6 = {}
Matej Klotton0178d522016-11-04 11:11:44 +0100173
174 self.generate_remote_hosts()
Klement Sekeraf62ae122016-10-11 11:47:09 +0200175
176 self._local_ip4 = "172.16.%u.1" % self.sw_if_index
177 self._local_ip4n = socket.inet_pton(socket.AF_INET, self.local_ip4)
Neale Ranns24b170a2017-08-15 05:33:11 -0700178 self._local_ip4_subnet = "172.16.%u.0" % self.sw_if_index
179 self._local_ip4n_subnet = socket.inet_pton(socket.AF_INET,
180 self._local_ip4_subnet)
181 self._local_ip4_bcast = "172.16.%u.255" % self.sw_if_index
182 self._local_ip4n_bcast = socket.inet_pton(socket.AF_INET,
183 self._local_ip4_bcast)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100184 self.local_ip4_prefix_len = 24
185 self.has_ip4_config = False
186 self.ip4_table_id = 0
Klement Sekeraf62ae122016-10-11 11:47:09 +0200187
Klement Sekera46a87ad2017-01-02 08:22:23 +0100188 self._local_ip6 = "fd01:%x::1" % self.sw_if_index
Klement Sekeraf62ae122016-10-11 11:47:09 +0200189 self._local_ip6n = socket.inet_pton(socket.AF_INET6, self.local_ip6)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100190 self.local_ip6_prefix_len = 64
191 self.has_ip6_config = False
192 self.ip6_table_id = 0
Klement Sekeraf62ae122016-10-11 11:47:09 +0200193
194 r = self.test.vapi.sw_interface_dump()
195 for intf in r:
196 if intf.sw_if_index == self.sw_if_index:
197 self._name = intf.interface_name.split(b'\0', 1)[0]
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100198 self._local_mac = \
Klement Sekera7bb873a2016-11-18 07:38:42 +0100199 ':'.join(intf.l2_address.encode('hex')[i:i + 2]
200 for i in range(0, 12, 2))
Klement Sekeraf62ae122016-10-11 11:47:09 +0200201 self._dump = intf
202 break
203 else:
204 raise Exception(
205 "Could not find interface with sw_if_index %d "
206 "in interface dump %s" %
207 (self.sw_if_index, repr(r)))
Neale Ranns2a3ea492017-04-19 05:24:40 -0700208 self._local_ip6_ll = mk_ll_addr(self.local_mac)
209 self._local_ip6n_ll = socket.inet_pton(socket.AF_INET6,
210 self.local_ip6_ll)
Juraj Slobodac0374232018-02-01 15:18:49 +0100211 self._remote_ip6_ll = mk_ll_addr(self.remote_mac)
212 self._remote_ip6n_ll = socket.inet_pton(socket.AF_INET6,
213 self.remote_ip6_ll)
Klement Sekeraf62ae122016-10-11 11:47:09 +0200214
Klement Sekeraf62ae122016-10-11 11:47:09 +0200215 def config_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100216 """Configure IPv4 address on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200217 self.test.vapi.sw_interface_add_del_address(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100218 self.sw_if_index, self.local_ip4n, self.local_ip4_prefix_len)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000219 self.has_ip4_config = True
220
221 def unconfig_ip4(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100222 """Remove IPv4 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000223 try:
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100224 if self.has_ip4_config:
Neale Ranns177bbdc2016-11-15 09:46:51 +0000225 self.test.vapi.sw_interface_add_del_address(
226 self.sw_if_index,
227 self.local_ip4n,
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100228 self.local_ip4_prefix_len,
229 is_add=0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000230 except AttributeError:
231 self.has_ip4_config = False
232 self.has_ip4_config = False
Klement Sekeraf62ae122016-10-11 11:47:09 +0200233
Neale Rannsbaf2e902017-02-25 04:20:00 -0800234 def configure_ipv4_neighbors(self):
Jane546d3b2016-12-08 13:10:03 +0100235 """For every remote host assign neighbor's MAC to IPv4 addresses.
236
237 :param vrf_id: The FIB table / VRF ID. (Default value = 0)
238 """
Matej Klotton0178d522016-11-04 11:11:44 +0100239 for host in self._remote_hosts:
240 macn = host.mac.replace(":", "").decode('hex')
241 ipn = host.ip4n
Jane546d3b2016-12-08 13:10:03 +0100242 self.test.vapi.ip_neighbor_add_del(
Neale Rannsbaf2e902017-02-25 04:20:00 -0800243 self.sw_if_index, macn, ipn)
Matej Klotton0178d522016-11-04 11:11:44 +0100244
Klement Sekeraf62ae122016-10-11 11:47:09 +0200245 def config_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100246 """Configure IPv6 address on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200247 self.test.vapi.sw_interface_add_del_address(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100248 self.sw_if_index, self._local_ip6n, self.local_ip6_prefix_len,
249 is_ipv6=1)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000250 self.has_ip6_config = True
251
252 def unconfig_ip6(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100253 """Remove IPv6 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000254 try:
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100255 if self.has_ip6_config:
Neale Ranns177bbdc2016-11-15 09:46:51 +0000256 self.test.vapi.sw_interface_add_del_address(
257 self.sw_if_index,
258 self.local_ip6n,
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100259 self.local_ip6_prefix_len,
260 is_ipv6=1, is_add=0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000261 except AttributeError:
262 self.has_ip6_config = False
263 self.has_ip6_config = False
264
Neale Rannsbaf2e902017-02-25 04:20:00 -0800265 def configure_ipv6_neighbors(self):
Jan Gelety057bb8c2016-12-20 17:32:45 +0100266 """For every remote host assign neighbor's MAC to IPv6 addresses.
267
268 :param vrf_id: The FIB table / VRF ID. (Default value = 0)
269 """
Klement Sekera46a87ad2017-01-02 08:22:23 +0100270 for host in self._remote_hosts:
271 macn = host.mac.replace(":", "").decode('hex')
Jan Gelety057bb8c2016-12-20 17:32:45 +0100272 ipn = host.ip6n
Klement Sekera46a87ad2017-01-02 08:22:23 +0100273 self.test.vapi.ip_neighbor_add_del(
Neale Rannsbaf2e902017-02-25 04:20:00 -0800274 self.sw_if_index, macn, ipn, is_ipv6=1)
Klement Sekera46a87ad2017-01-02 08:22:23 +0100275
Neale Ranns177bbdc2016-11-15 09:46:51 +0000276 def unconfig(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100277 """Unconfigure IPv6 and IPv4 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000278 self.unconfig_ip4()
279 self.unconfig_ip6()
Klement Sekeraf62ae122016-10-11 11:47:09 +0200280
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000281 def set_table_ip4(self, table_id):
282 """Set the interface in a IPv4 Table.
Matej Klotton86d87c42016-11-11 11:38:55 +0100283
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100284 .. note:: Must be called before configuring IP4 addresses.
285 """
286 self.ip4_table_id = table_id
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000287 self.test.vapi.sw_interface_set_table(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100288 self.sw_if_index, 0, self.ip4_table_id)
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000289
290 def set_table_ip6(self, table_id):
291 """Set the interface in a IPv6 Table.
Matej Klotton86d87c42016-11-11 11:38:55 +0100292
293 .. note:: Must be called before configuring IP6 addresses.
294 """
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100295 self.ip6_table_id = table_id
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000296 self.test.vapi.sw_interface_set_table(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100297 self.sw_if_index, 1, self.ip6_table_id)
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000298
Klement Sekeraf62ae122016-10-11 11:47:09 +0200299 def disable_ipv6_ra(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100300 """Configure IPv6 RA suppress on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200301 self.test.vapi.sw_interface_ra_suppress(self.sw_if_index)
302
Neale Ranns32e1c012016-11-22 17:07:28 +0000303 def ip6_ra_config(self, no=0, suppress=0, send_unicast=0):
Neale Ranns75152282017-01-09 01:00:45 -0800304 """Configure IPv6 RA suppress on the VPP interface."""
305 self.test.vapi.ip6_sw_interface_ra_config(self.sw_if_index,
Neale Ranns32e1c012016-11-22 17:07:28 +0000306 no,
Neale Ranns75152282017-01-09 01:00:45 -0800307 suppress,
308 send_unicast)
309
Neale Ranns87df12d2017-02-18 08:16:41 -0800310 def ip6_ra_prefix(self, address, address_length, is_no=0,
311 off_link=0, no_autoconfig=0, use_default=0):
312 """Configure IPv6 RA suppress on the VPP interface."""
313 self.test.vapi.ip6_sw_interface_ra_prefix(self.sw_if_index,
314 address,
315 address_length,
316 is_no=is_no,
317 off_link=off_link,
318 no_autoconfig=no_autoconfig,
319 use_default=use_default)
320
Klement Sekeraf62ae122016-10-11 11:47:09 +0200321 def admin_up(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100322 """Put interface ADMIN-UP."""
Klement Sekerada505f62017-01-04 12:58:53 +0100323 self.test.vapi.sw_interface_set_flags(self.sw_if_index,
324 admin_up_down=1)
Klement Sekeraf62ae122016-10-11 11:47:09 +0200325
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100326 def admin_down(self):
327 """Put interface ADMIN-down."""
Klement Sekerada505f62017-01-04 12:58:53 +0100328 self.test.vapi.sw_interface_set_flags(self.sw_if_index,
329 admin_up_down=0)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100330
Neale Ranns75152282017-01-09 01:00:45 -0800331 def ip6_enable(self):
332 """IPv6 Enable interface"""
Klement Sekerada505f62017-01-04 12:58:53 +0100333 self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index,
334 enable=1)
Neale Ranns75152282017-01-09 01:00:45 -0800335
336 def ip6_disable(self):
337 """Put interface ADMIN-DOWN."""
Klement Sekerada505f62017-01-04 12:58:53 +0100338 self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index,
339 enable=0)
Neale Ranns75152282017-01-09 01:00:45 -0800340
Klement Sekeraf62ae122016-10-11 11:47:09 +0200341 def add_sub_if(self, sub_if):
Matej Klotton86d87c42016-11-11 11:38:55 +0100342 """Register a sub-interface with this interface.
Klement Sekeraf62ae122016-10-11 11:47:09 +0200343
344 :param sub_if: sub-interface
Klement Sekeraf62ae122016-10-11 11:47:09 +0200345 """
346 if not hasattr(self, 'sub_if'):
347 self.sub_if = sub_if
348 else:
349 if isinstance(self.sub_if, list):
350 self.sub_if.append(sub_if)
351 else:
352 self.sub_if = sub_if
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000353
354 def enable_mpls(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100355 """Enable MPLS on the VPP interface."""
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000356 self.test.vapi.sw_interface_enable_disable_mpls(
357 self.sw_if_index)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100358
Neale Ranns180279b2017-03-16 15:49:09 -0400359 def disable_mpls(self):
360 """Enable MPLS on the VPP interface."""
361 self.test.vapi.sw_interface_enable_disable_mpls(
362 self.sw_if_index, 0)
363
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100364 def is_ip4_entry_in_fib_dump(self, dump):
365 for i in dump:
366 if i.address == self.local_ip4n and \
367 i.address_length == self.local_ip4_prefix_len and \
368 i.table_id == self.ip4_table_id:
369 return True
370 return False
Neale Ranns39f9d8b2017-02-16 21:57:05 -0800371
372 def set_unnumbered(self, ip_sw_if_index):
373 """ Set the interface to unnumbered via ip_sw_if_index """
374 self.test.vapi.sw_interface_set_unnumbered(
375 self.sw_if_index,
376 ip_sw_if_index)
377
Neale Ranns37be7362017-02-21 17:30:26 -0800378 def unset_unnumbered(self, ip_sw_if_index):
Neale Ranns4b919a52017-03-11 05:55:21 -0800379 """ Unset the interface to unnumbered via ip_sw_if_index """
Neale Ranns37be7362017-02-21 17:30:26 -0800380 self.test.vapi.sw_interface_set_unnumbered(
381 self.sw_if_index,
382 ip_sw_if_index,
383 is_add=0)
384
Neale Ranns39f9d8b2017-02-16 21:57:05 -0800385 def set_proxy_arp(self, enable=1):
386 """ Set the interface to enable/disable Proxy ARP """
387 self.test.vapi.proxy_arp_intfc_enable_disable(
388 self.sw_if_index,
389 enable)
Klement Sekera75e7d132017-09-20 08:26:30 +0200390
391 def query_vpp_config(self):
392 dump = self.test.vapi.sw_interface_dump()
393 return self.is_interface_config_in_dump(dump)
394
395 def is_interface_config_in_dump(self, dump):
396 for i in dump:
397 if i.interface_name.rstrip(' \t\r\n\0') == self.name and \
398 i.sw_if_index == self.sw_if_index:
399 return True
400 else:
401 return False