Skip to content

Commit

Permalink
Merge branch 'sonic-net:master' into dpu_test_plan_draft_pr
Browse files Browse the repository at this point in the history
  • Loading branch information
nissampa authored Jul 10, 2024
2 parents 6202ea7 + eb770be commit 2e1f68f
Show file tree
Hide file tree
Showing 27 changed files with 322 additions and 188 deletions.
23 changes: 7 additions & 16 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ t0:
- platform_tests/counterpoll/test_counterpoll_watermark.py
- platform_tests/fwutil/test_fwutil.py
- platform_tests/link_flap/test_cont_link_flap.py
- platform_tests/mellanox/test_check_sfp_eeprom.py
- platform_tests/mellanox/test_check_sfp_presence.py
- platform_tests/mellanox/test_check_sfp_using_ethtool.py
- platform_tests/mellanox/test_check_sysfs.py
- platform_tests/mellanox/test_hw_management_service.py
- platform_tests/mellanox/test_psu_power_threshold.py
- platform_tests/mellanox/test_reboot_cause.py
- platform_tests/sfp/test_show_intf_xcvr.py
- platform_tests/sfp/test_sfpshow.py
- platform_tests/sfp/test_sfputil.py
Expand Down Expand Up @@ -299,10 +292,6 @@ onboarding_t0:
- bgp/test_bgp_peer_shutdown.py
- cacl/test_ebtables_application.py
- clock/test_clock.py
- dualtor_mgmt/test_dualtor_bgp_update_delay.py
- dualtor_mgmt/test_egress_drop_nvidia.py
- dualtor_mgmt/test_grpc_periodical_sync.py
- dualtor_mgmt/test_ingress_drop.py
- generic_config_updater/test_dynamic_acl.py
- generic_config_updater/test_pfcwd_status.py
- generic_config_updater/test_pg_headroom_update.py
Expand All @@ -314,11 +303,6 @@ onboarding_t0:
- pfcwd/test_pfcwd_timer_accuracy.py
- pfcwd/test_pfcwd_warm_reboot.py
- platform_tests/cli/test_show_platform.py
- platform_tests/daemon/test_fancontrol.py
- platform_tests/daemon/test_ledd.py
- platform_tests/daemon/test_pcied.py
- platform_tests/daemon/test_psud.py
- platform_tests/daemon/test_syseepromd.py
- platform_tests/link_flap/test_link_flap.py
# - platform_tests/test_advanced_reboot.py
- platform_tests/test_cont_warm_reboot.py
Expand All @@ -339,6 +323,13 @@ onboarding_t0:
onboarding_t1:
- decap/test_decap.py

onboarding_dualtor:
- dualtor_mgmt/test_dualtor_bgp_update_delay.py
- dualtor_mgmt/test_grpc_periodical_sync.py
- dualtor_mgmt/test_ingress_drop.py
- dualtor_mgmt/test_server_failure.py
- dualtor_mgmt/test_toggle_mux.py

specific_param:
t0-sonic:
- name: bgp/test_bgp_fact.py
Expand Down
93 changes: 92 additions & 1 deletion .azure-pipelines/pr_test_skip_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ t0:
- platform_tests/api/test_sfp.py
- platform_tests/api/test_thermal.py
- platform_tests/api/test_watchdog.py
# These test scripts are aimed to test some daemons on physical testbed.
- platform_tests/daemon/test_fancontrol.py
- platform_tests/daemon/test_ledd.py
- platform_tests/daemon/test_pcied.py
- platform_tests/daemon/test_psud.py
- platform_tests/daemon/test_syseepromd.py
# These test scripts are aimed to run on mellanox platform
- platform_tests/mellanox/test_check_sfp_eeprom.py
- platform_tests/mellanox/test_check_sfp_presence.py
- platform_tests/mellanox/test_check_sfp_using_ethtool.py
- platform_tests/mellanox/test_check_sysfs.py
- platform_tests/mellanox/test_hw_management_service.py
- platform_tests/mellanox/test_psu_power_threshold.py
- platform_tests/mellanox/test_reboot_cause.py
- snmp/test_snmp_phy_entity.py

t1:
Expand All @@ -51,11 +65,24 @@ t1:
- platform_tests/api/test_sfp.py
- platform_tests/api/test_thermal.py
- platform_tests/api/test_watchdog.py
# These test scripts are aimed to test some daemons on physical testbed.
- platform_tests/daemon/test_fancontrol.py
- platform_tests/daemon/test_ledd.py
- platform_tests/daemon/test_pcied.py
- platform_tests/daemon/test_psud.py
- platform_tests/daemon/test_syseepromd.py
# These test scripts are aimed to run on mellanox platform
- platform_tests/mellanox/test_check_sfp_eeprom.py
- platform_tests/mellanox/test_check_sfp_presence.py
- platform_tests/mellanox/test_check_sfp_using_ethtool.py
- platform_tests/mellanox/test_check_sysfs.py
- platform_tests/mellanox/test_hw_management_service.py
- platform_tests/mellanox/test_psu_power_threshold.py
- platform_tests/mellanox/test_reboot_cause.py
- snmp/test_snmp_phy_entity.py
# Not supported port type
- sub_port_interfaces/test_sub_port_l2_forwarding.py


t2:
# This script only supported on Mellanox
- generic_config_updater/test_pfcwd_interval.py
Expand All @@ -78,4 +105,68 @@ t2:
- platform_tests/api/test_watchdog.py
# Test is not supported on vs testbed
- platform_tests/test_intf_fec.py
# These test scripts are aimed to test some daemons on physical testbed.
- platform_tests/daemon/test_fancontrol.py
- platform_tests/daemon/test_ledd.py
- platform_tests/daemon/test_pcied.py
- platform_tests/daemon/test_psud.py
- platform_tests/daemon/test_syseepromd.py
# These test scripts are aimed to run on mellanox platform
- platform_tests/mellanox/test_check_sfp_eeprom.py
- platform_tests/mellanox/test_check_sfp_presence.py
- platform_tests/mellanox/test_check_sfp_using_ethtool.py
- platform_tests/mellanox/test_check_sysfs.py
- platform_tests/mellanox/test_hw_management_service.py
- platform_tests/mellanox/test_psu_power_threshold.py
- platform_tests/mellanox/test_reboot_cause.py
- snmp/test_snmp_phy_entity.py

dualtor:
# This test is only for Nvidia platforms.
- dualtor_mgmt/test_egress_drop_nvidia.py

tgen:
# Ixia test only support on physical ixia testbed
- ixia/ecn/test_dequeue_ecn.py
- ixia/ecn/test_red_accuracy.py
- ixia/ixanvl/test_bgp_conformance.py
- ixia/pfc/test_global_pause.py
- ixia/pfc/test_pfc_congestion.py
- ixia/pfc/test_pfc_pause_lossless.py
- ixia/pfc/test_pfc_pause_lossy.py
- ixia/pfcwd/test_pfcwd_a2a.py
- ixia/pfcwd/test_pfcwd_basic.py
- ixia/pfcwd/test_pfcwd_burst_storm.py
- ixia/pfcwd/test_pfcwd_m2o.py
- ixia/pfcwd/test_pfcwd_runtime_traffic.py
- ixia/test_ixia_traffic.py
- ixia/test_tgen.py

wan:
# Currently PR test will not test wan topo
- wan/isis/test_isis_authentication.py
- wan/isis/test_isis_csnp_interval.py
- wan/isis/test_isis_database.py
- wan/isis/test_isis_dynamic_hostname.py
- wan/isis/test_isis_ecmp.py
- wan/isis/test_isis_hello_interval.py
- wan/isis/test_isis_hello_pad.py
- wan/isis/test_isis_holdtime.py
- wan/isis/test_isis_intf_passive.py
- wan/isis/test_isis_level_capacity.py
- wan/isis/test_isis_log_adjacency_change.py
- wan/isis/test_isis_lsp_fragment.py
- wan/isis/test_isis_lsp_gen_interval.py
- wan/isis/test_isis_lsp_lifetime.py
- wan/isis/test_isis_lsp_refresh.py
- wan/isis/test_isis_metric_wide.py
- wan/isis/test_isis_neighbor.py
- wan/isis/test_isis_overload_bit.py
- wan/isis/test_isis_redistribute.py
- wan/isis/test_isis_spf_default_interval.py
- wan/isis/test_isis_spf_ietf_interval.py
- wan/lacp/test_wan_lacp.py
- wan/lacp/test_wan_lag_member.py
- wan/lacp/test_wan_lag_min_link.py
- wan/lldp/test_wan_lldp.py
- wan/traffic_test/test_traffic.py
10 changes: 7 additions & 3 deletions ansible/roles/fanout/templates/arista_7260cx3_deploy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ vrf definition management
speed forced 40gfull
no shutdown
{% elif device_conn[inventory_hostname][intf]['speed'] == "10000" %}
{% for sub in range (1,5) %}
{% for sub in range (1,5) %}
{% set subintf = 'Ethernet' + i|string + '/' + sub|string %}
interface {{ subintf }}
interface {{ subintf }}
{% if subintf in device_port_vlans[inventory_hostname] and device_port_vlans[inventory_hostname][subintf]['mode'] != "Trunk" %}
description {{ device_conn[inventory_hostname][subintf]['peerdevice'] }}-{{ device_conn[inventory_hostname][subintf]['peerport'] }}
switchport access vlan {{ device_port_vlans[inventory_hostname][subintf]['vlanids'] }}
switchport mode dot1q-tunnel
spanning-tree portfast
speed forced 10gfull
no shutdown
!
{% endfor %}
{% else %}
shutdown
{% endif %}
{% endfor %}
{% elif device_conn[inventory_hostname][intf]['speed'] == "50000" %}
interface {{ intf }}
description {{ device_conn[inventory_hostname][intf]['peerdevice'] }}-{{ device_conn[inventory_hostname][intf]['peerport'] }}
Expand Down
25 changes: 1 addition & 24 deletions ansible/roles/vm_set/library/vm_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,20 +426,6 @@ def destroy_bridges(self):
self.destroy_ovs_bridge(VS_CHASSIS_INBAND_BRIDGE_NAME)
self.destroy_ovs_bridge(VS_CHASSIS_MIDPLANE_BRIDGE_NAME)

def reinsert_8021q(self):
"""
Reinsert module 8021q in case of vconfig add command failed to work
Would not do reinsert in a shared test server, in case of affect traffic
"""
ngts_docker_count = 0
out = VMTopology.cmd('docker ps')
for line in out.split('\n'):
if 'docker-ngts' in line:
ngts_docker_count += 1
if ngts_docker_count < 2:
VMTopology.cmd('rmmod 8021q')
VMTopology.cmd('modprobe 8021q')

def destroy_ovs_bridge(self, bridge_name):
logging.info('=== Destroy bridge %s ===' % bridge_name)
VMTopology.cmd('ovs-vsctl --if-exists del-br %s' % bridge_name)
Expand Down Expand Up @@ -1309,13 +1295,6 @@ def remove_host_ports(self):
if isinstance(intf, list):
host_ifindex = intf[0][2] if len(intf[0]) == 3 else i
is_active_active = intf in self.host_interfaces_active_active
dual_if_template = ACTIVE_ACTIVE_INTERFACES_TEMPLATE \
if is_active_active else MUXY_INTERFACES_TEMPLATE
dual_if = adaptive_name(
dual_if_template, self.vm_set_name, host_ifindex)
ptf_if = PTF_FP_IFACE_TEMPLATE % host_ifindex
tmp_name = ptf_if + VMTopology._generate_fingerprint(dual_if, MAX_INTF_LEN-len(ptf_if))
self.remove_veth_if_from_docker(dual_if, ptf_if, tmp_name)
self.remove_dualtor_cable(
host_ifindex, is_active_active=is_active_active)
else:
Expand Down Expand Up @@ -1774,7 +1753,7 @@ def main():
module = AnsibleModule(
argument_spec=dict(
cmd=dict(required=True, choices=['create', 'bind', 'bind_keysight_api_server_ip',
'renumber', 'unbind', 'destroy', "connect-vms", "disconnect-vms", "reinsert-8021q"]),
'renumber', 'unbind', 'destroy', "connect-vms", "disconnect-vms"]),
vm_set_name=dict(required=False, type='str'),
topo=dict(required=False, type='dict'),
vm_names=dict(required=True, type='list'),
Expand Down Expand Up @@ -1820,8 +1799,6 @@ def main():
net.create_bridges()
elif cmd == 'destroy':
net.destroy_bridges()
elif cmd == 'reinsert-8021q':
net.reinsert_8021q()
elif cmd == 'bind':
check_params(module, ['vm_set_name',
'topo',
Expand Down
7 changes: 0 additions & 7 deletions ansible/roles/vm_set/tasks/remove_topo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,3 @@
vm_names: "{{ VM_targets }}"
become: yes
when: vm_type is defined and vm_type=="ceos"

- name: Reinsert 8021q module
vm_topology:
cmd: 'reinsert-8021q'
vm_names: "{{ VM_targets }}"
become: yes
when: vm_type is defined and vm_type=="ceos"
17 changes: 17 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ stages:
MGMT_BRANCH: $(BUILD_BRANCH)
TEST_SET: onboarding_t1

- job: onboarding_elastictest_dualtor
displayName: "onboarding dualtor testcases by Elastictest - optional"
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dualtor
STOP_ON_FAILURE: "False"
RETRY_TIMES: 0
MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: $(BUILD_BRANCH)
TEST_SET: onboarding_dualtor

# - job: wan_elastictest
# displayName: "kvmtest-wan by Elastictest"
# timeoutInMinutes: 240
Expand Down
46 changes: 38 additions & 8 deletions tests/arp/test_neighbor_mac.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import contextlib
import logging
import pytest
import time

from tests.common.helpers.assertions import pytest_assert
from tests.common.utilities import wait_until

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -35,15 +37,43 @@ def interfaceConfig(self, duthosts, rand_one_dut_hostname):
None
"""
duthost = duthosts[rand_one_dut_hostname]
logger.info("Configure the DUT interface, start interface, add IP address")
self.__startInterface(duthost)
self.__configureInterfaceIp(duthost, action="add")

yield

logger.info("Restore the DUT interface config, remove IP address")
self.__configureInterfaceIp(duthost, action="remove")
self.__shutdownInterface(duthost)
intfStatus = duthost.show_interface(command="status")["ansible_facts"]["int_status"]
if self.DUT_ETH_IF not in intfStatus:
pytest.skip('{} not found'.format(self.DUT_ETH_IF))

status = intfStatus[self.DUT_ETH_IF]
if "up" not in status["oper_state"]:
pytest.skip('{} is down'.format(self.DUT_ETH_IF))

portchannel = status["vlan"] if "PortChannel" in status["vlan"] else None

@contextlib.contextmanager
def removeFromPortChannel(duthost, portchannel, intf):
try:
if portchannel:
duthost.command("sudo config portchannel member del {} {}".format(portchannel, intf))
pytest_assert(wait_until(
10, 1, 0,
lambda: 'routed' in duthost.show_interface(command="status")
["ansible_facts"]["int_status"][intf]["vlan"]),
'{} is not in routed status'.format(intf)
)
yield
finally:
if portchannel:
duthost.command("sudo config portchannel member add {} {}".format(portchannel, intf))

with removeFromPortChannel(duthost, portchannel, self.DUT_ETH_IF):
logger.info("Configure the DUT interface, start interface, add IP address")
self.__startInterface(duthost)
self.__configureInterfaceIp(duthost, action="add")

yield

logger.info("Restore the DUT interface config, remove IP address")
self.__configureInterfaceIp(duthost, action="remove")
self.__shutdownInterface(duthost)

@pytest.fixture(params=[0, 1])
def macIndex(self, request):
Expand Down
1 change: 1 addition & 0 deletions tests/autorestart/test_container_autorestart.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def config_reload_after_tests(duthosts, selected_rand_one_per_hwsku_hostname, tb
and "enabled" not in feature_list.get(DHCP_SERVER, ""):
dhcp_server_hosts.append(hostname)
duthost.shell("config feature state %s enabled" % DHCP_SERVER)
duthost.shell("sudo config feature autorestart %s enabled" % DHCP_SERVER)
duthost.shell("sudo systemctl restart %s.service" % DHCP_RELAY)
pytest_require(
wait_until(120, 1, 1,
Expand Down
22 changes: 22 additions & 0 deletions tests/common/devices/sonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,28 @@ def add_ip_addr_to_port(self, port, ip, gwaddr):
"""
self.command("config interface ip add {} {} {}".format(port, ip, gwaddr))

def remove_ip_addr_from_vlan(self, vlan, ip):
"""
Remove ip addr from the vlan.
:param vlan: vlan name
:param ip: IP address
Example:
config interface ip remove Vlan1000 192.168.0.0/24
"""
self.command("config interface ip remove {} {}".format(vlan, ip))

def add_ip_addr_to_vlan(self, vlan, ip):
"""
Add ip addr to the vlan.
:param vlan: vlan name
:param ip: IP address
Example:
config interface ip add Vlan1000 192.168.0.0/24
"""
self.command("config interface ip add {} {}".format(vlan, ip))

def remove_vlan(self, vlan_id):
"""
Remove vlan
Expand Down
12 changes: 12 additions & 0 deletions tests/common/fixtures/duthost_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,3 +849,15 @@ def assert_addr_in_output(addr_set: Dict[str, List], hostname: str,
pytest_assert(addr not in cmd_output,
f"{hostname} {cmd_desc} still with addr {addr}")
logger.info(f"{addr} not exists in the output of {cmd_desc} which is expected")


# Currently, conditional mark would only match longest prefix,
# so our mark in tests_mark_conditions_skip_traffic_test.yaml couldn't be matched.
# Use a temporary work around to add skip_traffic_test fixture here,
# once conditional mark support add all matches, will remove this code.
@pytest.fixture(scope="module")
def skip_traffic_test(duthosts, rand_one_dut_hostname):
duthost = duthosts[rand_one_dut_hostname]
if duthost.facts["asic_type"] == "vs":
return True
return False
Loading

0 comments on commit 2e1f68f

Please sign in to comment.