From dc42242b86a156edee71c813981d4edb672b51d6 Mon Sep 17 00:00:00 2001 From: Tamer Ahmed Date: Fri, 14 Feb 2020 14:47:50 -0800 Subject: [PATCH] [vs tests] Enable multi-vlan for pytests (#71) enable multi-vlan for pytests signed-off-by: Tamer Ahmed --- scripts/vs/buildimage-vs-image/runtest.sh | 56 +++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/scripts/vs/buildimage-vs-image/runtest.sh b/scripts/vs/buildimage-vs-image/runtest.sh index cca500bb2616..c04f00df6c01 100755 --- a/scripts/vs/buildimage-vs-image/runtest.sh +++ b/scripts/vs/buildimage-vs-image/runtest.sh @@ -4,24 +4,52 @@ cd $HOME mkdir -p .ssh cp /data/pkey.txt .ssh/id_rsa chmod 600 .ssh/id_rsa + +# Refresh virtual switch with vms-kvm-t0 topology cd /data/sonic-mgmt/ansible ./testbed-cli.sh -m veos.vtb -t vtestbed.csv refresh-dut vms-kvm-t0 lab password.txt || true sleep 120 + +# Create and deploy default vlan configuration (one_vlan_a) to the virtual switch ./testbed-cli.sh -m veos.vtb -t vtestbed.csv deploy-mg vms-kvm-t0 lab password.txt sleep 180 -export ANSIBLE_LIBRARY=/data/sonic-mgmt/ansible/library/ -cd /data/sonic-mgmt/tests +cd /data/sonic-mgmt/tests # Run anounce route test case in order to populate BGP route -py.test --inventory veos.vtb --host-pattern all --user admin -vvv --show-capture stdout --testbed vms-kvm-t0 --testbed_file vtestbed.csv --disable_loganalyzer --junitxml=tr.xml test_announce_routes.py - -tests="test_interfaces.py \ - test_bgp_fact.py \ - test_lldp.py \ - snmp/test_snmp_cpu.py \ - snmp/test_snmp_interfaces.py \ - snmp/test_snmp_lldp.py \ - snmp/test_snmp_pfc_counters.py \ - snmp/test_snmp_queue.py" - -py.test --inventory veos.vtb --host-pattern all --user admin -vvv --show-capture stdout --testbed vms-kvm-t0 --testbed_file vtestbed.csv --disable_loganalyzer --junitxml=tr.xml $tests +ANSIBLE_LIBRARY=/data/sonic-mgmt/ansible/library/ \ + py.test --inventory veos.vtb --host-pattern all --user admin -vvv --show-capture stdout --testbed vms-kvm-t0 \ + --testbed_file vtestbed.csv --disable_loganalyzer --junitxml=tr.xml test_announce_routes.py + +# Tests to run using one vlan configuration +tests_1vlan="\ + test_interfaces.py \ + test_bgp_fact.py \ + test_lldp.py \ + test_dhcp_relay.py \ + snmp/test_snmp_cpu.py \ + snmp/test_snmp_interfaces.py \ + snmp/test_snmp_lldp.py \ + snmp/test_snmp_pfc_counters.py \ + snmp/test_snmp_queue.py \ +" + +# Run tests_1vlan on vlab-01 virtual switch +ANSIBLE_LIBRARY=/data/sonic-mgmt/ansible/library/ \ + py.test --inventory veos.vtb --host-pattern all --user admin -vvv --show-capture stdout --testbed vms-kvm-t0 \ + --testbed_file vtestbed.csv --disable_loganalyzer --junitxml=tr.xml $tests_1vlan + +# Create and deploy two vlan configuration (two_vlan_a) to the virtual switch +cd /data/sonic-mgmt/ansible +./testbed-cli.sh -m veos.vtb -t vtestbed.csv deploy-mg vms-kvm-t0 lab password.txt -e vlan_config=two_vlan_a +sleep 180 + +# Tests to run using two vlan configuration +tests_2vlans="\ + test_dhcp_relay.py \ +" + +cd /data/sonic-mgmt/tests +# Run tests_2vlans on vlab-01 virtual switch +ANSIBLE_LIBRARY=/data/sonic-mgmt/ansible/library/ \ + py.test --inventory veos.vtb --host-pattern all --user admin -vvv --show-capture stdout --testbed vms-kvm-t0 \ + --testbed_file vtestbed.csv --disable_loganalyzer --junitxml=tr.xml $tests_2vlans