@@ -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 {
@@ -297,6 +297,57 @@ func TestEgressIP(t *testing.T) {
297
297
t .Fatalf ("Unexpected eip state: %#v" , eip )
298
298
}
299
299
300
+ // Drop namespace EgressIP (remote)
301
+ eip .deleteNamespaceEgress (42 )
302
+ err = assertNoNetlinkChanges (eip )
303
+ if err != nil {
304
+ t .Fatalf ("%v" , err )
305
+ }
306
+ flows , err = ovsif .DumpFlows ("" )
307
+ if err != nil {
308
+ t .Fatalf ("Unexpected error dumping flows: %v" , err )
309
+ }
310
+ err = assertFlowChanges (origFlows , flows ,
311
+ flowChange {
312
+ kind : flowRemoved ,
313
+ match : []string {"table=100" , "reg0=42" , "172.17.0.3->tun_dst" },
314
+ },
315
+ )
316
+ if err != nil {
317
+ t .Fatalf ("Unexpected flow changes: %v\n Orig: %#v\n New: %#v" , err , origFlows , flows )
318
+ }
319
+ origFlows = flows
320
+
321
+ if eip .namespacesByVNID [42 ] != nil || eip .namespacesByEgressIP ["172.17.0.100" ] != nil || eip .nodesByEgressIP ["172.17.0.100" ] != node3 {
322
+ t .Fatalf ("Unexpected eip state: %#v" , eip )
323
+ }
324
+
325
+ // Add namespace EgressIP back again after having removed it...
326
+ eip .updateNamespaceEgress (42 , "172.17.0.100" )
327
+ err = assertNoNetlinkChanges (eip )
328
+ if err != nil {
329
+ t .Fatalf ("%v" , err )
330
+ }
331
+ flows , err = ovsif .DumpFlows ("" )
332
+ if err != nil {
333
+ t .Fatalf ("Unexpected error dumping flows: %v" , err )
334
+ }
335
+ err = assertFlowChanges (origFlows , flows ,
336
+ flowChange {
337
+ kind : flowAdded ,
338
+ match : []string {"table=100" , "reg0=42" , "172.17.0.3->tun_dst" },
339
+ },
340
+ )
341
+ if err != nil {
342
+ t .Fatalf ("Unexpected flow changes: %v\n Orig: %#v\n New: %#v" , err , origFlows , flows )
343
+ }
344
+ origFlows = flows
345
+
346
+ ns42 = eip .namespacesByVNID [42 ]
347
+ if ns42 == nil || eip .namespacesByEgressIP ["172.17.0.100" ] != ns42 || eip .nodesByEgressIP ["172.17.0.100" ] != node3 {
348
+ t .Fatalf ("Unexpected eip state: %#v" , eip )
349
+ }
350
+
300
351
// Drop remote node EgressIP
301
352
eip .updateNodeEgress ("172.17.0.3" , []string {"172.17.0.100" })
302
353
err = assertNoNetlinkChanges (eip )
0 commit comments