fc70523cdda2250c78c6a512a7649d0571bbf391
[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 | | Compute Path
28 | | ${src_port} | ${src_node}= | First Interface
29 | | ${dst_port} | ${dst_node}= | Last Interface
30 | | Set Suite Variable | ${src_node}
31 | | Set Suite Variable | ${src_port}
32 | | Set Suite Variable | ${dst_node}
33 | | Set Suite Variable | ${dst_port}
34 | | Set Interface State | ${src_node} | ${src_port} | 'up'
35 | | Set Interface Ethernet MTU | ${src_node} | ${src_port} | 9000
36 | | ${adj_mac}= | Get interface mac | ${src_node} | ${src_port}
37 | | Config and Start SFC test | ${dst_node} | ${dst_port}
38 | | ... | ${adj_mac} | ${testtype}
39
40 | Node "${from_node}" interface "${from_port}" send "${size}" Bytes packet to node "${to_node}" interface "${to_port}" for "${type}" test
41 | | [Documentation] | At the first start the tcpdump on the TG node,
42 | | ... | then build the packet with the scapy and send the packet to the
43 | | ... | DUT node, DUT node will receive the packet on the ingress interface
44 | | ... | DUT will loopback packet to the TG after processed. TG will use
45 | | ... | the tcpdump to capture the packet and check the packet is correct.
46 | | ${filter_dst_ip}= | Set Variable | 192.168.50.71
47 | | Start the tcpdump on the Node | ${from_node} | ${from_port} | ${filter_dst_ip}
48 | | ${src_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.101 | 192.168.50.72
49 | | ${dst_ip}= | Set Variable If | "${type}" == "Classifier" | 10.10.12.100 | 192.168.50.76
50 | | ${src_mac}= | Get interface mac | ${from_node} | ${from_port}
51 | | ${dst_mac}= | Get interface mac | ${to_node} | ${to_port}
52 | | ${from_port_name}= | Get interface name | ${from_node} | ${from_port}
53 | | ${to_port_name}= | Get interface name | ${to_node} | ${to_port}
54 | | ${timeout}= | Set Variable | 10
55 | | ${frame_size}= | Convert To Integer | ${size}
56 | | ${args}= | Traffic Script Gen Arg | ${from_port_name} | ${from_port_name}
57 | |          | ...      | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
58 | | ${args}= | Catenate | ${args} | --framesize ${frame_size}
59 | |          | ...      | --timeout ${timeout} | --testtype "${type}"
60 | | Run Keyword If | "${type}" == "Classifier" | Run Traffic Script On Node
61 | | | | | ... | send_tcp_for_classifier_test.py | ${from_node} | ${args}
62 | | ... | ELSE IF | "${type}" == "Proxy Inbound" | Run Traffic Script On Node
63 | | | | | ... | send_vxlangpe_nsh_for_proxy_test.py | ${from_node} | ${args}
64 | | ... | ELSE IF | "${type}" == "Proxy Outbound" | Run Traffic Script On Node
65 | | | | | ... | send_vxlan_for_proxy_test.py | ${from_node} | ${args}
66 | | ... | ELSE | Run Traffic Script On Node | send_vxlangpe_nsh_for_sff_test.py
67 | | | | | ... | ${from_node} | ${args}