diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2016-02-17 11:13:46 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-19 21:14:59 -0800 |
commit | b67befc30abb79bd6c70fbb96437ae6e90cfb274 (patch) | |
tree | 4fdb7bb854091b3f0321e6b10898e71277fe5e83 | |
parent | 496ce6cd0873b492df8190ed2d010a87def9b5e3 (diff) |
ops: maintenance of two-way route exchange
-rw-r--r-- | gobgpd/main.go | 1 | ||||
-rw-r--r-- | openswitch/openswitch.go | 148 | ||||
-rw-r--r-- | server/server.go | 2 | ||||
-rw-r--r-- | server/zclient.go | 2 | ||||
-rw-r--r-- | table/destination_test.go | 2 | ||||
-rw-r--r-- | table/path.go | 7 | ||||
-rw-r--r-- | table/path_test.go | 20 | ||||
-rw-r--r-- | table/policy_test.go | 2 | ||||
-rw-r--r-- | table/table_manager.go | 10 | ||||
-rw-r--r-- | table/table_test.go | 2 |
10 files changed, 118 insertions, 78 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 17bf68f3..b8e024f4 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -161,6 +161,7 @@ func main() { log.Errorf("Failed to start ops config manager: %s", err) os.Exit(1) } + log.Info("Coordination with OpenSwitch") m.Serve() } else if opts.ConfigFile != "" { go config.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh, reloadCh) diff --git a/openswitch/openswitch.go b/openswitch/openswitch.go index 293f3d11..cdb1cb17 100644 --- a/openswitch/openswitch.go +++ b/openswitch/openswitch.go @@ -35,8 +35,8 @@ const ( ) const ( - NEXTHOP_UUID = "nexthop" - ROUTE_UUID = "route" + NEXTHOP_TRANSACT_NUUID = "nexthop" + ROUTE_TRANSACT_NUUID = "route" ) type Notifier struct { @@ -104,7 +104,7 @@ func (m *OpsManager) getVrfUUID() (uuid.UUID, error) { for k, _ := range vrfs { return uuid.FromStringOrNil(k), nil } - return uuid.Nil, fmt.Errorf("vrf table not found") + return uuid.Nil, fmt.Errorf("uuid not found in VRF table") } func (m *OpsManager) getBGPRouterUUID() (uint32, uuid.UUID, error) { @@ -132,20 +132,27 @@ func (m *OpsManager) getBGPRouterUUID() (uint32, uuid.UUID, error) { } } } - return asn, uuid.Nil, fmt.Errorf("not found") + return asn, uuid.Nil, fmt.Errorf("row not found in vrf table") } -func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*api.Path, bool, error) { +func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*api.Path, bool, bool, error) { var nlri bgp.AddrPrefixInterface path := &api.Path{ - Pattrs: make([][]byte, 0), + IsFromOps: true, + Pattrs: make([][]byte, 0), } isWithdraw := false + isFromGobgp := false prefix := route.New.Fields["prefix"].(string) safi := route.New.Fields["sub_address_family"].(string) afi := route.New.Fields["address_family"].(string) m := route.New.Fields["metric"].(float64) attrs := route.New.Fields["path_attributes"].(ovsdb.OvsMap).GoMap + + if attrs["IsFromGobgp"] == "true" { + isFromGobgp = true + } + nh := make([]interface{}, 0) nhId, ok := route.New.Fields["bgp_nexthops"].(ovsdb.UUID) if ok { @@ -164,12 +171,12 @@ func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*a log.Debug("nexthop addres does not exist") } else if len(nh) == 1 { if net.ParseIP(nh[0].(string)) == nil { - return nil, isWithdraw, fmt.Errorf("invalid nexthop address") + return nil, isWithdraw, isFromGobgp, fmt.Errorf("invalid nexthop address") } else { nexthop = nh[0].(string) } } else { - return nil, isWithdraw, fmt.Errorf("route has multiple nexthop address") + return nil, isWithdraw, isFromGobgp, fmt.Errorf("route has multiple nexthop address") } med, _ := bgp.NewPathAttributeMultiExitDisc(uint32(m)).Serialize() @@ -177,7 +184,7 @@ func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*a lpref, err := strconv.Atoi(attrs["BGP_loc_pref"].(string)) if err != nil { - return nil, isWithdraw, err + return nil, isWithdraw, isFromGobgp, err } localPref, _ := bgp.NewPathAttributeLocalPref(uint32(lpref)).Serialize() path.Pattrs = append(path.Pattrs, localPref) @@ -191,7 +198,7 @@ func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*a case "?": origin_t = bgp.BGP_ORIGIN_ATTR_TYPE_INCOMPLETE default: - return nil, isWithdraw, fmt.Errorf("invalid origin") + return nil, isWithdraw, isFromGobgp, fmt.Errorf("invalid origin") } origin, _ := bgp.NewPathAttributeOrigin(uint8(origin_t)).Serialize() path.Pattrs = append(path.Pattrs, origin) @@ -200,22 +207,22 @@ func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*a case "ipv4", "ipv6": ip, net, err := net.ParseCIDR(prefix) if err != nil { - return nil, isWithdraw, err + return nil, isWithdraw, isFromGobgp, err } ones, _ := net.Mask.Size() if afi == "ipv4" { if ip.To4() == nil { - return nil, isWithdraw, fmt.Errorf("invalid ipv4 prefix") + return nil, isWithdraw, isFromGobgp, fmt.Errorf("invalid ipv4 prefix") } nlri = bgp.NewIPAddrPrefix(uint8(ones), ip.String()) } else { if ip.To16() == nil { - return nil, isWithdraw, fmt.Errorf("invalid ipv6 prefix") + return nil, isWithdraw, isFromGobgp, fmt.Errorf("invalid ipv6 prefix") } nlri = bgp.NewIPv6AddrPrefix(uint8(ones), ip.String()) } default: - return nil, isWithdraw, fmt.Errorf("unsupported address family: %s", afi) + return nil, isWithdraw, isFromGobgp, fmt.Errorf("unsupported address family: %s", afi) } if afi == "ipv4" && safi == "unicast" { @@ -230,7 +237,7 @@ func parseRouteToGobgp(route ovsdb.RowUpdate, nexthops map[string]ovsdb.Row) (*a isWithdraw = true } - return path, isWithdraw, nil + return path, isWithdraw, isFromGobgp, nil } func (m *OpsManager) getBGPNeighborUUIDs(id uuid.UUID) ([]net.IP, []uuid.UUID, error) { @@ -257,7 +264,7 @@ func (m *OpsManager) getBGPNeighborUUIDs(id uuid.UUID) ([]net.IP, []uuid.UUID, e return addrs, ids, nil } } - return nil, nil, fmt.Errorf("not found") + return nil, nil, fmt.Errorf("neighbor not found") } func (m *OpsManager) handleVrfUpdate(update ovsdb.TableUpdate) *server.GrpcRequest { @@ -297,7 +304,9 @@ func (m *OpsManager) handleBgpRouterUpdate(update ovsdb.TableUpdate) []*server.G if _, ok := v.Old.Fields["router_id"]; initial || ok { r, ok := v.New.Fields["router_id"].(string) if !ok { - log.Debugf("router-id is not configured yet") + log.WithFields(log.Fields{ + "Topic": "openswitch", + }).Debug("router-id is not configured yet") return nil } reqs = append(reqs, server.NewGrpcRequest(server.REQ_MOD_GLOBAL_CONFIG, "add", bgp.RouteFamily(0), &api.ModGlobalConfigArguments{ @@ -341,7 +350,9 @@ func (m *OpsManager) handleNeighborUpdate(update ovsdb.TableUpdate) []*server.Gr if uuid.Equal(id, uuid.FromStringOrNil(k)) { asn, ok := v.New.Fields["remote_as"].(float64) if !ok { - log.Debugf("remote-as is not configured yet") + log.WithFields(log.Fields{ + "Topic": "openswitch", + }).Debug("remote-as is not configured yet") continue } reqs = append(reqs, server.NewGrpcRequest(server.REQ_MOD_NEIGHBOR, "add", bgp.RouteFamily(0), &api.ModNeighborArguments{ @@ -369,9 +380,13 @@ func (m *OpsManager) handleRouteUpdate(update ovsdb.TableUpdate) []*server.GrpcR } idx := vrf.(ovsdb.UUID).GoUuid if uuid.Equal(id, uuid.FromStringOrNil(idx)) { - path, isWithdraw, err := parseRouteToGobgp(v, m.cache["BGP_Nexthop"]) + path, isWithdraw, isFromGobgp, err := parseRouteToGobgp(v, m.cache["BGP_Nexthop"]) if err != nil { - log.Error("faild to parse path: %v", err) + log.WithFields(log.Fields{ + "Topic": "openswitch", + "Path": path, + "Err": err, + }).Debug("failed to parse path") return nil } if isWithdraw { @@ -381,8 +396,10 @@ func (m *OpsManager) handleRouteUpdate(update ovsdb.TableUpdate) []*server.GrpcR Name: "", Path: path, })) - log.Debug("advertised route is withdraw") } else { + if isFromGobgp { + return nil + } reqs = append(reqs, server.NewGrpcRequest(server.REQ_MOD_PATH, "add", bgp.RouteFamily(0), &api.ModPathArguments{ Operation: api.Operation_ADD, Resource: api.Resource_GLOBAL, @@ -400,7 +417,12 @@ func parseRouteToOps(pl []*cmd.Path) (map[string]interface{}, bool, error) { IsWithdraw := false for _, p := range pl { var nexthop string - pathAttr := map[string]string{"BGP_iBGP": "false", "BGP_flags": "16", "BGP_internal": "false", "BGP_loc_pref": "0"} + pathAttr := map[string]string{"BGP_iBGP": "false", + "BGP_flags": "16", + "BGP_internal": "false", + "BGP_loc_pref": "0", + "IsFromGobgp": "true", + } for _, a := range p.PathAttrs { switch a.GetType() { case bgp.BGP_ATTR_TYPE_NEXT_HOP: @@ -459,7 +481,7 @@ func insertNextHop(opsRoute map[string]interface{}) ovsdb.Operation { Op: "insert", Table: "BGP_Nexthop", Row: nexthop, - UUIDName: NEXTHOP_UUID, + UUIDName: NEXTHOP_TRANSACT_NUUID, } return insNextHopOp } @@ -469,7 +491,7 @@ func insertRoute(vrfId uuid.UUID, opsRoute map[string]interface{}) (ovsdb.Operat vrfSet, _ := ovsdb.NewOvsSet(v) opsRoute["vrf"] = vrfSet - nexthop := []ovsdb.UUID{ovsdb.UUID{NEXTHOP_UUID}} + nexthop := []ovsdb.UUID{ovsdb.UUID{NEXTHOP_TRANSACT_NUUID}} nexthopSet, _ := ovsdb.NewOvsSet(nexthop) opsRoute["bgp_nexthops"] = nexthopSet @@ -484,7 +506,7 @@ func insertRoute(vrfId uuid.UUID, opsRoute map[string]interface{}) (ovsdb.Operat Op: "insert", Table: "BGP_Route", Row: opsRoute, - UUIDName: ROUTE_UUID, + UUIDName: ROUTE_TRANSACT_NUUID, } return insRouteOp, nil } @@ -536,20 +558,16 @@ func (m *OpsManager) Transact(operations []ovsdb.Operation) error { if len(reply) < len(operations) { return fmt.Errorf("number of replies should be atleast equal to number of Operations") } - ok := true + var repErr error for i, o := range reply { if o.Error != "" && i < len(operations) { - log.Errorf("transaction failed due to an error :", o.Error, " details:", o.Details, " in ", operations[i]) - ok = false + repErr = fmt.Errorf("transaction failed due to an error :", o.Error, " details:", o.Details, " in ", operations[i]) } else if o.Error != "" { - log.Errorf("transaction failed due to an error :", o.Error) - ok = false + repErr = fmt.Errorf("transaction failed due to an error :", o.Error) } } - if ok { - log.Debugf("bgp route update successful") - } else { - return fmt.Errorf("bgp route update failed") + if repErr != nil { + return repErr } return nil } @@ -570,16 +588,33 @@ func (m *OpsManager) GobgpMonitor(ready *bool) { reqCh <- req res := <-req.ResponseCh if err := res.Err(); err != nil { - log.Errorf("operation failed. reqtype: %d, err: %s", req.RequestType, err) + log.WithFields(log.Fields{ + "Topic": "openswitch", + "Type": "Monitor", + "RequestType": req.RequestType, + "Err": err, + }).Error("grpc operation failed") } d := res.Data.(*api.Destination) - p, err := cmd.ApiStruct2Path(d.Paths[0]) + bPath := d.Paths[0] + if bPath.IsFromOps && !bPath.IsWithdraw { + continue + } + p, err := cmd.ApiStruct2Path(bPath) if err != nil { - log.Error("faild parse") + log.WithFields(log.Fields{ + "Topic": "openswitch", + "Type": "MonitorRequest", + "Err": err, + }).Error("failed parse path of gobgp") } o, err := m.TransactPreparation(p) if err != nil { - log.Errorf("%v", err) + log.WithFields(log.Fields{ + "Topic": "openswitch", + "Type": "Monitor", + "Err": err, + }).Error("failed transact preparation of ops") } m.opsCh <- o } @@ -601,11 +636,12 @@ func (m *OpsManager) GobgpServe() error { m.grpcQueue = m.grpcQueue[1:] r := <-grpcRes - if err := r.Err(); err != nil { - log.Errorf("operation failed. err: %s", err) - } - if err := r.Err(); err != nil { - log.Errorf("operation failed. err: %s", err) + if r.Err() != nil { + log.WithFields(log.Fields{ + "Topic": "openswitch", + "Type": "ModRequest", + "Err": r.Err(), + }).Error("grpc operation failed") } else { if monitorReady { if grpcReq.RequestType == server.REQ_MOD_GLOBAL_CONFIG && grpcReq.Name == "del" { @@ -681,7 +717,7 @@ type OpsOperation struct { } type GrpcChs struct { - grpcCh chan *server.GrpcRequest + grpcCh chan *server.GrpcRequest } type OpsChs struct { @@ -690,13 +726,13 @@ type OpsChs struct { } type OpsManager struct { - ops *ovsdb.OvsdbClient - grpcCh chan *server.GrpcRequest - opsCh chan *OpsOperation + ops *ovsdb.OvsdbClient + grpcCh chan *server.GrpcRequest + opsCh chan *OpsOperation opsUpdateCh chan *ovsdb.TableUpdates - grpcQueue []*server.GrpcRequest - bgpReady bool - cache map[string]map[string]ovsdb.Row + grpcQueue []*server.GrpcRequest + bgpReady bool + cache map[string]map[string]ovsdb.Row } func NewOpsManager(grpcCh chan *server.GrpcRequest) (*OpsManager, error) { @@ -710,12 +746,12 @@ func NewOpsManager(grpcCh chan *server.GrpcRequest) (*OpsManager, error) { ops.Register(n) return &OpsManager{ - ops: ops, - grpcCh: grpcCh, - opsCh: make(chan *OpsOperation, 1024), + ops: ops, + grpcCh: grpcCh, + opsCh: make(chan *OpsOperation, 1024), opsUpdateCh: opsUpdateCh, - grpcQueue: gQueue, - bgpReady: false, - cache: make(map[string]map[string]ovsdb.Row), + grpcQueue: gQueue, + bgpReady: false, + cache: make(map[string]map[string]ovsdb.Row), }, nil } diff --git a/server/server.go b/server/server.go index 325f6730..70cafeaa 100644 --- a/server/server.go +++ b/server/server.go @@ -1438,7 +1438,7 @@ func (server *BgpServer) Api2PathList(resource api.Resource, name string, ApiPat pattr = append(pattr, bgp.NewPathAttributeExtendedCommunities(extcomms)) } - paths = append(paths, table.NewPath(pi, nlri, path.IsWithdraw, pattr, time.Now(), path.NoImplicitWithdraw)) + paths = append(paths, table.NewPath(pi, nlri, path.IsWithdraw, pattr, time.Now(), path.NoImplicitWithdraw, path.IsFromOps)) } return paths, nil diff --git a/server/zclient.go b/server/zclient.go index 3c3d3180..a6427781 100644 --- a/server/zclient.go +++ b/server/zclient.go @@ -127,7 +127,7 @@ func createPathFromIPRouteMessage(m *zebra.Message, peerInfo *table.PeerInfo) *t med := bgp.NewPathAttributeMultiExitDisc(body.Metric) pattr = append(pattr, med) - p := table.NewPath(peerInfo, nlri, isWithdraw, pattr, time.Now(), false) + p := table.NewPath(peerInfo, nlri, isWithdraw, pattr, time.Now(), false, false) p.SetIsFromZebra(true) return p } diff --git a/table/destination_test.go b/table/destination_test.go index f5556175..1bd6c944 100644 --- a/table/destination_test.go +++ b/table/destination_test.go @@ -81,7 +81,7 @@ func DestCreatePath(peerD []*PeerInfo) []*Path { nlriList := updateMsgD.NLRI pathAttributes := updateMsgD.PathAttributes nlri_info := nlriList[0] - pathD[i] = NewPath(peerD[i], nlri_info, false, pathAttributes, time.Now(), false) + pathD[i] = NewPath(peerD[i], nlri_info, false, pathAttributes, time.Now(), false, false) } return pathD } diff --git a/table/path.go b/table/path.go index 375ad1af..9ed5b78b 100644 --- a/table/path.go +++ b/table/path.go @@ -52,6 +52,7 @@ type originInfo struct { noImplicitWithdraw bool validation config.RpkiValidationResultType isFromZebra bool + isFromOps bool key string uuid []byte eor bool @@ -68,7 +69,7 @@ type Path struct { filtered map[string]PolicyDirection } -func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pattrs []bgp.PathAttributeInterface, timestamp time.Time, noImplicitWithdraw bool) *Path { +func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pattrs []bgp.PathAttributeInterface, timestamp time.Time, noImplicitWithdraw bool, isFromOps bool) *Path { if !isWithdraw && pattrs == nil { log.WithFields(log.Fields{ "Topic": "Table", @@ -84,6 +85,7 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa source: source, timestamp: timestamp, noImplicitWithdraw: noImplicitWithdraw, + isFromOps: isFromOps, }, IsWithdraw: isWithdraw, pathAttrs: pattrs, @@ -99,7 +101,7 @@ func NewEOR(family bgp.RouteFamily) *Path { nlri: nlri, eor: true, }, - filtered: make(map[string]PolicyDirection), + filtered: make(map[string]PolicyDirection), } } @@ -240,6 +242,7 @@ func (path *Path) ToApiStruct(id string) *api.Path { SourceAsn: path.OriginInfo().source.AS, SourceId: path.OriginInfo().source.ID.String(), Stale: path.IsStale(), + IsFromOps: path.OriginInfo().isFromOps, } } diff --git a/table/path_test.go b/table/path_test.go index bcc532a1..6c71cc05 100644 --- a/table/path_test.go +++ b/table/path_test.go @@ -14,13 +14,13 @@ import ( func TestPathNewIPv4(t *testing.T) { peerP := PathCreatePeer() pathP := PathCreatePath(peerP) - ipv4p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), time.Now(), false) + ipv4p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), time.Now(), false, false) assert.NotNil(t, ipv4p) } func TestPathNewIPv6(t *testing.T) { peerP := PathCreatePeer() pathP := PathCreatePath(peerP) - ipv6p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), time.Now(), false) + ipv6p := NewPath(pathP[0].GetSource(), pathP[0].GetNlri(), true, pathP[0].GetPathAttrs(), time.Now(), false, false) assert.NotNil(t, ipv6p) } @@ -42,7 +42,7 @@ func TestPathCreatePath(t *testing.T) { nlriList := updateMsgP.NLRI pathAttributes := updateMsgP.PathAttributes nlri_info := nlriList[0] - path := NewPath(peerP[0], nlri_info, false, pathAttributes, time.Now(), false) + path := NewPath(peerP[0], nlri_info, false, pathAttributes, time.Now(), false, false) assert.NotNil(t, path) } @@ -87,7 +87,7 @@ func TestASPathLen(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) assert.Equal(10, p.GetAsPathLen()) } @@ -113,7 +113,7 @@ func TestPathPrependAsnToExistingSeqAttr(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) p.PrependAsn(65000, 1) assert.Equal([]uint32{65000, 65001, 65002, 65003, 65004, 65005, 0, 0, 0}, p.GetAsSeqList()) @@ -135,7 +135,7 @@ func TestPathPrependAsnToNewAsPathAttr(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) asn := uint32(65000) p.PrependAsn(asn, 1) @@ -163,7 +163,7 @@ func TestPathPrependAsnToNewAsPathSeq(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) asn := uint32(65000) p.PrependAsn(asn, 1) @@ -193,7 +193,7 @@ func TestPathPrependAsnToEmptyAsPathAttr(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) asn := uint32(65000) p.PrependAsn(asn, 1) @@ -229,7 +229,7 @@ func TestPathPrependAsnToFullPathAttr(t *testing.T) { update := bgpmsg.Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(update) peer := PathCreatePeer() - p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false) + p := NewPath(peer[0], update.NLRI[0], false, update.PathAttributes, time.Now(), false, false) expected := []uint32{65000, 65000} for _, v := range asns { @@ -258,7 +258,7 @@ func PathCreatePath(peerP []*PeerInfo) []*Path { nlriList := updateMsgP.NLRI pathAttributes := updateMsgP.PathAttributes nlri_info := nlriList[0] - pathP[i] = NewPath(peerP[i], nlri_info, false, pathAttributes, time.Now(), false) + pathP[i] = NewPath(peerP[i], nlri_info, false, pathAttributes, time.Now(), false, false) } return pathP } diff --git a/table/policy_test.go b/table/policy_test.go index 38b55794..8874a2f6 100644 --- a/table/policy_test.go +++ b/table/policy_test.go @@ -876,7 +876,7 @@ func TestAsPathCondition(t *testing.T) { bgp.NewAs4PathParam(asPathAttrType, ases), } pathAttributes := []bgp.PathAttributeInterface{bgp.NewPathAttributeAsPath(aspathParam)} - p := NewPath(nil, nil, false, pathAttributes, time.Time{}, false) + p := NewPath(nil, nil, false, pathAttributes, time.Time{}, false, false) return astest{ path: p, result: result, diff --git a/table/table_manager.go b/table/table_manager.go index afb4deac..119b81b2 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -33,7 +33,7 @@ func nlri2Path(m *bgp.BGPMessage, p *PeerInfo, now time.Time) []*Path { pathAttributes := updateMsg.PathAttributes pathList := make([]*Path, 0) for _, nlri := range updateMsg.NLRI { - path := NewPath(p, nlri, false, pathAttributes, now, false) + path := NewPath(p, nlri, false, pathAttributes, now, false, false) pathList = append(pathList, path) } return pathList @@ -44,7 +44,7 @@ func withdraw2Path(m *bgp.BGPMessage, p *PeerInfo, now time.Time) []*Path { pathAttributes := updateMsg.PathAttributes pathList := make([]*Path, 0) for _, nlri := range updateMsg.WithdrawnRoutes { - path := NewPath(p, nlri, true, pathAttributes, now, false) + path := NewPath(p, nlri, true, pathAttributes, now, false, false) pathList = append(pathList, path) } return pathList @@ -67,7 +67,7 @@ func mpreachNlri2Path(m *bgp.BGPMessage, p *PeerInfo, now time.Time) []*Path { for _, mp := range attrList { nlri_info := mp.Value for _, nlri := range nlri_info { - path := NewPath(p, nlri, false, pathAttributes, now, false) + path := NewPath(p, nlri, false, pathAttributes, now, false, false) pathList = append(pathList, path) } } @@ -92,7 +92,7 @@ func mpunreachNlri2Path(m *bgp.BGPMessage, p *PeerInfo, now time.Time) []*Path { nlri_info := mp.Value for _, nlri := range nlri_info { - path := NewPath(p, nlri, true, pathAttributes, now, false) + path := NewPath(p, nlri, true, pathAttributes, now, false, false) pathList = append(pathList, path) } } @@ -189,7 +189,7 @@ func (manager *TableManager) AddVrf(name string, rd bgp.RouteDistinguisherInterf pattr := make([]bgp.PathAttributeInterface, 0, 2) pattr = append(pattr, bgp.NewPathAttributeOrigin(bgp.BGP_ORIGIN_ATTR_TYPE_IGP)) pattr = append(pattr, bgp.NewPathAttributeMpReachNLRI(nexthop, []bgp.AddrPrefixInterface{nlri})) - msgs = append(msgs, NewPath(info, nlri, false, pattr, time.Now(), false)) + msgs = append(msgs, NewPath(info, nlri, false, pattr, time.Now(), false, false)) } return msgs, nil } diff --git a/table/table_test.go b/table/table_test.go index 9cec4133..b38d11a9 100644 --- a/table/table_test.go +++ b/table/table_test.go @@ -107,7 +107,7 @@ func TableCreatePath(peerT []*PeerInfo) []*Path { nlriList := updateMsgT.NLRI pathAttributes := updateMsgT.PathAttributes nlri_info := nlriList[0] - pathT[i] = NewPath(peerT[i], nlri_info, false, pathAttributes, time.Now(), false) + pathT[i] = NewPath(peerT[i], nlri_info, false, pathAttributes, time.Now(), false, false) } return pathT } |