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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 | Library | resources.libraries.python.NATUtil
16 | Documentation | Keywords for NAT feature in VPP.
19 | Configure inside and outside interfaces
20 | | [Documentation] | Configure inside and outside interfaces for NAT44.
22 | | ... | *Arguments:*
23 | | ... | - node - DUT node to set NAT44 interfaces on. Type: dictionary
24 | | ... | - int_in - Inside interface. Type: string
25 | | ... | - int_out - Outside interface. Type: string
29 | | ... | \| Configure inside and outside interfaces \| ${nodes['DUT1']} \
30 | | ... | \| FortyGigabitEtherneta/0/0 \| FortyGigabitEtherneta/0/1 \|
32 | | [Arguments] | ${node} | ${int_in} | ${int_out}
34 | | ${int_in_name}= | Set variable | ${node['interfaces']['${int_in}']['name']}
35 | | ${int_out_name}= | Set variable | ${node['interfaces']['${int_out}']['name']}
36 | | Set NAT44 Interfaces | ${node} | ${int_in_name} | ${int_out_name}
38 | Configure deterministic mode for NAT44
39 | | [Documentation] | Set deterministic behaviour of NAT44.
41 | | ... | *Arguments:*
42 | | ... | - node - DUT node to set deterministic mode for NAT44 on.
43 | | ... | Type: dictionary
44 | | ... | - ip_in - Inside IP. Type: string
45 | | ... | - subnet_in - Inside IP subnet. Type: string
46 | | ... | - ip_out - Outside IP. Type: string
47 | | ... | - subnet_out - Outside IP subnet. Type: string
51 | | ... | \| Configure deterministic mode for NAT44 \| ${nodes['DUT1']} \
52 | | ... | \| 100.0.0.0 \| 12 \| 12.1.1.0 \| 24 \|
54 | | [Arguments] | ${node} | ${ip_in} | ${subnet_in} | ${ip_out} | ${subnet_out}
56 | | Set NAT44 deterministic | ${node} | ${ip_in} | ${subnet_in} | ${ip_out}
57 | | ... | ${subnet_out}
59 | Configure workers for NAT
60 | | [Documentation] | Configure workers for NAT.
62 | | ... | *Arguments:*
63 | | ... | - node - DUT node to set NAT workers on. Type: dictionary
64 | | ... | - lcores - list of cores, format: range e.g. 1-5 or list of ranges \
65 | | ... | e.g.: 1-5,18-22. Type: string
69 | | ... | \| Configure workers for NAT \| ${nodes['DUT1']} \| 12-23,36-47 \|
71 | | [Arguments] | ${node} | ${lcores}
73 | | Set NAT workers | ${node} | ${lcores}
76 | | [Documentation] | Get the NAT settings on the node.
78 | | ... | *Arguments:*
79 | | ... | - node - DUT node to show NAT. Type: dictionary
83 | | ... | \| Show NAT verbose \| ${nodes['DUT1']} \|
85 | | [Arguments] | ${node}
87 | | Show NAT | ${node}
89 | Get NAT44 deterministic forward
90 | | [Documentation] | Show forward IP address and port(s).
92 | | ... | *Arguments:*
93 | | ... | - node - DUT node to get NAT44 deterministic forward on.
94 | | ... | Type: dictionary
95 | | ... | - ip - IP address. Type: string
99 | | ... | \| Get NAT44 deterministic forward \| ${nodes['DUT1']} \| 10.0.0.2 \|
101 | | [Arguments] | ${node} | ${ip}
103 | | Show NAT44 deterministic forward | ${node} | ${ip}
105 | Get NAT44 deterministic reverse
106 | | [Documentation] | Show reverse IP address.
108 | | ... | *Arguments:*
109 | | ... | - node - DUT node to get NAT44 deterministic reverse on.
110 | | ... | Type: dictionary
111 | | ... | - ip - IP address. Type: string
112 | | ... | - port - Port. Type: string or integer
116 | | ... | \| Get NAT44 deterministic reverse \| ${nodes['DUT1']} \| 10.0.0.2 \
119 | | [Arguments] | ${node} | ${ip} | ${port}
121 | | Show NAT44 deterministic reverse | ${node} | ${ip} | ${port}
124 | | [Documentation] | Get list of interfaces configured with NAT from VPP node.
126 | | ... | *Arguments:*
127 | | ... | - node - DUT node to get NAT interfaces on. Type: dictionary
131 | | ... | \| Get NAT interfaces \| ${nodes['DUT1']} \|
133 | | [Arguments] | ${node}
135 | | Get NAT interfaces | ${node}
137 | Get NAT static mappings
138 | | [Documentation] | Get NAT static mappings from VPP node.
140 | | ... | *Arguments:*
141 | | ... | - node - DUT node to get NAT static mappings on. Type: dictionary
145 | | ... | \| Get NAT static mappings \| ${nodes['DUT1']} \|
147 | | [Arguments] | ${node}
149 | | Get NAT static mappings | ${node}