Add iACL IPv4/IPv6 tests.
[csit.git] / resources / libraries / robot / iacl.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 | Documentation | Keywords for iACL tests
16 | Resource | resources/libraries/robot/default.robot
17 | Library | resources.libraries.python.InterfaceUtil
18 | Library | resources.libraries.python.NodePath
19
20 *** Keywords ***
21 | Node path computed for 3-node topology
22 | | [Arguments] | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
23 | | [Documentation] | *Create interface variables for 3-node topology.*
24 | | ...
25 | | ... | *Arguments:*
26 | | ... | - ${tg_node} - Node attached to the path. Type: dictionary
27 | | ... | - ${dut1_node} - Node attached to the path. Type: dictionary
28 | | ... | - ${dut2_node} - Node attached to the path. Type: dictionary
29 | | ...
30 | | ... | _Set testcase variables for nodes and interfaces._
31 | | ... | - ${tg_node} - Variable for node in path. Type: dictionary
32 | | ... | - ${dut1_node} - Variable for node in path. Type: dictionary
33 | | ... | - ${dut2_node} - Variable for node in path. Type: dictionary
34 | | ... | - ${tg_if1} - First interface of TG node. Type: str
35 | | ... | - ${tg_if2} - Second interface of TG node. Type: str
36 | | ... | - ${dut1_if1} - First interface of first DUT node. Type: str
37 | | ... | - ${dut1_if2} - Second interface of first DUT node. Type: str
38 | | ... | - ${dut2_if1} - First interface of second DUT node. Type: str
39 | | ... | - ${dut2_if2} - Second interface of second DUT node. Type: str
40 | | ... | - ${tg_if1_mac} - MAC address of TG interface (1st).
41 | | ... | - ${tg_if2_mac} - MAC address of TG interface (2nd).
42 | | ... | - ${dut1_if1_mac} - MAC address of DUT1 interface (1st).
43 | | ... | - ${dut1_if2_mac} - MAC address of DUT1 interface (2nd).
44 | | ...
45 | | Append Nodes | ${tg_node} | ${dut1_node} | ${dut2_node} | ${tg_node}
46 | | Compute Path
47 | | ${tg_if1} | ${tg_node}= | Next Interface
48 | | ${dut1_if1} | ${dut1_node}= | Next Interface
49 | | ${dut1_if2} | ${dut1_node}= | Next Interface
50 | | ${dut2_if1} | ${dut2_node}= | Next Interface
51 | | ${dut2_if2} | ${dut2_node}= | Next Interface
52 | | ${tg_if2} | ${tg_node}= | Next Interface
53 | | ${tg_if1_mac}= | Get interface mac | ${tg_node} | ${tg_if1}
54 | | ${tg_if2_mac}= | Get interface mac | ${tg_node} | ${tg_if2}
55 | | ${dut1_if1_mac}= | Get interface mac | ${dut1_node} | ${dut1_if1}
56 | | ${dut1_if2_mac}= | Get interface mac | ${dut1_node} | ${dut1_if2}
57 | | Set Test Variable | ${tg_node}
58 | | Set Test Variable | ${tg_if1}
59 | | Set Test Variable | ${tg_if2}
60 | | Set Test Variable | ${dut1_node}
61 | | Set Test Variable | ${dut1_if1}
62 | | Set Test Variable | ${dut1_if2}
63 | | Set Test Variable | ${dut2_node}
64 | | Set Test Variable | ${dut2_if1}
65 | | Set Test Variable | ${dut2_if2}
66 | | Set Test Variable | ${tg_if1_mac}
67 | | Set Test Variable | ${tg_if2_mac}
68 | | Set Test Variable | ${dut1_if1_mac}
69 | | Set Test Variable | ${dut1_if2_mac}
70
71 | Interfaces in path are up
72 | | [Documentation] | *Set UP state on interfaces in path on nodes.*
73 | | ...
74 | | Set Interface State | ${tg_node} | ${tg_if1} | up
75 | | Set Interface State | ${tg_node} | ${tg_if2} | up
76 | | Set Interface State | ${dut1_node} | ${dut1_if1} | up
77 | | Set Interface State | ${dut1_node} | ${dut1_if2} | up
78 | | Set Interface State | ${dut2_node} | ${dut2_if1} | up
79 | | Set Interface State | ${dut2_node} | ${dut2_if2} | up
80 | | Vpp Node Interfaces Ready Wait | ${dut1_node}
81 | | Vpp Node Interfaces Ready Wait | ${dut2_node}
82
83 | IPv4 Addresses set on the node interfaces
84 | | [Arguments] | ${dut_node} | ${int1} | ${ip_addr1} | ${int2} | ${ip_addr2}
85 | | ...         | ${prefix_length}
86 | | [Documentation] | Setup IPv4 adresses on the node interfaces
87 | | ...
88 | | ... | *Arguments*
89 | | ... | - ${dut_node} - VPP node.
90 | | ... | - ${int1} - First node interface.
91 | | ... | - ${ip_addr1} - First IP address.
92 | | ... | - ${int2} - Second node interface.
93 | | ... | - ${ip_addr2} - Second IP address.
94 | | ... | - ${prefix_length} - IP prefix length.
95 | | ...
96 | | ... | *Example*
97 | | ... | \| IPv4 Addresses set on the node interfaces \
98 | | ... | \| ${dut1_node} \| ${dut1_if1} \| ${dut1_if1_ip} \
99 | | ... | \| ${dut1_if2} \| ${dut1_if2_ip} \| ${prefix_length} \|
100 | | ...
101 | | Set Interface Address | ${dut_node} | ${int1} | ${ip_addr1}
102 | | ...                   | ${prefix_length}
103 | | Set Interface Address | ${dut_node} | ${int2} | ${ip_addr2}
104 | | ...                   | ${prefix_length}
105
106 | IPv6 Addresses set on the node interfaces
107 | | [Arguments] | ${dut_node} | ${int1} | ${ip_addr1} | ${int2} | ${ip_addr2}
108 | | ...         | ${prefix_length}
109 | | [Documentation] | Setup IPv6 adresses on the node interfaces
110 | | ...
111 | | ... | *Arguments*
112 | | ... | - ${dut_node} - VPP node.
113 | | ... | - ${int1} - First node interface.
114 | | ... | - ${ip_addr1} - First IP address.
115 | | ... | - ${int2} - Second node interface.
116 | | ... | - ${ip_addr2} - Second IP address.
117 | | ... | - ${prefix_length} - IP prefix length.
118 | | ...
119 | | ... | *Example*
120 | | ... | \| IPv6 Addresses set on the node interfaces \
121 | | ... | \| ${dut1_node} \| ${dut1_if1} \| ${dut1_if1_ip} \
122 | | ... | \| ${dut1_if2} \| ${dut1_if2_ip} \| ${prefix_length} \|
123 | | ...
124 | | Vpp Set If Ipv6 Addr | ${dut_node} | ${int1} | ${ip_addr1} | ${prefix_length}
125 | | Vpp Set If Ipv6 Addr | ${dut_node} | ${int2} | ${ip_addr2} | ${prefix_length}