Skip to content

Commit

Permalink
Merge branch 'sonic-net:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Azarack authored Jan 31, 2024
2 parents ed4515a + 8b9965a commit f3cbac8
Show file tree
Hide file tree
Showing 185 changed files with 8,184 additions and 1,388 deletions.
21 changes: 7 additions & 14 deletions .azure-pipelines/baseline_test/baseline.test.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ jobs:
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -17,14 +15,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: t0_2vlans_elastictest
displayName: "kvmtest-t0-2vlans by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -38,14 +35,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: t1_lag_elastictest
displayName: "kvmtest-t1-lag by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -57,14 +53,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: dualtor_elastictest
displayName: "kvmtest-dualtor-t0 by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -77,14 +72,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: multi_asic_elastictest
displayName: "kvmtest-multi-asic-t1-lag by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -98,14 +92,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: sonic_t0_elastictest
displayName: "kvmtest-t0-sonic by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -120,14 +113,13 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: dpu_elastictest
displayName: "kvmtest-dpu by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: ubuntu-20.04
strategy:
parallel: $[ variables['BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM'] ]
steps:
- template: ../run-test-elastictest-template.yml
parameters:
Expand All @@ -139,3 +131,4 @@ jobs:
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)
65 changes: 65 additions & 0 deletions .azure-pipelines/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import sys
import logging
import json

_self_dir = os.path.dirname(os.path.abspath(__file__))
base_path = os.path.realpath(os.path.join(_self_dir, ".."))
if base_path not in sys.path:
sys.path.append(base_path)
ansible_path = os.path.realpath(os.path.join(_self_dir, "../ansible"))
if ansible_path not in sys.path:
sys.path.append(ansible_path)

from tests.common.plugins.pdu_controller.pdu_manager import pdu_manager_factory # noqa E402

logger = logging.getLogger(__name__)


def get_pdu_managers(sonichosts, conn_graph_facts):
"""Get PDU managers for all the devices to be upgraded.
Args:
sonichosts (SonicHosts): Instance of class SonicHosts
conn_graph_facts (dict): Connection graph dict.
Returns:
dict: A dict of PDU managers. Key is device hostname. Value is the PDU manager object for the device.
"""
pdu_managers = {}
device_pdu_links = conn_graph_facts['device_pdu_links']
device_pdu_info = conn_graph_facts['device_pdu_info']
for hostname in sonichosts.hostnames:
pdu_links = device_pdu_links[hostname]
pdu_info = device_pdu_info[hostname]
pdu_vars = {}
for pdu_name in pdu_info.keys():
pdu_vars[pdu_name] = sonichosts.get_host_visible_vars(pdu_name)

pdu_managers[hostname] = pdu_manager_factory(hostname, pdu_links, pdu_info, pdu_vars)
return pdu_managers


def check_reachability(localhost, sonichosts):
hosts_reachability = {}

logger.info("Check ICMP ping")
for hostname, ip in zip(sonichosts.hostnames, sonichosts.ips):
hosts_reachability[hostname] = True
logger.info("Ping {} @{} from localhost".format(hostname, ip))
ping_failed = localhost.command(
"timeout 2 ping {} -c 1".format(ip), module_ignore_errors=True
).get("localhost", {}).get("failed")
if ping_failed:
logger.info("Ping {} @{} from localhost failed.".format(hostname, ip))
hosts_reachability[hostname] = False

logger.info("Check if ansible can SSH to sonichosts")
for hostname, ping_result in sonichosts.ping(module_ignore_errors=True).items():
if ping_result["failed"]:
logger.info("SSH to {} failed.".format(hostname))
hosts_reachability[hostname] = False

logger.info("Hosts reachability: {}".format(json.dumps(hosts_reachability, indent=2)))

return hosts_reachability
Loading

0 comments on commit f3cbac8

Please sign in to comment.