Skip to content

Commit f25695c

Browse files
theasianpianistselldinesh
authored andcommitted
[dash] Add tests to cover PLNSG, FNIC, trusted VNI, return path ECMP (#19700)
Add test to cover DASH features PLNSG, floating NIC, trusted VNI, and return path ECMP Signed-off-by: selldinesh <dinesh.sellappan@keysight.com>
1 parent fac4ad3 commit f25695c

14 files changed

Lines changed: 821 additions & 165 deletions

tests/common/devices/multi_asic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def critical_services_tracking_list(self):
9898
if "dhcp_server" in config_facts["FEATURE"] and config_facts["FEATURE"]["dhcp_server"]["state"] == "enabled":
9999
service_list.append("dhcp_server")
100100

101+
if config_facts['DEVICE_METADATA']['localhost'].get('switch_type', '') == 'dpu' and 'snmp' in service_list:
102+
service_list.remove('snmp')
103+
101104
# Update the asic service based on feature table state and asic flag
102105
for service in list(self.sonichost.DEFAULT_ASIC_SERVICES):
103106
if service == 'teamd' and config_facts['DEVICE_METADATA']['localhost'].get('switch_type', '') == 'dpu':

tests/common/helpers/smartswitch_util.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ def correlate_dpu_info_with_dpuhost(dpuhosts, duthost):
4545
dpuhost.dpu_data_port_ip = dpu_ip_intf_facts[data_port_on_dpu]['ipv4'] if \
4646
data_port_on_dpu in dpu_ip_intf_facts else ''
4747

48-
dpuhost.data_port_on_npu = data_port_on_npu
48+
dpuhost.npu_dataplane_port = data_port_on_npu
49+
dpuhost.dpu_dataplane_port = data_port_on_dpu
50+
dpuhost.npu_dataplane_mac = duthost.get_dut_iface_mac(data_port_on_npu)
51+
dpuhost.dpu_dataplane_mac = dpuhost.get_dut_iface_mac(data_port_on_dpu)
52+
4953
dpuhost.dataplane_mask_length = 31
5054
dpuhost.name = f"dpu{dpuhost.dpu_index}"
51-
logger.info(f"dpuhost.data_port_on_npu: {dpuhost.data_port_on_npu}, "
52-
f"dpuhost.npu_data_port_ip:{dpuhost.npu_data_port_ip}, "
53-
f"dpuhost.dpu_data_port_ip:{dpuhost.dpu_data_port_ip}, ")
55+
logger.info(f"dpuhost.data_port_on_npu: {dpuhost.npu_dataplane_port}, "
56+
f"dpuhost.npu_data_port_ip: {dpuhost.npu_data_port_ip}, "
57+
f"dpuhost.npu_dataplane_mac: {dpuhost.npu_dataplane_mac}, "
58+
f"dpuhost.data_port_on_dpu: {dpuhost.dpu_dataplane_port}, "
59+
f"dpuhost.dpu_data_port_ip: {dpuhost.dpu_data_port_ip}, "
60+
f"dpuhost.dpu_dataplane_mac: {dpuhost.dpu_dataplane_mac}")

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,20 @@ bgp/test_traffic_shift_sup.py:
446446
#######################################
447447
##### cacl #####
448448
#######################################
449+
cacl/test_cacl_application.py:
450+
skip:
451+
reason: "skip test_cacl_application in PR test temporarily"
452+
conditions:
453+
- "asic_type in ['vs']"
454+
455+
cacl/test_cacl_application.py::test_cacl_acl_loader_commands_internal:
456+
skip:
457+
reason: "test_cacl_acl_loader_commands_internal is only supported on t0/t1 testbed"
458+
conditions_logical_operator: or
459+
conditions:
460+
- "topo_type not in ['t1', 't0']"
461+
- "'dualtor' in topo_name"
462+
449463
cacl/test_cacl_application.py::test_cacl_application_dualtor:
450464
skip:
451465
reason: "test_cacl_application_dualtor is only supported on dualtor topology"
@@ -584,15 +598,15 @@ dash/test_dash_privatelink.py:
584598
reason: "Currently dash tests are not supported on KVM or non-smartswitch T1s"
585599
conditions:
586600
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
587-
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40']"
601+
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40', 'Mellanox-SN4280-O28', 'Cisco-8102-28FH-DPU-O']"
588602

589603
dash/test_dash_smartswitch_vnet.py:
590604
skip:
591605
conditions_logical_operator: or
592606
reason: "Currently dash tests are not supported on KVM or non-smartswitch T1s"
593607
conditions:
594608
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
595-
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40']"
609+
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40', 'Mellanox-SN4280-O28']"
596610

597611
dash/test_dash_vnet.py:
598612
skip:
@@ -602,6 +616,22 @@ dash/test_dash_vnet.py:
602616
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
603617
- "platform in ['x86_64-nvidia_sn4280-r0']"
604618

619+
dash/test_fnic.py:
620+
skip:
621+
conditions_logical_operator: or
622+
reason: "Currently dash tests are not supported on KVM or non-smartswitch T1s"
623+
conditions:
624+
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
625+
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40', 'Mellanox-SN4280-O28', 'Cisco-8102-28FH-DPU-O']"
626+
627+
dash/test_plnsg.py:
628+
skip:
629+
conditions_logical_operator: or
630+
reason: "Currently dash tests are not supported on KVM or non-smartswitch T1s"
631+
conditions:
632+
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
633+
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40', 'Mellanox-SN4280-O28', 'Cisco-8102-28FH-DPU-O']"
634+
605635
dash/test_relaxed_match_negative.py:
606636
skip:
607637
reason: "Currently dash tests are not supported on KVM"
@@ -3492,18 +3522,6 @@ restapi/test_restapi.py:
34923522
conditions:
34933523
- "asic_type not in ['mellanox']"
34943524

3495-
restapi/test_restapi.py::test_create_interface:
3496-
xfail:
3497-
reason: "Skipped due to community issue https://github.com/sonic-net/sonic-mgmt/issues/17997 on SN5 devices"
3498-
conditions:
3499-
- "https://github.com/sonic-net/sonic-mgmt/issues/17997 and 'SN5' in hwsku"
3500-
3501-
restapi/test_restapi.py::test_create_interface_sad:
3502-
xfail:
3503-
reason: "Skipped due to community issue https://github.com/sonic-net/sonic-mgmt/issues/17997 on SN5 devices"
3504-
conditions:
3505-
- "https://github.com/sonic-net/sonic-mgmt/issues/17997 and 'SN5' in hwsku"
3506-
35073525
restapi/test_restapi.py::test_create_vrf:
35083526
skip:
35093527
reason: "Only supported on Mellanox T1"

tests/dash/configs/privatelink_config.py

Lines changed: 138 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from dash_api.eni_pb2 import State
1+
from dash_api.eni_pb2 import State, EniMode
22
from dash_api.route_type_pb2 import ActionType, EncapType, RoutingType
33
from dash_api.types_pb2 import IpVersion
44

@@ -24,11 +24,14 @@
2424

2525
APPLIANCE_ID = "100"
2626
LOCAL_REGION_ID = "100"
27-
VM_VNI = "4321"
27+
VM_VNI = 4321
2828
ENCAP_VNI = 100
29+
NSG_OUTBOUND_VNI = 100
2930
VNET1 = "Vnet1"
31+
VNET2 = "Vnet2"
3032
VNET1_VNI = "2001"
3133
VNET1_GUID = "559c6ce8-26ab-4193-b946-ccc6e8f930b2"
34+
VNET2_GUID = "559c6ce8-26ab-4193-b946-ccc6e8f930b3"
3235
VM_MAC = "44:E3:9F:EF:C4:6E"
3336
ENI_MAC = "F4:93:9F:EF:C4:7E"
3437
ENI_MAC_STRING = ENI_MAC.replace(":", "")
@@ -41,6 +44,17 @@
4144
ROUTE_GROUP1_GUID = "48af6ce8-26cc-4293-bfa6-0126e8fcdeb2"
4245
ROUTE_GROUP2_GUID = "58cf62e0-22cc-4693-baa6-012358fcdec9"
4346
OUTBOUND_DIR_LOOKUP = "dst_mac"
47+
TUNNEL1 = "Tunnel1"
48+
ENI_ID2 = "497f23d7-f0ac-4c99-a98f-59b470e8c7bd"
49+
TUNNEL1_ENDPOINT_IP = "40.40.40.40"
50+
TUNNEL2 = "Tunnel2"
51+
TUNNEL1_ENDPOINT_IPS = [TUNNEL1_ENDPOINT_IP]
52+
TUNNEL2_ENDPOINT_IPS = ["60.60.60.60", "70.70.70.70"]
53+
TUNNEL3 = "Tunnel3"
54+
TUNNEL3_ENDPOINT_IPS = ["80.80.80.80"]
55+
TUNNEL4 = "Tunnel4"
56+
TUNNEL4_ENDPOINT_IPS = ["90.90.90.90", "10.10.10.10"]
57+
ENI_TRUSTED_VNI = "800"
4458
METER_POLICY_V4 = "MeterPolicyV4"
4559
METER_RULE_V4_PREFIX1 = "48.10.5.0/24"
4660
METER_RULE_V4_PREFIX2 = "92.6.0.0/16"
@@ -49,7 +63,18 @@
4963
f"DASH_APPLIANCE_TABLE:{APPLIANCE_ID}": {
5064
"sip": APPLIANCE_VIP,
5165
"vm_vni": VM_VNI,
52-
"local_region_id": LOCAL_REGION_ID
66+
"local_region_id": LOCAL_REGION_ID,
67+
"trusted_vnis": [ENCAP_VNI, NSG_OUTBOUND_VNI],
68+
}
69+
}
70+
71+
APPLIANCE_FNIC_CONFIG = {
72+
f"DASH_APPLIANCE_TABLE:{APPLIANCE_ID}": {
73+
"sip": APPLIANCE_VIP,
74+
"vm_vni": VM_VNI,
75+
"outbound_direction_lookup": OUTBOUND_DIR_LOOKUP,
76+
"local_region_id": LOCAL_REGION_ID,
77+
"trusted_vnis": ENCAP_VNI
5378
}
5479
}
5580

@@ -60,6 +85,27 @@
6085
}
6186
}
6287

88+
VNET2_CONFIG = {
89+
f"DASH_VNET_TABLE:{VNET2}": {
90+
"vni": VM_VNI,
91+
"guid": VNET2_GUID
92+
}
93+
}
94+
95+
ENI_FNIC_CONFIG = {
96+
f"DASH_ENI_TABLE:{ENI_ID}": {
97+
"vnet": VNET1,
98+
"underlay_ip": VM1_PA,
99+
"mac_address": ENI_MAC,
100+
"eni_id": ENI_ID2,
101+
"admin_state": State.STATE_ENABLED,
102+
"pl_underlay_sip": APPLIANCE_VIP,
103+
"pl_sip_encoding": f"{PL_ENCODING_IP}/{PL_ENCODING_MASK}",
104+
"eni_mode": EniMode.MODE_FNIC,
105+
"trusted_vnis": ENI_TRUSTED_VNI,
106+
}
107+
}
108+
63109
ENI_CONFIG = {
64110
f"DASH_ENI_TABLE:{ENI_ID}": {
65111
"vnet": VNET1,
@@ -70,6 +116,7 @@
70116
"pl_underlay_sip": APPLIANCE_VIP,
71117
"pl_sip_encoding": f"{PL_ENCODING_IP}/{PL_ENCODING_MASK}",
72118
"v4_meter_policy_id": METER_POLICY_V4,
119+
"trusted_vnis": VM_VNI
73120
}
74121
}
75122

@@ -83,11 +130,94 @@
83130
}
84131
}
85132

86-
VM1_VNET_MAPPING_CONFIG = {
87-
f"DASH_VNET_MAPPING_TABLE:{VNET1}:{VM1_CA}": {
88-
"routing_type": RoutingType.ROUTING_TYPE_VNET,
89-
"underlay_ip": VM1_PA,
90-
"metering_class_or": "2",
133+
PE_PLNSG_SINGLE_ENDPOINT_VNET_MAPPING_CONFIG = {
134+
f"DASH_VNET_MAPPING_TABLE:{VNET1}:{PE_CA}": {
135+
"routing_type": RoutingType.ROUTING_TYPE_PRIVATELINK,
136+
"underlay_ip": PE_PA,
137+
"overlay_sip_prefix": f"{PL_OVERLAY_SIP}/{PL_OVERLAY_SIP_MASK}",
138+
"overlay_dip_prefix": f"{PL_OVERLAY_DIP}/{PL_OVERLAY_DIP_MASK}",
139+
"metering_class_or": "1586",
140+
"tunnel": TUNNEL3,
141+
}
142+
}
143+
144+
PE_PLNSG_MULTI_ENDPOINT_VNET_MAPPING_CONFIG = {
145+
f"DASH_VNET_MAPPING_TABLE:{VNET1}:{PE_CA}": {
146+
"routing_type": RoutingType.ROUTING_TYPE_PRIVATELINK,
147+
"underlay_ip": PE_PA,
148+
"overlay_sip_prefix": f"{PL_OVERLAY_SIP}/{PL_OVERLAY_SIP_MASK}",
149+
"overlay_dip_prefix": f"{PL_OVERLAY_DIP}/{PL_OVERLAY_DIP_MASK}",
150+
"metering_class_or": "1586",
151+
"tunnel": TUNNEL4,
152+
}
153+
}
154+
155+
TUNNEL1_CONFIG = {
156+
f"DASH_TUNNEL_TABLE:{TUNNEL1}": {
157+
"endpoints": TUNNEL1_ENDPOINT_IPS,
158+
"vni": ENCAP_VNI,
159+
"encap_type": EncapType.ENCAP_TYPE_VXLAN
160+
}
161+
}
162+
163+
TUNNEL2_CONFIG = {
164+
f"DASH_TUNNEL_TABLE:{TUNNEL2}": {
165+
"endpoints": TUNNEL2_ENDPOINT_IPS,
166+
"encap_type": EncapType.ENCAP_TYPE_VXLAN,
167+
"vni": ENCAP_VNI,
168+
}
169+
}
170+
171+
TUNNEL3_CONFIG = {
172+
f"DASH_TUNNEL_TABLE:{TUNNEL3}": {
173+
"endpoints": TUNNEL3_ENDPOINT_IPS,
174+
"vni": NSG_OUTBOUND_VNI,
175+
"encap_type": EncapType.ENCAP_TYPE_VXLAN,
176+
}
177+
}
178+
179+
TUNNEL4_CONFIG = {
180+
f"DASH_TUNNEL_TABLE:{TUNNEL4}": {
181+
"endpoints": TUNNEL4_ENDPOINT_IPS,
182+
"vni": NSG_OUTBOUND_VNI,
183+
"encap_type": EncapType.ENCAP_TYPE_VXLAN,
184+
}
185+
}
186+
187+
INBOUND_VNI_ROUTE_RULE_CONFIG = {
188+
f"DASH_ROUTE_RULE_TABLE:{ENI_ID}:{ENCAP_VNI}:{PE_PA}/32": {
189+
"action_type": ActionType.ACTION_TYPE_DECAP,
190+
"priority": 1
191+
}
192+
}
193+
194+
# For floating NIC, outbound packet will pass through inbound pipeline first before going to the outbound pipeline
195+
# Need this route rule entry to prevent the packet from being dropped in the inbound pipeline
196+
TRUSTED_VNI_ROUTE_RULE_CONFIG = {
197+
f"DASH_ROUTE_RULE_TABLE:{ENI_ID}:{ENI_TRUSTED_VNI}:{VM1_PA}/32": {
198+
"action_type": ActionType.ACTION_TYPE_DECAP,
199+
"priority": 1
200+
}
201+
}
202+
203+
VM_SUBNET_ROUTE_WITH_TUNNEL_MULTI_ENDPOINT = {
204+
f"DASH_ROUTE_TABLE:{ROUTE_GROUP1}:{VM_CA_SUBNET}": {
205+
"routing_type": RoutingType.ROUTING_TYPE_DIRECT,
206+
"tunnel": TUNNEL2
207+
}
208+
}
209+
210+
VM_SUBNET_ROUTE_WITH_TUNNEL_SINGLE_ENDPOINT = {
211+
f"DASH_ROUTE_TABLE:{ROUTE_GROUP1}:{VM_CA_SUBNET}": {
212+
"routing_type": RoutingType.ROUTING_TYPE_DIRECT,
213+
"tunnel": TUNNEL1
214+
}
215+
}
216+
217+
VM_VNI_ROUTE_RULE_CONFIG = {
218+
f"DASH_ROUTE_RULE_TABLE:{ENI_ID}:{VM_VNI}:{VM1_PA}/32": {
219+
"action_type": ActionType.ACTION_TYPE_DECAP,
220+
"priority": 1
91221
}
92222
}
93223

0 commit comments

Comments
 (0)