Add library for set path variables for testing.
[csit.git] / tests / suites / ipv4 / ipv4_iacl_untagged.robot
1 # Copyright (c) 2016 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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/counters.robot
17 | Resource | resources/libraries/robot/interfaces.robot
18 | Resource | resources/libraries/robot/testing_path.robot
19 | Resource | resources/libraries/robot/ipv4.robot
20 | Resource | resources/libraries/robot/l2_xconnect.robot
21 | Resource | resources/libraries/robot/traffic.robot
22 | Library | resources.libraries.python.Classify.Classify
23 | Library | resources.libraries.python.Trace
24
25 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO
26 | Suite Setup | Run Keywords | Setup all TGs before traffic script
27 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
28 | Test Setup | Setup all DUTs before test
29 | Test Teardown | Show packet trace on all DUTs | ${nodes}
30
31 *** Variables ***
32 | ${dut1_to_tg_ip}= | 192.168.1.1
33 | ${dut1_to_dut2_ip}= | 192.168.2.1
34 | ${dut1_to_dut2_ip_GW}= | 192.168.2.2
35 | ${test_dst_ip}= | 32.0.0.1
36 | ${test_src_ip}= | 16.0.0.1
37 | ${prefix_length}= | 24
38
39 *** Test Cases ***
40 | VPP drops packets based on IPv4 source addresses
41 | | [Documentation] | Create classify table on VPP, add source IP address
42 | | ...             | of traffic into table and setup 'deny' traffic
43 | | ...             | and check if traffic is dropped.
44 | | Given Path for 3-node testing is set
45 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
46 | | And Interfaces in 3-node path are up
47 | | And Set Interface Address | ${dut1_node}
48 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
49 | | And Set Interface Address | ${dut1_node}
50 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
51 | | ${table_index} | ${skip_n} | ${match_n}= | When Vpp Create Classify Table
52 | | ... | ${dut1_node} | ip4 | src
53 | | And Vpp Configure Classify Session
54 | | ... | ${dut1_node} | deny | ${table_index} | ${skip_n} | ${match_n}
55 | | ... | ip4 | src | ${test_src_ip}
56 | | And Vpp Enable Input Acl Interface
57 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${table_index}
58 | | And Add Arp On Dut
59 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
60 | | ... | ${tg_to_dut2_mac}
61 | | And Vpp Route Add
62 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
63 | | ... | ${dut1_to_dut2_ip_GW} | ${dut1_to_dut2}
64 | | And L2 setup xconnect on DUT
65 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
66 | | Then Send packet from Port to Port should failed | ${tg_node}
67 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
68 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2}
69 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
70
71
72 | VPP drops packets based on IPv4 destination addresses
73 | | [Documentation] | Create classify table on VPP, add destination IP address
74 | | ...             | of traffic into table and setup 'deny' traffic
75 | | ...             | and check if traffic is dropped.
76 | | Given Path for 3-node testing is set
77 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
78 | | And Interfaces in 3-node path are up
79 | | And Set Interface Address | ${dut1_node}
80 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
81 | | And Set Interface Address | ${dut1_node}
82 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
83 | | ${table_index} | ${skip_n} | ${match_n}= | When Vpp Create Classify Table
84 | | ... | ${dut1_node} | ip4 | dst
85 | | And Vpp Configure Classify Session
86 | | ... | ${dut1_node} | deny | ${table_index} | ${skip_n} | ${match_n}
87 | | ... | ip4 | dst | ${test_dst_ip}
88 | | And Vpp Enable Input Acl Interface
89 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${table_index}
90 | | And Add Arp On Dut
91 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
92 | | ... | ${tg_to_dut2_mac}
93 | | And Vpp Route Add
94 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
95 | | ... | ${dut1_to_dut2_ip_GW} | ${dut1_to_dut2}
96 | | And L2 setup xconnect on DUT
97 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
98 | | Then Send packet from Port to Port should failed | ${tg_node}
99 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
100 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2}
101 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
102
103
104 | VPP drops packets based on IPv4 src-addr and dst-addr
105 | | [Documentation] | Create classify table on VPP, add source and destination
106 | | ...             | IP address of traffic into table and setup 'deny' traffic
107 | | ...             | and check if traffic is dropped.
108 | | Given Path for 3-node testing is set
109 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
110 | | And Interfaces in 3-node path are up
111 | | And Set Interface Address | ${dut1_node}
112 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
113 | | And Set Interface Address | ${dut1_node}
114 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
115 | | ${table_index_1} | ${skip_n_1} | ${match_n_1}=
116 | | ... | When Vpp Create Classify Table | ${dut1_node} | ip4 | src
117 | | ${table_index_2} | ${skip_n_2} | ${match_n_2}=
118 | | ... | When Vpp Create Classify Table | ${dut1_node} | ip4 | dst
119 | | And Vpp Configure Classify Session
120 | | ... | ${dut1_node} | deny | ${table_index_1} | ${skip_n_1} | ${match_n_2}
121 | | ... | ip4 | src | ${test_src_ip}
122 | | And Vpp Configure Classify Session
123 | | ... | ${dut1_node} | deny | ${table_index_2} | ${skip_n_2} | ${match_n_2}
124 | | ... | ip4 | dst | ${test_dst_ip}
125 | | And Vpp Enable Input Acl Interface
126 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${table_index_1}
127 | | And Vpp Enable Input Acl Interface
128 | | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${table_index_2}
129 | | And Add Arp On Dut
130 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
131 | | ... | ${tg_to_dut2_mac}
132 | | And Vpp Route Add
133 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
134 | | ... | ${dut1_to_dut2_ip_GW} | ${dut1_to_dut2}
135 | | And L2 setup xconnect on DUT
136 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
137 | | Then Send packet from Port to Port should failed | ${tg_node}
138 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
139 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2}
140 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}