blob: 1db34ba795808cb44add396eeb00c9d471883780 [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 Ranns3b81a1e2018-09-06 09:50:26 -07004from util import Host, mk_ll_addr, mactobinary
Jan65209ed2016-12-05 23:29:17 +01005
Klement Sekeraf62ae122016-10-11 11:47:09 +02006
7class VppInterface(object):
Matej Klotton86d87c42016-11-11 11:38:55 +01008 """Generic VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +02009 __metaclass__ = ABCMeta
10
11 @property
12 def sw_if_index(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010013 """Interface index assigned by VPP."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020014 return self._sw_if_index
15
16 @property
17 def remote_mac(self):
Klement Sekerada505f62017-01-04 12:58:53 +010018 """MAC-address of the remote interface "connected" to this interface"""
Matej Klotton0178d522016-11-04 11:11:44 +010019 return self._remote_hosts[0].mac
Klement Sekeraf62ae122016-10-11 11:47:09 +020020
21 @property
22 def local_mac(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010023 """MAC-address of the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020024 return self._local_mac
25
26 @property
27 def local_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010028 """Local IPv4 address on VPP interface (string)."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020029 return self._local_ip4
30
31 @property
32 def local_ip4n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010033 """Local IPv4 address - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010034 return socket.inet_pton(socket.AF_INET, self._local_ip4)
Klement Sekeraf62ae122016-10-11 11:47:09 +020035
36 @property
37 def remote_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010038 """IPv4 address of remote peer "connected" to this interface."""
Matej Klotton0178d522016-11-04 11:11:44 +010039 return self._remote_hosts[0].ip4
Klement Sekeraf62ae122016-10-11 11:47:09 +020040
41 @property
42 def remote_ip4n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010043 """IPv4 address of remote peer - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010044 return socket.inet_pton(socket.AF_INET, self.remote_ip4)
Klement Sekeraf62ae122016-10-11 11:47:09 +020045
46 @property
47 def local_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010048 """Local IPv6 address on VPP interface (string)."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020049 return self._local_ip6
50
51 @property
52 def local_ip6n(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010053 """Local IPv6 address - raw, suitable as API parameter."""
Matej Klotton0178d522016-11-04 11:11:44 +010054 return socket.inet_pton(socket.AF_INET6, self.local_ip6)
Klement Sekeraf62ae122016-10-11 11:47:09 +020055
56 @property
57 def remote_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010058 """IPv6 address of remote peer "connected" to this interface."""
Matej Klotton0178d522016-11-04 11:11:44 +010059 return self._remote_hosts[0].ip6
Klement Sekeraf62ae122016-10-11 11:47:09 +020060
61 @property
62 def remote_ip6n(self):
63 """IPv6 address of remote peer - raw, suitable as API parameter"""
Matej Klotton0178d522016-11-04 11:11:44 +010064 return socket.inet_pton(socket.AF_INET6, self.remote_ip6)
Klement Sekeraf62ae122016-10-11 11:47:09 +020065
66 @property
Juraj Slobodac0374232018-02-01 15:18:49 +010067 def local_ip6_ll(self):
68 """Local IPv6 linnk-local address on VPP interface (string)."""
69 return self._local_ip6_ll
70
71 @property
72 def local_ip6n_ll(self):
73 """Local IPv6 link-local address - raw, suitable as API parameter."""
74 return self._local_ip6n_ll
75
76 @property
77 def remote_ip6_ll(self):
78 """Link-local IPv6 address of remote peer
79 "connected" to this interface."""
80 return self._remote_ip6_ll
81
82 @property
83 def remote_ip6n_ll(self):
84 """Link-local IPv6 address of remote peer
85 - raw, suitable as API parameter"""
86 return self._remote_ip6n_ll
87
88 @property
Klement Sekeraf62ae122016-10-11 11:47:09 +020089 def name(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010090 """Name of the interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020091 return self._name
92
93 @property
94 def dump(self):
Matej Klotton86d87c42016-11-11 11:38:55 +010095 """RAW result of sw_interface_dump for this interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +020096 return self._dump
97
98 @property
99 def test(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100100 """Test case creating this interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200101 return self._test
102
Matej Klotton0178d522016-11-04 11:11:44 +0100103 @property
104 def remote_hosts(self):
105 """Remote hosts list"""
106 return self._remote_hosts
107
108 @remote_hosts.setter
109 def remote_hosts(self, value):
Matej Klotton86d87c42016-11-11 11:38:55 +0100110 """
111 :param list value: List of remote hosts.
112 """
Matej Klotton0178d522016-11-04 11:11:44 +0100113 self._remote_hosts = value
Matej Klotton86d87c42016-11-11 11:38:55 +0100114 self._hosts_by_mac = {}
115 self._hosts_by_ip4 = {}
116 self._hosts_by_ip6 = {}
117 for host in self._remote_hosts:
118 self._hosts_by_mac[host.mac] = host
119 self._hosts_by_ip4[host.ip4] = host
120 self._hosts_by_ip6[host.ip6] = host
Matej Klotton0178d522016-11-04 11:11:44 +0100121
122 def host_by_mac(self, mac):
Matej Klotton86d87c42016-11-11 11:38:55 +0100123 """
Matej Klottonc5bf07f2016-11-23 15:27:17 +0100124 :param mac: MAC address to find host by.
Matej Klotton86d87c42016-11-11 11:38:55 +0100125 :return: Host object assigned to interface.
126 """
Matej Klotton0178d522016-11-04 11:11:44 +0100127 return self._hosts_by_mac[mac]
128
129 def host_by_ip4(self, ip):
Matej Klotton86d87c42016-11-11 11:38:55 +0100130 """
131 :param ip: IPv4 address to find host by.
132 :return: Host object assigned to interface.
133 """
Matej Klotton0178d522016-11-04 11:11:44 +0100134 return self._hosts_by_ip4[ip]
135
136 def host_by_ip6(self, ip):
Matej Klotton86d87c42016-11-11 11:38:55 +0100137 """
138 :param ip: IPv6 address to find host by.
139 :return: Host object assigned to interface.
140 """
Matej Klotton0178d522016-11-04 11:11:44 +0100141 return self._hosts_by_ip6[ip]
142
143 def generate_remote_hosts(self, count=1):
Matej Klotton86d87c42016-11-11 11:38:55 +0100144 """Generate and add remote hosts for the interface.
145
146 :param int count: Number of generated remote hosts.
147 """
Matej Klotton0178d522016-11-04 11:11:44 +0100148 self._remote_hosts = []
149 self._hosts_by_mac = {}
150 self._hosts_by_ip4 = {}
151 self._hosts_by_ip6 = {}
Klement Sekera7bb873a2016-11-18 07:38:42 +0100152 for i in range(
153 2, count + 2): # 0: network address, 1: local vpp address
Matej Klotton0178d522016-11-04 11:11:44 +0100154 mac = "02:%02x:00:00:ff:%02x" % (self.sw_if_index, i)
155 ip4 = "172.16.%u.%u" % (self.sw_if_index, i)
Klement Sekera46a87ad2017-01-02 08:22:23 +0100156 ip6 = "fd01:%x::%x" % (self.sw_if_index, i)
Neale Ranns2a3ea492017-04-19 05:24:40 -0700157 ip6_ll = mk_ll_addr(mac)
158 host = Host(mac, ip4, ip6, ip6_ll)
Matej Klotton0178d522016-11-04 11:11:44 +0100159 self._remote_hosts.append(host)
160 self._hosts_by_mac[mac] = host
161 self._hosts_by_ip4[ip4] = host
162 self._hosts_by_ip6[ip6] = host
163
Matej Klottonc5bf07f2016-11-23 15:27:17 +0100164 @abstractmethod
165 def __init__(self, test):
166 self._test = test
167
168 self._remote_hosts = []
169 self._hosts_by_mac = {}
170 self._hosts_by_ip4 = {}
171 self._hosts_by_ip6 = {}
Matej Klotton0178d522016-11-04 11:11:44 +0100172
Neale Ranns3b81a1e2018-09-06 09:50:26 -0700173 def set_mac(self, mac):
174 self._local_mac = mac
175 self._local_ip6_ll = mk_ll_addr(mac)
176 self.test.vapi.sw_interface_set_mac_address(
177 self.sw_if_index,
178 mactobinary(self._local_mac))
179
Klement Sekera31da2e32018-06-24 22:49:55 +0200180 def set_sw_if_index(self, sw_if_index):
181 self._sw_if_index = sw_if_index
182
Matej Klotton0178d522016-11-04 11:11:44 +0100183 self.generate_remote_hosts()
Klement Sekeraf62ae122016-10-11 11:47:09 +0200184
185 self._local_ip4 = "172.16.%u.1" % self.sw_if_index
186 self._local_ip4n = socket.inet_pton(socket.AF_INET, self.local_ip4)
Neale Ranns24b170a2017-08-15 05:33:11 -0700187 self._local_ip4_subnet = "172.16.%u.0" % self.sw_if_index
188 self._local_ip4n_subnet = socket.inet_pton(socket.AF_INET,
189 self._local_ip4_subnet)
190 self._local_ip4_bcast = "172.16.%u.255" % self.sw_if_index
191 self._local_ip4n_bcast = socket.inet_pton(socket.AF_INET,
192 self._local_ip4_bcast)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100193 self.local_ip4_prefix_len = 24
194 self.has_ip4_config = False
195 self.ip4_table_id = 0
Klement Sekeraf62ae122016-10-11 11:47:09 +0200196
Klement Sekera46a87ad2017-01-02 08:22:23 +0100197 self._local_ip6 = "fd01:%x::1" % self.sw_if_index
Klement Sekeraf62ae122016-10-11 11:47:09 +0200198 self._local_ip6n = socket.inet_pton(socket.AF_INET6, self.local_ip6)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100199 self.local_ip6_prefix_len = 64
200 self.has_ip6_config = False
201 self.ip6_table_id = 0
Klement Sekeraf62ae122016-10-11 11:47:09 +0200202
203 r = self.test.vapi.sw_interface_dump()
204 for intf in r:
205 if intf.sw_if_index == self.sw_if_index:
206 self._name = intf.interface_name.split(b'\0', 1)[0]
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100207 self._local_mac = \
Klement Sekera7bb873a2016-11-18 07:38:42 +0100208 ':'.join(intf.l2_address.encode('hex')[i:i + 2]
209 for i in range(0, 12, 2))
Klement Sekeraf62ae122016-10-11 11:47:09 +0200210 self._dump = intf
211 break
212 else:
213 raise Exception(
214 "Could not find interface with sw_if_index %d "
215 "in interface dump %s" %
216 (self.sw_if_index, repr(r)))
Neale Ranns2a3ea492017-04-19 05:24:40 -0700217 self._local_ip6_ll = mk_ll_addr(self.local_mac)
218 self._local_ip6n_ll = socket.inet_pton(socket.AF_INET6,
219 self.local_ip6_ll)
Juraj Slobodac0374232018-02-01 15:18:49 +0100220 self._remote_ip6_ll = mk_ll_addr(self.remote_mac)
221 self._remote_ip6n_ll = socket.inet_pton(socket.AF_INET6,
222 self.remote_ip6_ll)
Klement Sekeraf62ae122016-10-11 11:47:09 +0200223
Klement Sekeraf62ae122016-10-11 11:47:09 +0200224 def config_ip4(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100225 """Configure IPv4 address on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200226 self.test.vapi.sw_interface_add_del_address(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100227 self.sw_if_index, self.local_ip4n, self.local_ip4_prefix_len)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000228 self.has_ip4_config = True
229
230 def unconfig_ip4(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100231 """Remove IPv4 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000232 try:
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100233 if self.has_ip4_config:
Neale Ranns177bbdc2016-11-15 09:46:51 +0000234 self.test.vapi.sw_interface_add_del_address(
235 self.sw_if_index,
236 self.local_ip4n,
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100237 self.local_ip4_prefix_len,
238 is_add=0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000239 except AttributeError:
240 self.has_ip4_config = False
241 self.has_ip4_config = False
Klement Sekeraf62ae122016-10-11 11:47:09 +0200242
Neale Rannsbaf2e902017-02-25 04:20:00 -0800243 def configure_ipv4_neighbors(self):
Jane546d3b2016-12-08 13:10:03 +0100244 """For every remote host assign neighbor's MAC to IPv4 addresses.
245
246 :param vrf_id: The FIB table / VRF ID. (Default value = 0)
247 """
Matej Klotton0178d522016-11-04 11:11:44 +0100248 for host in self._remote_hosts:
249 macn = host.mac.replace(":", "").decode('hex')
250 ipn = host.ip4n
Jane546d3b2016-12-08 13:10:03 +0100251 self.test.vapi.ip_neighbor_add_del(
Neale Rannsbaf2e902017-02-25 04:20:00 -0800252 self.sw_if_index, macn, ipn)
Matej Klotton0178d522016-11-04 11:11:44 +0100253
Klement Sekeraf62ae122016-10-11 11:47:09 +0200254 def config_ip6(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100255 """Configure IPv6 address on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200256 self.test.vapi.sw_interface_add_del_address(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100257 self.sw_if_index, self._local_ip6n, self.local_ip6_prefix_len,
258 is_ipv6=1)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000259 self.has_ip6_config = True
260
261 def unconfig_ip6(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100262 """Remove IPv6 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000263 try:
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100264 if self.has_ip6_config:
Neale Ranns177bbdc2016-11-15 09:46:51 +0000265 self.test.vapi.sw_interface_add_del_address(
266 self.sw_if_index,
267 self.local_ip6n,
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100268 self.local_ip6_prefix_len,
269 is_ipv6=1, is_add=0)
Neale Ranns177bbdc2016-11-15 09:46:51 +0000270 except AttributeError:
271 self.has_ip6_config = False
272 self.has_ip6_config = False
273
Neale Rannsbaf2e902017-02-25 04:20:00 -0800274 def configure_ipv6_neighbors(self):
Jan Gelety057bb8c2016-12-20 17:32:45 +0100275 """For every remote host assign neighbor's MAC to IPv6 addresses.
276
277 :param vrf_id: The FIB table / VRF ID. (Default value = 0)
278 """
Klement Sekera46a87ad2017-01-02 08:22:23 +0100279 for host in self._remote_hosts:
280 macn = host.mac.replace(":", "").decode('hex')
Jan Gelety057bb8c2016-12-20 17:32:45 +0100281 ipn = host.ip6n
Klement Sekera46a87ad2017-01-02 08:22:23 +0100282 self.test.vapi.ip_neighbor_add_del(
Neale Rannsbaf2e902017-02-25 04:20:00 -0800283 self.sw_if_index, macn, ipn, is_ipv6=1)
Klement Sekera46a87ad2017-01-02 08:22:23 +0100284
Neale Ranns177bbdc2016-11-15 09:46:51 +0000285 def unconfig(self):
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100286 """Unconfigure IPv6 and IPv4 address on the VPP interface."""
Neale Ranns177bbdc2016-11-15 09:46:51 +0000287 self.unconfig_ip4()
288 self.unconfig_ip6()
Klement Sekeraf62ae122016-10-11 11:47:09 +0200289
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000290 def set_table_ip4(self, table_id):
291 """Set the interface in a IPv4 Table.
Matej Klotton86d87c42016-11-11 11:38:55 +0100292
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100293 .. note:: Must be called before configuring IP4 addresses.
294 """
295 self.ip4_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, 0, self.ip4_table_id)
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000298
299 def set_table_ip6(self, table_id):
300 """Set the interface in a IPv6 Table.
Matej Klotton86d87c42016-11-11 11:38:55 +0100301
302 .. note:: Must be called before configuring IP6 addresses.
303 """
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100304 self.ip6_table_id = table_id
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000305 self.test.vapi.sw_interface_set_table(
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100306 self.sw_if_index, 1, self.ip6_table_id)
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000307
Klement Sekeraf62ae122016-10-11 11:47:09 +0200308 def disable_ipv6_ra(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100309 """Configure IPv6 RA suppress on the VPP interface."""
Klement Sekeraf62ae122016-10-11 11:47:09 +0200310 self.test.vapi.sw_interface_ra_suppress(self.sw_if_index)
311
Neale Ranns32e1c012016-11-22 17:07:28 +0000312 def ip6_ra_config(self, no=0, suppress=0, send_unicast=0):
Neale Ranns75152282017-01-09 01:00:45 -0800313 """Configure IPv6 RA suppress on the VPP interface."""
314 self.test.vapi.ip6_sw_interface_ra_config(self.sw_if_index,
Neale Ranns32e1c012016-11-22 17:07:28 +0000315 no,
Neale Ranns75152282017-01-09 01:00:45 -0800316 suppress,
317 send_unicast)
318
Neale Ranns87df12d2017-02-18 08:16:41 -0800319 def ip6_ra_prefix(self, address, address_length, is_no=0,
320 off_link=0, no_autoconfig=0, use_default=0):
321 """Configure IPv6 RA suppress on the VPP interface."""
322 self.test.vapi.ip6_sw_interface_ra_prefix(self.sw_if_index,
323 address,
324 address_length,
325 is_no=is_no,
326 off_link=off_link,
327 no_autoconfig=no_autoconfig,
328 use_default=use_default)
329
Klement Sekeraf62ae122016-10-11 11:47:09 +0200330 def admin_up(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100331 """Put interface ADMIN-UP."""
Klement Sekerada505f62017-01-04 12:58:53 +0100332 self.test.vapi.sw_interface_set_flags(self.sw_if_index,
333 admin_up_down=1)
Klement Sekeraf62ae122016-10-11 11:47:09 +0200334
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100335 def admin_down(self):
336 """Put interface ADMIN-down."""
Klement Sekerada505f62017-01-04 12:58:53 +0100337 self.test.vapi.sw_interface_set_flags(self.sw_if_index,
338 admin_up_down=0)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100339
Neale Ranns75152282017-01-09 01:00:45 -0800340 def ip6_enable(self):
341 """IPv6 Enable interface"""
Klement Sekerada505f62017-01-04 12:58:53 +0100342 self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index,
343 enable=1)
Neale Ranns75152282017-01-09 01:00:45 -0800344
345 def ip6_disable(self):
346 """Put interface ADMIN-DOWN."""
Klement Sekerada505f62017-01-04 12:58:53 +0100347 self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index,
348 enable=0)
Neale Ranns75152282017-01-09 01:00:45 -0800349
Klement Sekeraf62ae122016-10-11 11:47:09 +0200350 def add_sub_if(self, sub_if):
Matej Klotton86d87c42016-11-11 11:38:55 +0100351 """Register a sub-interface with this interface.
Klement Sekeraf62ae122016-10-11 11:47:09 +0200352
353 :param sub_if: sub-interface
Klement Sekeraf62ae122016-10-11 11:47:09 +0200354 """
355 if not hasattr(self, 'sub_if'):
356 self.sub_if = sub_if
357 else:
358 if isinstance(self.sub_if, list):
359 self.sub_if.append(sub_if)
360 else:
361 self.sub_if = sub_if
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000362
363 def enable_mpls(self):
Matej Klotton86d87c42016-11-11 11:38:55 +0100364 """Enable MPLS on the VPP interface."""
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000365 self.test.vapi.sw_interface_enable_disable_mpls(
366 self.sw_if_index)
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100367
Neale Ranns180279b2017-03-16 15:49:09 -0400368 def disable_mpls(self):
369 """Enable MPLS on the VPP interface."""
370 self.test.vapi.sw_interface_enable_disable_mpls(
371 self.sw_if_index, 0)
372
Matej Klotton8d8a1da2016-12-22 11:06:56 +0100373 def is_ip4_entry_in_fib_dump(self, dump):
374 for i in dump:
375 if i.address == self.local_ip4n and \
376 i.address_length == self.local_ip4_prefix_len and \
377 i.table_id == self.ip4_table_id:
378 return True
379 return False
Neale Ranns39f9d8b2017-02-16 21:57:05 -0800380
381 def set_unnumbered(self, ip_sw_if_index):
382 """ Set the interface to unnumbered via ip_sw_if_index """
383 self.test.vapi.sw_interface_set_unnumbered(
384 self.sw_if_index,
385 ip_sw_if_index)
386
Neale Ranns37be7362017-02-21 17:30:26 -0800387 def unset_unnumbered(self, ip_sw_if_index):
Neale Ranns4b919a52017-03-11 05:55:21 -0800388 """ Unset the interface to unnumbered via ip_sw_if_index """
Neale Ranns37be7362017-02-21 17:30:26 -0800389 self.test.vapi.sw_interface_set_unnumbered(
390 self.sw_if_index,
391 ip_sw_if_index,
392 is_add=0)
393
Neale Ranns39f9d8b2017-02-16 21:57:05 -0800394 def set_proxy_arp(self, enable=1):
395 """ Set the interface to enable/disable Proxy ARP """
396 self.test.vapi.proxy_arp_intfc_enable_disable(
397 self.sw_if_index,
398 enable)
Klement Sekera75e7d132017-09-20 08:26:30 +0200399
400 def query_vpp_config(self):
401 dump = self.test.vapi.sw_interface_dump()
402 return self.is_interface_config_in_dump(dump)
403
404 def is_interface_config_in_dump(self, dump):
405 for i in dump:
406 if i.interface_name.rstrip(' \t\r\n\0') == self.name and \
407 i.sw_if_index == self.sw_if_index:
408 return True
409 else:
410 return False