aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/l2/l2_traffic.robot
blob: bca801778ebfa2300147ec8caf305873774f2b7a (plain)
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
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | resources.libraries.python.topology.Topology
| Library | resources.libraries.python.TrafficScriptExecutor
| Documentation | Keywords to send and receive different types of traffic \
| ... | through L2 network.

*** Keywords ***
| Send ICMP packet and verify received packet
| | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to \
| | ... | destination interface. Packet can be set with Dot1q or
| | ... | Dot1ad tag(s) when required.
| | ...
| | ... | *Arguments:*
| | ...
| | ... | - tg_node - TG node. Type: dictionary
| | ... | - src_int - Source interface. Type: string
| | ... | - dst_int - Destination interface. Type: string
| | ... | - src_ip - Source IP address (Optional). Type: string
| | ... | - dst_ip - Destination IP address (Optional). Type: string
| | ... | - encaps - Encapsulation: Dot1q or Dot1ad (Optional). Type: string
| | ... | - vlan1 - VLAN (outer) tag (Optional). Type: integer
| | ... | - vlan2 - VLAN inner tag (Optional). Type: integer
| | ... | - encaps_rx - Expected encapsulation on RX side: Dot1q or Dot1ad
| | ... | (Optional). Type: string
| | ... | - vlan1_rx - VLAN (outer) tag on RX side (Optional). Type: integer
| | ... | - vlan2_rx - VLAN inner tag on RX side (Optional). Type: integer
| | ...
| | ... | *Return:*
| | ...
| | ... | - No value returned
| | ...
| | ... | *Example:*
| | ...
| | ... | _NOTE:_ Default IP is IPv4
| | ...
| | ... | \| Send ICMP packet and verify received packet \| ${nodes['TG']} \
| | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
| | ... | \| Send ICMP packet and verify received packet \| ${nodes['TG']} \
| | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=100 \|
| | ... | \| Send ICMP packet and verify received packet \| ${nodes['TG']} \
| | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1ad \| vlan1=110 \
| | ... | \| vlan2=220 \|
| | ... | \| Send ICMP packet and verify received packet \| ${nodes['TG']} \
| | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=110 \
| | ... | \| encaps_rx=Dot1q \|
| | ... | \| Send ICMP packet and verify received packet \| ${nodes['TG']} \
| | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=110 \
| | ... | \| encaps_rx=Dot1q \| vlan1_rx=120 \|
| | ...
| | [Arguments] | ${tg_node} | ${src_int} | ${dst_int}
| | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2 | ${encaps}=${EMPTY}
| | ... | ${vlan1}=${EMPTY} | ${vlan2}=${EMPTY} | ${encaps_rx}=${EMPTY}
| | ... | ${vlan1_rx}=${EMPTY} | ${vlan2_rx}=${EMPTY}
| | ...
| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
| | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
| | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name}
| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
| | ${args}= | Run Keyword If | '${encaps}' == '${EMPTY}'
| | | ... | Set Variable | ${args}
| | ... | ELSE | Catenate | ${args} | --encaps ${encaps} | --vlan1 ${vlan1}
| | ${args}= | Run Keyword If | '${vlan2}' == '${EMPTY}'
| | | ... | Set Variable | ${args}
| | ... | ELSE | Catenate | ${args} | --vlan2 ${vlan2}
| | ${args}= | Run Keyword If | '${encaps_rx}' == '${EMPTY}'
| | | ... | Set Variable | ${args}
| | ... | ELSE | Catenate | ${args} | --encaps_rx ${encaps_rx}
| | ${args}= | Run Keyword If | '${vlan1_rx}' == '${EMPTY}'
| | | ... | Set Variable | ${args}
| | ... | ELSE | Catenate | ${args} | --vlan1_rx ${vlan1_rx}
| | ${args}= | Run Keyword If | '${vlan2_rx}' == '${EMPTY}'
| | | ... | Set Variable | ${args}
| | ... | ELSE | Catenate | ${args} | --vlan2_rx ${vlan2_rx}
| | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}

| ICMP packet transmission should fail
| | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to
| | ... | destination interface and expect failure with
| | ... | ICMP echo Rx timeout error message.
| | ...
| | ... | *Arguments:*
| | ...
| | ... | - tg_node - TG node. Type: dictionary
| | ... | - src_int - Source interface. Type: string
| | ... | - dst_int - Destination interface. Type: string
| | ... | - src_ip - Source IP address (Optional). Type: string
| | ... | - dst_ip - Destination IP address (Optional). Type: string
| | ...
| | ... | *Return:*
| | ...
| | ... | - No value returned
| | ...
| | ... | *Example:*
| | ...
| | ... | _NOTE:_ Default IP is IPv4
| | ...
| | ... | \| ICMP packet transmission should fail\| ${nodes['TG']} \
| | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
| | ...
| | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} |
| | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
| | ...
| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
| | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
| | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name}
| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
| | Run Keyword And Expect Error | ICMP echo Rx timeout |
| | ... | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}

| Send ICMPv4 bidirectionally and verify received packets
| | [Documentation] | Send ICMPv4 echo request from both directions,
| | ... | from interface1 to interface2 and from interface2 to interface1.
| | ...
| | ... | *Arguments:*
| | ...
| | ... | - tg_node - TG node. Type: dictionary
| | ... | - src_int - Source interface. Type: string
| | ... | - dst_int - Destination interface. Type: string
| | ... | - src_ip - Source IP address (Optional). Type: string
| | ... | - dst_ip - Destination IP address (Optional). Type: string
| | ...
| | ... | *Return:*
| | ...
| | ... | - No value returned
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Send ICMPv4 bidirectionally and verify received packets \
| | ... | \| ${nodes['TG']} \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
| | ...
| | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=192.168.100.1 |
| | ... | ${dst_ip}=192.168.100.2
| | ...
| | Send ICMP packet and verify received packet
| | ... | ${tg_node} | ${int1} | ${int2} | ${src_ip} | ${dst_ip}
| | Send ICMP packet and verify received packet
| | ... | ${tg_node} | ${int2} | ${int1} | ${dst_ip} | ${src_ip}

| Send ICMPv6 bidirectionally and verify received packets
| | [Documentation] | Send ICMPv6 echo request from both directions,
| | ... | from interface1 to interface2 and from interface2 to interface1.
| | ...
| | ... | *Arguments:*
| | ...
| | ... | - tg_node - TG node. Type: dictionary
| | ... | - src_int - Source interface. Type: string
| | ... | - dst_int - Destination interface. Type: string
| | ... | - src_ip - Source IP address (Optional). Type: string
| | ... | - dst_ip - Destination IP address (Optional). Type: string
| | ...
| | ... | *Return:*
| | ...
| | ... | - No value returned
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Send ICMPv6 bidirectionally and verify received packets \
| | ... | \| ${nodes['TG']} \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
| | ...
| | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=3ffe:63::1 |
| | ... | ${dst_ip}=3ffe:63::2
| | ...
| | Send ICMP packet and verify received packet
| | ... | ${tg_node} | ${int1} | ${int2} | ${src_ip} | ${dst_ip}
| | Send ICMP packet and verify received packet
| | ... | ${tg_node} | ${int2} | ${int1} | ${dst_ip} | ${src_ip}
8_from_f32x8 (f32x8 v) { return (u32x8) _mm256_cvttps_epi32 ((__m256) v); } #define u32x8_blend(a,b,m) \ (u32x8) _mm256_blend_epi32 ((__m256i) a, (__m256i) b, m) #define u16x16_blend(v1, v2, mask) \ (u16x16) _mm256_blend_epi16 ((__m256i) (v1), (__m256i) (v2), mask) static_always_inline u64x4 u64x4_gather (void *p0, void *p1, void *p2, void *p3) { u64x4 r = { *(u64 *) p0, *(u64 *) p1, *(u64 *) p2, *(u64 *) p3 }; return r; } static_always_inline u32x8 u32x8_gather (void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6, void *p7) { u32x8 r = { *(u32 *) p0, *(u32 *) p1, *(u32 *) p2, *(u32 *) p3, *(u32 *) p4, *(u32 *) p5, *(u32 *) p6, *(u32 *) p7, }; return r; } static_always_inline void u64x4_scatter (u64x4 r, void *p0, void *p1, void *p2, void *p3) { *(u64 *) p0 = r[0]; *(u64 *) p1 = r[1]; *(u64 *) p2 = r[2]; *(u64 *) p3 = r[3]; } static_always_inline void u32x8_scatter (u32x8 r, void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6, void *p7) { *(u32 *) p0 = r[0]; *(u32 *) p1 = r[1]; *(u32 *) p2 = r[2]; *(u32 *) p3 = r[3]; *(u32 *) p4 = r[4]; *(u32 *) p5 = r[5]; *(u32 *) p6 = r[6]; *(u32 *) p7 = r[7]; } static_always_inline void u64x4_scatter_one (u64x4 r, int index, void *p) { *(u64 *) p = r[index]; } static_always_inline void u32x8_scatter_one (u32x8 r, int index, void *p) { *(u32 *) p = r[index]; } static_always_inline u8x32 u8x32_is_greater (u8x32 v1, u8x32 v2) { return (u8x32) _mm256_cmpgt_epi8 ((__m256i) v1, (__m256i) v2); } static_always_inline u8x32 u8x32_blend (u8x32 v1, u8x32 v2, u8x32 mask) { return (u8x32) _mm256_blendv_epi8 ((__m256i) v1, (__m256i) v2, (__m256i) mask); } #define u32x8_permute_lanes(a, b, m) \ (u32x8) _mm256_permute2x128_si256 ((__m256i) a, (__m256i) b, m) #define u64x4_permute_lanes(a, b, m) \ (u64x4) _mm256_permute2x128_si256 ((__m256i) a, (__m256i) b, m) static_always_inline u32x8 u32x8_min (u32x8 a, u32x8 b) { return (u32x8) _mm256_min_epu32 ((__m256i) a, (__m256i) b); } static_always_inline u32 u32x8_min_scalar (u32x8 v) { return u32x4_min_scalar (u32x4_min (u32x8_extract_lo (v), u32x8_extract_hi (v))); } static_always_inline void u32x8_transpose (u32x8 a[8]) { u64x4 r[8], x, y; r[0] = (u64x4) u32x8_interleave_lo (a[0], a[1]); r[1] = (u64x4) u32x8_interleave_hi (a[0], a[1]); r[2] = (u64x4) u32x8_interleave_lo (a[2], a[3]); r[3] = (u64x4) u32x8_interleave_hi (a[2], a[3]); r[4] = (u64x4) u32x8_interleave_lo (a[4], a[5]); r[5] = (u64x4) u32x8_interleave_hi (a[4], a[5]); r[6] = (u64x4) u32x8_interleave_lo (a[6], a[7]); r[7] = (u64x4) u32x8_interleave_hi (a[6], a[7]); x = u64x4_interleave_lo (r[0], r[2]); y = u64x4_interleave_lo (r[4], r[6]); a[0] = u32x8_permute_lanes (x, y, 0x20); a[4] = u32x8_permute_lanes (x, y, 0x31); x = u64x4_interleave_hi (r[0], r[2]); y = u64x4_interleave_hi (r[4], r[6]); a[1] = u32x8_permute_lanes (x, y, 0x20); a[5] = u32x8_permute_lanes (x, y, 0x31); x = u64x4_interleave_lo (r[1], r[3]); y = u64x4_interleave_lo (r[5], r[7]); a[2] = u32x8_permute_lanes (x, y, 0x20); a[6] = u32x8_permute_lanes (x, y, 0x31); x = u64x4_interleave_hi (r[1], r[3]); y = u64x4_interleave_hi (r[5], r[7]); a[3] = u32x8_permute_lanes (x, y, 0x20); a[7] = u32x8_permute_lanes (x, y, 0x31); } static_always_inline void u64x4_transpose (u64x4 a[8]) { u64x4 r[4]; r[0] = u64x4_interleave_lo (a[0], a[1]); r[1] = u64x4_interleave_hi (a[0], a[1]); r[2] = u64x4_interleave_lo (a[2], a[3]); r[3] = u64x4_interleave_hi (a[2], a[3]); a[0] = u64x4_permute_lanes (r[0], r[2], 0x20); a[1] = u64x4_permute_lanes (r[1], r[3], 0x20); a[2] = u64x4_permute_lanes (r[0], r[2], 0x31); a[3] = u64x4_permute_lanes (r[1], r[3], 0x31); } #endif /* included_vector_avx2_h */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */