Skip to content

Commit 873d46d

Browse files
authored
Merge branch 'opencomputeproject:master' into master
2 parents 92cb623 + 09a5a86 commit 873d46d

35 files changed

+6273
-2822
lines changed

.github/codeql/codeql-config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: "CodeQL config"
2+
queries:
3+
- uses: security-and-quality
4+
- uses: security-extended

.github/workflows/codeql-analysis.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# For more infomation, please visit: https://github.com/github/codeql-action
2+
3+
name: "CodeQL"
4+
5+
on:
6+
push:
7+
branches:
8+
- 'master'
9+
- 'v[0-9].*'
10+
pull_request_target:
11+
branches:
12+
- 'master'
13+
- 'v[0-9].*'
14+
workflow_dispatch:
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-20.04
20+
permissions:
21+
actions: read
22+
contents: read
23+
security-events: write
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
language: [ 'python' ]
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
# Initializes the CodeQL tools for scanning.
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v2.1.29
37+
with:
38+
config-file: ./.github/codeql/codeql-config.yml
39+
languages: ${{ matrix.language }}
40+
41+
- name: Perform CodeQL Analysis
42+
uses: github/codeql-action/analyze@v2.1.29
43+
with:
44+
category: "/language:${{matrix.language}}"

doc/sai-ptf/fdb_test_plan.md

+318
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
# SAI FDB Test plan <!-- omit in toc -->
2+
3+
- [Test Configuration](#test-configuration)
4+
- [Test Execution](#test-execution)
5+
- [Test Execution](#test-execution-1)
6+
- [Common Test Data/Packet](#common-test-datapacket)
7+
- [Test Group1: MAC learning](#test-group1-mac-learning)
8+
- [Case1: test_vlan_port_learn_disable](#case1-test_vlan_port_learn_disable)
9+
- [Case2: test_bg_port_learn_disable](#case2-test_bg_port_learn_disable)
10+
- [Case3: test_non_bgPort_no_learn](#case3-test_non_bgport_no_learn)
11+
- [Case4: test_new_vlan_member_learn](#case4-test_new_vlan_member_learn)
12+
- [Case5: test_remove_vlan_member_no_learn](#case5-test_remove_vlan_member_no_learn)
13+
- [Case6: test_no_learn_invalidate_vlan](#case6-test_no_learn_invalidate_vlan)
14+
- [Case7: test_no_learn_broadcast_src](#case7-test_no_learn_broadcast_src)
15+
- [Case8: test_no_learn_multicast_src](#case8-test_no_learn_multicast_src)
16+
- [Test Group2: FDB age](#test-group2-fdb-age)
17+
- [Case1: test_port_age](#case1-test_port_age)
18+
- [Case2: test_aging_after_move](#case2-test_aging_after_move)
19+
- [Case3: test_mac_moving_after_aging](#case3-test_mac_moving_after_aging)
20+
- [Test Group3: FDB flush](#test-group3-fdb-flush)
21+
- [Case1: test_flush_vlan_static](#case1-test_flush_vlan_static)
22+
- [Case2: test_flush_vlan_dynamic](#case2-test_flush_vlan_dynamic)
23+
- [Case3: test_flush_port_static](#case3-test_flush_port_static)
24+
- [Case4: test_flush_port_dynamic](#case4-test_flush_port_dynamic)
25+
- [Case5: test_flush_all_static](#case5-test_flush_all_static)
26+
- [Case6: test_flush_all_dynamic](#case6-test_flush_all_dynamic)
27+
- [Case7: test_flush_all](#case7-test_flush_all)
28+
- [Test Group4: MAC move](#test-group4-mac-move)
29+
- [Case1: test_disable_move_drop](#case1-test_disable_move_drop)
30+
- [Case2: test_dynamic_mac_move](#case2-test_dynamic_mac_move)
31+
- [Case3: test_static_mac_move](#case3-test_static_mac_move)
32+
33+
# Test Configuration
34+
35+
For the test configuration, please refer to the file
36+
- [Config_t0](./config_data/config_t0.md)
37+
38+
**Note. All the tests will be based on the configuration above, if any additional configuration is required, it will be specified in the Test case.**
39+
40+
# Test Execution
41+
42+
# Test Execution
43+
44+
## Common Test Data/Packet
45+
In this FDB test, the example packet structure is below.
46+
- Simple L2 packet
47+
```python
48+
simple_udp_packet(eth_dst=dmac,
49+
eth_src=smac)
50+
```
51+
- VLAN
52+
```Python
53+
simple_udp_packet(eth_dst=dmsc,
54+
eth_src=smac,
55+
vlan_vid=lvlan_id)
56+
```
57+
58+
**Note. If need other kinds of packets, they will be added to the test case/group respectively.**
59+
60+
## Test Group1: MAC learning
61+
### Case1: test_vlan_port_learn_disable
62+
### Case2: test_bg_port_learn_disable
63+
### Case3: test_non_bgPort_no_learn
64+
### Case4: test_new_vlan_member_learn
65+
### Case5: test_remove_vlan_member_no_learn
66+
### Case6: test_no_learn_invalidate_vlan
67+
### Case7: test_no_learn_broadcast_src
68+
### Case8: test_no_learn_multicast_src
69+
70+
### Testing Objective <!-- omit in toc -->
71+
- test_vlan_port_learn_disable: Verify if MAC addresses are not learned on the port when VLAN port is disabled.
72+
- test_bg_port_learn_disable: Verify if MAC addresses are not learned on the port whenbridge port learning is disabled.
73+
- test_non_bgPort_no_learn: Verify if MAC addresses are not learned on the port when the port is not a bridge port.
74+
- test_new_vlan_member_learn: Verify newly added VLAN members can learn.
75+
- test_remove_vlan_member_no_learn: Verify no MAC addresses are learned on the removed vlan member.
76+
- test_no_learn_invalidate_vlan: Verify no MAC addresses are learned on invalidate vlan ID.
77+
- test_no_learn_broadcast_src: Verify broadcast mac address is not learned.
78+
- test_no_learn_multicast_src: Verify multicast mac address is not learned.
79+
80+
### Test steps: <!-- omit in toc -->
81+
82+
- test_vlan_port_learn_disable
83+
84+
1. Flush all MAC
85+
2. Disable MAC learn on VLAN10
86+
3. Create a packet with SMAC ``MacX``
87+
4. send packet from port1
88+
5. Verify the packet flood to other VLAN10 ports
89+
6. Create a packet with DMAC ``MacX``
90+
7. send the packet on port2
91+
8. Verify the packet flood to other VLAN10 ports, including port1
92+
9. check FDB entries, no new entry
93+
94+
- test_bg_port_learn_disable
95+
96+
1. Flush all MAC
97+
2. Disable MAC learn on Port1(Bridge Port1)
98+
3. Create a packet with SMAC ``MacX``
99+
4. send packet from port1
100+
5. Verify the packet flood to other VLAN10 ports
101+
6. Create a packet with DMAC ``MacX``
102+
7. send the packet on port2
103+
8. Verify the packet flood to other VLAN10 ports, including port1
104+
9. check FDB entries, no new entry
105+
106+
- test_non_bgPort_no_learn
107+
108+
1. Flush all MAC
109+
2. Removed Port1 from Bridge Port1 for each case
110+
3. Create a packet with SMAC ``MacX``
111+
4. send packet from port1
112+
5. Verify the packet flood to other VLAN10 ports
113+
6. Create a packet with DMAC ``MacX``
114+
7. send the packet on port2
115+
8. Verify the packet flood to other VLAN10 ports, including port1
116+
9. check FDB entries, no new entry
117+
118+
- test_new_vlan_member_learn
119+
120+
1. Add Port24 to VLAN10
121+
2. Create Packet with SMAC=``MacX`` DMAC=``Port1 MAC``
122+
3. Send packet on port24
123+
4. verify only receive a packet on port1
124+
5. Create a packet with DMAC=``MacX``
125+
6. Send packet on port1
126+
7. Verify only receive a packet on port24
127+
8. check FDB entries, new entry ``MacX`` on Port24 learned
128+
129+
- test_remove_vlan_member_learn
130+
131+
1. Remove Port2 from VLAN10
132+
2. Create a Packet with SMAC=``MacX`` and VLAN10 tag
133+
3. Send packet on port2
134+
4. Verify no packet was received on any port
135+
5. Create a packet with DMAC=``MacX`` and VLAN10 tag
136+
6. Send packet on port1
137+
7. Verify flooding to VLAN10 ports, no packet on port2
138+
8. check FDB entries, no new entry
139+
140+
- test_no_learn_invalidate_vlan
141+
- test_no_learn_broadcast_src
142+
- test_no_learn_multicast_src
143+
144+
1. Create a packet with vlan_id=``VLAN11`` SMAC=``MacX``/SMAC=``broadcast address``/SMAC=``multicast address``
145+
2. Send packet on port2
146+
3. Verify no packet was received on any port
147+
4. Create a packet with vlan_id=``VLAN11`` DMAC=``MacX``/DMAC=``broadcast address``/DMAC=``multicast address``
148+
5. Send packet on port1
149+
6. Dropped for ``VLAN11``, For broadcast and multicast address, flooding on all vlan10 ports, except port1
150+
7. check FDB entries, no new entry
151+
152+
153+
## Test Group2: FDB age
154+
### Case1: test_port_age
155+
### Case2: test_aging_after_move
156+
### Case3: test_mac_moving_after_aging
157+
### Testing Objective <!-- omit in toc -->
158+
- test_port_age: Verifying if the dynamic FDB entry associated with the port is removed after the aging interval.
159+
- test_aging_after_move: Verifying the aging time refreshed if dynamic FDB entry associated with one port and then moved to another port (not the initial learning time)
160+
- test_mac_moving_after_aging: Verifying the mac can be learnt again after the mac aging reached.
161+
162+
163+
### Test steps: <!-- omit in toc -->
164+
- test_port_age
165+
166+
1. Set FDB aging time=10
167+
2. Create Packet with SMAC=``MacX`` DMAC=``Port1 MAC``
168+
3. Send packet on port2
169+
4. verify only receive a packet on port1
170+
5. Create a packet with DMAC=``MacX``
171+
6. Send packet on port1
172+
7. Verify only receive a packet on port2
173+
8. Wait for the ``aging`` time
174+
9. Send packet on port1
175+
10. Verify flooding packet to VLAN10 ports, except port1
176+
177+
- test_aging_after_move
178+
179+
1. Set FDB aging time=10
180+
2. Create Packet with SMAC=``MacX`` DMAC=``Port1 MAC``
181+
3. Send packet on port2
182+
4. verify only receive a packet on port1
183+
5. Create a packet with DMAC=``MacX``
184+
6. Send packet on port1
185+
7. Verify only receive a packet on port2
186+
8. Send packet on port3
187+
7. Verify only receive a packet on port2
188+
9. Wait for the ``aging`` time
189+
10. Send packet on port3
190+
11. Verify flooding packet to VLAN10 ports, except port3
191+
192+
- test_mac_moving_after_aging
193+
194+
1. Set FDB aging time=10
195+
2. Create Packet with SMAC=``MacX`` DMAC=``Port1 MAC``
196+
3. Send packet on port2
197+
4. verify only receive a packet on port1
198+
5. Create a packet with DMAC=``MacX``
199+
6. Send packet on port1
200+
7. Verify only receive a packet on port2
201+
8. Wait for the ``aging`` time
202+
9. Create Packet with SMAC=``MacX`` DMAC=``Port1 MAC``
203+
10. Send packet on port3(mac moved from Port2 to Port3)
204+
11. verify only receive a packet on port1
205+
12. Create and send a packet with DMAC=``MacX``
206+
13. Verify only receive a packet on port3
207+
208+
## Test Group3: FDB flush
209+
### Case1: test_flush_vlan_static
210+
### Case2: test_flush_vlan_dynamic
211+
### Case3: test_flush_port_static
212+
### Case4: test_flush_port_dynamic
213+
### Case5: test_flush_all_static
214+
### Case6: test_flush_all_dynamic
215+
### Case7: test_flush_all
216+
217+
### Testing Objective <!-- omit in toc -->
218+
Verify flushing of static/dynamic entries on VLAN/Port/All.
219+
### Test steps: <!-- omit in toc -->
220+
- test_flush_vlan_static
221+
222+
1. Flush with condition for each case: ``Static`` flush on ``VLAN10``
223+
2. Send packets: ``port1`` DMAC=``Port2 MAC``
224+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
225+
4. Send packets: ``Port9`` DMAC=``Port10 MAC``
226+
5. Verify unicast to the corresponding port
227+
228+
- test_flush_port_static
229+
230+
1. Flush with condition: ``Static`` flush on ``Port1``
231+
2. Send packets: ``Port2`` DMAC=``Port1 MAC``
232+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
233+
4. Send packets: ``Port10`` DMAC=``Port9 MAC``
234+
5. Verify unicast to the corresponding port
235+
236+
- test_flush_all_static
237+
238+
1. Flush with condition: flush for all ``Static``
239+
2. Send packets for each case in sequence:``port1`` DMAC=``Port2 MAC``
240+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
241+
4. Send packets:``Port9`` DMAC=``Port10 MAC``
242+
5. Verify flush happens in a certain domain
243+
244+
- test_flush_vlan_dynamic
245+
246+
1. Flush with condition: ``Dynamic`` flush on ``VLAN20``
247+
2. Send packets for each case in sequence: ``Port9`` DMAC=``Port10 MAC``
248+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
249+
4. Send packets for each case in sequence: ``port1`` DMAC=``Port2 MAC``
250+
5. Verify unicast to the corresponding port
251+
252+
253+
- test_flush_port_dynamic
254+
255+
1. Flush with condition: ``Dynamic`` flush on ``Port9``
256+
2. Send packets: ``Port10`` DMAC=``Port9 MAC``
257+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
258+
4. Send packets: ``Port2`` DMAC=``Port1 MAC``
259+
5. Verify unicast to the corresponding port
260+
261+
262+
- test_flush_all_dynamic
263+
264+
1. Flush with condition: flush for all ``Dynamic``
265+
2. Send packets for each case in sequence: ``Port9`` DMAC=``Port10 MAC``
266+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
267+
4. Send packets for each case in sequence: ``port1`` DMAC=``Port2 MAC``
268+
5. Verify flush happens in a certain domain
269+
270+
- test_flush_all
271+
272+
1. Flush with conditions: flush for ``All``
273+
2. Send packets : ``port1`` DMAC=``Port2 MAC``; ``Port9`` DMAC=``Port10 MAC``;
274+
3. Verify flooding happened, packets received in related VLAN, except the ingress port.
275+
276+
277+
## Test Group4: MAC move
278+
### Case1: test_disable_move_drop
279+
### Case2: test_dynamic_mac_move
280+
### Case3: test_static_mac_move
281+
### Testing Objective <!-- omit in toc -->
282+
- test_disable_move_drop: Verify if disable MAC move, drop packet with known SMAC if the SMAC was already learnt on other port.
283+
- test_dynamic_mac_move: Verify when enabling MAC move, previous learnt mac(SMAC) on a port can be learnt on other port
284+
- test_static_mac_move: Verify when enabling MAC move, previous installed mac(static SMAC) on a port can be set to other port
285+
286+
### Test steps: <!-- omit in toc -->
287+
- test_disable_move_drop
288+
289+
1. Disable mac move for ``Port1 MAC`` on Port1
290+
2. Create a packet with SMAC=``Port1 MAC`` DMAC=``Port2 MAC``
291+
3. Send packet on port1
292+
4. Verify packet received on port2
293+
5. Send packet in step2 on port3
294+
6. Verify the packet gets dropped
295+
296+
- test_dynamic_mac_move
297+
298+
1. Flush All MAC
299+
2. Install static FDB entry for port2 with ``Port2 MAC``(with allow_mac_move as true)
300+
3. Send Packet on Port1 with SMAC=``Port1 MAC`` DMAC=``Port2 MAC``
301+
4. Verify packet received on port2
302+
5. Send packet in step2 on port3
303+
8. Verify packet received on port2
304+
9. Send packet with DMAC=``Port1 MAC`` SMAC=``Port2 MAC`` on Port2
305+
10. Verify packet received on port3
306+
307+
- test_static_mac_move
308+
309+
1. Flush All MAC
310+
2. Install static FDB entry for port2 with ``Port2 MAC``
311+
3. Install static FDB entry for port1 with ``Port1 MAC``
312+
4. Enable mac move for ``Port1 MAC`` on Port1
313+
5. Create packet with SMAC=``Port1 MAC`` DMAC=``Port2 MAC``
314+
6. Send packet on port1
315+
7. Verify packet received on port2
316+
8. Install static FDB entry for port3 with ``Port1 MAC``
317+
9. Send packet in step2 on port3
318+
10. Verify packet received on port2

inc/saiport.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,8 @@ typedef enum _sai_port_attr_t
17581758
/**
17591759
* @brief Attribute data for #SAI_PORT_ATTR_AUTO_NEG_STATUS
17601760
*
1761-
* Auto negotiation (AN) done state: 0 for AN in progress, 0 for AN done
1761+
* Auto negotiation (AN) done state: 0 for AN in progress, 1 for AN done
1762+
* If auto negotiation is off, the returned value should be 0.
17621763
*
17631764
* @type bool
17641765
* @flags READ_ONLY

0 commit comments

Comments
 (0)