Skip to content
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
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/common/plugins/conditional_mark/tests_mark_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,17 @@ gnmi/test_gnoi_system_reboot.py::test_gnoi_system_reboot_warm:
- "release in ['202412']"
- "'f2' in topo_name"

#######################################
##### ha #####
#######################################
ha/test_ha_steady_state_pl.py:
skip:
conditions_logical_operator: or
reason: "Currently ha tests are not supported on KVM or non-smartswitch T1s"
conditions:
- "asic_type in ['vs'] and https://github.com/sonic-net/sonic-mgmt/issues/16407"
- "hwsku not in ['Cisco-8102-28FH-DPU-O-T1', 'Mellanox-SN4280-O8C40', 'Mellanox-SN4280-O28', 'Cisco-8102-28FH-DPU-O']"

#######################################
##### hash #####
#######################################
Expand Down
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,17 @@ def pytest_addoption(parser):
parser.addoption('--minigraph2', action='store', type=str, help='path to the minigraph2')

#####################################
# dash, vxlan, route shared options #
# ha, dash, vxlan, route shared options #
#####################################
parser.addoption("--skip_cleanup", action="store_true", help="Skip config cleanup after test (tests: dash, vxlan)")
parser.addoption("--num_routes", action="store", default=None, type=int,
help="Number of routes (tests: route, vxlan)")
parser.addoption("--skip_cert_cleanup", action="store_true", help="Skip certificates cleanup after test")
parser.addoption("--skip_config", action="store_true", help="Don't apply configurations on DUT")
parser.addoption("--vxlan_udp_dport", action="store", default="random",
help="The vxlan udp dst port used in the test")
parser.addoption("--dpu_index", action="store", default=0, type=int,
help="The default dpu used for the test")

############################
# sflow options #
Expand Down
40 changes: 1 addition & 39 deletions tests/dash/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ROUTING_ACTION_TYPE, LOOKUP_OVERLAY_IP, ACL_GROUP, ACL_STAGE, LOCAL_DUT_INTF, REMOTE_DUT_INTF, \
REMOTE_PTF_SEND_INTF, REMOTE_PTF_RECV_INTF, LOCAL_REGION_ID, VXLAN_UDP_BASE_SRC_PORT, VXLAN_UDP_SRC_PORT_MASK, \
NPU_DATAPLANE_IP, NPU_DATAPLANE_MAC, NPU_DATAPLANE_PORT, DPU_DATAPLANE_IP, DPU_DATAPLANE_MAC, DPU_DATAPLANE_PORT
from dash_utils import render_template_to_host, apply_swssconfig_file
from tests.common.dash_utils import render_template_to_host, apply_swssconfig_file
from gnmi_utils import generate_gnmi_cert, apply_gnmi_cert, recover_gnmi_cert, apply_gnmi_file
from dash_acl import AclGroup, DEFAULT_ACL_GROUP, WAIT_AFTER_CONFIG, DefaultAclRule
from tests.common.helpers.smartswitch_util import correlate_dpu_info_with_dpuhost, get_data_port_on_dpu, get_dpu_dataplane_port # noqa F401
Expand All @@ -35,50 +35,12 @@ def pytest_addoption(parser):
Adds pytest options that are used by DASH tests
"""

parser.addoption(
"--skip_config",
action="store_true",
help="Don't apply configurations on DUT"
)

parser.addoption(
"--config_only",
action="store_true",
help="Apply new configurations on DUT without running tests"
)

parser.addoption(
"--skip_dataplane_checking",
action="store_true",
help="Skip dataplane checking"
)

parser.addoption(
"--vxlan_udp_dport",
action="store",
default="random",
help="The vxlan udp dst port used in the test"
)

parser.addoption(
"--skip_cert_cleanup",
action="store_true",
help="Skip certificates cleanup after test"
)

parser.addoption(
"--dpu_index",
action="store",
default=0,
type=int,
help="The default dpu used for the test"
)


@pytest.fixture(scope="module")
def config_only(request):
return request.config.getoption("--config_only")


@pytest.fixture(scope="module")
def skip_config(request):
Expand Down
2 changes: 1 addition & 1 deletion tests/dash/dash_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import random
from collections.abc import Iterable
from constants import * # noqa: F403
from dash_utils import render_template
from tests.common.dash_utils import render_template
from gnmi_utils import apply_gnmi_file
import packets
import ptf.testutils as testutils
Expand Down
2 changes: 1 addition & 1 deletion tests/dash/test_dash_disable_enable_eni.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from constants import LOCAL_PTF_INTF, REMOTE_PTF_INTF
from tests.common.plugins.allure_wrapper import allure_step_wrapper as allure
from gnmi_utils import apply_gnmi_file
from dash_utils import render_template_to_host
from tests.common.dash_utils import render_template_to_host
from tests.common.utilities import wait_until
from tests.common.helpers.assertions import pytest_assert

Expand Down
2 changes: 1 addition & 1 deletion tests/dash/test_dash_metering.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.helpers.assertions import pytest_assert
from configs.privatelink_config import TUNNEL1_ENDPOINT_IPS, TUNNEL2_ENDPOINT_IPS
from tests.common import config_reload
from tests.dash.dash_utils import verify_tunnel_packets
from tests.common.dash_utils import verify_tunnel_packets
from dash_eni_counter_utils import get_eni_counter_oid, get_eni_meter_counters

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/dash/test_dash_smartswitch_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from constants import LOCAL_PTF_INTF, REMOTE_PA_IP, REMOTE_PTF_RECV_INTF, REMOTE_DUT_INTF, \
VXLAN_UDP_BASE_SRC_PORT, VXLAN_UDP_SRC_PORT_MASK
from gnmi_utils import apply_gnmi_file
from dash_utils import render_template_to_host, apply_swssconfig_file
from tests.common.dash_utils import render_template_to_host, apply_swssconfig_file
from tests.dash.conftest import get_interface_ip
from tests.common import config_reload

Expand Down
2 changes: 1 addition & 1 deletion tests/dash/test_eni_based_forwarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import ptf.packet as scapy

from ptf.mask import Mask
from dash_utils import render_template_to_host, apply_swssconfig_file
from tests.common.dash_utils import render_template_to_host, apply_swssconfig_file
from tests.dash.conftest import get_interface_ip
from tests.common.helpers.assertions import pytest_assert
from tests.common.utilities import wait_until
Expand Down
2 changes: 1 addition & 1 deletion tests/dash/test_fnic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tests.common.helpers.assertions import pytest_assert
from configs.privatelink_config import TUNNEL1_ENDPOINT_IPS, TUNNEL2_ENDPOINT_IPS
from tests.common import config_reload
from tests.dash.dash_utils import verify_tunnel_packets
from tests.common.dash_utils import verify_tunnel_packets

logger = logging.getLogger(__name__)

Expand Down
192 changes: 192 additions & 0 deletions tests/ha/configs/privatelink_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
from dash_api.eni_pb2 import State
from dash_api.route_type_pb2 import ActionType, EncapType, RoutingType
from dash_api.types_pb2 import IpVersion

VNET = "vnet"
VNET_ENCAP = "vnet_encap"
VNET_DIRECT = "vnet_direct"
PRIVATELINK = "privatelink"
DECAP = "decap"

APPLIANCE_VIP = "3.2.1.0"
VM1_PA = "25.1.1.1" # VM host physical address
VM1_CA = "10.0.0.11" # VM customer address
VM_CA_SUBNET = "10.0.0.0/16"
PE_PA = "101.1.2.3" # private endpoint physical address
PE_CA = "10.2.0.100" # private endpoint customer address
PE_CA_SUBNET = "10.2.0.0/16"
PL_ENCODING_IP = "::d107:64:ff71:0:0"
PL_ENCODING_MASK = "::ffff:ffff:ffff:0:0"
PL_OVERLAY_SIP = "fd41:108:20:abc:abc::0"
PL_OVERLAY_SIP_MASK = "ffff:ffff:ffff:ffff:ffff:ffff::"
PL_OVERLAY_DIP = "2603:10e1:100:2::3401:203"
PL_OVERLAY_DIP_MASK = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"

APPLIANCE_ID = "100"
LOCAL_REGION_ID = "100"
VM_VNI = 4321
ENCAP_VNI = 100
NSG_OUTBOUND_VNI = 100
VNET1 = "Vnet1"
VNET2 = "Vnet2"
VNET1_VNI = "2001"
VNET1_GUID = "559c6ce8-26ab-4193-b946-ccc6e8f930b2"
VNET2_GUID = "559c6ce8-26ab-4193-b946-ccc6e8f930b3"
VM_MAC = "44:E3:9F:EF:C4:6E"
ENI_MAC = "F4:93:9F:EF:C4:7E"
ENI_MAC_STRING = ENI_MAC.replace(":", "")
# REMOTE MAC is corresponding to PE MAC
REMOTE_MAC = "43:BE:65:25:FA:67"
REMOTE_MAC_STRING = REMOTE_MAC.replace(":", "")
ENI_ID = "497f23d7-f0ac-4c99-a98f-59b470e8c7bd"
ROUTE_GROUP1 = "RouteGroup1"
ROUTE_GROUP2 = "RouteGroup2"
ROUTE_GROUP1_GUID = "48af6ce8-26cc-4293-bfa6-0126e8fcdeb2"
ROUTE_GROUP2_GUID = "58cf62e0-22cc-4693-baa6-012358fcdec9"
OUTBOUND_DIR_LOOKUP = "dst_mac"
ENI_ID2 = "497f23d7-f0ac-4c99-a98f-59b470e8c7bd"
ENI_TRUSTED_VNI = "800"
METER_POLICY_V4 = "MeterPolicyV4"
METER_RULE_V4_PREFIX1 = "48.10.5.0/24"
METER_RULE_V4_PREFIX2 = "92.6.0.0/16"

APPLIANCE_CONFIG = {
f"DASH_APPLIANCE_TABLE:{APPLIANCE_ID}": {
"sip": APPLIANCE_VIP,
"vm_vni": VM_VNI,
"local_region_id": LOCAL_REGION_ID,
"trusted_vnis": [ENCAP_VNI, NSG_OUTBOUND_VNI],
}
}


VNET_CONFIG = {
f"DASH_VNET_TABLE:{VNET1}": {
"vni": VNET1_VNI,
"guid": VNET1_GUID
}
}


VNET2_CONFIG = {
f"DASH_VNET_TABLE:{VNET2}": {
"vni": VM_VNI,
"guid": VNET2_GUID
}
}


ENI_CONFIG = {
f"DASH_ENI_TABLE:{ENI_ID}": {
"vnet": VNET1,
"underlay_ip": VM1_PA,
"mac_address": ENI_MAC,
"eni_id": ENI_ID,
"admin_state": State.STATE_ENABLED,
"pl_underlay_sip": APPLIANCE_VIP,
"pl_sip_encoding": f"{PL_ENCODING_IP}/{PL_ENCODING_MASK}",
"v4_meter_policy_id": METER_POLICY_V4,
"trusted_vnis": VM_VNI
}
}

PE_VNET_MAPPING_CONFIG = {
f"DASH_VNET_MAPPING_TABLE:{VNET1}:{PE_CA}": {
"routing_type": RoutingType.ROUTING_TYPE_PRIVATELINK,
"underlay_ip": PE_PA,
"overlay_sip_prefix": f"{PL_OVERLAY_SIP}/{PL_OVERLAY_SIP_MASK}",
"overlay_dip_prefix": f"{PL_OVERLAY_DIP}/{PL_OVERLAY_DIP_MASK}",
"metering_class_or": "1586",
}
}


INBOUND_VNI_ROUTE_RULE_CONFIG = {
f"DASH_ROUTE_RULE_TABLE:{ENI_ID}:{ENCAP_VNI}:{PE_PA}/32": {
"action_type": ActionType.ACTION_TYPE_DECAP,
"priority": 1
}
}


PE_SUBNET_ROUTE_CONFIG = {
f"DASH_ROUTE_TABLE:{ROUTE_GROUP1}:{PE_CA_SUBNET}": {
"routing_type": RoutingType.ROUTING_TYPE_VNET,
"vnet": VNET1,
"metering_class_or": "2048",
"metering_class_and": "4095",
}
}

VM_SUBNET_ROUTE_CONFIG = {
f"DASH_ROUTE_TABLE:{ROUTE_GROUP1}:{VM_CA_SUBNET}": {
"routing_type": RoutingType.ROUTING_TYPE_VNET,
"vnet": VNET1,
"metering_class_or": "2048",
"metering_class_and": "4095",
}
}

ROUTING_TYPE_VNET_CONFIG = {
f"DASH_ROUTING_TYPE_TABLE:{VNET}": {
"items": [
{
"action_name": "action1",
"action_type": ActionType.ACTION_TYPE_STATICENCAP,
"encap_type": EncapType.ENCAP_TYPE_VXLAN,
},
]
}
}

ROUTING_TYPE_PL_CONFIG = {
f"DASH_ROUTING_TYPE_TABLE:{PRIVATELINK}": {
"items": [
{
"action_name": "action1",
"action_type": ActionType.ACTION_TYPE_4_to_6
},
{
"action_name": "action2",
"action_type": ActionType.ACTION_TYPE_STATICENCAP,
"encap_type": EncapType.ENCAP_TYPE_NVGRE,
"vni": ENCAP_VNI
}
]
}
}

ROUTE_GROUP1_CONFIG = {
f"DASH_ROUTE_GROUP_TABLE:{ROUTE_GROUP1}": {
"guid": ROUTE_GROUP1_GUID,
"version": "rg_version"
}
}

ENI_ROUTE_GROUP1_CONFIG = {
f"DASH_ENI_ROUTE_TABLE:{ENI_ID}": {
"group_id": ROUTE_GROUP1
}
}

METER_POLICY_V4_CONFIG = {
f"DASH_METER_POLICY_TABLE:{METER_POLICY_V4}": {
"ip_version": IpVersion.IP_VERSION_IPV4
}
}

METER_RULE1_V4_CONFIG = {
f"DASH_METER_RULE_TABLE:{METER_POLICY_V4}:1": {
"priority": "10",
"ip_prefix": f"{METER_RULE_V4_PREFIX1}",
"metering_class": 1,
}
}

METER_RULE2_V4_CONFIG = {
f"DASH_METER_RULE_TABLE:{METER_POLICY_V4}:2": {
"priority": "10",
"ip_prefix": f"{METER_RULE_V4_PREFIX2}",
"metering_class": 2,
}
}
Loading
Loading