summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/server.go398
1 files changed, 0 insertions, 398 deletions
diff --git a/server/server.go b/server/server.go
index 77d8fb22..d09d0da1 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1656,15 +1656,6 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg {
case REQ_POLICY_PREFIX, REQ_POLICY_NEIGHBOR, REQ_POLICY_ASPATH,
REQ_POLICY_COMMUNITY, REQ_POLICY_EXTCOMMUNITY, REQ_POLICY_ROUTEPOLICY:
server.handleGrpcShowPolicy(grpcReq)
- case REQ_POLICY_PREFIX_ADD, REQ_POLICY_NEIGHBOR_ADD, REQ_POLICY_ASPATH_ADD,
- REQ_POLICY_COMMUNITY_ADD, REQ_POLICY_EXTCOMMUNITY_ADD, REQ_POLICY_ROUTEPOLICY_ADD:
- server.handleGrpcAddPolicy(grpcReq)
- case REQ_POLICY_PREFIX_DELETE, REQ_POLICY_NEIGHBOR_DELETE, REQ_POLICY_ASPATH_DELETE,
- REQ_POLICY_COMMUNITY_DELETE, REQ_POLICY_EXTCOMMUNITY_DELETE, REQ_POLICY_ROUTEPOLICY_DELETE:
- server.handleGrpcDelPolicy(grpcReq)
- case REQ_POLICY_PREFIXES_DELETE, REQ_POLICY_NEIGHBORS_DELETE, REQ_POLICY_ASPATHS_DELETE,
- REQ_POLICY_COMMUNITIES_DELETE, REQ_POLICY_EXTCOMMUNITIES_DELETE, REQ_POLICY_ROUTEPOLICIES_DELETE:
- server.handleGrpcDelPolicies(grpcReq)
case REQ_MONITOR_GLOBAL_BEST_CHANGED, REQ_MONITOR_NEIGHBOR_PEER_STATE:
server.broadcastReqs = append(server.broadcastReqs, grpcReq)
case REQ_MRT_GLOBAL_RIB, REQ_MRT_LOCAL_RIB:
@@ -1905,395 +1896,6 @@ func (server *BgpServer) handleGrpcShowPolicy(grpcReq *GrpcRequest) {
close(grpcReq.ResponseCh)
}
-func (server *BgpServer) handleGrpcAddPolicy(grpcReq *GrpcRequest) {
- result := &GrpcResponse{}
- switch grpcReq.RequestType {
- case REQ_POLICY_PREFIX_ADD:
- reqPrefixSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchPrefixSet
- conPrefixSetList := server.routingPolicy.DefinedSets.PrefixSets.PrefixSetList
- isReqPrefixSet, prefixSet := table.PrefixSetToConfigStruct(reqPrefixSet)
- if !isReqPrefixSet {
- result.ResponseErr = fmt.Errorf("doesn't reqest of policy prefix.")
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
- }
- // If the same PrefixSet is not set, add PrefixSet of request to the end.
- // If only name of the PrefixSet is same, overwrite with PrefixSet of request
- idxPrefixSet, idxPrefix := table.IndexOfPrefixSet(conPrefixSetList, prefixSet)
- if idxPrefixSet == -1 {
- conPrefixSetList = append(conPrefixSetList, prefixSet)
- } else {
- if idxPrefix == -1 {
- conPrefixSetList[idxPrefixSet].PrefixList =
- append(conPrefixSetList[idxPrefixSet].PrefixList, prefixSet.PrefixList[0])
- }
- }
- server.routingPolicy.DefinedSets.PrefixSets.PrefixSetList = conPrefixSetList
- case REQ_POLICY_NEIGHBOR_ADD:
- reqNeighborSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchNeighborSet
- conNeighborSetList := server.routingPolicy.DefinedSets.NeighborSets.NeighborSetList
- isReqNeighborSet, neighborSet := table.NeighborSetToConfigStruct(reqNeighborSet)
- if !isReqNeighborSet {
- result.ResponseErr = fmt.Errorf("doesn't reqest of policy neighbor.")
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
- }
- // If the same NeighborSet is not set, add NeighborSet of request to the end.
- // If only name of the NeighborSet is same, overwrite with NeighborSet of request
- idxNeighborSet, idxNeighbor := table.IndexOfNeighborSet(conNeighborSetList, neighborSet)
- if idxNeighborSet == -1 {
- conNeighborSetList = append(conNeighborSetList, neighborSet)
- } else {
- if idxNeighbor == -1 {
- conNeighborSetList[idxNeighborSet].NeighborInfoList =
- append(conNeighborSetList[idxNeighborSet].NeighborInfoList, neighborSet.NeighborInfoList[0])
- }
- }
- server.routingPolicy.DefinedSets.NeighborSets.NeighborSetList = conNeighborSetList
- case REQ_POLICY_ASPATH_ADD:
- reqAsPathSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchAsPathSet
- conAsPathSetList := server.routingPolicy.DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList
- isReqAsPathSet, asPathSet := table.AsPathSetToConfigStruct(reqAsPathSet)
- if !isReqAsPathSet {
- result.ResponseErr = fmt.Errorf("doesn't reqest of policy aspath.")
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
- }
- // If the same AsPathSet is not set, add AsPathSet of request to the end.
- // If only name of the AsPathSet is same, overwrite with AsPathSet of request
- idxAsPathSet, idxAsPath := table.IndexOfAsPathSet(conAsPathSetList, asPathSet)
- if idxAsPathSet == -1 {
- conAsPathSetList = append(conAsPathSetList, asPathSet)
- } else {
- if idxAsPath == -1 {
- conAsPathSetList[idxAsPathSet].AsPathList =
- append(conAsPathSetList[idxAsPathSet].AsPathList, asPathSet.AsPathList[0])
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList = conAsPathSetList
- case REQ_POLICY_COMMUNITY_ADD:
- reqCommunitySet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchCommunitySet
- conCommunitySetList := server.routingPolicy.DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList
- isReqCommunitySet, communitySet := table.CommunitySetToConfigStruct(reqCommunitySet)
- if !isReqCommunitySet {
- result.ResponseErr = fmt.Errorf("doesn't reqest of policy community.")
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
- }
- // If the same CommunitySet is not set, add CommunitySet of request to the end.
- // If only name of the CommunitySet is same, overwrite with CommunitySet of request
- idxCommunitySet, idxCommunity := table.IndexOfCommunitySet(conCommunitySetList, communitySet)
- if idxCommunitySet == -1 {
- conCommunitySetList = append(conCommunitySetList, communitySet)
- } else {
- if idxCommunity == -1 {
- conCommunitySetList[idxCommunitySet].CommunityList =
- append(conCommunitySetList[idxCommunitySet].CommunityList, communitySet.CommunityList[0])
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList = conCommunitySetList
- case REQ_POLICY_EXTCOMMUNITY_ADD:
- reqExtCommunitySet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchExtCommunitySet
- conExtCommunitySetList := server.routingPolicy.DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList
- isReqExtCommunitySet, extCommunitySet := table.ExtCommunitySetToConfigStruct(reqExtCommunitySet)
- if !isReqExtCommunitySet {
- result.ResponseErr = fmt.Errorf("doesn't reqest of policy extended community.")
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
- }
- // If the same ExtCommunitySet is not set, add ExtCommunitySet of request to the end.
- // If only name of the ExtCommunitySet is same, overwrite with ExtCommunitySet of request
- idxExtCommunitySet, idxExtCommunity := table.IndexOfExtCommunitySet(conExtCommunitySetList, extCommunitySet)
- if idxExtCommunitySet == -1 {
- conExtCommunitySetList = append(conExtCommunitySetList, extCommunitySet)
- } else {
- if idxExtCommunity == -1 {
- conExtCommunitySetList[idxExtCommunitySet].ExtCommunityList =
- append(conExtCommunitySetList[idxExtCommunitySet].ExtCommunityList, extCommunitySet.ExtCommunityList[0])
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList = conExtCommunitySetList
- case REQ_POLICY_ROUTEPOLICY_ADD:
- reqPolicy := grpcReq.Data.(*api.PolicyDefinition)
- reqConditions := reqPolicy.StatementList[0].Conditions
- reqActions := reqPolicy.StatementList[0].Actions
- conPolicyList := server.routingPolicy.PolicyDefinitions.PolicyDefinitionList
- _, policyDef := table.PolicyDefinitionToConfigStruct(reqPolicy)
- idxPolicy, idxStatement := table.IndexOfPolicyDefinition(conPolicyList, policyDef)
- if idxPolicy == -1 {
- conPolicyList = append(conPolicyList, policyDef)
- } else {
- statement := policyDef.Statements.StatementList[0]
- if idxStatement == -1 {
- conPolicyList[idxPolicy].Statements.StatementList =
- append(conPolicyList[idxPolicy].Statements.StatementList, statement)
- } else {
- conConditions := &conPolicyList[idxPolicy].Statements.StatementList[idxStatement].Conditions
- conActions := &conPolicyList[idxPolicy].Statements.StatementList[idxStatement].Actions
- if reqConditions.MatchPrefixSet != nil {
- conConditions.MatchPrefixSet = statement.Conditions.MatchPrefixSet
- }
- if reqConditions.MatchNeighborSet != nil {
- conConditions.MatchNeighborSet = statement.Conditions.MatchNeighborSet
- }
- if reqConditions.MatchAsPathSet != nil {
- conConditions.BgpConditions.MatchAsPathSet = statement.Conditions.BgpConditions.MatchAsPathSet
- }
- if reqConditions.MatchCommunitySet != nil {
- conConditions.BgpConditions.MatchCommunitySet = statement.Conditions.BgpConditions.MatchCommunitySet
- }
- if reqConditions.MatchExtCommunitySet != nil {
- conConditions.BgpConditions.MatchExtCommunitySet = statement.Conditions.BgpConditions.MatchExtCommunitySet
- }
- if reqConditions.MatchAsPathLength != nil {
- conConditions.BgpConditions.AsPathLength = statement.Conditions.BgpConditions.AsPathLength
- }
- if reqActions.RouteAction != api.RouteAction_NONE {
- conActions.RouteDisposition.AcceptRoute = statement.Actions.RouteDisposition.AcceptRoute
- conActions.RouteDisposition.RejectRoute = statement.Actions.RouteDisposition.RejectRoute
- }
- if reqActions.Community != nil {
- conActions.BgpActions.SetCommunity = statement.Actions.BgpActions.SetCommunity
- }
- if reqActions.Med != "" {
- conActions.BgpActions.SetMed = statement.Actions.BgpActions.SetMed
- }
- if reqActions.AsPrepend != nil {
- conActions.BgpActions.SetAsPathPrepend = statement.Actions.BgpActions.SetAsPathPrepend
- }
- }
- }
- server.routingPolicy.PolicyDefinitions.PolicyDefinitionList = conPolicyList
- }
- server.handlePolicy(server.routingPolicy)
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
-}
-
-func (server *BgpServer) handleGrpcDelPolicy(grpcReq *GrpcRequest) {
- result := &GrpcResponse{}
- switch grpcReq.RequestType {
- case REQ_POLICY_PREFIX_DELETE:
- reqPrefixSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchPrefixSet
- conPrefixSetList := server.routingPolicy.DefinedSets.PrefixSets.PrefixSetList
- isReqPrefixSet, prefixSet := table.PrefixSetToConfigStruct(reqPrefixSet)
- if isReqPrefixSet {
- // If only name of the PrefixSet is same, delete all of the elements of the PrefixSet.
- // If the same element PrefixSet, delete the it's element from PrefixSet.
- idxPrefixSet, idxPrefix := table.IndexOfPrefixSet(conPrefixSetList, prefixSet)
- prefix := prefixSet.PrefixList[0]
- if idxPrefixSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy prefix that has %v %v %v doesn't exist.", prefixSet.PrefixSetName,
- prefix.IpPrefix, prefix.MasklengthRange)
- } else {
- if idxPrefix == -1 {
- result.ResponseErr = fmt.Errorf("Policy prefix that has %v %v %v doesn't exist.", prefixSet.PrefixSetName,
- prefix.IpPrefix, prefix.MasklengthRange)
- } else {
- conPrefixSetList[idxPrefixSet].PrefixList =
- append(conPrefixSetList[idxPrefixSet].PrefixList[:idxPrefix], conPrefixSetList[idxPrefixSet].PrefixList[idxPrefix+1:]...)
- }
- }
- } else {
- idxPrefixSet := -1
- for i, conPrefixSet := range conPrefixSetList {
- if conPrefixSet.PrefixSetName == reqPrefixSet.PrefixSetName {
- idxPrefixSet = i
- break
- }
- }
- if idxPrefixSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy prefix that has %v doesn't exist.", prefixSet.PrefixSetName)
- } else {
- conPrefixSetList = append(conPrefixSetList[:idxPrefixSet], conPrefixSetList[idxPrefixSet+1:]...)
- }
- }
- server.routingPolicy.DefinedSets.PrefixSets.PrefixSetList = conPrefixSetList
- case REQ_POLICY_NEIGHBOR_DELETE:
- reqNeighborSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchNeighborSet
- conNeighborSetList := server.routingPolicy.DefinedSets.NeighborSets.NeighborSetList
- isReqNeighborSet, neighborSet := table.NeighborSetToConfigStruct(reqNeighborSet)
- if isReqNeighborSet {
- // If only name of the NeighborSet is same, delete all of the elements of the NeighborSet.
- // If the same element NeighborSet, delete the it's element from NeighborSet.
- idxNeighborSet, idxNeighbor := table.IndexOfNeighborSet(conNeighborSetList, neighborSet)
- if idxNeighborSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy neighbor that has %v %v doesn't exist.", neighborSet.NeighborSetName,
- neighborSet.NeighborInfoList[0].Address)
- } else {
- if idxNeighbor == -1 {
- result.ResponseErr = fmt.Errorf("Policy neighbor that has %v %v doesn't exist.", neighborSet.NeighborSetName,
- neighborSet.NeighborInfoList[0].Address)
- } else {
- conNeighborSetList[idxNeighborSet].NeighborInfoList =
- append(conNeighborSetList[idxNeighborSet].NeighborInfoList[:idxNeighbor],
- conNeighborSetList[idxNeighborSet].NeighborInfoList[idxNeighbor+1:]...)
- }
- }
- } else {
- idxNeighborSet := -1
- for i, conNeighborSet := range conNeighborSetList {
- if conNeighborSet.NeighborSetName == reqNeighborSet.NeighborSetName {
- idxNeighborSet = i
- break
- }
- }
- if idxNeighborSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy neighbor %v doesn't exist.", neighborSet.NeighborSetName)
- } else {
- conNeighborSetList = append(conNeighborSetList[:idxNeighborSet], conNeighborSetList[idxNeighborSet+1:]...)
- }
- }
- server.routingPolicy.DefinedSets.NeighborSets.NeighborSetList = conNeighborSetList
- case REQ_POLICY_ASPATH_DELETE:
- reqAsPathSet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchAsPathSet
- conAsPathSetList := server.routingPolicy.DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList
- result := &GrpcResponse{}
- isReqAsPathSet, asPathSet := table.AsPathSetToConfigStruct(reqAsPathSet)
- // If only name of the AsPathSet is same, delete all of the elements of the AsPathSet.
- // If the same element AsPathSet, delete the it's element from AsPathSet.
- idxAsPathSet, idxAsPath := table.IndexOfAsPathSet(conAsPathSetList, asPathSet)
- if isReqAsPathSet {
- if idxAsPathSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy aspath that has %v %v doesn't exist.", asPathSet.AsPathSetName,
- asPathSet.AsPathList[0].AsPath)
- } else {
- if idxAsPath == -1 {
- result.ResponseErr = fmt.Errorf("Policy aspath that has %v %v doesn't exist.", asPathSet.AsPathSetName,
- asPathSet.AsPathList[0].AsPath)
- } else {
- conAsPathSetList[idxAsPathSet].AsPathList =
- append(conAsPathSetList[idxAsPathSet].AsPathList[:idxAsPath],
- conAsPathSetList[idxAsPathSet].AsPathList[idxAsPath+1:]...)
- }
- }
- } else {
- if idxAsPathSet == -1 {
- result.ResponseErr = fmt.Errorf("Policy aspath %v doesn't exist.", asPathSet.AsPathSetName)
- } else {
- conAsPathSetList = append(conAsPathSetList[:idxAsPathSet], conAsPathSetList[idxAsPathSet+1:]...)
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.AsPathSets.AsPathSetList = conAsPathSetList
- case REQ_POLICY_COMMUNITY_DELETE:
- reqCommunitySet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchCommunitySet
- conCommunitySetList := server.routingPolicy.DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList
- isReqCommunitySet, CommunitySet := table.CommunitySetToConfigStruct(reqCommunitySet)
- // If only name of the CommunitySet is same, delete all of the elements of the CommunitySet.
- // If the same element CommunitySet, delete the it's element from CommunitySet.
- idxCommunitySet, idxCommunity := table.IndexOfCommunitySet(conCommunitySetList, CommunitySet)
- if isReqCommunitySet {
- if idxCommunitySet == -1 {
- result.ResponseErr = fmt.Errorf("Policy community that has %v %v doesn't exist.", CommunitySet.CommunitySetName,
- CommunitySet.CommunityList[0].Community)
- } else {
- if idxCommunity == -1 {
- result.ResponseErr = fmt.Errorf("Policy community that has %v %v doesn't exist.", CommunitySet.CommunitySetName,
- CommunitySet.CommunityList[0].Community)
- } else {
- conCommunitySetList[idxCommunitySet].CommunityList =
- append(conCommunitySetList[idxCommunitySet].CommunityList[:idxCommunity],
- conCommunitySetList[idxCommunitySet].CommunityList[idxCommunity+1:]...)
- }
- }
- } else {
- if idxCommunitySet == -1 {
- result.ResponseErr = fmt.Errorf("Policy community %v doesn't exist.", CommunitySet.CommunitySetName)
- } else {
- conCommunitySetList = append(conCommunitySetList[:idxCommunitySet], conCommunitySetList[idxCommunitySet+1:]...)
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.CommunitySets.CommunitySetList = conCommunitySetList
- case REQ_POLICY_EXTCOMMUNITY_DELETE:
- reqExtCommunitySet := grpcReq.Data.(*api.PolicyDefinition).StatementList[0].Conditions.MatchExtCommunitySet
- conExtCommunitySetList := server.routingPolicy.DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList
- isReqExtCommunitySet, ExtCommunitySet := table.ExtCommunitySetToConfigStruct(reqExtCommunitySet)
- // If only name of the ExtCommunitySet is same, delete all of the elements of the ExtCommunitySet.
- // If the same element ExtCommunitySet, delete the it's element from ExtCommunitySet.
- idxExtCommunitySet, idxExtCommunity := table.IndexOfExtCommunitySet(conExtCommunitySetList, ExtCommunitySet)
- if isReqExtCommunitySet {
- if idxExtCommunitySet == -1 {
- result.ResponseErr = fmt.Errorf("Policy extended community that has %v %v doesn't exist.",
- ExtCommunitySet.ExtCommunitySetName, ExtCommunitySet.ExtCommunityList[0].ExtCommunity)
- } else {
- if idxExtCommunity == -1 {
- result.ResponseErr = fmt.Errorf("Policy extended community that has %v %v doesn't exist.",
- ExtCommunitySet.ExtCommunitySetName, ExtCommunitySet.ExtCommunityList[0].ExtCommunity)
- } else {
- conExtCommunitySetList[idxExtCommunitySet].ExtCommunityList =
- append(conExtCommunitySetList[idxExtCommunitySet].ExtCommunityList[:idxExtCommunity],
- conExtCommunitySetList[idxExtCommunitySet].ExtCommunityList[idxExtCommunity+1:]...)
- }
- }
- } else {
- if idxExtCommunitySet == -1 {
- result.ResponseErr = fmt.Errorf("Policy extended community %v doesn't exist.",
- ExtCommunitySet.ExtCommunitySetName)
- } else {
- conExtCommunitySetList =
- append(conExtCommunitySetList[:idxExtCommunitySet], conExtCommunitySetList[idxExtCommunitySet+1:]...)
- }
- }
- server.routingPolicy.DefinedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList = conExtCommunitySetList
- case REQ_POLICY_ROUTEPOLICY_DELETE:
- reqPolicy := grpcReq.Data.(*api.PolicyDefinition)
- conPolicyList := server.routingPolicy.PolicyDefinitions.PolicyDefinitionList
- isStatement, policyDef := table.PolicyDefinitionToConfigStruct(reqPolicy)
- idxPolicy, idxStatement := table.IndexOfPolicyDefinition(conPolicyList, policyDef)
- if isStatement {
- if idxPolicy == -1 {
- result.ResponseErr = fmt.Errorf("Policy that has %v doesn't exist.", policyDef.Name)
- } else {
- if idxStatement == -1 {
- result.ResponseErr = fmt.Errorf("Policy Statment that has %v doesn't exist.", policyDef.Statements.StatementList[0].Name)
- } else {
- conPolicyList[idxPolicy].Statements.StatementList =
- append(conPolicyList[idxPolicy].Statements.StatementList[:idxStatement], conPolicyList[idxPolicy].Statements.StatementList[idxStatement+1:]...)
- }
- }
- } else {
- idxPolicy := -1
- for i, conPolicy := range conPolicyList {
- if conPolicy.Name == reqPolicy.PolicyDefinitionName {
- idxPolicy = i
- break
- }
- }
- if idxPolicy == -1 {
- result.ResponseErr = fmt.Errorf("Policy that has %v doesn't exist.", policyDef.Name)
- } else {
- conPolicyList = append(conPolicyList[:idxPolicy], conPolicyList[idxPolicy+1:]...)
- }
- }
- server.routingPolicy.PolicyDefinitions.PolicyDefinitionList = conPolicyList
- }
- server.handlePolicy(server.routingPolicy)
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
-}
-
-func (server *BgpServer) handleGrpcDelPolicies(grpcReq *GrpcRequest) {
- result := &GrpcResponse{}
- definedSets := &server.routingPolicy.DefinedSets
- switch grpcReq.RequestType {
- case REQ_POLICY_PREFIXES_DELETE:
- definedSets.PrefixSets.PrefixSetList = make([]config.PrefixSet, 0)
- case REQ_POLICY_NEIGHBORS_DELETE:
- definedSets.NeighborSets.NeighborSetList = make([]config.NeighborSet, 0)
- case REQ_POLICY_ASPATHS_DELETE:
- definedSets.BgpDefinedSets.AsPathSets.AsPathSetList = make([]config.AsPathSet, 0)
- case REQ_POLICY_COMMUNITIES_DELETE:
- definedSets.BgpDefinedSets.CommunitySets.CommunitySetList = make([]config.CommunitySet, 0)
- case REQ_POLICY_EXTCOMMUNITIES_DELETE:
- definedSets.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList = make([]config.ExtCommunitySet, 0)
- case REQ_POLICY_ROUTEPOLICIES_DELETE:
- server.routingPolicy.PolicyDefinitions.PolicyDefinitionList = make([]config.PolicyDefinition, 0)
- }
- server.handlePolicy(server.routingPolicy)
- grpcReq.ResponseCh <- result
- close(grpcReq.ResponseCh)
-}
-
func (server *BgpServer) handleMrt(grpcReq *GrpcRequest) {
now := uint32(time.Now().Unix())
view := ""