Introduce VPP-IPsec container tests.
[csit.git] / resources / libraries / robot / crypto / ipsec.robot
index b571fcd..20529dc 100644 (file)
 | Library | resources.libraries.python.IPsecUtil
 | Library | resources.libraries.python.IPUtil
 | Library | resources.libraries.python.IPv6Util
-| Library | resources.libraries.python.NodePath
-| Library | resources.libraries.python.TrafficScriptExecutor
-| ...
-| Resource | resources/libraries/robot/shared/default.robot
-| ...
-| Documentation | IPsec keywords
+|
+| Documentation | IPsec keywords.
 
 *** Keywords ***
 | Generate keys for IPSec
 | | [Documentation] | Generate keys for IPsec.
-| | ...
+| |
 | | ... | *Arguments:*
 | | ... | - crypto_alg - Encryption algorithm. Type: enum
 | | ... | - integ_alg - Integrity algorithm. Type: enum
-| | ...
+| |
 | | ... | _NOTE:_ This KW sets following test case variable:
 | | ... | - encr_key - Encryption key. Type: string
 | | ... | - auth_key - Integrity key. Type: string
-| | ...
+| |
 | | ... | *Example:*
 | | ... | \| ${encr_alg}= \| Crypto Alg AES CBC 128 \|
 | | ... | \| ${auth_alg}= \| Integ Alg SHA1 96 \|
 | | ... | \| Generate keys for IPSec \| ${encr_alg} \| ${auth_alg} \|
+| |
 | | [Arguments] | ${crypto_alg} | ${integ_alg}
+| |
 | | ${encr_key_len}= | Get Crypto Alg Key Len | ${crypto_alg}
 | | ${encr_key}= | Generate Random String | ${encr_key_len}
 | | ${auth_key_len}= | Get Integ Alg Key Len | ${integ_alg}
 
 | Configure path for IPSec test
 | | [Documentation] | Setup path for IPsec testing TG<-->DUT1.
-| | ...
-| | ... | _NOTE:_ This KW sets following test case variable:
-| | ... | - tg_node - TG node. Type: dictionary
-| | ... | - tg_if - TG interface connected to DUT. Type: string
-| | ... | - tg_if_mac - TG interface MAC. Type: string
-| | ... | - dut_node - DUT node. Type: dictionary
-| | ... | - dut_if - DUT interface connected to TG. Type: string
-| | ... | - dut_if_mac - DUT interface MAC. Type: string
-| | ... | - dut_lo - DUT loopback interface. Type: string
-| | ...
+| |
 | | ... | *Example:*
 | | ... | \| Configure path for IPSec test \|
-| | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
-| | Compute Path
-| | ${tg_if} | ${tg_node}= | Next Interface
-| | ${dut_if} | ${dut_node}= | Next Interface
-| | ${dut_if_mac}= | Get Interface Mac | ${dut_node} | ${dut_if}
-| | ${tg_if_mac}= | Get Interface Mac | ${tg_node} | ${tg_if}
-| | ${dut_lo}= | Vpp Create Loopback | ${dut_node}
-| | Set Interface State | ${dut_node} | ${dut_if} | up
-| | Set Interface State | ${dut_node} | ${dut_lo} | up
-| | Vpp Node Interfaces Ready Wait | ${dut_node}
-| | Set Test Variable | ${tg_node}
-| | Set Test Variable | ${tg_if}
-| | Set Test Variable | ${tg_if_mac}
-| | Set Test Variable | ${dut_node}
-| | Set Test Variable | ${dut_if}
-| | Set Test Variable | ${dut_if_mac}
-| | Set Test Variable | ${dut_lo}
+| |
+| | Set Interface State | ${dut1} | ${dut1_if1} | up
+| | Set Interface State | ${dut1} | ${dut1_if2} | up
+| | Vpp Node Interfaces Ready Wait | ${dut1}
 
 | Configure topology for IPv4 IPsec testing
 | | [Documentation] | Setup topology for IPv4 IPsec testing.
-| | ...
+| |
 | | ... | _NOTE:_ This KW sets following test case variable:
 | | ... | - dut_tun_ip - DUT tunnel IP address. Type: string
 | | ... | - dut_src_ip - DUT source IP address. Type: string
 | | ... | - tg_tun_ip - TG tunnel IP address. Type: string
 | | ... | - tg_src_ip - TG source IP address. Type: string
-| | ...
+| |
 | | ... | *Example:*
 | | ... | \| Configure topology for IPv4 IPsec testing \|
+| |
 | | Configure path for IPSec test
-| | VPP Interface Set IP Address | ${dut_node} | ${dut_if} | ${dut_if_ip4}
-| | ... | ${ip4_plen}
-| | VPP Interface Set IP Address | ${dut_node} | ${dut_lo} | ${dut_lo_ip4}
-| | ... | ${ip4_plen}
-| | VPP Add IP Neighbor | ${dut_node} | ${dut_if} | ${tg_if_ip4} | ${tg_if_mac}
-| | Vpp Route Add | ${dut_node} | ${tg_lo_ip4} | ${ip4_plen}
-| | ... | gateway=${tg_if_ip4} | interface=${dut_if}
-| | Set Test Variable | ${dut_tun_ip} | ${dut_if_ip4}
-| | Set Test Variable | ${dut_src_ip} | ${dut_lo_ip4}
-| | Set Test Variable | ${tg_tun_ip} | ${tg_if_ip4}
-| | Set Test Variable | ${tg_src_ip} | ${tg_lo_ip4}
+| | VPP Interface Set IP Address
+| | ... | ${dut1} | ${dut1_if1} | ${dut_if1_ip4} | ${ip4_plen}
+| | VPP Interface Set IP Address
+| | ... | ${dut1} | ${dut1_if2} | ${dut_if2_ip4} | ${ip4_plen}
+| | VPP Add IP Neighbor
+| | ... | ${dut1} | ${dut1_if1} | ${tg_if1_ip4} | ${tg_if1_mac}
+| | VPP Add IP Neighbor
+| | ... | ${dut1} | ${dut1_if2} | ${tg_if2_ip4} | ${tg_if2_mac}
+| | Vpp Route Add
+| | ... | ${dut1} | ${tg_host_ip4} | ${ip4_plen} | gateway=${tg_if1_ip4}
+| | ... | interface=${dut1_if1}
+| | Set Test Variable | ${dut_tun_ip} | ${dut_if1_ip4}
+| | Set Test Variable | ${tg_tun_ip} | ${tg_if1_ip4}
+| | Set Test Variable | ${tg_src_ip} | ${tg_host_ip4}
+| | Set Test Variable | ${tg_dst_ip} | ${tg_if2_ip4}
 
 | Configure topology for IPv6 IPsec testing
 | | [Documentation] | Setup topology fo IPv6 IPsec testing.
-| | ...
+| |
 | | ... | _NOTE:_ This KW sets following test case variable:
 | | ... | - dut_tun_ip - DUT tunnel IP address. Type: string
 | | ... | - dut_src_ip - DUT source IP address. Type: string
 | | ... | - tg_tun_ip - TG tunnel IP address. Type: string
 | | ... | - tg_src_ip - TG source IP address. Type: string
-| | ...
+| |
 | | ... | *Example:*
 | | ... | \| Configure topology for IPv6 IPsec testing \|
+| |
 | | Configure path for IPSec test
 | | VPP Interface Set IP Address
-| | ... | ${dut_node} | ${dut_if} | ${dut_if_ip6} | ${ip6_plen}
+| | ... | ${dut1} | ${dut1_if1} | ${dut_if1_ip6} | ${ip6_plen}
 | | VPP Interface Set IP Address
-| | ... | ${dut_node} | ${dut_lo} | ${dut_lo_ip6} | ${ip6_plen}
-| | VPP Add IP Neighbor | ${dut_node} | ${dut_if} | ${tg_if_ip6} | ${tg_if_mac}
+| | ... | ${dut1} | ${dut1_if2} | ${dut_if2_ip6} | ${ip6_plen}
+| | VPP Add IP Neighbor
+| | ... | ${dut1} | ${dut1_if1} | ${tg_if1_ip6} | ${tg_if1_mac}
+| | VPP Add IP Neighbor
+| | ... | ${dut1} | ${dut1_if2} | ${tg_if2_ip6} | ${tg_if2_mac}
 | | Vpp All RA Suppress Link Layer | ${nodes}
-| | Vpp Route Add | ${dut_node} | ${tg_lo_ip6} | ${ip6_plen_rt}
-| | ... | gateway=${tg_if_ip6} | interface=${dut_if}
-| | Set Test Variable | ${dut_tun_ip} | ${dut_if_ip6}
-| | Set Test Variable | ${dut_src_ip} | ${dut_lo_ip6}
-| | Set Test Variable | ${tg_tun_ip} | ${tg_if_ip6}
-| | Set Test Variable | ${tg_src_ip} | ${tg_lo_ip6}
+| | Vpp Route Add
+| | ... | ${dut1} | ${tg_host_ip6} | ${ip6_plen_rt} | gateway=${tg_if1_ip6}
+| | ... | interface=${dut1_if1}
+| | Set Test Variable | ${dut_tun_ip} | ${dut_if1_ip6}
+| | Set Test Variable | ${tg_tun_ip} | ${tg_if1_ip6}
+| | Set Test Variable | ${tg_src_ip} | ${tg_host_ip6}
+| | Set Test Variable | ${tg_dst_ip} | ${tg_if2_ip6}
 
 | Configure manual keyed connection for IPSec
 | | [Documentation] | Setup IPsec manual keyed connection on VPP node.
-| | ...
+| |
 | | ... | *Arguments:*
 | | ... | - node - VPP node to setup IPsec on. Type: dictionary
 | | ... | - interface - Interface to enable IPsec on. Type: string
 | | ... | - r_ip - Remote IP address. Type: string
 | | ... | - l_tunnel - Local tunnel IP address (optional). Type: string
 | | ... | - r_tunnel - Remote tunnel IP address (optional). Type: string
-| | ...
+| |
 | | ... | _NOTE:_ This KW sets following test case variables:
 | | ... | - l_sa_id
 | | ... | - r_sa_id
-| | ...
+| |
 | | ... | *Example:*
 | | ... | \| ${encr_alg}= \| Crypto Alg AES CBC 128 \|
 | | ... | \| ${auth_alg}= \| Integ Alg SHA1 96 \|
 | | ... | \| GigabitEthernet0/8/0 \| ${encr_alg} \| sixteenbytes_key \
 | | ... | \| ${auth_alg} \| twentybytessecretkey \| ${1000} \| ${1001} \
 | | ... | \| 192.168.4.4 \| 192.168.3.3 \| 192.168.100.3 \| 192.168.100.2 \|
-| | ...
+| |
 | | [Arguments] | ${node} | ${interface} | ${crypto_alg} | ${crypto_key}
 | | ... | ${integ_alg} | ${integ_key} | ${l_spi} | ${r_spi} | ${l_ip}
 | | ... | ${r_ip} | ${l_tunnel}=${None} | ${r_tunnel}=${None}
 | | ... | ${is_ipv6}=${FALSE}
-| | ...
+| |
 | | Set Test Variable | ${l_sa_id} | ${10}
 | | Set Test Variable | ${r_sa_id} | ${20}
 | | ${spd_id}= | Set Variable | ${1}
 | | ... | sa_id=${l_sa_id} | laddr_range=${l_ip}
 | | ... | raddr_range=${r_ip} | inbound=${FALSE}
 
-| Send IPsec Packet and verify ESP encapsulation in received packet
-| | [Documentation] | Send IPsec packet from TG to DUT. Receive IPsec packet\
-| | ... | from DUT on TG and verify ESP encapsulation.
-| | ...
-| | ... | *Arguments:*
-| | ... | - node - TG node. Type: dictionary
-| | ... | - interface - TG Interface. Type: string
-| | ... | - dst_mac - Destination 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
-| | ... | - l_ip - Local IP address. Type: string
-| | ... | - r_ip - Remote IP address. Type: string
-| | ... | - l_tunnel - Local tunnel IP address (optional). Type: string
-| | ... | - r_tunnel - Remote tunnel IP address (optional). 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 \
-| | ... | \| 52:54:00:d4:d8:22 \| ${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} | ${interface} | ${dst_mac} | ${crypto_alg}
-| | ... | ${crypto_key} | ${integ_alg} | ${integ_key} | ${l_spi}
-| | ... | ${r_spi} | ${l_ip} | ${r_ip} | ${l_tunnel}=${None}
-| | ... | ${r_tunnel}=${None}
-| | ${src_mac}= | Get Interface Mac | ${node} | ${interface}
-| | ${if_name}= | Get Interface Name | ${node} | ${interface}
-| | ${args}= | Traffic Script Gen Arg | ${if_name} | ${if_name} | ${src_mac}
-| | ... | ${dst_mac} | ${l_ip} | ${r_ip}
-| | ${crypto_alg_str}= | Get Crypto Alg Scapy Name | ${crypto_alg}
-| | ${integ_alg_str}= | Get Integ Alg Scapy Name | ${integ_alg}
-| | ${args}= | Catenate | ${args} | --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}
-| | ${args}= | Set Variable If | "${l_tunnel}" == "${None}" | ${args}
-| | ... | ${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}
-
-| Set up IPSec SW device functional test
+| Initialize IPSec in 3-node circular topology
 | | [Documentation]
-| | ... | Set up IPSec SW device functional test for required IP version.
-| | ...
-| | ... | *Arguments:*
-| | ... | - ${ip_version} - IP version: IPv4 or IPv6. Type: string
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Set up IPSec SW device functional test \| IPv4 \|
-| | ...
-| | [Arguments] | ${ip_version}
-| | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
-| | :FOR | ${dut} | IN | @{duts}
-| | | Import Library | resources.libraries.python.VppConfigGenerator
-| | | ... | WITH NAME | ${dut}
-| | | Run keyword | ${dut}.Set Node | ${nodes['${dut}']}
-| | | Run keyword | ${dut}.Set Vpp Startup Conf Backup
-| | | Run keyword | ${dut}.Set Vpp Logfile | /tmp/vpp.log
-| | | Run keyword | ${dut}.Add Unix Nodaemon
-| | | Run keyword | ${dut}.Add Unix Log
-| | | Run keyword | ${dut}.Add Unix Coredump
-| | | Run keyword | ${dut}.Add Unix CLI Listen | /run/vpp/cli.sock
-| | | Run keyword | ${dut}.Add Unix Gid
-| | | Run keyword | ${dut}.Add Api Segment Gid
-| | | ${socket_id}= | Set Variable | ${0}
-| | | ${sw_dev_count}= | Set Variable | ${1}
-| | | Run keyword | ${dut}.Add DPDK SW Cryptodev | aesni_mb | ${socket_id}
-| | | ... | ${sw_dev_count}
-| | | Run keyword | ${dut}.Add DPDK SW Cryptodev | aesni_gcm | ${socket_id}
-| | | ... | ${sw_dev_count}
-| | Write startup configuration on all VPP DUTs
-| | Set up VPP device test
-| | Run Keyword | Configure topology for ${ip_version} IPsec testing
+| | ... | Set UP state on VPP interfaces in path on nodes in 3-node circular
+| | ... | topology. Get the interface MAC addresses and setup ARP on all VPP
+| | ... | interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG and
+| | ... | DUT1-DUT2 links. Set routing for encrypted traffic on both DUT nodes
+| | ... | with prefix /8 and next hop of neighbour DUT or TG interface IPv4
+| | ... | address.
+| |
+| | Set interfaces in path up
+| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
+| | ... | ${dut1_if1_ip4} | 24
+| | VPP Interface Set IP Address | ${dut2} | ${dut2_if2}
+| | ... | ${dut2_if2_ip4} | 24
+| | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | ${tg_if1_ip4} | ${tg_if1_mac}
+| | VPP Add IP Neighbor | ${dut2} | ${dut2_if2} | ${tg_if2_ip4} | ${tg_if2_mac}
+| | Vpp Route Add | ${dut1} | ${laddr_ip4} | 8 | gateway=${tg_if1_ip4}
+| | ... | interface=${dut1_if1}
+| | Vpp Route Add | ${dut2} | ${raddr_ip4} | 8 | gateway=${tg_if2_ip4}
+| | ... | interface=${dut2_if2}
 
-| Tear down IPSec SW device functional test
+| Initialize IPSec in 3-node circular container topology
 | | [Documentation]
-| | ... | Tear down IPSec SW device functional test.
-| | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
-| | :FOR | ${dut} | IN | @{duts}
-| | | Run keyword | ${dut}.Restore Config
-| | Tear down VPP device test
+| | ... | Set UP state on VPP interfaces in path on nodes in 3-node circular
+| | ... | topology. Get the interface MAC addresses and setup ARP on all VPP
+| | ... | interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG and
+| | ... | DUT1-DUT2 links. Set routing for encrypted traffic on both DUT nodes
+| | ... | with prefix /8 and next hop of neighbour DUT or TG interface IPv4
+| | ... | address.
+| |
+| | Set interfaces in path up on DUT | DUT1
+| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
+| | ... | ${dut1_if1_ip4} | 24
+| | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | ${tg_if1_ip4} | ${tg_if1_mac}
+| | Vpp Route Add | ${dut1} | ${laddr_ip4} | 8 | gateway=${tg_if1_ip4}
+| | ... | interface=${dut1_if1}