@@ -246,7 +246,7 @@ func TestEgressIP(t *testing.T) {
246
246
t .Fatalf ("Unexpected eip state: %#v" , eip )
247
247
}
248
248
249
- // Drop namespace EgressIP
249
+ // Drop namespace EgressIP (local)
250
250
eip .deleteNamespaceEgress (44 )
251
251
err = assertNetlinkChange (eip , "release 172.17.0.102" )
252
252
if err != nil {
@@ -292,8 +292,54 @@ func TestEgressIP(t *testing.T) {
292
292
}
293
293
origFlows = flows
294
294
295
- ns44 = eip .namespacesByVNID [44 ]
296
- if ns44 == nil || eip .namespacesByEgressIP ["172.17.0.102" ] != ns44 || eip .nodesByEgressIP ["172.17.0.102" ] != node4 {
295
+ // Drop namespace EgressIP (remote)
296
+ eip .deleteNamespaceEgress (42 )
297
+ err = assertNoNetlinkChanges (eip )
298
+ if err != nil {
299
+ t .Fatalf ("%v" , err )
300
+ }
301
+ flows , err = ovsif .DumpFlows ("" )
302
+ if err != nil {
303
+ t .Fatalf ("Unexpected error dumping flows: %v" , err )
304
+ }
305
+ err = assertFlowChanges (origFlows , flows ,
306
+ flowChange {
307
+ kind : flowRemoved ,
308
+ match : []string {"table=100" , "reg0=42" , "172.17.0.3->tun_dst" },
309
+ },
310
+ )
311
+ if err != nil {
312
+ t .Fatalf ("Unexpected flow changes: %v\n Orig: %#v\n New: %#v" , err , origFlows , flows )
313
+ }
314
+ origFlows = flows
315
+
316
+ if eip .namespacesByVNID [42 ] != nil || eip .namespacesByEgressIP ["172.17.0.100" ] != nil || eip .nodesByEgressIP ["172.17.0.100" ] != node3 {
317
+ t .Fatalf ("Unexpected eip state: %#v" , eip )
318
+ }
319
+
320
+ // Add namespace EgressIP back again after having removed it...
321
+ eip .updateNamespaceEgress (42 , "172.17.0.100" )
322
+ err = assertNoNetlinkChanges (eip )
323
+ if err != nil {
324
+ t .Fatalf ("%v" , err )
325
+ }
326
+ flows , err = ovsif .DumpFlows ("" )
327
+ if err != nil {
328
+ t .Fatalf ("Unexpected error dumping flows: %v" , err )
329
+ }
330
+ err = assertFlowChanges (origFlows , flows ,
331
+ flowChange {
332
+ kind : flowAdded ,
333
+ match : []string {"table=100" , "reg0=42" , "172.17.0.3->tun_dst" },
334
+ },
335
+ )
336
+ if err != nil {
337
+ t .Fatalf ("Unexpected flow changes: %v\n Orig: %#v\n New: %#v" , err , origFlows , flows )
338
+ }
339
+ origFlows = flows
340
+
341
+ ns42 = eip .namespacesByVNID [42 ]
342
+ if ns42 == nil || eip .namespacesByEgressIP ["172.17.0.100" ] != ns42 || eip .nodesByEgressIP ["172.17.0.100" ] != node3 {
297
343
t .Fatalf ("Unexpected eip state: %#v" , eip )
298
344
}
299
345
0 commit comments