diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-11-12 05:27:43 +0100 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-11-28 18:26:21 +0100 |
commit | d68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch) | |
tree | 487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/robot/features | |
parent | ed0258a440cfad7023d643f717ab78ac568dc59b (diff) |
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/robot/features')
-rw-r--r-- | resources/libraries/robot/features/acl.robot | 70 | ||||
-rw-r--r-- | resources/libraries/robot/features/gbp.robot | 28 | ||||
-rw-r--r-- | resources/libraries/robot/features/policer.robot | 27 |
3 files changed, 66 insertions, 59 deletions
diff --git a/resources/libraries/robot/features/acl.robot b/resources/libraries/robot/features/acl.robot index a70a34c2db..fa94507994 100644 --- a/resources/libraries/robot/features/acl.robot +++ b/resources/libraries/robot/features/acl.robot @@ -19,17 +19,17 @@ | | [Documentation] | | ... | Configure MACIP ACL with required number of not-hitting permit ACEs | | ... | plus two hitting ACEs for both traffic directions. -| | ... +| | | | ... | *Arguments:* | | ... | - dut_node - DUT node. Type: dictionary | | ... | - dut_if1 - DUT node interface1 name (Optional). Type: string | | ... | - dut_if2 - DUT node interface2 name (Optional). Type: string -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Configure MACIP ACLs \| ${nodes['DUT1']} \| GigabitEthernet0/7/0 \ | | ... | \| GigabitEthernet0/8/0 \| -| | ... +| | | | ... | _NOTE:_ This KW uses following test case variables: | | ... | - src_ip_start - Source IP address start. Type: string | | ... | - ip_step - IP address step. Type: string @@ -52,23 +52,23 @@ | | ... | Type: string | | ... | - tg_mac_mask - MAC address mask for traffic streams. | | ... | 00:00:00:00:00:00 is a wildcard mask. Type: string -| | ... +| | | | [Arguments] | ${dut} | ${dut_if1}=${NONE} | ${dut_if2}=${NONE} -| | ... +| | | | ${src_ip_int} = | IP To Int | ${src_ip_start} | | ${src_ip_int} = | Evaluate | ${src_ip_int} - ${ip_step} -| | ... +| | | | ${ip_limit} = | Set Variable | 255.255.255.255 | | ${ip_limit_int} = | IP To Int | ${ip_limit} -| | ... +| | | | ${src_mac_int} = | Mac To Int | ${src_mac_start} | | ${src_mac_int} = | Evaluate | ${src_mac_int} - ${src_mac_step} -| | ... +| | | | ${mac_limit} = | Set Variable | ff:ff:ff:ff:ff:ff | | ${mac_limit_int} = | Mac To Int | ${mac_limit} -| | ... +| | | | ${acl}= | Set Variable | ipv4 permit -| | :FOR | ${nr} | IN RANGE | 0 | ${no_hit_aces_number} +| | FOR | ${nr} | IN RANGE | 0 | ${no_hit_aces_number} | | | ${src_ip_int} = | Evaluate | ${src_ip_int} + ${ip_step} | | | ${src_mac_int} = | Evaluate | ${src_mac_int} + ${src_mac_step} | | | ${ipv4_limit_reached}= | Set Variable If @@ -90,6 +90,7 @@ | | | ${acl}= | Catenate | ${acl} | ip ${src_ip}/32 | | | ... | mac ${src_mac} | mask ${src_mac_mask}, | | | Exit For Loop If | '${ipv4_limit_reached}' == '${TRUE}' or '${mac_limit_reached}' == '${TRUE}' +| | END | | ${acl0}= | Catenate | ${acl} | | ... | ipv4 ${acl_action} ip ${tg_stream1_subnet} mac ${tg_stream1_mac} | | ... | mask ${tg_mac_mask} @@ -109,17 +110,17 @@ | | [Documentation] | | ... | Configure ACL with required number of not-hitting permit ACEs plus two | | ... | hitting ACEs for both traffic directions. -| | ... +| | | | ... | *Arguments:* | | ... | - dut_node - DUT node. Type: dictionary | | ... | - dut_if1 - DUT node interface1 name (Optional). Type: string | | ... | - dut_if2 - DUT node interface2 name (Optional). Type: string -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Configure IPv4 ACLs \| ${nodes['DUT1']} \| GigabitEthernet0/7/0 \ | | ... | \| GigabitEthernet0/8/0 \| -| | ... +| | | | ... | _NOTE:_ This KW uses following test case variables: | | ... | - src_ip_start - Source IP address start. Type: string | | ... | - dst_ip_start - Destination IP address start. Type: string @@ -137,7 +138,7 @@ | | ... | Type: string | | ... | - trex_stream2_subnet - IP subnet used by T-Rex in direction 1->0. | | ... | Type: string -| | ... +| | | | [Arguments] | ${dut} | ${dut_if1}=${NONE} | ${dut_if2}=${NONE} | | ${src_ip_int} = | Evaluate | | ... | int(ipaddress.ip_address(unicode($src_ip_start))) - $ip_step @@ -152,7 +153,7 @@ | | ${dport}= | Evaluate | $dport_start - $port_step | | ${port_limit}= | Set Variable | ${65535} | | ${acl}= | Set Variable | ipv4 permit -| | :FOR | ${nr} | IN RANGE | 0 | ${no_hit_aces_number} +| | FOR | ${nr} | IN RANGE | 0 | ${no_hit_aces_number} | | | ${src_ip_int} = | Evaluate | $src_ip_int + $ip_step | | | ${dst_ip_int} = | Evaluate | $dst_ip_int + $ip_step | | | ${sport}= | Evaluate | $sport + $port_step @@ -184,6 +185,7 @@ | | | ... | sport ${sport} | dport ${dport}, | | | Exit For Loop If | | | ... | $ipv4_limit_reached is True or $udp_limit_reached is True +| | END | | ${acl}= | Catenate | ${acl} | | ... | ipv4 ${acl_action} src ${trex_stream1_subnet}, | | ... | ipv4 ${acl_action} src ${trex_stream2_subnet} @@ -203,28 +205,29 @@ | Configure ACLs on a single interface | | [Documentation] | | ... | Configure ACL -| | ... +| | | | ... | *Arguments:* | | ... | - dut - DUT node. Type: string | | ... | - dut_if - DUT node interface name. Type: string | | ... | - acl_apply_type - To what path apply the ACL - input or output. | | ... | - acl_action - Action for the rule - deny, permit, permit+reflect. | | ... | - subnets - Subnets to apply the specific ACL. Type: list -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Configure ACLs on a single interface \| ${nodes['DUT1']} | | ... | \| ... \| GigabitEthernet0/7/0 \| input \| permit | 0.0.0.0/0 -| | ... +| | | | [Arguments] | ${dut} | ${dut_if} | ${acl_apply_type} | ${acl_action} | | ... | @{subnets} | | Set Test variable | ${acl} | ${EMPTY} -| | :FOR | ${subnet} | IN | @{subnets} +| | FOR | ${subnet} | IN | @{subnets} | | | ${acl} = | Run Keyword If | '${acl}' == '${EMPTY}' | | | ... | Set Variable | ipv4 ${acl_action} src ${subnet} | | | ... | ELSE | | | ... | Catenate | SEPARATOR=", " | ${acl} | | | ... | ipv4 ${acl_action} src ${subnet} +| | END | | Add Replace Acl Multi Entries | ${dut} | rules=${acl} | | @{acl_list} = | Create List | ${0} | | Set Acl List For Interface | ${dut} | ${dut_if} | ${acl_apply_type} @@ -239,17 +242,17 @@ | | ... | on DUT1-DUT2 link and set routing on both DUT nodes with prefix /24 | | ... | and next hop of neighbour DUT interface IPv4 address. | | ... | Apply required ACL rules to DUT1 interfaces. -| | ... +| | | | ... | *Arguments:* | | ... | - ip_nr - Number of IPs to be used. Type: integer -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Initialize IPv4 routing fwith IPv4 ACLs on DUT1 \ | | ... | in 3-node circular topology \| -| | ... +| | | | [Arguments] | ${ip_nr}=${1} -| | ... +| | | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error | | ... | Variable Should Exist | ${dut2} | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS' @@ -258,21 +261,22 @@ | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Set Variable | ${dut2_if2} | | ... | ELSE | Set Variable | ${dut1_if2} -| | ... +| | | | Set interfaces in path up -| | ... -| | :FOR | ${number} | IN RANGE | 2 | ${ip_nr}+2 +| | +| | FOR | ${number} | IN RANGE | 2 | ${ip_nr}+2 | | | VPP Add IP Neighbor | | | ... | ${dut1} | ${dut1_if1} | 10.10.10.${number} | ${tg_if1_mac} | | | VPP Add IP Neighbor | | | ... | ${dut} | ${dut_if2} | 20.20.20.${number} | ${tg_if2_mac} +| | END | | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | VPP Add IP Neighbor | | ... | ${dut1} | ${dut1_if2} | 1.1.1.2 | ${dut2_if1_mac} | | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | VPP Add IP Neighbor | | ... | ${dut2} | ${dut2_if1} | 1.1.1.1 | ${dut1_if2_mac} -| | ... +| | | | VPP Interface Set IP Address | | ... | ${dut1} | ${dut1_if1} | 10.10.10.1 | 24 | | VPP Interface Set IP Address @@ -283,12 +287,12 @@ | | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | VPP Interface Set IP Address | | ... | ${dut2} | ${dut2_if1} | 1.1.1.2 | 30 -| | ... +| | | | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Vpp Route Add | ${dut1} | 20.20.20.0 | 24 | gateway=1.1.1.2 | | ... | interface=${dut1_if2} | | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Vpp Route Add | ${dut2} | 10.10.10.0 | 24 | gateway=1.1.1.1 | | ... | interface=${dut2_if1} -| | ... +| | | | Configure IPv4 ACLs | ${dut1} | ${dut1_if1} | ${dut1_if2} diff --git a/resources/libraries/robot/features/gbp.robot b/resources/libraries/robot/features/gbp.robot index 8495475639..57ddf6dd1a 100644 --- a/resources/libraries/robot/features/gbp.robot +++ b/resources/libraries/robot/features/gbp.robot @@ -13,26 +13,26 @@ *** Settings *** | Library | resources.libraries.python.GBP -| ... +| | Documentation | GBP keywords. *** Keywords *** | Initialize GBP routing domains on node | | [Documentation] | | ... | Initialize GBP routing domains on node. -| | ... +| | | | ... | *Arguments:* | | ... | - dut - DUT node. Type: string | | ... | - count - Number of baseline interface variables. Type: integer -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Initialize GBP routing domains on node \| DUT1 \| 1 \| -| | ... +| | | | [Arguments] | ${dut} | ${count}=${1} -| | ... +| | | | ${dut_str}= | Convert To Lowercase | ${dut} -| | :FOR | ${id} | IN RANGE | 1 | ${count} + 1 +| | FOR | ${id} | IN RANGE | 1 | ${count} + 1 | | | ${hexa_id}= | Convert To Hex | ${id} | length=2 | lowercase=yes | | | ${dut_lo}= | VPP Create Loopback | ${nodes['${dut}']} | | | ... | mac=ba:dc:00:ff:ee:${hexa_id} @@ -80,20 +80,22 @@ | | | ... | ${nodes['${dut}']} | ${200} | ${300} | acl_index=${0} | | | GBP Contract Add Del | | | ... | ${nodes['${dut}']} | ${300} | ${200} | acl_index=${0} +| | END | Initialize GBP routing domains | | [Documentation] | | ... | Initialize GBP routing domains on all DUTs. -| | ... +| | | | ... | *Arguments:* | | ... | - count - Number of GBP routing domains. Type: integer -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Initialize GBP routing domains \| 1 \| -| | ... +| | | | [Arguments] | ${count}=${1} -| | ... -| | :FOR | ${dut} | IN | @{duts} +| | +| | FOR | ${dut} | IN | @{duts} | | | Initialize GBP routing domains on node | ${dut} | count=${count} +| | END | | Set interfaces in path up diff --git a/resources/libraries/robot/features/policer.robot b/resources/libraries/robot/features/policer.robot index 962f4cf2be..bbabdd7632 100644 --- a/resources/libraries/robot/features/policer.robot +++ b/resources/libraries/robot/features/policer.robot @@ -14,7 +14,7 @@ *** Settings *** | Library | resources.libraries.python.Classify | Library | resources.libraries.python.Policer -| ... +| | Documentation | Policer keywords *** Keywords *** @@ -23,7 +23,7 @@ | | ... | Setup of 2r3c color-aware or color-blind policer with dst IPv4 match | | ... | on all DUT nodes in 2-node / 3-node circular topology. Policer is | | ... | applied on links TG - DUTx. -| | ... +| | | | ${policer_index}= | Policer Set Configuration | ${dut1} | policer1 | ${cir} | | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit | | ... | Mark_and_Transmit | Transmit | ${t} | exceed_dscp=${dscp} @@ -35,7 +35,7 @@ | | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} | | Policer Classify Set Interface | ${dut1} | ${dut1_if1} | | ... | ip4_table_index=${table_idx} -| | ... +| | | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error | | ... | Variable Should Exist | ${dut2} | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS' @@ -44,7 +44,7 @@ | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Set Variable | ${dut2_if2} | | ... | ELSE | Set Variable | ${dut1_if2} -| | ... +| | | | ${policer_index}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Policer Set Configuration | ${dut} | policer2 | ${cir} | | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit @@ -65,7 +65,7 @@ | | ... | Setup of 2r3c color-aware or color-blind policer with dst IPv6 match | | ... | on all DUT nodes in 2-node / 3-node circular topology. Policer is | | ... | applied on links TG - DUTx. -| | ... +| | | | ${policer_index}= | Policer Set Configuration | ${dut1} | policer1 | ${cir} | | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit | | ... | Mark_and_Transmit | Transmit | ${t} | exceed_dscp=${dscp} @@ -77,7 +77,7 @@ | | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} | | Policer Classify Set Interface | ${dut1} | ${dut1_if1} | | ... | ip6_table_index=${table_idx} -| | ... +| | | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error | | ... | Variable Should Exist | ${dut2} | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS' @@ -86,7 +86,7 @@ | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Set Variable | ${dut2_if2} | | ... | ELSE | Set Variable | ${dut1_if2} -| | ... +| | | | ${policer_index}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Policer Set Configuration | ${dut} | policer2 | ${cir} | | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit @@ -105,16 +105,17 @@ | Show Classify Tables Verbose on all DUTs | | [Documentation] | Show classify tables verbose on all DUT nodes in topology. -| | ... +| | | | ... | *Arguments:* | | ... | - nodes - Topology. Type: dictionary -| | ... +| | | | ... | *Example:* -| | ... +| | | | ... | \| Show Classify Tables Verbose on all DUTs \| ${nodes} \| -| | ... +| | | | [Arguments] | ${nodes} -| | ... +| | | | ${duts}= | Get Matches | ${nodes} | DUT* -| | :FOR | ${dut} | IN | @{duts} +| | FOR | ${dut} | IN | @{duts} | | | Show Classify Tables Verbose | ${nodes['${dut}']} +| | END |