Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PTF-SAI] COVER TUNNEL ATTR, AND P2MP TEST #1769

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions test/sai_test/config/tunnel_configer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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.

Expand All @@ -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.

Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions test/sai_test/data_module/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions test/sai_test/sai_tunnel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down