@@ -112,38 +112,70 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
112
112
description : "just a port" . into ( ) ,
113
113
} ) ;
114
114
115
- let link_name =
115
+ let link0_name =
116
116
Name :: from_str ( "phy0" ) . expect ( "phy0 should be a valid name" ) ;
117
117
118
- let lldp_params = LldpLinkConfigCreate {
118
+ let lldp0_params = LldpLinkConfigCreate {
119
119
enabled : true ,
120
120
link_name : Some ( "Link Name" . into ( ) ) ,
121
- link_description : Some ( "link_ Dscription " . into ( ) ) ,
121
+ link_description : Some ( "link description " . into ( ) ) ,
122
122
chassis_id : Some ( "Chassis ID" . into ( ) ) ,
123
123
system_name : Some ( "System Name" . into ( ) ) ,
124
124
system_description : Some ( "System description" . into ( ) ) ,
125
- management_ip : None ,
125
+ management_ip : Some (
126
+ "203.0.113.10"
127
+ . parse ( )
128
+ . expect ( "management_ip should be a valid address" ) ,
129
+ ) ,
130
+ } ;
131
+
132
+ let link1_name =
133
+ Name :: from_str ( "phy1" ) . expect ( "phy1 should be a valid name" ) ;
134
+
135
+ let lldp1_params = LldpLinkConfigCreate {
136
+ enabled : true ,
137
+ link_name : Some ( "Link Name 2" . into ( ) ) ,
138
+ link_description : Some ( "link description" . into ( ) ) ,
139
+ chassis_id : Some ( "Chassis ID" . into ( ) ) ,
140
+ system_name : Some ( "System Name" . into ( ) ) ,
141
+ system_description : Some ( "System description" . into ( ) ) ,
142
+ management_ip : Some (
143
+ "203.0.113.10"
144
+ . parse ( )
145
+ . expect ( "management_ip should be a valid address" ) ,
146
+ ) ,
126
147
} ;
127
148
128
149
// links
129
150
settings. links . push ( LinkConfigCreate {
130
- link_name : link_name. clone ( ) ,
151
+ link_name : link0_name. clone ( ) ,
152
+ mtu : 4700 ,
153
+ lldp : lldp0_params. clone ( ) ,
154
+ fec : Some ( LinkFec :: None ) ,
155
+ speed : LinkSpeed :: Speed100G ,
156
+ autoneg : false ,
157
+ tx_eq : None ,
158
+ } ) ;
159
+
160
+ settings. links . push ( LinkConfigCreate {
161
+ link_name : link1_name. clone ( ) ,
131
162
mtu : 4700 ,
132
- lldp : lldp_params . clone ( ) ,
163
+ lldp : lldp1_params . clone ( ) ,
133
164
fec : Some ( LinkFec :: None ) ,
134
165
speed : LinkSpeed :: Speed100G ,
135
166
autoneg : false ,
136
167
tx_eq : None ,
137
168
} ) ;
169
+
138
170
// interfaces
139
171
settings. interfaces . push ( SwitchInterfaceConfigCreate {
140
- link_name : link_name . clone ( ) ,
172
+ link_name : link0_name . clone ( ) ,
141
173
v6_enabled : true ,
142
174
kind : SwitchInterfaceKind :: Primary ,
143
175
} ) ;
144
176
// routes
145
177
settings. routes . push ( RouteConfig {
146
- link_name : link_name . clone ( ) ,
178
+ link_name : link0_name . clone ( ) ,
147
179
routes : vec ! [ Route {
148
180
dst: "1.2.3.0/24" . parse( ) . unwrap( ) ,
149
181
gw: "1.2.3.4" . parse( ) . unwrap( ) ,
@@ -153,7 +185,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
153
185
} ) ;
154
186
// addresses
155
187
settings. addresses . push ( AddressConfig {
156
- link_name : link_name . clone ( ) ,
188
+ link_name : link0_name . clone ( ) ,
157
189
addresses : vec ! [ Address {
158
190
address: "203.0.113.10/24" . parse( ) . unwrap( ) ,
159
191
vlan_id: None ,
@@ -173,7 +205,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
173
205
. parsed_body ( )
174
206
. unwrap ( ) ;
175
207
176
- assert_eq ! ( created. links. len( ) , 1 ) ;
208
+ assert_eq ! ( created. links. len( ) , 2 ) ;
177
209
assert_eq ! ( created. routes. len( ) , 1 ) ;
178
210
assert_eq ! ( created. addresses. len( ) , 1 ) ;
179
211
@@ -182,7 +214,14 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
182
214
assert_eq ! ( link0. mtu, 4700 ) ;
183
215
184
216
let lldp0 = link0. lldp_link_config . clone ( ) . unwrap ( ) ;
185
- assert_eq ! ( lldp0, lldp_params) ;
217
+ assert_eq ! ( lldp0, lldp0_params) ;
218
+
219
+ let link1 = & created. links [ 1 ] ;
220
+ assert_eq ! ( & link1. link_name. to_string( ) , "phy1" ) ;
221
+ assert_eq ! ( link1. mtu, 4700 ) ;
222
+
223
+ let lldp1 = link1. lldp_link_config . clone ( ) . unwrap ( ) ;
224
+ assert_eq ! ( lldp1, lldp1_params) ;
186
225
187
226
let ifx0 = & created. interfaces [ 0 ] ;
188
227
assert_eq ! ( & ifx0. interface_name. to_string( ) , "phy0" ) ;
@@ -208,7 +247,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
208
247
. parsed_body ( )
209
248
. unwrap ( ) ;
210
249
211
- assert_eq ! ( roundtrip. links. len( ) , 1 ) ;
250
+ assert_eq ! ( roundtrip. links. len( ) , 2 ) ;
212
251
assert_eq ! ( roundtrip. routes. len( ) , 1 ) ;
213
252
assert_eq ! ( roundtrip. addresses. len( ) , 1 ) ;
214
253
@@ -217,7 +256,14 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
217
256
assert_eq ! ( link0. mtu, 4700 ) ;
218
257
219
258
let lldp0 = link0. lldp_link_config . clone ( ) . unwrap ( ) ;
220
- assert_eq ! ( lldp0, lldp_params) ;
259
+ assert_eq ! ( lldp0, lldp0_params) ;
260
+
261
+ let link1 = & roundtrip. links [ 1 ] ;
262
+ assert_eq ! ( & link1. link_name. to_string( ) , "phy1" ) ;
263
+ assert_eq ! ( link1. mtu, 4700 ) ;
264
+
265
+ let lldp1 = link1. lldp_link_config . clone ( ) . unwrap ( ) ;
266
+ assert_eq ! ( lldp1, lldp1_params) ;
221
267
222
268
let ifx0 = & roundtrip. interfaces [ 0 ] ;
223
269
assert_eq ! ( & ifx0. interface_name. to_string( ) , "phy0" ) ;
@@ -259,7 +305,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
259
305
260
306
// Update port settings. Should not see conflict.
261
307
settings. bgp_peers . push ( BgpPeerConfig {
262
- link_name : link_name . clone ( ) ,
308
+ link_name : link0_name . clone ( ) ,
263
309
peers : vec ! [ BgpPeer {
264
310
bgp_config: NameOrId :: Name ( "as47" . parse( ) . unwrap( ) ) ,
265
311
interface_name: "phy0" . parse( ) . unwrap( ) ,
0 commit comments