diff --git a/test/sai_test/config/tunnel_configer.py b/test/sai_test/config/tunnel_configer.py index d05e26482..2b98e3721 100644 --- a/test/sai_test/config/tunnel_configer.py +++ b/test/sai_test/config/tunnel_configer.py @@ -42,8 +42,8 @@ def t0_tunnel_config_helper(test_obj: 'T0TestBase', tunnel_configer = TunnelConfiger(test_obj) if is_create_tunnel: - tunnel = tunnel_configer.create_tunnel([1], [17,18], ttl_mode) - tunnel.tun_ip = test_obj.servers[11][1].ipv4 + tunnel = tunnel_configer.create_tunnel([1], [17, 18], ttl_mode) + tunnel.tun_ip.append(test_obj.servers[11][1].ipv4) tunnel_configer.create_tunnel_term(tunnel) test_obj.dut.tunnel_list.append(tunnel) @@ -86,35 +86,38 @@ def create_tunnel(self, oports, uports, ttl_mode): ttl_mode= ttl_mode) # underlay configuration - self.uvrf = self.test_obj.dut.default_vrf + tunnel.uvrf.append(self.test_obj.dut.default_vrf) # overlay configuration - self.ovrf = self.test_obj.dut.default_vrf + tunnel.ovrf.append(self.test_obj.dut.default_vrf) - tunnel.urif_lpb = sai_thrift_create_router_interface( + tunnel.urif_lpb.append(sai_thrift_create_router_interface( self.client, type=SAI_ROUTER_INTERFACE_TYPE_LOOPBACK, - virtual_router_id=tunnel.uvrf) + virtual_router_id=tunnel.uvrf[0])) - tunnel.orif_lpb = sai_thrift_create_router_interface( + tunnel.orif_lpb.append(sai_thrift_create_router_interface( self.client, type=SAI_ROUTER_INTERFACE_TYPE_LOOPBACK, - virtual_router_id=tunnel.ovrf) + virtual_router_id=tunnel.ovrf[0])) # tunnel tunnel.oid = sai_thrift_create_tunnel( self.client, type=tunnel.tunnel_type, - encap_src_ip=sai_ipaddress(tunnel.lpb_ip), + encap_src_ip=sai_ipaddress(tunnel.lpb_ip[0]), encap_ttl_val = TTL_VAL, encap_ttl_mode = ttl_mode, decap_ttl_mode = ttl_mode, - underlay_interface=tunnel.urif_lpb, - overlay_interface=tunnel.orif_lpb) + underlay_interface=tunnel.urif_lpb[0], + overlay_interface=tunnel.orif_lpb[0], + encap_ecn_mode=SAI_TUNNEL_ENCAP_ECN_MODE_STANDARD, + decap_ecn_mode=SAI_TUNNEL_DECAP_ECN_MODE_STANDARD, + loopback_packet_action=SAI_PACKET_ACTION_DROP) return tunnel - def create_tunnel_term(self, tunnel): + def create_tunnel_term(self, tunnel, i=0): """ Create tunnel term. @@ -128,11 +131,11 @@ def create_tunnel_term(self, tunnel): vr_id=tunnel.uvrf, action_tunnel_id=tunnel.oid, type=tunnel.term_type, - dst_ip=sai_ipaddress(tunnel.lpb_ip), - src_ip=sai_ipaddress(tunnel.tun_ip)) + dst_ip=sai_ipaddress(tunnel.lpb_ip[i]), + src_ip=sai_ipaddress(tunnel.tun_ip[i])) tunnel.tunnel_terms.append(tunnel_term) - def create_tunnel_route_v4_v6(self, tunnel, vm_ip, vm_ipv6): + def create_tunnel_route_v4_v6(self, tunnel, vm_ip, vm_ipv6, index=0): """ Create tunnel special route v4 and v6. @@ -146,7 +149,7 @@ def create_tunnel_route_v4_v6(self, tunnel, vm_ip, vm_ipv6): self.client, type=SAI_NEXT_HOP_TYPE_TUNNEL_ENCAP, tunnel_id=tunnel.oid, - ip=sai_ipaddress(tunnel.tun_ip), + ip=sai_ipaddress(tunnel.tun_ip[index]), tunnel_mac=tunnel.inner_dmac) # routes to VM via tunnel nexthop diff --git a/test/sai_test/data_module/tunnel.py b/test/sai_test/data_module/tunnel.py index a443b4533..04073860f 100644 --- a/test/sai_test/data_module/tunnel.py +++ b/test/sai_test/data_module/tunnel.py @@ -63,22 +63,22 @@ def __init__(self, self.oport_devs = oport_indexs self.uport_devs = uport_indexs - self.lpb_ip = LOOPBACK_IPV4 - self.tun_ip = None + self.lpb_ip = [LOOPBACK_IPV4] + self.tun_ip = [] self.tun_lpb_mask = "/32" self.inner_dmac = INNER_DMAC # underlay configuration - self.uvrf = None + self.uvrf = [] # overlay configuration - self.ovrf = None + self.ovrf = [] # loopback RIFs for tunnel - self.urif_lpb = None + self.urif_lpb = [] - self.orif_lpb = None + self.orif_lpb = [] self.tunnel_type = tunnel_type diff --git a/test/sai_test/sai_tunnel_test.py b/test/sai_test/sai_tunnel_test.py index 6fdd88387..d8570e15b 100644 --- a/test/sai_test/sai_tunnel_test.py +++ b/test/sai_test/sai_tunnel_test.py @@ -11,8 +11,10 @@ def setUp(self): tunnel_config = self.dut.tunnel_list[-1] self.oport_dev = self.dut.port_obj_list[1].dev_port_index self.uport_dev = self.dut.port_obj_list[18].dev_port_index - self.tun_ip = tunnel_config.tun_ip - self.lpb_ip = tunnel_config.lpb_ip + self.tun_ip_list = tunnel_config.tun_ip + self.lpb_ip_list = tunnel_config.lpb_ip + self.tun_ip = tunnel_config.tun_ip[0] + self.lpb_ip = tunnel_config.lpb_ip[0] self.recv_dev_port_idxs = self.get_dev_port_indexes(self.servers[11][1].l3_lag_obj.member_port_indexs) self.vm_ip = "100.100.1.1"