From 7228b3dc1f1c7dca64bdfd5053244252bccd6180 Mon Sep 17 00:00:00 2001 From: Hitoshi Irino Date: Sun, 3 Mar 2019 12:48:57 +0900 Subject: Refactoring source code for BGP/MPLS L3VPN with ZAPI 6 - Deleting receiveVrfId (which is introduced on 2 previous commit 90eeb5de870b95345650e3ee98741e040a0b6e93) from Path struct and Introducing pathVrf Map in zclient. - Recovering logic (which is changed on 1 previous commit acfd5bedb6d94775392200db597a5ac420b31b2e) to use assignMplsLabel in server.go. - Refectoring zclient's newIPRouteBody for deleating duplicate logic for IPv4 and IPv6. --- internal/pkg/table/path.go | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'internal/pkg/table') diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go index bdeb6ff2..b6080ffa 100644 --- a/internal/pkg/table/path.go +++ b/internal/pkg/table/path.go @@ -133,14 +133,13 @@ type Validation struct { } type Path struct { - info *originInfo - parent *Path - pathAttrs []bgp.PathAttributeInterface - dels []bgp.BGPAttrType - attrsHash uint32 - aslooped bool - reason BestPathReason - receiveVrfId uint32 //VRF in which the path was received. + info *originInfo + parent *Path + pathAttrs []bgp.PathAttributeInterface + dels []bgp.BGPAttrType + attrsHash uint32 + aslooped bool + reason BestPathReason // For BGP Nexthop Tracking, this field shows if nexthop is invalidated by IGP. IsNexthopInvalid bool @@ -168,9 +167,8 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa timestamp: timestamp.Unix(), noImplicitWithdraw: noImplicitWithdraw, }, - IsWithdraw: isWithdraw, - pathAttrs: pattrs, - receiveVrfId: 0, + IsWithdraw: isWithdraw, + pathAttrs: pattrs, } } @@ -334,13 +332,6 @@ func (path *Path) IsIBGP() bool { return (as == path.GetSource().LocalAS) && as != 0 } -func (path *Path) ReceiveVrfId() uint32 { - return path.receiveVrfId -} -func (path *Path) SetReceiveVrfId(vrfId uint32) { - path.receiveVrfId = vrfId -} - // create new PathAttributes func (path *Path) Clone(isWithdraw bool) *Path { return &Path{ @@ -348,7 +339,6 @@ func (path *Path) Clone(isWithdraw bool) *Path { IsWithdraw: isWithdraw, IsNexthopInvalid: path.IsNexthopInvalid, attrsHash: path.attrsHash, - receiveVrfId: path.receiveVrfId, } } @@ -590,7 +580,6 @@ func (path *Path) String() string { if path.IsWithdraw { s.WriteString(", withdraw") } - s.WriteString(fmt.Sprintf(", receiveVrfId: %d", path.receiveVrfId)) s.WriteString(" }") return s.String() } @@ -1149,7 +1138,6 @@ func (p *Path) ToGlobal(vrf *Vrf) *Path { path.delPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP) path.setPathAttr(bgp.NewPathAttributeMpReachNLRI(nh.String(), []bgp.AddrPrefixInterface{nlri})) path.IsNexthopInvalid = p.IsNexthopInvalid - path.receiveVrfId = p.receiveVrfId return path } -- cgit v1.2.3