HC Test: Fix expected error when ACL table should be empty
[csit.git] / resources / libraries / robot / honeycomb / nat.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 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
16 | Library | resources.libraries.python.honeycomb.NAT.NATKeywords
17 | Documentation | Keywords used to test Honeycomb NAT node.
18
19 *** Keywords ***
20 | NAT Operational Data From Honeycomb Should Be empty
21 | | [Documentation] | Uses Honeycomb API to retrieve NAT operational data\
22 | | ... | and expects to find only default values.
23 | | ...
24 | | ... | *Arguments:*
25 | | ... | - node - information about a DUT node. Type: dictionary
26 | | ... | - default_settings - NAT default settings. Type: dictionary
27 | | ...
28 | | ... | *Example:*
29 | | ...
30 | | ... | \| NAT Operational Data From Honeycomb Should Be empty \
31 | | ... | \| ${nodes['DUT1']} \| ${default_settings} \|
32 | | [Arguments] | ${node} | ${default_settings}
33 | | ${data}= | Get NAT Oper data | ${node}
34 | | Compare data structures | ${data} | ${default_settings}
35
36 | Honeycomb configures NAT entry
37 | | [Documentation] | Uses Honeycomb API to configure a static NAT entry.
38 | | ...
39 | | ... | *Arguments:*
40 | | ... | - node - information about a DUT node. Type: dictionary
41 | | ... | - data - NAT entry to configure. Type: dictionary
42 | | ... | - instance - NAT instance on VPP node. Type: integer
43 | | ... | - index - Index of NAT entry. Type: integer
44 | | ...
45 | | ... | *Example:*
46 | | ...
47 | | ... | \| Honeycomb configures NAT entry \| ${nodes['DUT1']} \| ${data} \
48 | | ... | \| ${0} \| ${1} \|
49 | | [Arguments] | ${node} | ${data} | ${instance}=0 | ${index}=1
50 | | Configure NAT entries | ${node} | ${data} | ${instance} | ${index}
51
52 | NAT entries from Honeycomb should be
53 | | [Documentation] | Uses Honeycomb API to retrieve NAT operational data\
54 | | ... | and compares against expected settings.
55 | | ...
56 | | ... | *Arguments:*
57 | | ... | - node - information about a DUT node. Type: dictionary
58 | | ... | - settings - NAT entry to expect. Type: dictionary
59 | | ... | - instance - NAT instance on VPP node. Type: integer
60 | | ...
61 | | ... | *Example:*
62 | | ...
63 | | ... | \| NAT entries from Honeycomb should be \| ${nodes['DUT1']} \
64 | | ... | \| ${settings} \| ${0} \|
65 | | [Arguments] | ${node} | ${settings} | ${instance}=0
66 | | ${data}= | Get NAT Oper data | ${node}
67 | | ${data}= | Set Variable
68 | | ... | ${data['nat-instances']['nat-instance'][${instance}]['mapping-table']}
69 | | Compare data structures | ${data} | ${settings}
70
71 | Honeycomb configures NAT on interface
72 | | [Documentation] | Uses Honeycomb API to configure NAT on an interface.
73 | | ...
74 | | ... | *Arguments:*
75 | | ... | - node - information about a DUT node. Type: dictionary
76 | | ... | - interface - name of an interface on the node. Type: string
77 | | ... | - direction - NAT direction parameter, inbound or outbound.\
78 | | ... | Type: string
79 | | ...
80 | | ... | *Example:*
81 | | ...
82 | | ... | \| Honeycomb configures NAT on interface \| ${nodes['DUT1']} \
83 | | ... | \| GigabitEthernet0/8/0 \| outbound \|
84 | | [Arguments] | ${node} | ${interface} | ${direction}
85 | | Configure NAT on interface
86 | | ... | ${node} | ${interface} | ${direction}
87
88 | Honeycomb removes NAT interface configuration
89 | | [Documentation] | Uses Honeycomb API to remove an existing NAT interface\
90 | | ... | configuration.
91 | | ...
92 | | ... | *Arguments:*
93 | | ... | - node - information about a DUT node. Type: dictionary
94 | | ... | - interface - name of an interface on the node. Type: string
95 | | ... | - direction - NAT direction parameter, inbound or outbound.\
96 | | ... | Type: string
97 | | ...
98 | | ... | *Example:*
99 | | ...
100 | | ... | \| Honeycomb removes NAT interface configuration \| ${nodes['DUT1']} \
101 | | ... | \| GigabitEthernet0/8/0 \| outbound \|
102 | | [Arguments] | ${node} | ${interface} | ${direction}
103 | | Configure NAT on interface
104 | | ... | ${node} | ${interface} | ${direction} | ${True}
105
106 | NAT interface Operational Data From Honeycomb Should Be
107 | | [Documentation] | Uses Honeycomb API to retrieve interface operational data\
108 | | ... | and compares the NAT section against expected settings.
109 | | ...
110 | | ... | *Arguments:*
111 | | ... | - node - information about a DUT node. Type: dictionary
112 | | ... | - interface - name of an interface on the node. Type: string
113 | | ... | - direction - NAT direction parameter, inbound or outbound.\
114 | | ... | Type: string
115 | | ...
116 | | ... | *Example:*
117 | | ...
118 | | ... | \| NAT interface Operational Data From Honeycomb Should Be \
119 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| outbound \|
120 | | [Arguments] | ${node} | ${interface} | ${direction}
121 | | ${data}= | Get interface oper data | ${node} | ${interface}
122 | | Variable should exist | ${data['interface-nat:nat']['${direction}']}
123
124 | NAT interface Operational Data From Honeycomb Should Be empty
125 | | [Documentation] | Uses Honeycomb API to retrieve interface operational data\
126 | | ... | and expects to find no data for the given direction.
127 | | ...
128 | | ... | *Arguments:*
129 | | ... | - node - information about a DUT node. Type: dictionary
130 | | ... | - interface - name of an interface on the node. Type: string
131 | | ... | - direction - NAT direction parameter, inbound or outbound.\
132 | | ... | Type: string
133 | | ...
134 | | ... | *Example:*
135 | | ...
136 | | ... | \| NAT interface Operational Data From Honeycomb Should Be empty \
137 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| outbound \|
138 | | [Arguments] | ${node} | ${interface} | ${direction}
139 | | ${data}= | Get interface oper data | ${node} | ${interface}
140 | | Variable should not exist | ${data['interface-nat:nat']['${direction}']}
141
142 | NAT interface Operational Data From VAT Should Be
143 | | [Documentation] | Uses Honeycomb API to retrieve NAT configured interfaces\
144 | | ... | and compares with expected settings.
145 | | ...
146 | | ... | *Arguments:*
147 | | ... | - node - information about a DUT node. Type: dictionary
148 | | ... | - settings - settings to expect. Type: dictionary
149 | | ... | Type: string
150 | | ...
151 | | ... | *Example:*
152 | | ...
153 | | ... | \| NAT interface Operational Data From VAT Should Be \
154 | | ... | \| ${nodes['DUT1']} \| ${settings} \|
155 | | [Arguments] | ${node} | ${settings}
156 | | ${data}= | VPP get NAT interfaces | ${node}
157 | | Compare data structures | ${data} | ${settings}