64d31a98975cd0743a9328ed41c3ee801651fe29
[csit.git] / resources / libraries / robot / nsh_sfc / default.robot
1 # Copyright (c) 2017 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Variables | resources/libraries/python/topology.py
16 | Library | resources.libraries.python.topology.Topology
17 | Library | resources.libraries.python.InterfaceUtil
18 | Library | resources.libraries.python.SFC.SFCTest
19 | Library | Collections
20
21 *** Keywords ***
22 | Setup DUT nodes for '${type}' functional testing
23 | | [Documentation] | Configure and Start the SFC functional test
24 | | ... | on the DUT node.
25 | | ${testtype}= | Convert to String | ${type}
26 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
27 | | ... | ${nodes['TG']}
28 | | Compute Path | always_same_link=${FALSE}
29 | | ${tg_to_dut_if1} | ${tg_node}= | First Interface
30 | | ${tg_to_dut_if2} | ${tg_node}= | Last Interface
31 | | ${dut_to_tg_if1} | ${dut_node}= | First Ingress Interface
32 | | ${dut_to_tg_if2} | ${dut_node}= | Last Egress Interface
33 | | ${tg_to_dut_if1_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if1}
34 | | ${tg_to_dut_if2_mac}= | Get interface mac | ${tg_node} | ${tg_to_dut_if2}
35 | | ${dut_to_tg_if1_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if1}
36 | | ${dut_to_tg_if2_mac}= | Get interface mac | ${dut_node} | ${dut_to_tg_if2}
37 | | Set Suite Variable | ${tg_to_dut_if1}
38 | | Set Suite Variable | ${tg_to_dut_if2}
39 | | Set Suite Variable | ${dut_to_tg_if1}
40 | | Set Suite Variable | ${dut_to_tg_if2}
41 | | Set Suite Variable | ${tg_to_dut_if1_mac}
42 | | Set Suite Variable | ${tg_to_dut_if2_mac}
43 | | Set Suite Variable | ${dut_to_tg_if1_mac}
44 | | Set Suite Variable | ${dut_to_tg_if2_mac}
45 | | Set Suite Variable | ${tg_node}
46 | | Set Suite Variable | ${dut_node}
47 | | Set Interface State | ${tg_node} | ${tg_to_dut_if1} | 'up'
48 | | Set Interface State | ${tg_node} | ${tg_to_dut_if2} | 'up'
49 | | Set Interface Ethernet MTU | ${tg_node} | ${tg_to_dut_if1} | 9000
50 | | Set Interface Ethernet MTU | ${tg_node} | ${tg_to_dut_if2} | 9000
51 | | Config and Start SFC test | ${dut_node} | ${dut_to_tg_if1}
52 | | ... | ${dut_to_tg_if2} | ${tg_to_dut_if1_mac} | ${tg_to_dut_if2_mac}
53 | | ... | ${testtype}
54
55
56 | Node "${from_node}" interface "${from_port}" send "${size}" Bytes packet to node "${to_node}" interface "${to_port}" for "${type}" test
57 | | [Documentation] | At the first start the tcpdump on the TG node,
58 | | ... | then build the packet with the scapy and send the packet to the
59 | | ... | DUT node, DUT node will receive the packet on the ingress interface
60 | | ... | DUT will loopback packet to the TG after processed. TG will use
61 | | ... | the tcpdump to capture the packet and check the packet is correct.
62 | | ${src_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.101 | 192.168.50.72
63 | | ${dst_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.100 | 192.168.50.76
64 | | ${src_mac}= | Get interface mac | ${from_node} | ${from_port}
65 | | ${dst_mac}= | Get interface mac | ${to_node} | ${to_port}
66 | | ${tx_port_name}= | Get interface name | ${from_node} | ${from_port}
67 | | ${rx_port_name}= | Get interface name | ${from_node} | ${tg_to_dut_if2}
68 | | ${timeout}= | Set Variable | 10
69 | | ${frame_size}= | Convert To Integer | ${size}
70 | | ${args}= | Traffic Script Gen Arg | ${rx_port_name} | ${tx_port_name}
71 | |          | ...      | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
72 | | ${args}= | Catenate | ${args} | --framesize ${frame_size}
73 | |          | ...      | --timeout ${timeout} | --testtype "${type}"
74 | | Run Keyword If | "${type}" == "Classifier" | Run Traffic Script On Node
75 | | | | | ... | send_tcp_for_classifier_test.py | ${from_node} | ${args}
76 | | ... | ELSE IF | "${type}" == "Proxy Inbound" | Run Traffic Script On Node
77 | | | | | ... | send_vxlangpe_nsh_for_proxy_test.py | ${from_node} | ${args}
78 | | ... | ELSE IF | "${type}" == "Proxy Outbound" | Run Traffic Script On Node
79 | | | | | ... | send_vxlan_for_proxy_test.py | ${from_node} | ${args}
80 | | ... | ELSE | Run Traffic Script On Node | send_vxlangpe_nsh_for_sff_test.py
81 | | | | | ... | ${from_node} | ${args}