summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-02-21 13:34:23 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-02-21 17:51:21 +0900
commit1b88fa78d93b8cfb87f9563c5f80cf65097a220b (patch)
tree8e406a44b1f7d79862653cbe7a31fb8d32e111fb
parent82ce8fec0e3836aeedb1e15910181d4c29fbaee6 (diff)
table: fix handleMacMobility()
needs to find a diffrent ESI with the same mac address. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--table/table_manager.go7
-rw-r--r--test/scenario_test/evpn_test.py6
2 files changed, 7 insertions, 6 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index 498aabad..7341df17 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -259,7 +259,7 @@ func (manager *TableManager) handleMacMobility(path *Path) []*Destination {
if !path2.IsLocal() || path2.GetNlri().(*bgp.EVPNNLRI).RouteType != bgp.EVPN_ROUTE_TYPE_MAC_IP_ADVERTISEMENT {
continue
}
- f := func(p *Path) (uint32, net.HardwareAddr, int) {
+ f := func(p *Path) (bgp.EthernetSegmentIdentifier, net.HardwareAddr, int) {
nlri := p.GetNlri().(*bgp.EVPNNLRI)
d := nlri.RouteTypeData.(*bgp.EVPNMacIPAdvertisementRoute)
ecs := p.GetExtCommunities()
@@ -270,13 +270,14 @@ func (manager *TableManager) handleMacMobility(path *Path) []*Destination {
break
}
}
- return d.ETag, d.MacAddress, seq
+ return d.ESI, d.MacAddress, seq
}
e1, m1, s1 := f(path)
e2, m2, s2 := f(path2)
- if e1 == e2 && bytes.Equal(m1, m2) && s1 > s2 {
+ if bytes.Equal(m1, m2) && !bytes.Equal(e1.Value, e2.Value) && s1 > s2 {
path2.IsWithdraw = true
dsts = append(dsts, manager.Tables[bgp.RF_EVPN].insert(path2))
+ break
}
}
return dsts
diff --git a/test/scenario_test/evpn_test.py b/test/scenario_test/evpn_test.py
index 00760d15..b3d290bc 100644
--- a/test/scenario_test/evpn_test.py
+++ b/test/scenario_test/evpn_test.py
@@ -80,7 +80,7 @@ class GoBGPTestBase(unittest.TestCase):
def test_02_add_evpn_route(self):
self.g1.local('gobgp global rib add '
- '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 1000 1000 '
+ '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 esi AS 1 1 1 etag 1000 label 1000 '
'rd 10:10 rt 10:10')
grib = self.g1.get_global_rib(rf='evpn')
self.assertTrue(len(grib) == 1)
@@ -111,7 +111,7 @@ class GoBGPTestBase(unittest.TestCase):
def test_03_check_mac_mobility(self):
self.g2.local('gobgp global rib add '
- '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 1000 1000 '
+ '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 esi AS 2 1 1 etag 1000 label 1000 '
'rd 10:20 rt 10:10')
time.sleep(3)
@@ -127,7 +127,7 @@ class GoBGPTestBase(unittest.TestCase):
def test_04_check_mac_mobility_again(self):
self.g1.local('gobgp global rib add '
- '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 1000 1000 '
+ '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 esi AS 3 1 1 etag 1000 label 1000 '
'rd 10:20 rt 10:10')
time.sleep(3)