@@ -141,26 +141,43 @@ func createInitialDBContent(ctx context.Context, c client.Client, expectedState
141141func validateDBConfig (dbContent * testDBEntries , conf * sriovnetworkv1.OVSConfigExt ) {
142142 Expect (dbContent .OpenVSwitch ).To (HaveLen (1 ))
143143 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 ))
146146 ovs := dbContent .OpenVSwitch [0 ]
147147 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+ }
150156 Expect (ovs .Bridges ).To (ContainElement (br .UUID ))
151157 Expect (br .Name ).To (Equal (conf .Name ))
152158 Expect (br .DatapathType ).To (Equal (conf .Bridge .DatapathType ))
153159 Expect (br .OtherConfig ).To (Equal (conf .Bridge .OtherConfig ))
154160 Expect (br .ExternalIDs ).To (Equal (conf .Bridge .ExternalIDs ))
161+ port , ok := ports [conf .Uplinks [0 ].Name ]
162+ Expect (ok ).To (BeTrue ())
155163 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 ())
157166 Expect (port .Interfaces ).To (ContainElement (iface .UUID ))
158- Expect (iface .Name ).To (Equal (conf .Uplinks [0 ].Name ))
159167 Expect (iface .Options ).To (Equal (conf .Uplinks [0 ].Interface .Options ))
160168 Expect (iface .Type ).To (Equal (conf .Uplinks [0 ].Interface .Type ))
161169 Expect (iface .OtherConfig ).To (Equal (conf .Uplinks [0 ].Interface .OtherConfig ))
162170 Expect (iface .ExternalIDs ).To (Equal (conf .Uplinks [0 ].Interface .ExternalIDs ))
163171 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 ())
164181}
165182
166183var _ = Describe ("OVS" , func () {
0 commit comments