aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/shared
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/robot/shared')
-rw-r--r--resources/libraries/robot/shared/default.robot1
-rw-r--r--resources/libraries/robot/shared/traffic.robot55
2 files changed, 56 insertions, 0 deletions
diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot
index 93aa3976a2..58bbb97acb 100644
--- a/resources/libraries/robot/shared/default.robot
+++ b/resources/libraries/robot/shared/default.robot
@@ -25,6 +25,7 @@
| Library | resources.libraries.python.CpuUtils
| Library | resources.libraries.python.CoreDumpUtil
| Library | resources.libraries.python.DUTSetup
+| Library | resources.libraries.python.FlowUtil
| Library | resources.libraries.python.L2Util
| Library | resources.libraries.python.InterfaceUtil
| Library | resources.libraries.python.IPUtil
diff --git a/resources/libraries/robot/shared/traffic.robot b/resources/libraries/robot/shared/traffic.robot
index bd8edcf751..af348bb12e 100644
--- a/resources/libraries/robot/shared/traffic.robot
+++ b/resources/libraries/robot/shared/traffic.robot
@@ -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}