From ac8b7ce3b05805a978b8186440e62dcd0d9023c3 Mon Sep 17 00:00:00 2001 From: selias Date: Wed, 21 Sep 2016 10:52:31 +0200 Subject: CSIT-235: Switched Port Analyzer mirroring (SPAN) - IPv4 - add library for SPAN setup - add telemetry traffic script and a keyword to run it - add "telemetry" folders for python and robot libraries - move IPFIX libraries to these new folders - add first SPAN test case, mirroring IPv4 ICMP packets Change-Id: Ibca35f724c13662bf80dce2d7e2649d1a0b8676a Signed-off-by: selias --- resources/libraries/robot/ipfix.robot | 111 ------------------------ resources/libraries/robot/telemetry/ipfix.robot | 111 ++++++++++++++++++++++++ resources/libraries/robot/telemetry/span.robot | 56 ++++++++++++ 3 files changed, 167 insertions(+), 111 deletions(-) delete mode 100644 resources/libraries/robot/ipfix.robot create mode 100644 resources/libraries/robot/telemetry/ipfix.robot create mode 100644 resources/libraries/robot/telemetry/span.robot (limited to 'resources/libraries/robot') diff --git a/resources/libraries/robot/ipfix.robot b/resources/libraries/robot/ipfix.robot deleted file mode 100644 index d8840a5261..0000000000 --- a/resources/libraries/robot/ipfix.robot +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright (c) 2016 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: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Traffic keywords""" - -*** Settings *** -| Library | resources.libraries.python.TrafficScriptExecutor -| Library | resources.libraries.python.InterfaceUtil -| Resource | resources/libraries/robot/default.robot -| Documentation | Traffic keywords - -*** Keywords *** -| Send packets and verify IPFIX -| | [Documentation] | Send simple TCP or UDP packets from source interface\ -| | ... | to destination interface. Listen for IPFIX flow report on source\ -| | ... | interface and verify received report against number of packets sent. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - dst_node - Destination node. Type: dictionary -| | ... | - src_int - Source interface. Type: string -| | ... | - dst_int - Destination interface. Type: string -| | ... | - src_ip - Source IP address. Type: string -| | ... | - dst_ip - Destination IP address. Type: string -| | ... | - protocol - TCP or UDP (Optional, default is TCP). Type: string -| | ... | - port - Source and destination ports to use -| | ... | (Optional, default is port 20). Type: integer -| | ... | - count - Number of packets to send -| | ... | (Optional, default is one packet). Type: integer -| | ... | - timeout - Timeout value in seconds (Optional, default is 10 sec). -| | ... | Should be at least twice the configured IPFIX flow report interval. -| | ... | Type: integer -| | ... -| | ... | *Return:* -| | ... -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ -| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| UDP \ -| | ... | \| ${20} \| ${5} \| ${10} \| -| | ... | -| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | -| | ... | ${src_ip} | ${dst_ip} | ${protocol}=tcp | ${port}=20 | ${count}=1 -| | ... | ${timeout}=${10} -| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} -| | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_int} -| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} -| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} -| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${args}= | Set Variable -| | ... | ${args} --protocol ${protocol} --port ${port} --count ${count} -| | Run Traffic Script On Node | ipfix_check.py | ${tg_node} | ${args} -| | ... | ${timeout} - -| Send session sweep and verify IPFIX -| | [Documentation] | Send simple TCP or UDP packets from source interface\ -| | ... | to destination interface using a range of source addresses. Listen\ -| | ... | for IPFIX flow report on source interface and verify received report\ -| | ... | against number of packets sent from each source address. -| | ... -| | ... | *Arguments:* -| | ... -| | ... | - tg_node - TG node. Type: dictionary -| | ... | - dst_node - Destination node. Type: dictionary -| | ... | - src_int - Source interface. Type: string -| | ... | - dst_int - Destination interface. Type: string -| | ... | - src_ip - Source IP address. Type: string -| | ... | - dst_ip - Destination IP address. Type: string -| | ... | - ip_range - Number of sequential source addresses. Type:integer -| | ... | - protocol - TCP or UDP (Optional, defaults to TCP). Type: string -| | ... | - port - Source and destination ports to use (Optional). Type: integer -| | ... | - count - Number of packets to send (Optional). Type: integer -| | ... | - timeout - Timeout value in seconds (optional). Type:integer -| | ... -| | ... | *Return:* -| | ... -| | ... | - No value returned -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ -| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| 20 \| -| | ... | UDP \| ${20} \| ${5} \| ${10} \| -| | ... | -| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | -| | ... | ${src_ip} | ${dst_ip} | ${ip_range} | ${protocol}=tcp | ${port}=20 -| | ... | ${count}=${1} | ${timeout}=${10} -| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} -| | ${dst_mac}= | Set Variable | ${dut1_to_tg_mac} -| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} -| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} -| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} -| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} -| | ${args}= | Set Variable | ${args} --protocol ${protocol} --port ${port} -| | ${args}= | Set Variable | ${args} --count ${count} --sessions ${ip_range} -| | Run Traffic Script On Node | ipfix_sessions.py | ${tg_node} | ${args} -| | ... | ${timeout} \ No newline at end of file diff --git a/resources/libraries/robot/telemetry/ipfix.robot b/resources/libraries/robot/telemetry/ipfix.robot new file mode 100644 index 0000000000..5248964f29 --- /dev/null +++ b/resources/libraries/robot/telemetry/ipfix.robot @@ -0,0 +1,111 @@ +# Copyright (c) 2016 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: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""IPFIX keywords""" + +*** Settings *** +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.InterfaceUtil +| Resource | resources/libraries/robot/default.robot +| Documentation | Traffic keywords + +*** Keywords *** +| Send packets and verify IPFIX +| | [Documentation] | Send simple TCP or UDP packets from source interface\ +| | ... | to destination interface. Listen for IPFIX flow report on source\ +| | ... | interface and verify received report against number of packets sent. +| | ... +| | ... | *Arguments:* +| | ... +| | ... | - tg_node - TG node. Type: dictionary +| | ... | - dst_node - Destination node. Type: dictionary +| | ... | - src_int - Source interface. Type: string +| | ... | - dst_int - Destination interface. Type: string +| | ... | - src_ip - Source IP address. Type: string +| | ... | - dst_ip - Destination IP address. Type: string +| | ... | - protocol - TCP or UDP (Optional, default is TCP). Type: string +| | ... | - port - Source and destination ports to use +| | ... | (Optional, default is port 20). Type: integer +| | ... | - count - Number of packets to send +| | ... | (Optional, default is one packet). Type: integer +| | ... | - timeout - Timeout value in seconds (Optional, default is 10 sec). +| | ... | Should be at least twice the configured IPFIX flow report interval. +| | ... | Type: integer +| | ... +| | ... | *Return:* +| | ... +| | ... | - No value returned +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ +| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| UDP \ +| | ... | \| ${20} \| ${5} \| ${10} \| +| | ... | +| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | +| | ... | ${src_ip} | ${dst_ip} | ${protocol}=tcp | ${port}=20 | ${count}=1 +| | ... | ${timeout}=${10} +| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} +| | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_int} +| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} +| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} +| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} +| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} +| | ${args}= | Set Variable +| | ... | ${args} --protocol ${protocol} --port ${port} --count ${count} +| | Run Traffic Script On Node | ipfix_check.py | ${tg_node} | ${args} +| | ... | ${timeout} + +| Send session sweep and verify IPFIX +| | [Documentation] | Send simple TCP or UDP packets from source interface\ +| | ... | to destination interface using a range of source addresses. Listen\ +| | ... | for IPFIX flow report on source interface and verify received report\ +| | ... | against number of packets sent from each source address. +| | ... +| | ... | *Arguments:* +| | ... +| | ... | - tg_node - TG node. Type: dictionary +| | ... | - dst_node - Destination node. Type: dictionary +| | ... | - src_int - Source interface. Type: string +| | ... | - dst_int - Destination interface. Type: string +| | ... | - src_ip - Source IP address. Type: string +| | ... | - dst_ip - Destination IP address. Type: string +| | ... | - ip_range - Number of sequential source addresses. Type:integer +| | ... | - protocol - TCP or UDP (Optional, defaults to TCP). Type: string +| | ... | - port - Source and destination ports to use (Optional). Type: integer +| | ... | - count - Number of packets to send (Optional). Type: integer +| | ... | - timeout - Timeout value in seconds (optional). Type:integer +| | ... +| | ... | *Return:* +| | ... +| | ... | - No value returned +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Send packets and verify IPFIX \| ${nodes['TG']} | ${nodes['DUT1']}\ +| | ... | \| eth1 \| GigabitEthernet0/8/0 \| 16.0.0.1 \| 192.168.0.2 \| 20 \| +| | ... | UDP \| ${20} \| ${5} \| ${10} \| +| | ... | +| | [Arguments] | ${tg_node} | ${dst_node} | ${src_int} | ${dst_int} | +| | ... | ${src_ip} | ${dst_ip} | ${ip_range} | ${protocol}=tcp | ${port}=20 +| | ... | ${count}=${1} | ${timeout}=${10} +| | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int} +| | ${dst_mac}= | Set Variable | ${dut1_to_tg_mac} +| | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int} +| | ${dst_int_name}= | Get interface name | ${dst_node} | ${dst_int} +| | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} +| | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip} +| | ${args}= | Set Variable | ${args} --protocol ${protocol} --port ${port} +| | ${args}= | Set Variable | ${args} --count ${count} --sessions ${ip_range} +| | Run Traffic Script On Node | ipfix_sessions.py | ${tg_node} | ${args} +| | ... | ${timeout} \ No newline at end of file diff --git a/resources/libraries/robot/telemetry/span.robot b/resources/libraries/robot/telemetry/span.robot new file mode 100644 index 0000000000..d994e95e3e --- /dev/null +++ b/resources/libraries/robot/telemetry/span.robot @@ -0,0 +1,56 @@ +# Copyright (c) 2016 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: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.topology.Topology +| Documentation | SPAN traffic keywords + +*** Keywords *** +| Send Packet And Check Received Copies +| | [Documentation] | Sends an ARP or ICMP packet from TG to DUT using one\ +| | ... | link, then receive a copy of both the sent packet and the DUT's reply\ +| | ... | on the second link. +| | ... +| | ... | *Arguments:* +| | ... +| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary +| | ... | - tx_src_port - First interface on TG. Type: string +| | ... | - tx_src_mac - MAC address of the first interface on TG. Type: string +| | ... | - tx_dst_mac - MAC address of the first interface on DUT. Type: string +| | ... | - rx_port - Second interface on TG. Type: string +| | ... | - src_ip - Packet source IP address. Type: string +| | ... | - dst_ip - Packet destination IP address. Type: string +| | ... | - ptype - Type of payload, ARP or ICMP. Type: string +| | ... +| | ... | *Return:* +| | ... | - No value returned +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Send Packet And Check Received Copies \| ${nodes['TG']} \| eth1 \ +| | ... | \| 8:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \ +| | ... | \| eth3 \| 192.168.0.2 \| 192.168.0.3 \| ARP \| +| | ... +| | [Arguments] | ${tg_node} | ${tx_src_port} +| | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_port} +| | ... | ${src_ip} | ${dst_ip} | ${ptype} +| | ${tx_port_name}= | Get interface name | ${tg_node} | ${tx_src_port} +| | ${rx_port_name}= | Get interface name | ${tg_node} | ${rx_port} +| | ${args}= | Catenate +| | ... | --tg_src_mac ${tx_src_mac} --dut_if1_mac ${tx_dst_mac} +| | ... | --src_ip ${src_ip} --dst_ip ${dst_ip} +| | ... | --tx_if ${tx_port_name} --rx_if | ${rx_port_name} +| | ... | --ptype ${ptype} +| | Run Traffic Script On Node | span_check.py | ${tg_node} | +| | ... | ${args} \ No newline at end of file -- cgit 1.2.3-korg