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.SNATUtil
16 | Library | resources.libraries.python.NAT.NATUtil
17 | Documentation | Keywords for SNAT feature in VPP.
20 | Set inside and outside interfaces
21 | | [Documentation] | Set inside and outside interfaces for SNAT.
23 | | ... | *Arguments:*
24 | | ... | - node - DUT node to set SNAT interfaces on. Type: dictionary
25 | | ... | - int_in - Inside interface. Type: string
26 | | ... | - int_out - Outside interface. Type: string
30 | | ... | \| Set inside and outside interfaces \| ${nodes['DUT1']} \
31 | | ... | \| FortyGigabitEtherneta/0/0 \| FortyGigabitEtherneta/0/1 \|
33 | | [Arguments] | ${node} | ${int_in} | ${int_out}
35 | | ${int_in_name}= | Set variable | ${node['interfaces']['${int_in}']['name']}
36 | | ${int_out_name}= | Set variable | ${node['interfaces']['${int_out}']['name']}
37 | | Set SNAT Interfaces | ${node} | ${int_in_name} | ${int_out_name}
39 | Set deterministic mode for SNAT
40 | | [Documentation] | Set deterministic behaviour of SNAT.
42 | | ... | *Arguments:*
43 | | ... | - node - DUT node to set deterministic mode for SNAT on.
44 | | ... | Type: dictionary
45 | | ... | - ip_in - Inside IP. Type: string
46 | | ... | - subnet_in - Inside IP subnet. Type: string
47 | | ... | - ip_out - Outside IP. Type: string
48 | | ... | - subnet_out - Outside IP subnet. Type: string
52 | | ... | \| Set deterministic mode for SNAT \| ${nodes['DUT1']} \
53 | | ... | \| 100.0.0.0 \| 12 \| 12.1.1.0 \| 24 \|
55 | | [Arguments] | ${node} | ${ip_in} | ${subnet_in} | ${ip_out} | ${subnet_out}
57 | | Set SNAT deterministic | ${node} | ${ip_in} | ${subnet_in} | ${ip_out}
58 | | ... | ${subnet_out}
60 | Set workers for SNAT
61 | | [Documentation] | Set workers for SNAT.
63 | | ... | *Arguments:*
64 | | ... | - node - DUT node to set SNAT workers on. Type: dictionary
65 | | ... | - lcores - list of cores, format: range e.g. 1-5 or list of ranges \
66 | | ... | e.g.: 1-5,18-22. Type: string
70 | | ... | \| Set workers for SNAT \| ${nodes['DUT1']} \| 12-23,36-47 \|
72 | | [Arguments] | ${node} | ${lcores}
74 | | Set SNAT workers | ${node} | ${lcores}
77 | | [Documentation] | Get the SNAT settings on the node.
79 | | ... | *Arguments:*
80 | | ... | - node - DUT node to show SNAT. Type: dictionary
84 | | ... | \| Show SNAT verbose \| ${nodes['DUT1']} \|
86 | | [Arguments] | ${node}
88 | | Show SNAT | ${node}
90 | Get SNAT deterministic forward
91 | | [Documentation] | Show forward IP address and port(s).
93 | | ... | *Arguments:*
94 | | ... | - node - DUT node to get SNAT deterministic forward on.
95 | | ... | Type: dictionary
96 | | ... | - ip - IP address. Type: string
100 | | ... | \| Get SNAT deterministic forward \| ${nodes['DUT1']} \| 10.0.0.2 \|
102 | | [Arguments] | ${node} | ${ip}
104 | | Show SNAT deterministic forward | ${node} | ${ip}
106 | Get SNAT deterministic reverse
107 | | [Documentation] | Show reverse IP address.
109 | | ... | *Arguments:*
110 | | ... | - node - DUT node to get SNAT deterministic reverse on.
111 | | ... | Type: dictionary
112 | | ... | - ip - IP address. Type: string
113 | | ... | - port - Port. Type: string or integer
117 | | ... | \| Get SNAT deterministic reverse \| ${nodes['DUT1']} \| 10.0.0.2 \
120 | | [Arguments] | ${node} | ${ip} | ${port}
122 | | Show SNAT deterministic reverse | ${node} | ${ip} | ${port}
125 | | [Documentation] | Get list of interfaces configured with NAT from VPP node.
127 | | ... | *Arguments:*
128 | | ... | - node - DUT node to get SNAT interfaces on. Type: dictionary
132 | | ... | \| Get NAT interfaces \| ${nodes['DUT1']} \|
134 | | [Arguments] | ${node}
136 | | VPP get NAT interfaces | ${node}
138 | Get NAT static mappings
139 | | [Documentation] | Get NAT static mappings from VPP node.
141 | | ... | *Arguments:*
142 | | ... | - node - DUT node to get SNAT static mappings on. Type: dictionary
146 | | ... | \| Get NAT static mappings \| ${nodes['DUT1']} \|
148 | | [Arguments] | ${node}
150 | | VPP get NAT static mappings | ${node}