summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--policy/policy.go6
-rw-r--r--server/server.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/policy/policy.go b/policy/policy.go
index 9ad7b349..d3e4ef03 100644
--- a/policy/policy.go
+++ b/policy/policy.go
@@ -1297,6 +1297,9 @@ func AsPathLengthToConfigStruct(reqAsPathLength *api.AsPathLength) config.AsPath
func ConditionsToConfigStruct(reqConditions *api.Conditions) config.Conditions {
conditions := config.Conditions{}
+ if reqConditions == nil {
+ return conditions
+ }
if reqConditions.MatchPrefixSet != nil {
conditions.MatchPrefixSet = reqConditions.MatchPrefixSet.PrefixSetName
}
@@ -1346,6 +1349,9 @@ func ActionsToApiStruct(conActions config.Actions) *api.Actions {
func ActionsToConfigStruct(reqActions *api.Actions) config.Actions {
actions := config.Actions{}
+ if reqActions == nil{
+ return actions
+ }
if reqActions.Community != nil {
actions.BgpActions.SetCommunity.Communities = reqActions.Community.Communities
actions.BgpActions.SetCommunity.Options = reqActions.Community.Options
diff --git a/server/server.go b/server/server.go
index ce0edf65..b6fcc363 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1661,9 +1661,9 @@ func (server *BgpServer) handleGrpcDelPolicy(grpcReq *GrpcRequest) {
case REQ_POLICY_ROUTEPOLICY_DELETE:
reqPolicy := grpcReq.Data.(*api.PolicyDefinition)
conPolicyList := server.routingPolicy.PolicyDefinitionList
- result := &GrpcResponse{}
isStatement, policyDef := policy.PolicyDefinitionToConfigStruct(reqPolicy)
idxPolicy, idxStatement := policy.IndexOfPolicyDefinition(conPolicyList, policyDef)
+ log.Error(fmt.Sprintf("isStatament=%v, idxPolicy=%d, idxStatement=%d", isStatement, idxPolicy, idxStatement))
if isStatement {
if idxPolicy == -1 {
result.ResponseErr = fmt.Errorf("Policy that has %v doesn't exist.", policyDef.Name)