X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Fshared%2Ftraffic.robot;h=af348bb12ed82cd1afe48a2b6cbd3e95a3b5192e;hb=585b2e3c08cb87badfe702eb29300634c761a17b;hp=08f579c9dfd9a1863aae9779a2324384cecce158;hpb=a9f54ca5080aeef17686f300a6807bf9b46b7c90;p=csit.git diff --git a/resources/libraries/robot/shared/traffic.robot b/resources/libraries/robot/shared/traffic.robot index 08f579c9df..af348bb12e 100644 --- a/resources/libraries/robot/shared/traffic.robot +++ b/resources/libraries/robot/shared/traffic.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2020 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: @@ -652,3 +652,58 @@ | | ... | --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} + +| Send flow packet and verify action +| | [Documentation] | Send packet and verify the correctness of flow action. +| | +| | ... | *Arguments:* +| | +| | ... | _NOTE:_ Arguments are based on topology: +| | ... | TG(if1)->(if1)DUT +| | +| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary +| | ... | - tx_interface - TG Interface 1. Type: string +| | ... | - tx_dst_mac - MAC address of DUT-if1. Type: string +| | ... | - flow_type - Flow packet type. Type: string +| | ... | - proto - Flow packet protocol. Type: string +| | ... | - src_ip - Source ip address. Type: string +| | ... | - dst_ip - Destination IP address. Type: string +| | ... | - src_port - Source port. Type: int +| | ... | - dst_port - Destination port. Type: int +| | ... | - value - Additional packet value. Type: integer +| | ... | - traffic_script - Traffic script that send packet. Type: string +| | ... | - action - drop, mark or redirect-to-queue. Type: string +| | ... | - action_value - action value. Type: integer +| | +| | ... | *Return:* +| | ... | - No value returned +| | +| | ... | *Example:* +| | ... | \| Send flow packet and verify actions \| ${nodes['TG']} \| eth2 \ +| | ... | \| 08:00:27:a2:52:5b \| IP4 \| UDP \ +| | ... | \| src_ip=1.1.1.1 \| dst_ip=2.2.2.2 \ +| | ... | \| src_port=${100} \| dst_port=${200} \ +| | ... | \| traffic_script=send_flow_packet \ +| | ... | \|action=mark \| action_value=${3} \| +| | +| | [Arguments] | ${tg_node} | ${tx_interface} | ${tx_dst_mac} +| | ... | ${flow_type} | ${proto} +| | ... | ${src_ip}=${None} | ${dst_ip}=${None} +| | ... | ${src_port}=${None} | ${dst_port}=${None} +| | ... | ${value}=${None} +| | ... | ${traffic_script}=send_flow_packet +| | ... | ${action}=redirect-to-queue +| | ... | ${action_value}=${3} +| | +| | ${tx_src_mac}= | Get Interface Mac | ${tg_node} | ${tx_interface} +| | ${tx_if_name}= | Get interface name | ${tg_node} | ${tx_interface} +| | ${args}= | Catenate +| | ... | --tg_if1_mac ${tx_src_mac} | --dut_if1_mac ${tx_dst_mac} +| | ... | --tx_if ${tx_if_name} | --flow_type ${flow_type} | --proto ${proto} +| | ... | --src_ip ${src_ip} | --dst_ip ${dst_ip} +| | ... | --src_port ${src_port} | --dst_port ${dst_port} +| | ... | --value ${value} +| | Run Traffic Script On Node | ${traffic_script}.py | ${tg_node} | ${args} +| | Vpp Verify Flow action | ${dut1} | ${action} | ${action_value} +| | ... | ${tx_src_mac} | ${tx_dst_mac} +| | ... | ${src_ip} | ${dst_ip}