forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpfc_wd.yml
More file actions
186 lines (150 loc) · 6.12 KB
/
Copy pathpfc_wd.yml
File metadata and controls
186 lines (150 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#-----------------------------------------
# Run all the PFC WD tests.
# The test currently supports arista fanout switches,to support othern platforms:
#
# 1. Add platform specific logic to deploy pfc packet generator automatically
# in roles/test/tasks/pfc_wd/functional_test/deploy_pfc_pktgen.yml
# or manual deploy roles/test/files/helpers/pfc_gen.py and ensure the file is available on fanout switch.
#
# 2. Create pfc_storm_[sku].j2 and pfc_storm_stop_[sku].j2 under roles/test/templates/
# to run/stop pfc packet generator which triggers pfc storm start/stop action.
#
# 3. Set pfc_storm_template and pfc_storm_stop_template variables to platform-specific template names.
# in roles/test/tasks/pfc_wd/functional_test/set_pfc_storm_templates.yml
#---------------------------------------------
- set_fact:
run_dir: /home/admin/pfc_wd_tests
out_dir: /home/admin/pfc_wd_tests/results
docker_testdir: /tmp
tests_location: roles/test/tasks/pfc_wd
- name: Create run_dir
file:
path: "{{ run_dir }}"
state: directory
- name: Gathering lab graph facts about the device
conn_graph_facts: host={{ inventory_hostname }}
connection: local
tags: always
- name: Gather minigraph facts about the device
minigraph_facts: host={{inventory_hostname}}
- set_fact:
port_list: "{{minigraph_ports.keys()}}"
ports: "{{minigraph_ports.keys() | join(' ')}}"
- set_fact:
neighbors: "{{device_conn}}"
- set_fact:
ansible_eth0_ipv4_addr: "{{ansible_eth0['ipv4']['address']}}"
ansible_ethernet0_mac_addr: "{{ansible_Ethernet0['macaddress']}}"
ansible_date_time: "{{ansible_date_time}}"
- set_fact:
seed: "{{ansible_date_time['day']}}"
- set_fact:
used: false
first_pair: false
pfc_wd_rx_port: "rx"
pfc_wd_test_port: "test"
- set_fact:
test_ports: {}
- name: Iterate all interfaces to get all interface ports info if exists
include: roles/test/tasks/pfc_wd/iterate_interfaces.yml
with_items: "{{minigraph_interfaces}}"
when: item['addr'] | ipv4
- set_fact:
restart: True
when: minigraph_portchannels| length > 0
- name: Iterate all the portchannels to get all portchanel member ports info if exists.
include: roles/test/tasks/pfc_wd/iterate_portchannels.yml
with_dict: "{{minigraph_portchannels}}"
- name: Generate ips in VLAN range
get_ip_in_range: num=1 prefix="{{minigraph_vlan_interfaces[0]['addr']}}/{{minigraph_vlan_interfaces[0]['prefixlen']}}" exclude_ips="{{minigraph_vlan_interfaces[0]['addr']}}"
become: no
connection: local
failed_when: False
when: minigraph_vlans | length >0
- name: Set unique MACs to PTF interfaces
script: roles/test/files/helpers/change_mac.sh
delegate_to: "{{ptf_host}}"
when: minigraph_vlans | length >0
- set_fact:
vlan_members: "{{minigraph_vlans[minigraph_vlans.keys()[0]]['members']}}"
when: minigraph_vlans | length >0
- name: Iterate all vlan members to get all vlan member ports info if exists.
include: roles/test/tasks/pfc_wd/iterate_vlans.yml
with_items: "{{vlan_members | default([])}}"
when: minigraph_vlans | length >0
- name: Flush vlan ips route
command: ip route flush {{generated_ips[0].split('/')[0]}}/32
become: yes
when: minigraph_vlans | length >0
- name: Add vlan ips route
command: ip route add {{generated_ips[0].split('/')[0]}}/32 dev {{minigraph_vlan_interfaces[0]['attachto']}}
become: yes
when: minigraph_vlans | length >0
- debug: msg="{{test_ports}}"
- set_fact:
select_test_ports: "{{select_test_ports | default({}) | combine({item.key: item.value})}}"
with_dict: "{{test_ports}}"
when: (item.value.test_port_id | int % 15) == (seed | int % 15)
- debug: msg="{{select_test_ports}}"
- name: Run default test if user has not specified warm reboot test
set_fact:
warm_reboot_test: false
when: warm_reboot_test is not defined
#****************************************#
# Start tests #
#****************************************#
- block:
- name: Vlan members initial value
set_fact:
vlan_members: []
when: vlan_members is undefined
- name: Vlan interfaces initial value
set_fact:
minigraph_vlan_interfaces: []
when: minigraph_vlan_interfaces is undefined
- block:
- name: Test PFC WD configuration validation.
vars:
pfc_wd_template: roles/test/templates/pfc_wd_config.j2
include: roles/test/tasks/pfc_wd/config_test/config_test.yml
- name: Test PFC WD Functional tests.
include: roles/test/tasks/pfc_wd/functional_test/functional_test.yml
with_dict: "{{select_test_ports}}"
- name: Test PFC WD Timer accuracy.
include: roles/test/tasks/pfc_wd/functional_test/check_timer_accuracy_test.yml
- name: Test PFC WD extreme case when all ports have storm
include: roles/test/tasks/pfc_wd/functional_test/storm_all_test.yml
- name: Set vlan members
set_fact:
vlan_members: "{{ minigraph_vlans[minigraph_vlan_interfaces[0]['attachto']]['members']}}"
when:
- pfc_asym is defined
- name: Enable asymmetric PFC on all server interfaces
command: config interface pfc asymmetric on {{ item }}
become: yes
with_items: "{{ vlan_members }}"
when:
- pfc_asym is defined
- testbed_type in ['t0']
- name: Test PFC WD Functional tests.
include: roles/test/tasks/pfc_wd/functional_test/functional_test.yml
with_dict: "{{select_test_ports}}"
when:
- pfc_asym is defined
- testbed_type in ['t0']
when: warm_reboot_test | bool == false
- block:
- name: Test PFC WD function against warm reboot
include: roles/test/tasks/pfc_wd/functional_test/functional_test_warm_reboot.yml
when: warm_reboot_test | bool == true
always:
- name: General cleanup.
file:
path: "{{ run_dir }}"
state: absent
- name: Disable asymmetric PFC on all server interfaces
command: config interface pfc asymmetric on {{ item.dut_name }}
become: yes
with_items: "{{ vlan_members }}"
when:
- pfc_asym is defined