X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_interface.py;h=29edb70ed581def8dd28e790a2498178a965c3f8;hb=32e1c010b0c34fd0984f7fc45fae648a182025c5;hp=856a5cc2183b1162e2ec31c73c6f529dbea9163e;hpb=75152289284aaf1116d62c6cdef5a3b0c793fa15;p=vpp.git diff --git a/test/vpp_interface.py b/test/vpp_interface.py index 856a5cc2183..29edb70ed58 100644 --- a/test/vpp_interface.py +++ b/test/vpp_interface.py @@ -15,7 +15,7 @@ class VppInterface(object): @property def remote_mac(self): - """MAC-address of the remote interface "connected" to this interface.""" + """MAC-address of the remote interface "connected" to this interface""" return self._remote_hosts[0].mac @property @@ -131,7 +131,7 @@ class VppInterface(object): 2, count + 2): # 0: network address, 1: local vpp address mac = "02:%02x:00:00:ff:%02x" % (self.sw_if_index, i) ip4 = "172.16.%u.%u" % (self.sw_if_index, i) - ip6 = "fd01:%04x::%04x" % (self.sw_if_index, i) + ip6 = "fd01:%x::%x" % (self.sw_if_index, i) host = Host(mac, ip4, ip6) self._remote_hosts.append(host) self._hosts_by_mac[mac] = host @@ -155,7 +155,7 @@ class VppInterface(object): self.has_ip4_config = False self.ip4_table_id = 0 - self._local_ip6 = "fd01:%04x::1" % self.sw_if_index + self._local_ip6 = "fd01:%x::1" % self.sw_if_index self._local_ip6n = socket.inet_pton(socket.AF_INET6, self.local_ip6) self.local_ip6_prefix_len = 64 self.has_ip6_config = False @@ -195,12 +195,16 @@ class VppInterface(object): self.has_ip4_config = False self.has_ip4_config = False - def configure_ipv4_neighbors(self): - """For every remote host assign neighbor's MAC to IPv4 addresses.""" + def configure_ipv4_neighbors(self, vrf_id=0): + """For every remote host assign neighbor's MAC to IPv4 addresses. + + :param vrf_id: The FIB table / VRF ID. (Default value = 0) + """ for host in self._remote_hosts: macn = host.mac.replace(":", "").decode('hex') ipn = host.ip4n - self.test.vapi.ip_neighbor_add_del(self.sw_if_index, macn, ipn) + self.test.vapi.ip_neighbor_add_del( + self.sw_if_index, macn, ipn, vrf_id) def config_ip6(self): """Configure IPv6 address on the VPP interface.""" @@ -222,6 +226,13 @@ class VppInterface(object): self.has_ip6_config = False self.has_ip6_config = False + def configure_ipv6_neighbors(self): + """For every remote host assign neighbor's MAC to IPv6 address.""" + for host in self._remote_hosts: + macn = host.mac.replace(":", "").decode('hex') + self.test.vapi.ip_neighbor_add_del( + self.sw_if_index, macn, host.ip6n, is_ipv6=1) + def unconfig(self): """Unconfigure IPv6 and IPv4 address on the VPP interface.""" self.unconfig_ip4() @@ -249,27 +260,32 @@ class VppInterface(object): """Configure IPv6 RA suppress on the VPP interface.""" self.test.vapi.sw_interface_ra_suppress(self.sw_if_index) - def ip6_ra_config(self, suppress=0, send_unicast=0): + def ip6_ra_config(self, no=0, suppress=0, send_unicast=0): """Configure IPv6 RA suppress on the VPP interface.""" self.test.vapi.ip6_sw_interface_ra_config(self.sw_if_index, + no, suppress, send_unicast) def admin_up(self): """Put interface ADMIN-UP.""" - self.test.vapi.sw_interface_set_flags(self.sw_if_index, admin_up_down=1) + self.test.vapi.sw_interface_set_flags(self.sw_if_index, + admin_up_down=1) def admin_down(self): """Put interface ADMIN-down.""" - self.test.vapi.sw_interface_set_flags(self.sw_if_index, admin_up_down=0) + self.test.vapi.sw_interface_set_flags(self.sw_if_index, + admin_up_down=0) def ip6_enable(self): """IPv6 Enable interface""" - self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index, enable=1) + self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index, + enable=1) def ip6_disable(self): """Put interface ADMIN-DOWN.""" - self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index, enable=0) + self.test.vapi.ip6_sw_interface_enable_disable(self.sw_if_index, + enable=0) def add_sub_if(self, sub_if): """Register a sub-interface with this interface.