sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
195 stars 714 forks source link

Failed to run pytest when neighbor device is SONiC #4454

Open xjasonlyu opened 2 years ago

xjasonlyu commented 2 years ago

Description

Failed to complete a pytest when using SONiC image as the neighbor devices.

Steps to reproduce the issue:

  1. Setup testbed step by step based on KVM Testbed Setup
  2. Choose SONiC image as the neighbor devices
  3. Run a pytest, e.g. ./run_tests.sh -n vms-kvm-t0 -d vlab-01 -c bgp/test_bgp_fact.py -f vtestbed.csv -i veos_vtb -e "--neighbor_type=sonic"

Describe the results you received:

Error message says the VM0100 doesn't have a valid interface Ethernet1 (because Ethernet1 doesn't exists in SONiC VM).

E           RunAnsibleModuleFail: run module command failed, Ansible Results =>
E           {
E               "changed": true, 
E               "cmd": [
E                   "sudo", 
E                   "config", 
E                   "interface", 
E                   "startup", 
E                   "Ethernet1"
E               ], 
E               "delta": "0:00:00.452509", 
E               "end": "2021-10-08 02:53:28.062707", 
E               "failed": true, 
E               "invocation": {
E                   "module_args": {
E                       "_raw_params": "sudo config interface startup Ethernet1", 
E                       "_uses_shell": false, 
E                       "argv": null, 
E                       "chdir": null, 
E                       "creates": null, 
E                       "executable": null, 
E                       "removes": null, 
E                       "stdin": null, 
E                       "stdin_add_newline": true, 
E                       "strip_empty_ends": true, 
E                       "warn": true
E                   }
E               }, 
E               "msg": "non-zero return code", 
E               "rc": 2, 
E               "start": "2021-10-08 02:53:27.610198", 
E               "stderr": "Usage: config interface startup [OPTIONS] <interface_name>\nTry \"config interface startup -h\" for help.\n\nError: Interface name is invalid. Please enter a valid interface name!!", 
E               "stderr_lines": [
E                   "Usage: config interface startup [OPTIONS] <interface_name>", 
E                   "Try \"config interface startup -h\" for help.", 
E                   "", 
E                   "Error: Interface name is invalid. Please enter a valid interface name!!"
E               ], 
E               "stdout": "", 
E               "stdout_lines": [], 
E               "warnings": [
E                   "Consider using 'become', 'become_method', and 'become_user' rather than running sudo"
E               ]
E           }

complex_args = {}
filename   = '/data/sonic-mgmt/tests/common/devices/sonic.py'
function_name = 'no_shutdown'
index      = 0
line_number = 818
lines      = ['        return self.command("sudo config interface startup {}".format(ifname))\n']
module_args = ('sudo config interface startup Ethernet1',)
module_async = False
module_ignore_errors = False
previous_frame = <frame object at 0x55ffb6b55720>
res        = {'stderr_lines': [u"Usage: config interface startup [OPTIONS] <interface_name>... using 'become', 'become_method', and 'become_user' rather than running sudo"]}
self       = <SonicHost> VM0100
verbose    = True

common/devices/base.py:89: RunAnsibleModuleFail</error></testcase></testsuite>

Describe the results you expected:

Pass the pytest successfully.

Additional information you deem important:

Output of show version:

SONiC Software Version: SONiC.master.42007-34267393b
Distribution: Debian 10.10
Kernel: 4.19.0-12-2-amd64
Build commit: 34267393b
Build date: Thu Oct  7 14:44:41 UTC 2021
Built by: AzDevOps@sonic-build-workers-000RTT

Platform: x86_64-kvm_x86_64-r0
HwSKU: Force10-S6000
ASIC: vs
ASIC Count: 1
Serial Number: N/A
Model Number: N/A
Hardware Revision: N/A
Uptime: 05:40:58 up 2 days,  1:50,  1 user,  load average: 1.10, 1.07, 1.08

Docker images:
REPOSITORY                    TAG                      IMAGE ID            SIZE
docker-dhcp-relay             latest                   3a0e8e1ad74d        427MB
docker-gbsyncd-vs             latest                   f61446a7956e        421MB
docker-gbsyncd-vs             master.42007-34267393b   f61446a7956e        421MB
docker-syncd-vs               latest                   d13ae0653b44        421MB
docker-syncd-vs               master.42007-34267393b   d13ae0653b44        421MB
docker-teamd                  latest                   7b99244e6921        426MB
docker-teamd                  master.42007-34267393b   7b99244e6921        426MB
docker-platform-monitor       latest                   aec8b8bc013e        631MB
docker-platform-monitor       master.42007-34267393b   aec8b8bc013e        631MB
docker-nat                    latest                   0212ed0ab6e6        429MB
docker-nat                    master.42007-34267393b   0212ed0ab6e6        429MB
docker-sonic-mgmt-framework   latest                   fddb931a7885        569MB
docker-sonic-mgmt-framework   master.42007-34267393b   fddb931a7885        569MB
docker-router-advertiser      latest                   740b761513ca        414MB
docker-router-advertiser      master.42007-34267393b   740b761513ca        414MB
docker-lldp                   latest                   4c733601ad36        454MB
docker-lldp                   master.42007-34267393b   4c733601ad36        454MB
docker-orchagent              latest                   b33ac0315d8c        444MB
docker-orchagent              master.42007-34267393b   b33ac0315d8c        444MB
docker-macsec                 latest                   097fca4f4cf6        429MB
docker-macsec                 master.42007-34267393b   097fca4f4cf6        429MB
docker-snmp                   latest                   6ca8ec872696        456MB
docker-snmp                   master.42007-34267393b   6ca8ec872696        456MB
docker-fpm-frr                latest                   9d8455b6f67a        444MB
docker-fpm-frr                master.42007-34267393b   9d8455b6f67a        444MB
docker-sonic-telemetry        latest                   1387526779aa        502MB
docker-sonic-telemetry        master.42007-34267393b   1387526779aa        502MB
docker-sflow                  latest                   c7dcc326269e        427MB
docker-sflow                  master.42007-34267393b   c7dcc326269e        427MB
docker-database               latest                   c1bc49f7bba1        414MB
docker-database               master.42007-34267393b   c1bc49f7bba1        414MB
yxieca commented 2 years ago

@xjasonlyu can you confirm that you are deploying (add-topo) with -k vsonic specified? Could it be that you deployed a testbed with ceos but trying to run test with setting neighbor type to sonic? @Pterosaur can help you further.

Pterosaur commented 2 years ago

Hi @xjasonlyu , it's a known issue that is being fixed by PR https://github.com/Azure/sonic-buildimage/pull/8971 and https://github.com/Azure/sonic-mgmt/pull/4341. Please check the sonic image of neighbor devices includes the PR https://github.com/Azure/sonic-buildimage/pull/8971 and manually merge the PR https://github.com/Azure/sonic-mgmt/pull/4341 to sonic-mgmt repo.