X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Ffeatures%2Fpolicer.robot;h=84296eb79ac0a9a8c429b414805db3cfdc20c1d7;hb=7829fea4a2c8936513fa95215b7d84997f814a69;hp=321488b8c5a4bf145202dc2d99f7d56180b80db4;hpb=6721e7f09aa95bff6622068332a3f56afad9c87b;p=csit.git diff --git a/resources/libraries/robot/features/policer.robot b/resources/libraries/robot/features/policer.robot index 321488b8c5..84296eb79a 100644 --- a/resources/libraries/robot/features/policer.robot +++ b/resources/libraries/robot/features/policer.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2016 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: @@ -12,88 +12,110 @@ # limitations under the License. *** Settings *** -| Resource | resources/libraries/robot/shared/default.robot -| Resource | resources/libraries/robot/shared/testing_path.robot +| Library | resources.libraries.python.Classify | Library | resources.libraries.python.Policer -| Library | resources.libraries.python.InterfaceUtil -| Library | resources.libraries.python.IPv4Util -| Library | resources.libraries.python.TrafficScriptExecutor -| Library | resources.libraries.python.IPv6Util -| Library | resources.libraries.python.IPv6Setup -| Library | resources.libraries.python.IPv4Setup.Dut | ${nodes['DUT1']} -| ... | WITH NAME | dut1_v4 -| Documentation | *Policer keywords* +| +| Documentation | Policer keywords *** Keywords *** -| Configure topology for IPv4 policer test -| | [Documentation] | Setup topology for IPv4 policer testing. -| | ... -| | ... | _NOTE:_ This KW sets following test case variables: -| | ... | - dut_to_tg_if1_ip - DUT first interface IP address. Type: string -| | ... | - dut_to_tg_if2_ip - DUT second interface IP address. Type: string -| | ... | - tg_to_dut_if1_ip - TG first interface IP address. Type: string -| | ... | - tg_to_dut_if2_ip - TG second interface IP address. Type: string -| | Configure path in 2-node circular topology | ${nodes['TG']} | ${nodes['DUT1']} -| | ... | ${nodes['TG']} -| | Set interfaces in 2-node circular topology up -| | Set Interface Address | ${dut_node} | ${dut_to_tg_if1} -| | ... | ${dut_to_tg_if1_ip4} | ${ip4_plen} -| | Set Interface Address | ${dut_node} | ${dut_to_tg_if2} -| | ... | ${dut_to_tg_if2_ip4} | ${ip4_plen} -| | dut1_v4.Set ARP | ${dut_to_tg_if2} | ${tg_to_dut_if2_ip4} -| | ... | ${tg_to_dut_if2_mac} -| | Set Test Variable | ${dut_to_tg_if1_ip} | ${dut_to_tg_if1_ip4} -| | Set Test Variable | ${dut_to_tg_if2_ip} | ${dut_to_tg_if2_ip4} -| | Set Test Variable | ${tg_to_dut_if1_ip} | ${tg_to_dut_if1_ip4} -| | Set Test Variable | ${tg_to_dut_if2_ip} | ${tg_to_dut_if2_ip4} +| Initialize IPv4 policer 2r3c-${t} in circular topology +| | [Documentation] +| | ... | 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} +| | ${table_idx} | ${skip_n} | ${match_n}= | Vpp Creates Classify Table L3 +| | ... | ${dut1} | ip4 | dst | 255.255.255.255 +| | ${pre_color}= | Policer Classify Get Precolor | exceed_color +| | Vpp Configures Classify Session L3 | ${dut1} | permit | ${table_idx} +| | ... | ${skip_n} | ${match_n} | ip4 | dst | 20.20.20.2 +| | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} +| | Policer Classify Set Interface +| | ... | ${dut1} | ${DUT1_${int}1}[0] +| | ... | ip4_table_index=${table_idx} +| | +| | ${dut2_status} | ${value}= | Run Keyword And Ignore Error +| | ... | Variable Should Exist | ${dut2} +| | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Set Variable | ${dut2} +| | ... | ELSE | Set Variable | ${dut1} +| | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Set Variable | ${DUT2_${int}2}[0] +| | ... | ELSE | Set Variable | ${DUT1_${int}2}[0] +| | +| | ${policer_index}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Policer Set Configuration | ${dut} | policer2 | ${cir} +| | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit +| | ... | Mark_and_Transmit | Transmit | ${t} | exceed_dscp=${dscp} +| | ... | ELSE | Set Variable | ${policer_index} +| | ${table_idx} | ${skip_n} | ${match_n}= +| | ... | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Vpp Creates Classify Table L3 | ${dut} | ip4 | dst | 255.255.255.255 +| | ... | ELSE | Set Variable | ${table_idx} | ${skip_n} | ${match_n} +| | Vpp Configures Classify Session L3 | ${dut} | permit | ${table_idx} +| | ... | ${skip_n} | ${match_n} | ip4 | dst | 10.10.10.2 +| | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} +| | Policer Classify Set Interface | ${dut} | ${dut_if2} +| | ... | ip4_table_index=${table_idx} -| Configure topology for IPv6 policer test -| | [Documentation] | Setup topology for IPv6 policer testing. -| | ... -| | ... | _NOTE:_ This KW sets following test case variables: -| | ... | - dut_to_tg_if1_ip - DUT first interface IP address. Type: string -| | ... | - dut_to_tg_if2_ip - DUT second interface IP address. Type: string -| | ... | - tg_to_dut_if1_ip - TG first interface IP address. Type: string -| | ... | - tg_to_dut_if2_ip - TG second interface IP address. Type: string -| | Configure path in 2-node circular topology | ${nodes['TG']} | ${nodes['DUT1']} -| | ... | ${nodes['TG']} -| | Set interfaces in 2-node circular topology up -| | Vpp Set If IPv6 Addr | ${dut_node} | ${dut_to_tg_if1} -| | ... | ${dut_to_tg_if1_ip6} | ${ip6_plen} -| | Vpp Set If IPv6 Addr | ${dut_node} | ${dut_to_tg_if2} -| | ... | ${dut_to_tg_if2_ip6} | ${ip6_plen} -| | Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${tg_to_dut_if2_ip6} -| | ... | ${tg_to_dut_if2_mac} -| | Vpp All RA Suppress Link Layer | ${nodes} -| | Set Test Variable | ${dut_to_tg_if1_ip} | ${dut_to_tg_if1_ip6} -| | Set Test Variable | ${dut_to_tg_if2_ip} | ${dut_to_tg_if2_ip6} -| | Set Test Variable | ${tg_to_dut_if1_ip} | ${tg_to_dut_if1_ip6} -| | Set Test Variable | ${tg_to_dut_if2_ip} | ${tg_to_dut_if2_ip6} +| Initialize IPv6 policer 2r3c-${t} in circular topology +| | [Documentation] +| | ... | 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} +| | ${table_idx} | ${skip_n} | ${match_n}= | Vpp Creates Classify Table L3 +| | ... | ${dut1} | ip6 | dst | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +| | ${pre_color}= | Policer Classify Get Precolor | exceed_color +| | Vpp Configures Classify Session L3 | ${dut1} | permit | ${table_idx} +| | ... | ${skip_n} | ${match_n} | ip6 | dst | 2001:2::2 +| | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} +| | Policer Classify Set Interface | ${dut1} | ${DUT1_${int}1}[0] +| | ... | ip6_table_index=${table_idx} +| | +| | ${dut2_status} | ${value}= | Run Keyword And Ignore Error +| | ... | Variable Should Exist | ${dut2} +| | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Set Variable | ${dut2} +| | ... | ELSE | Set Variable | ${dut1} +| | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Set Variable | ${DUT2_${int}2}[0] +| | ... | ELSE | Set Variable | ${DUT1_${int}2}[0] +| | +| | ${policer_index}= | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Policer Set Configuration | ${dut} | policer2 | ${cir} +| | ... | ${eir} | ${cb} | ${eb} | pps | Closest | 2R3C_RFC_2698 | Transmit +| | ... | Mark_and_Transmit | Transmit | ${t} | exceed_dscp=${dscp} +| | ... | ELSE | Set Variable | ${policer_index} +| | ${table_idx} | ${skip_n} | ${match_n}= +| | ... | Run Keyword If | '${dut2_status}' == 'PASS' +| | ... | Vpp Creates Classify Table L3 +| | ... | ${dut} | ip6 | dst | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff +| | ... | ELSE | Set Variable | ${table_idx} | ${skip_n} | ${match_n} +| | Vpp Configures Classify Session L3 | ${dut} | permit | ${table_idx} +| | ... | ${skip_n} | ${match_n} | ip6 | dst | 2001:1::2 +| | ... | hit_next_index=${policer_index} | opaque_index=${pre_color} +| | Policer Classify Set Interface | ${dut} | ${dut_if2} +| | ... | ip6_table_index=${table_idx} -| Send packet and verify marking -| | [Documentation] | Send packet and verify DSCP of the received packet. -| | ... +| Show Classify Tables Verbose on all DUTs +| | [Documentation] | Show classify tables verbose on all DUT nodes in topology. +| | | | ... | *Arguments:* -| | ... | - node - TG node. Type: dictionary -| | ... | - tx_if - TG transmit interface. Type: string -| | ... | - rx_if - TG receive interface. Type: string -| | ... | - src_mac - Packet source MAC. Type: string -| | ... | - dst_mac - Packet destination MAC. Type: string -| | ... | - src_ip - Packet source IP address. Type: string -| | ... | - dst_ip - Packet destination IP address. Type: string -| | ... | - dscp - DSCP value to verify. Type: enum -| | ... +| | ... | - nodes - Topology. Type: dictionary +| | | | ... | *Example:* -| | ... | \| ${dscp}= \| DSCP AF22 \| -| | ... | \| 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 \| ${dscp} \| -| | [Arguments] | ${node} | ${tx_if} | ${rx_if} | ${src_mac} | ${dst_mac} -| | ... | ${src_ip} | ${dst_ip} | ${dscp} -| | ${tx_if_name}= | Get Interface Name | ${node} | ${tx_if} -| | ${rx_if_name}= | Get Interface Name | ${node} | ${rx_if} -| | ${args}= | Traffic Script Gen Arg | ${rx_if_name} | ${tx_if_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${dscp_num}= | Get DSCP Num Value | ${dscp} -| | ${args}= | Set Variable | ${args} --dscp ${dscp_num} -| | Run Traffic Script On Node | policer.py | ${node} | ${args} +| | +| | ... | \| Show Classify Tables Verbose on all DUTs \| ${nodes} \| +| | +| | [Arguments] | ${nodes} +| | +| | FOR | ${dut} | IN | @{duts} +| | | Show Classify Tables Verbose | ${nodes['${dut}']} +| | END