Skip to content

Commit

Permalink
Merge branch 'master' into macsec_verify_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Pterosaur committed May 16, 2022
2 parents f82a69f + 57e5b17 commit 7351e3f
Show file tree
Hide file tree
Showing 18 changed files with 480 additions and 81 deletions.
2 changes: 2 additions & 0 deletions ansible/TestbedProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ def makeLabYAML(data, devices, testbed, outfile):
if dut in devices:
dutDict.update({dut:
{'ansible_host': devices[dut].get("ansible").get("ansible_host"),
'ansible_hostv6': devices[dut].get("ansible").get("ansible_hostv6"),
'ansible_ssh_user': devices[dut].get("ansible").get("ansible_ssh_user"),
'ansible_ssh_pass': devices[dut].get("ansible").get("ansible_ssh_pass"),
'hwsku': devices[dut].get("hwsku"),
Expand Down Expand Up @@ -687,6 +688,7 @@ def makeLabYAML(data, devices, testbed, outfile):
if ptfhost in testbed:
ptfDict.update({ptfhost:
{'ansible_host': testbed[ptfhost].get("ansible").get("ansible_host"),
'ansible_hostv6': testbed[ptfhost].get("ansible").get("ansible_hostv6"),
'ansible_ssh_user': testbed[ptfhost].get("ansible").get("ansible_ssh_user"),
'ansible_ssh_pass': testbed[ptfhost].get("ansible").get("ansible_ssh_pass")
}
Expand Down
5 changes: 5 additions & 0 deletions ansible/group_vars/all/nic_simulator_grpc_port_map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# mapping from testbed name to nic simulator gRPC binding port

nic_simulator_grpc_port:
vms-kvm-dual-mixed: 8900
9 changes: 8 additions & 1 deletion ansible/plugins/filter/filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ipaddress
import math
import os.path

from ansible import errors

Expand All @@ -13,7 +14,8 @@ def filters(self):
'extract_hostname': extract_hostname,
'first_n_elements': first_n_elements,
'expand_properties': expand_properties,
'first_ip_of_subnet': first_ip_of_subnet
'first_ip_of_subnet': first_ip_of_subnet,
'path_join': path_join
}


Expand Down Expand Up @@ -202,3 +204,8 @@ def first_ip_of_subnet(value):
return str(subnet[1])
else:
return ''


def path_join(paths):
"""Join path strings."""
return os.path.join(*paths)
9 changes: 8 additions & 1 deletion ansible/roles/test/files/ptftests/py3/fib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ def setUp(self):

self.pkt_action = self.test_params.get('pkt_action', self.ACTION_FWD)
self.ttl = self.test_params.get('ttl', 64)
self.ip_options = self.test_params.get('ip_options', False)

self.ip_options = False
ip_options_list = self.test_params.get('ip_options', False)
if isinstance(ip_options_list, list) and ip_options_list:
self.ip_options = scapy.IPOption(ip_options_list[0])
for opt in ip_options_list[1:]:
self.ip_options /= scapy.IPOption(opt)

self.src_vid = self.test_params.get('src_vid', None)
self.dst_vid = self.test_params.get('dst_vid', None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ r, ".* INFO systemd.*Finished Kernel crash dump capture service.*"

# https://dev.azure.com/msazure/One/_workitems/edit/14233575
r, ".* INFO systemd.*Starting Kernel crash dump capture service.*"

# https://dev.azure.com/msazure/One/_workitems/edit/14233609
r, ".*ERR syncd[0-9]*#syncd.*updateSupportedBufferPoolCounters.*BUFFER_POOL_WATERMARK_STAT_COUNTER.*counter SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_BYTES is not supported on buffer pool.*SAI_STATUS_INVALID_PARAMETER.*"
6 changes: 6 additions & 0 deletions ansible/roles/vm_set/tasks/add_topo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@
mux_simulator_action: start
when: "'dualtor' in topo"

- name: Start nic simulator
include_tasks: control_nic_simulator.yml
vars:
nic_simulator_action: start
when: topology.host_interfaces_active_active is defined and topology.host_interfaces_active_active|length > 0

when: container_type == "PTF"

- name: Save PTF image
Expand Down
86 changes: 86 additions & 0 deletions ansible/roles/vm_set/tasks/control_nic_simulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
- name: Start nic simulator
block:

- name: Get absolute path of {{ root_path }}
command: "realpath {{ root_path }}"
register: real_root_path

- name: Set variable abs_root_path
set_fact:
abs_root_path: "{{ real_root_path.stdout }}"

- name: Set nic simulator binding port
set_fact:
nic_simulator_port: "{{ nic_simulator_grpc_port[testbed_name] }}"

- name: Set network namespace path
set_fact:
netns_name: "{{ 'ns-' + vm_set_name }}"

- name: Find ip command absolute path
shell: which ip
register: which_ip_output

- name: Set ip command absolute path
set_fact:
ip_command_path: "{{ which_ip_output.stdout }}"

- name: Install pip3
apt:
name: python3-pip
state: present
become: yes
when: host_distribution_version.stdout == "18.04"

- name: Set Python version
set_fact:
python_command: "python3"
pip_command: "pip3"

- name: Install gRPC library
pip:
name:
- grpcio
- grpcio-tools
executable: "{{ pip_command }}"
become: yes
environment: "{{ proxy_env | default({}) }}"

- name: Set nic simulator source directory
set_fact:
nic_simulator_dir: "{{ (playbook_dir, 'dualtor', 'nic_simulator') | path_join }}"

- name: Copy nic simulator to test server
copy:
src: "{{ nic_simulator_dir }}"
dest: "{{ abs_root_path }}"
force: yes

- name: Generate nic simulator systemd service file
template:
src: nic-simulator.service.j2
dest: /etc/systemd/system/nic-simulator-{{ vm_set_name }}.service
become: yes

- name: Start the nic-simulator service for testbed {{ testbed_name }}
systemd:
name: nic-simulator-{{ vm_set_name }}
state: started
daemon_reload: yes
become: yes

when: nic_simulator_action == "start"

- name: Stop nic simulator
block:

- name: Stop the nic-simulator service for testbed {{ testbed_name }}
systemd:
name: nic-simulator-{{ vm_set_name }}
state: stopped
become: yes
ignore_errors: yes


when: nic_simulator_action == "stop"
6 changes: 6 additions & 0 deletions ansible/roles/vm_set/tasks/remove_topo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
mux_simulator_action: stop
when: "'dualtor' in topo"

- name: Stop nic simulator
include_tasks: control_nic_simulator.yml
vars:
nic_simulator_action: stop
when: topology.host_interfaces_active_active is defined and topology.host_interfaces_active_active|length > 0

- name: Stop PTF portchannel service
include_tasks: ptf_portchannel.yml
vars:
Expand Down
12 changes: 12 additions & 0 deletions ansible/roles/vm_set/tasks/renumber_topo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
mux_simulator_action: stop
when: "'dualtor' in topo"

- name: Stop nic simulator
include_tasks: control_nic_simulator.yml
vars:
nic_simulator_action: stop
when: topology.host_interfaces_active_active is defined and topology.host_interfaces_active_active|length > 0

- name: Stop PTF portchannel service
include_tasks: ptf_portchannel.yml
vars:
Expand Down Expand Up @@ -158,4 +164,10 @@
mux_simulator_action: start
when: "'dualtor' in topo"

- name: Start nic simulator
include_tasks: control_nic_simulator.yml
vars:
nic_simulator_action: start
when: topology.host_interfaces_active_active is defined and topology.host_interfaces_active_active|length > 0

when: container_type == "PTF"
6 changes: 6 additions & 0 deletions ansible/roles/vm_set/templates/nic-simulator.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=nic simulator
After=network.target

[Service]
ExecStart={{ ip_command_path }} netns exec {{ netns_name }} /usr/bin/env {{ python_command }} {{ abs_root_path }}/nic_simulator/nic_simulator.py -p {{ nic_simulator_port }} -v {{ vm_set_name }} -l debug
73 changes: 73 additions & 0 deletions docs/testplan/Chassis-fabric-test-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# **VOQ Chassis Fabric Test Plan**

- [Introduction](#introduction)
- [Scope](#scope)
- [Assumptions](#assumptions)
- [Test Setup](#test-setup)
- [Test Cases](#test-cases)

# Introduction

This is the test plan for Fabric link testing on SONIC Distributed VOQ System, as described in the [VOQ Fabric HLD](https://github.com/Azure/SONiC/blob/master/doc/voq/fabric.md)

## Scope

The scope of this test plan is as follows:
* Check if all the expected fabric links are up.
* Check if the fabric counters work correctly when there is data traffic.
* Check if the fabric devices can reach all of the forwarding ASICs of the chassis (reachability)

## Assumptions

The current SW design for fabric does not cover events like card insertion/removal or reboots. This test plan depends on fabric counter cli support (work in progress).

# Test Setup

These test cases will be run in the proposed [T2 topology](https://github.com/Azure/sonic-mgmt/blob/master/ansible/vars/topo_t2.yml). It is assumed that such a configuration is deployed on the chassis.

tbinfo will be populated with the number of fabric links per forwarding ASIC that are expected to be up.

# Test Cases

## Test Case 1. Test Fabric connectivity

### Test Objective
Verify that when the chassis is up and running, the fabric links that are expected to be up are up.

### Test Steps
* For each ASIC in the chassis (across different duts), run `show fabric counters port -n <asic_name>`

### Pass/Fail Criteria
* Verify for each ASIC, the number of links that are up matches the number of links per ASIC defined in the inventory. This is expected to be stored in the host_var attribute.

## Test Case 2. Test fabric reachability

### Test Objective
Verify that from each fabric ASIC, all forwarding ASICs are reachable.

### Test Steps
* Run `show fabric reachability -n asicN` for each fabric ASIC

### Pass/Fail Criteria
* Verify for each fabric ASIC, all the forwarding ASICs in the chassis are reachable and the switch ID matches the expected switch ID.

## Test Case 3. Test fabric counters under traffic

### Test Objective
Verify that under data traffic, all fabric links from an ASIC are utilized. The assumption is that the chassis architecture supports distributing data traffic across all fabric links.

Note that there may be some internal communication such as intra-chassis BGP, which means that the validation cannot strictly confirm exact match between ingress and egress traffic counts.
Instead, we will validate that the RX counts on the ASIC receiving traffic from the fabric are greater than or equal to the TX counts on the ASIC sending into the fabric.

### Test Steps
* Send a fixed number of packets traversing two ASICs
* Run `show fabric counters port -n asicN` for the ingress and egress ASIC.

Repeat the above test for the following packet sizes (bytes): 64, 256, 1512, 9000

### Pass/Fail Criteria
* Verify on the ingress ASIC that all fabric links have non-zero value for TX fabric data unit counter.
* Verify on the egress ASIC that all fabric links have non-zero value for RX fabric data unit counters.
* Verify that the RX fabric data unit counters are not less than the TX counters.
* Verify that there are no increments in error counters.

12 changes: 10 additions & 2 deletions tests/common/plugins/conditional_mark/tests_mark_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,24 @@ copp/test_copp.py::TestCOPP::test_trap_config_save_after_reboot:
#######################################
decap/test_decap.py::test_decap[ttl=pipe, dscp=pipe]:
skip:
reason: "Not supported on broadcom after 201911 release and mellanox all releases"
reason: "Not supported on broadcom after 201911 release, mellanox all releases and cisco-8000 all releases"
conditions:
- "(asic_type in ['broadcom'] and release not in ['201811', '201911']) or (asic_type in ['mellanox'])"
- "(asic_type in ['broadcom'] and release not in ['201811', '201911']) or (asic_type in ['mellanox']) or (asic_type in ['cisco-8000'])"

decap/test_decap.py::test_decap[ttl=pipe, dscp=uniform]:
skip:
reason: "Not supported on backend and broadcom before 202012 release"
conditions:
- "(topo_name in ['t1-backend', 't0-backend']) or (asic_type in ['broadcom'] and release in ['201811', '201911'])"

decap/test_decap.py::test_decap[ttl=uniform, dscp=pipe]:
skip:
reason: "Not supported uniform ttl mode"

decap/test_decap.py::test_decap[ttl=uniform, dscp=uniform]:
skip:
reason: "Not supported uniform ttl mode"

#######################################
##### dhcpv6_relay #####
#######################################
Expand Down
Loading

0 comments on commit 7351e3f

Please sign in to comment.