@@ -141,26 +141,43 @@ func createInitialDBContent(ctx context.Context, c client.Client, expectedState
141
141
func validateDBConfig (dbContent * testDBEntries , conf * sriovnetworkv1.OVSConfigExt ) {
142
142
Expect (dbContent .OpenVSwitch ).To (HaveLen (1 ))
143
143
Expect (dbContent .Bridge ).To (HaveLen (1 ))
144
- Expect (dbContent .Interface ).To (HaveLen (1 ))
145
- Expect (dbContent .Port ).To (HaveLen (1 ))
144
+ Expect (dbContent .Interface ).To (HaveLen (2 ))
145
+ Expect (dbContent .Port ).To (HaveLen (2 ))
146
146
ovs := dbContent .OpenVSwitch [0 ]
147
147
br := dbContent .Bridge [0 ]
148
- port := dbContent .Port [0 ]
149
- iface := dbContent .Interface [0 ]
148
+ ports := make (map [string ]* PortEntry , 0 )
149
+ interfaces := make (map [string ]* InterfaceEntry , 0 )
150
+ for _ , p := range dbContent .Port {
151
+ ports [p .Name ] = p
152
+ }
153
+ for _ , ifc := range dbContent .Interface {
154
+ interfaces [ifc .Name ] = ifc
155
+ }
150
156
Expect (ovs .Bridges ).To (ContainElement (br .UUID ))
151
157
Expect (br .Name ).To (Equal (conf .Name ))
152
158
Expect (br .DatapathType ).To (Equal (conf .Bridge .DatapathType ))
153
159
Expect (br .OtherConfig ).To (Equal (conf .Bridge .OtherConfig ))
154
160
Expect (br .ExternalIDs ).To (Equal (conf .Bridge .ExternalIDs ))
161
+ port , ok := ports [conf .Uplinks [0 ].Name ]
162
+ Expect (ok ).To (BeTrue ())
155
163
Expect (br .Ports ).To (ContainElement (port .UUID ))
156
- Expect (port .Name ).To (Equal (conf .Uplinks [0 ].Name ))
164
+ iface , ok := interfaces [conf .Uplinks [0 ].Name ]
165
+ Expect (ok ).To (BeTrue ())
157
166
Expect (port .Interfaces ).To (ContainElement (iface .UUID ))
158
- Expect (iface .Name ).To (Equal (conf .Uplinks [0 ].Name ))
159
167
Expect (iface .Options ).To (Equal (conf .Uplinks [0 ].Interface .Options ))
160
168
Expect (iface .Type ).To (Equal (conf .Uplinks [0 ].Interface .Type ))
161
169
Expect (iface .OtherConfig ).To (Equal (conf .Uplinks [0 ].Interface .OtherConfig ))
162
170
Expect (iface .ExternalIDs ).To (Equal (conf .Uplinks [0 ].Interface .ExternalIDs ))
163
171
Expect (iface .MTURequest ).To (Equal (conf .Uplinks [0 ].Interface .MTURequest ))
172
+ internalPort , ok := ports [conf .Name ]
173
+ Expect (ok ).To (BeTrue ())
174
+ internalIface , ok := interfaces [conf .Name ]
175
+ Expect (ok ).To (BeTrue ())
176
+ Expect (internalPort .Interfaces ).To (ContainElement (internalIface .UUID ))
177
+ Expect (internalIface .Options ).To (BeNil ())
178
+ Expect (internalIface .Type ).To (Equal ("internal" ))
179
+ Expect (internalIface .OtherConfig ).To (BeNil ())
180
+ Expect (internalIface .ExternalIDs ).To (BeNil ())
164
181
}
165
182
166
183
var _ = Describe ("OVS" , func () {
0 commit comments