FIX: Pylint reduce
[csit.git] / resources / libraries / robot / shared / traffic.robot
index 9358daf..bd8edcf 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2021 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:
@@ -61,7 +61,7 @@
 | |
 | | ... | *Example:*
 | |
-| | ... | \| Send packet and verify headers \| ${nodes['TG']} \| 10.0.0.1 \
+| | ... | \| Send packet and verify headers \| \${nodes['TG']} \| 10.0.0.1 \
 | | ... | \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \
 | | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \|
 | |
 | | ... | *Example:*
 | |
 | | ... | \| Packet transmission from port to port should fail \
-| | ... | \| ${nodes['TG']} \| 10.0.0.1 \ \| 32.0.0.1 \| eth2 \
+| | ... | \| \${nodes['TG']} \| 10.0.0.1 \ \| 32.0.0.1 \| eth2 \
 | | ... | \| 08:00:27:a2:52:5b \| eth3 \| 08:00:27:4d:ca:7a \
 | | ... | \| 08:00:27:ee:fd:b3 \| 08:00:27:7d:fd:10 \|
 | | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_src_port}
 | | ... | - dst_ip - Packet destination IP address. Type: string
 | |
 | | ... | *Example:*
-| | ... | \| Send packet and verify marking \| ${nodes['TG']} \| eth1 \| eth2 \
+| | ... | \| Send packet and verify marking \| \${nodes['TG']} \| eth1 \| eth2 \
 | | ... | \| 08:00:27:87:4d:f7 \| 52:54:00:d4:d8:22 \| 192.168.122.2 \
 | | ... | \| 192.168.122.1 \|
 | |
 | | ... | *Example:*
 | |
 | | ... | \| Send VXLAN encapsulated packet and verify received packet \
-| | ... | \| ${tg_node} \| port4 \| port4 \
+| | ... | \| \${tg_node} \| port4 \| port4 \
 | | ... | \| fa:16:3e:6d:f9:c5 \| fa:16:3e:e6:6d:9a \| 192.168.0.1 \
-| | ... | \| 192.168.0.2 \| ${101} \| 192.168.0.2 \| 192.168.0.1 \| ${102} \|
+| | ... | \| 192.168.0.2 \| ${101} \| 192.168.0.2 \| 192.168.0.1 \| \${102} \|
 | |
 | | [Arguments] | ${tg_node} | ${tx_if} | ${rx_if}
 | | ... | ${tx_src_mac} | ${tx_dst_mac}
 | | ... | *Example:*
 | |
 | | ... | \| Send ICMP echo request and verify answer \
-| | ... | \| ${nodes['TG']} \| eth2 \
+| | ... | \| \${nodes['TG']} \| eth2 \
 | | ... | \| 08:00:27:46:2b:4c \| 08:00:27:66:b8:57 \
 | | ... | \| 192.168.23.10 \| 192.168.23.1 \| 10 \|
 | |
 | | ... | - r_tunnel - Remote tunnel IP address (optional). Type: string
 | |
 | | ... | *Example:*
-| | ... | \| ${encr_alg}= \| Crypto Alg AES CBC 128 \|
-| | ... | \| ${auth_alg}= \| Integ Alg SHA1 96 \|
+| | ... | \| \${encr_alg}= \| Crypto Alg AES CBC 128 \|
+| | ... | \| \${auth_alg}= \| Integ Alg SHA1 96 \|
 | | ... | \| Send IPsec Packet and verify ESP encapsulation in received packet\
-| | ... | \| ${nodes['TG']} \| eth1 \| eth2 \
-| | ... | \| 52:54:00:d4:d8:22 \| 52:54:00:d4:d8:3e \| ${encr_alg} \
+| | ... | \| \${nodes['TG']} \| eth1 \| eth2 \
+| | ... | \| 52:54:00:d4:d8:22 \| 52:54:00:d4:d8:3e \| \${encr_alg} \
 | | ... | \| sixteenbytes_key \| ${auth_alg} \| twentybytessecretkey \
-| | ... | \| ${1001} \| ${1000} \| 192.168.3.3 \| 192.168.4.4 \| 192.168.100.2 \
-| | ... | \| 192.168.100.3 \|
+| | ... | \| \${1001} \| \00} \| 192.168.3.3 \| 192.168.4.4 \
+| | ... | \| 192.168.100.2 \| 192.168.100.3 \|
 | |
 | | [Arguments] | ${node} | ${tx_interface} | ${rx_interface} | ${tx_dst_mac}
 | | ... | ${rx_src_mac} | ${crypto_alg} | ${crypto_key} | ${integ_alg}
 | |
 | | ${tx_src_mac}= | Get Interface Mac | ${node} | ${tx_interface}
 | | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_interface}
-| | ${rx_dst_mac}= | Get Interface Mac | ${node} | ${tx_interface}
+| | ${rx_dst_mac}= | Get Interface Mac | ${node} | ${rx_interface}
 | | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_interface}
 | | ${args}= | Catenate | --rx_if ${rx_if_name} | --tx_if ${tx_if_name}
 | | ... | --tx_src_mac ${tx_src_mac} | --tx_dst_mac ${tx_dst_mac}
 | | ... | ${args} --src_tun ${l_tunnel}
 | | ${args}= | Set Variable If | "${r_tunnel}" == "${None}" | ${args}
 | | ... | ${args} --dst_tun ${r_tunnel}
-| | Run Traffic Script On Node | ipsec.py | ${node} | ${args}
+| | Run Traffic Script On Node | ipsec_policy.py | ${node} | ${args}
 
 | Send packet and verify LISP encap
 | | [Documentation] | Send ICMP packet to DUT out one interface and receive\
 | |
 | | ... | *Example:*
 | |
-| | ... | \| Send packet and verify LISP encap \| ${nodes['TG']} \| 10.0.0.1 \
+| | ... | \| Send packet and verify LISP encap \| \${nodes['TG']} \| 10.0.0.1 \
 | | ... | \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \
 | | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \| 10.0.1.1 \
 | | ... | \| 10.0.1.2 \|
 | | Run Traffic Script On Node | lisp/lisp_check.py | ${tg_node}
 | | ... | ${args}
 
+| Send IP Packet and verify ESP encapsulation in received packet
+| | [Documentation] | Send IP packet from TG to DUT. Receive IPsec packet\
+| | ... | from DUT on TG and verify ESP encapsulation. Send IPsec packet in\
+| | ... | opposite direction and verify received IP packet.
+| |
+| | ... | *Arguments:*
+| | ... | - node - TG node. Type: dictionary
+| | ... | - tx_interface - TG Interface 1. Type: string
+| | ... | - rx_interface - TG Interface 2. Type: string
+| | ... | - tx_dst_mac - Destination MAC for TX interface / DUT interface 1 MAC.
+| | ... | Type: string
+| | ... | - rx_src_mac - Source MAC for RX interface / DUT interface 2 MAC.
+| | ... | Type: string
+| | ... | - crypto_alg - Encrytion algorithm. Type: enum
+| | ... | - crypto_key - Encryption key. Type: string
+| | ... | - integ_alg - Integrity algorithm. Type: enum
+| | ... | - integ_key - Integrity key. Type: string
+| | ... | - l_spi - Local SPI. Type: integer
+| | ... | - r_spi - Remote SPI. Type: integer
+| | ... | - src_ip - Source IP address. Type: string
+| | ... | - dst_ip - Destination IP address. Type: string
+| | ... | - src_tun - Source tunnel IP address. Type: string
+| | ... | - dst_tun - Destination tunnel IP address. Type: string
+| |
+| | ... | *Example:*
+| | ... | \| \${encr_alg}= \| Crypto Alg AES CBC 128 \|
+| | ... | \| \${auth_alg}= \| Integ Alg SHA1 96 \|
+| | ... | \| Send IPsec Packet and verify ESP encapsulation in received packet\
+| | ... | \| \${nodes['TG']} \| eth1 \| eth2 \
+| | ... | \| 52:54:00:d4:d8:22 \| 52:54:00:d4:d8:3e \| \${encr_alg} \
+| | ... | \| sixteenbytes_key \| \${auth_alg} \| twentybytessecretkey \
+| | ... | \| \${1001} \| \${1000} \| 192.168.3.3 \| 192.168.4.4 \
+| | ... | \| 192.168.100.2 \| 192.168.100.3 \|
+| |
+| | [Arguments] | ${node} | ${tx_interface} | ${rx_interface} | ${tx_dst_mac}
+| | ... | ${rx_src_mac} | ${crypto_alg} | ${crypto_key} | ${integ_alg}
+| | ... | ${integ_key} | ${l_spi} | ${r_spi} | ${src_ip} | ${dst_ip}
+| | ... | ${src_tun} | ${dst_tun}
+| |
+| | ${tx_src_mac}= | Get Interface Mac | ${node} | ${tx_interface}
+| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_interface}
+| | ${rx_dst_mac}= | Get Interface Mac | ${node} | ${rx_interface}
+| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_interface}
+| | ${crypto_alg_str}= | Get Crypto Alg Scapy Name | ${crypto_alg}
+| | ${integ_alg_str}= | Get Integ Alg Scapy Name | ${integ_alg}
+| | ${args}= | Catenate | --rx_if ${rx_if_name} | --tx_if ${tx_if_name}
+| | ... | --tx_src_mac ${tx_src_mac} | --tx_dst_mac ${tx_dst_mac}
+| | ... | --rx_src_mac ${rx_src_mac} | --rx_dst_mac ${rx_dst_mac}
+| | ... | --src_ip ${src_ip} | --dst_ip ${dst_ip}
+| | ... | --crypto_alg ${crypto_alg_str} | --crypto_key ${crypto_key}
+| | ... | --integ_alg ${integ_alg_str} | --integ_key ${integ_key}
+| | ... | --l_spi ${l_spi} | --r_spi ${r_spi} | --src_tun ${src_tun}
+| | ... | --dst_tun ${dst_tun}
+| | Run Traffic Script On Node | ipsec_interface.py | ${node} | ${args}
+
 | Send packet and verify LISP GPE encap
 | | [Documentation] | Send ICMP packet to DUT out one interface and receive\
 | | ... | a LISP-GPE encapsulated packet on the other interface.
 | |
 | | ... | *Example:*
 | |
-| | ... | \| Send packet and verify LISP GPE encap \| ${nodes['TG']} \
+| | ... | \| Send packet and verify LISP GPE encap \| \${nodes['TG']} \
 | | ... | \| 10.0.0.1 \| 32.0.0.1 \
 | | ... | \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \
 | | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \
 | |
 | | ... | *Example:*
 | |
-| | ... | \| Send packet and verify LISP encap \| ${nodes['TG']} \| 10.0.0.1 \
+| | ... | \| Send packet and verify LISP encap \| \${nodes['TG']} \| 10.0.0.1 \
 | | ... | \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \
 | | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \| 10.0.1.1 \
 | | ... | \| 10.0.1.2 \|
 | | ... | --ot_mode | ${ot_mode}
 | | Run Traffic Script On Node | lisp/lispgpe_check.py | ${tg_node}
 | | ... | ${args}
+
+| Send IPv6 Packet and verify SRv6 encapsulation in received packet
+| | [Documentation] | Send IP packet from TG to DUT. Receive IPv6 packet with\
+| | ... | SRv6 extension header from DUT on TG and verify SRv6 encapsulation.\
+| | ... | Send IPv6 packet with SRv6 extension header in opposite direction and\
+| | ... | verify received IP packet.
+| |
+| | ... | *Arguments:*
+| | ... | - node - TG node. Type: dictionary
+| | ... | - tx_interface - TG Interface 1. Type: string
+| | ... | - rx_interface - TG Interface 2. Type: string
+| | ... | - tx_dst_mac - Destination MAC for TX interface / DUT interface 1 MAC.
+| | ... | Type: string
+| | ... | - rx_src_mac - Source MAC for RX interface / DUT interface 2 MAC.
+| | ... | Type: string
+| | ... | - src_ip - Source IP address. Type: string
+| | ... | - dst_ip - Destination IP address. Type: string
+| | ... | - dut_srcsid - Source SID on DUT (dir0). Type: string
+| | ... | - dut_dstsid1 - The first destination SID on DUT (dir1). Type: string
+| | ... | - tg_srcsid - Source SID on TG (dir1). Type: string
+| | ... | - tg_dstsid1 - The first destination SID on TG (dir0). Type: string
+| | ... | - dut_dstsid2 - The second destination SID on DUT (dir1). Type: string
+| | ... | - tg_dstsid2 - The second destination SID on TG (dir0). Type: string
+| | ... | - decap - True if decapsulation expected, false if encapsulated packet
+| | ... | expected on receiving interface (Optional). Type: boolean
+| | ... | - tg_dstsid3 - The third destination SID on TG (dir0) (Optional).
+| | ... | Type: string
+| | ... | - dut_dstsid3 - The third destination SID on DUT (dir1) (Optional).
+| | ... | Type: string
+| | ... | - static_proxy - Switch for SRv6 with endpoint to SR-unaware Service
+| | ... | Function via static proxy (Optional). Type: boolean
+| |
+| | ... | *Example:*
+| | ... | \| Send IPv6 Packet and verify SRv6 encapsulation in received packet\
+| | ... | \| \${nodes['TG']} \| eth1 \| eth2 \
+| | ... | \| 52:54:00:d4:d8:22 \| 52:54:00:d4:d8:3e \| 2002:1:: \
+| | ... | \| 2003:2:: \| 2003:1:: \| 2002:2:: \| decap=${False} \
+| | ... | \| tg_dstsid3=2002:4:: \| dut_dstsid3=2003:4:: \
+| | ... | \| static_proxy=${True} \|
+| |
+| | [Arguments] | ${node} | ${tx_interface} | ${rx_interface} | ${tx_dst_mac}
+| | ... | ${rx_src_mac} | ${src_ip} | ${dst_ip} | ${dut_srcsid}
+| | ... | ${dut_dstsid1} | ${tg_srcsid} | ${tg_dstsid1}
+| | ... | ${dut_dstsid2}=${None} | ${tg_dstsid2}=${None} | ${decap}=${True}
+| | ... | ${tg_dstsid3}=${None} | ${dut_dstsid3}=${None}
+| | ... | ${static_proxy}=${False}
+| |
+| | ${tx_src_mac}= | Get Interface Mac | ${node} | ${tx_interface}
+| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_interface}
+| | ${rx_dst_mac}= | Get Interface Mac | ${node} | ${rx_interface}
+| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_interface}
+| | ${args}= | Catenate | --rx_if ${rx_if_name} | --tx_if ${tx_if_name}
+| | ... | --tx_src_mac ${tx_src_mac} | --tx_dst_mac ${tx_dst_mac}
+| | ... | --rx_src_mac ${rx_src_mac} | --rx_dst_mac ${rx_dst_mac}
+| | ... | --src_ip ${src_ip} | --dst_ip ${dst_ip} | --dir0_srcsid ${dut_srcsid}
+| | ... | --dir0_dstsid1 ${tg_dstsid1} | --dir0_dstsid2 ${tg_dstsid2}
+| | ... | --dir1_srcsid ${tg_srcsid} | --dir1_dstsid1 ${dut_dstsid1}
+| | ... | --dir1_dstsid2 ${dut_dstsid2} | --decap ${decap}
+| | ... | --dir0_dstsid3 ${tg_dstsid3} | --dir1_dstsid3 ${dut_dstsid3}
+| | ... | --static_proxy ${static_proxy}
+| | Run Traffic Script On Node | srv6_encap.py | ${node} | ${args}
+
+| Send TCP or UDP packet and verify network address translations
+| | [Documentation] | Send TCP or UDP packet from TG-if1 to TG-if2 and response\
+| | ... | in opposite direction via DUT with configured NAT. Check packet\
+| | ... | headers on both sides.
+| |
+| | ... | *Arguments:*
+| |
+| | ... | _NOTE:_ Arguments are based on topology:
+| | ... | TG(if1)->(if1)DUT(if2)->TG(if2)
+| |
+| | ... | - tg_node - Node where to run traffic script. Type: dictionary
+| | ... | - tx_interface - TG Interface 1. Type: string
+| | ... | - rx_interface - TG Interface 2. Type: string
+| | ... | - tx_dst_mac - Destination MAC for TX interface / DUT interface 1 MAC.
+| | ... | Type: string
+| | ... | - rx_src_mac - Source MAC for RX interface / DUT interface 2 MAC.
+| | ... | Type: string
+| | ... | - src_ip_in - Internal source IP address. Type: string
+| | ... | - src_ip_out - External source IP address. Type: string
+| | ... | - dst_ip - Destination IP address. Type: string
+| | ... | - protocol - TCP or UDP protocol. Type: string
+| | ... | - src_port_in - Internal source TCP/UDP port. Type: string or integer
+| | ... | - src_port_out - External source TCP/UDP port; default value: unknown.
+| | ... | Type: string or integer
+| | ... | - dst_port - Destination TCP/UDP port. Type: string or integer
+| |
+| | ... | *Return:*
+| | ... | - No value returned
+| |
+| | ... | *Example:*
+| |
+| | ... | \| Send TCP or UDP packet and verify network address translations \
+| | ... | \| \${nodes['TG']} \| port1 \| port2 \| 08:00:27:cc:4f:54 \
+| | ... | \| 08:00:27:c9:6a:d5 \| 192.168.0.0 \| 68.142.68.0 \| 20.0.0.0 \
+| | ... | \| TCP \| 1024 \| 8080 \|
+| |
+| | [Arguments] | ${tg_node} | ${tx_interface} | ${rx_interface} | ${tx_dst_mac}
+| | ... | ${rx_src_mac} | ${src_ip_in} | ${src_ip_out} | ${dst_ip}
+| | ... | ${protocol} | ${src_port_in} | ${dst_port} | ${src_port_out}=unknown
+| |
+| | ${tx_src_mac}= | Get Interface Mac | ${tg_node} | ${tx_interface}
+| | ${tx_if_name}= | Get Interface Name | ${tg_node} | ${tx_interface}
+| | ${rx_dst_mac}= | Get Interface Mac | ${tg_node} | ${rx_interface}
+| | ${rx_if_name}= | Get Interface Name | ${tg_node} | ${rx_interface}
+| | ${args}= | Catenate | --rx_if ${rx_if_name} | --tx_if ${tx_if_name}
+| | ... | --tx_src_mac ${tx_src_mac} | --tx_dst_mac ${tx_dst_mac}
+| | ... | --rx_src_mac ${rx_src_mac} | --rx_dst_mac ${rx_dst_mac}
+| | ... | --src_ip_in ${src_ip_in} | --src_ip_out ${src_ip_out}
+| | ... | --dst_ip ${dst_ip} | --protocol ${protocol}
+| | ... | --src_port_in ${src_port_in} | --src_port_out ${src_port_out}
+| | ... | --dst_port ${dst_port}
+| | Run Traffic Script On Node | nat.py | ${tg_node} | ${args}
+
+| Send IP packet and verify GENEVE encapsulation in received packets
+| | [Documentation] | Send IP packet from TG to DUT. Receive GENEVE packet\
+| | ... | from DUT on TG and verify GENEVE encapsulation. Send GENEVE packet in\
+| | ... | opposite direction and verify received IP packet.
+| |
+| | ... | *Arguments:*
+| | ... | - node - TG node. Type: dictionary
+| | ... | - tx_interface - TG Interface 1. Type: string
+| | ... | - rx_interface - TG Interface 2. Type: string
+| | ... | - tx_dst_mac - Destination MAC for TX interface / DUT interface 1 MAC.
+| | ... | Type: string
+| | ... | - rx_src_mac - Source MAC for RX interface / DUT interface 2 MAC.
+| | ... | Type: string
+| | ... | - tun_local_ip - GENEVE tunnel source IP address. Type: string
+| | ... | - tun_remote_ip - GENEVE tunnel destination IP address. Type: string
+| | ... | - tun_vni - GENEVE tunnel VNI. Type: integer
+| | ... | - tun_src_ip - Source IP address of original IP packet / inner source
+| | ... | IP address of GENEVE packet. Type: string
+| | ... | - tun_dst_ip - Destination IP address of original IP packet / inner
+| | ... | destination IP address of GENEVE packet. Type: string
+| |
+| | ... | *Example:*
+| | ... | \| Send IP packet and verify GENEVE encapsulation in received packets\
+| | ... | \| \${nodes['TG']} \| eth1 \| eth2 \
+| | ... | \| 52:54:00:d4:d8:22 \| 52:54:00:d4:d8:3e \| 1.1.1.2 \| 1.1.1.1 \
+| | ... | \| 1 \| 10.128.1.0 \| 10.0.1.0 \| 24 \|11.0.1.2\|
+| |
+| | [Arguments] | ${node} | ${tx_interface} | ${rx_interface}
+| | ... | ${tx_dst_mac} | ${rx_src_mac} | ${tun_local_ip} | ${tun_remote_ip}
+| | ... | ${tun_vni} | ${tun_src_ip} | ${tun_dst_ip}
+| |
+| | ${tx_src_mac}= | Get Interface Mac | ${node} | ${tx_interface}
+| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_interface}
+| | ${rx_dst_mac}= | Get Interface Mac | ${node} | ${rx_interface}
+| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_interface}
+| | ${args}= | Catenate | --rx_if ${rx_if_name} | --tx_if ${tx_if_name}
+| | ... | --tx_src_mac ${tx_src_mac} | --tx_dst_mac ${tx_dst_mac}
+| | ... | --rx_src_mac ${rx_src_mac} | --rx_dst_mac ${rx_dst_mac}
+| | ... | --tun_local_ip ${tun_local_ip} | --tun_remote_ip ${tun_remote_ip}
+| | ... | --tun_vni ${tun_vni} | --tun_src_ip ${tun_src_ip}
+| | ... | --tun_dst_ip ${tun_dst_ip}
+| | Run Traffic Script On Node | geneve_tunnel.py | ${node} | ${args}