diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-08-10 20:02:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-11 07:13:49 +0900 |
commit | 54092b2703c6df26e40787696a9ac8afbacb5b5e (patch) | |
tree | a475f04ab0f460b10a5927d1b7b9b0be4d2f0e91 | |
parent | 331721e167b1d43213acf77f5c039b8b7b5c0c17 (diff) |
config: rename distributed-policy to in-policy
-rw-r--r-- | config/bgp_configs.go | 16 | ||||
-rw-r--r-- | docs/sources/cli-command-syntax.md | 8 | ||||
-rw-r--r-- | docs/sources/filter-detail.md | 26 | ||||
-rw-r--r-- | server/peer.go | 4 | ||||
-rw-r--r-- | server/server.go | 10 | ||||
-rw-r--r-- | test/scenario_test/policy/policy_generator.go | 6 |
6 files changed, 35 insertions, 35 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 50f7ddaa..bbc5edbd 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -811,10 +811,10 @@ type ApplyPolicyState struct { ExportPolicy []string // original -> rpol:default-export-policy DefaultExportPolicy DefaultPolicyType - // original -> rpol:distribute-policy - DistributePolicy []string - // original -> rpol:default-distribute-policy - DefaultDistributePolicy DefaultPolicyType + // original -> rpol:in-policy + InPolicy []string + // original -> rpol:default-in-policy + DefaultInPolicy DefaultPolicyType } //struct for container rpol:config @@ -827,10 +827,10 @@ type ApplyPolicyConfig struct { ExportPolicy []string // original -> rpol:default-export-policy DefaultExportPolicy DefaultPolicyType - // original -> rpol:distribute-policy - DistributePolicy []string - // original -> rpol:default-distribute-policy - DefaultDistributePolicy DefaultPolicyType + // original -> rpol:in-policy + InPolicy []string + // original -> rpol:default-in-policy + DefaultInPolicy DefaultPolicyType } //struct for container rpol:apply-policy diff --git a/docs/sources/cli-command-syntax.md b/docs/sources/cli-command-syntax.md index c34a62e6..e78e4062 100644 --- a/docs/sources/cli-command-syntax.md +++ b/docs/sources/cli-command-syntax.md @@ -108,14 +108,14 @@ The following options can be specified in the neighbor subcommand: % gobgp neighbor <neighbor address> policy add import <policy names> <default policy action> # add policy to export-policy configuration % gobgp neighbor <neighbor address> policy add export <policy names> <default policy action> -# add policy to distribute-policy configuration -% gobgp neighbor <neighbor address> policy add distribute <policy names> <default policy action> +# add policy to in-policy configuration +% gobgp neighbor <neighbor address> policy add in <policy names> <default policy action> # delete import-policy configuration from specific neighbor % gobgp neighbor <neighbor address> policy del import # delete export-policy configuration from specific neighbor % gobgp neighbor <neighbor address> policy del export -# delete distribute-policy configuration from specific neighbor -% gobgp neighbor <neighbor address> policy del distribute +# delete in-policy configuration from specific neighbor +% gobgp neighbor <neighbor address> policy del in # show a specific policy information % gobgp neighbor <neighbor address> policy ``` diff --git a/docs/sources/filter-detail.md b/docs/sources/filter-detail.md index 3a65652c..6f87a3f5 100644 --- a/docs/sources/filter-detail.md +++ b/docs/sources/filter-detail.md @@ -5,9 +5,9 @@ This page shows how to write your own policies. As [Policy configuration](https://github.com/osrg/gobgp/blob/master/docs/sources/policy.md) shows, -you can define import or export policies or distribute policies to control the route advertisement. +you can define Import or Export policies or In policies to control the route advertisement. -Note: The distribute policy is applied only when the peer is Route Server client. +Note: The In policy is applied only when the peer is Route Server client. Basically a policy has condition part and an action part. The condition part can be defined with attributes below: - prefix @@ -709,13 +709,13 @@ You can write condition and action under Statements. --- ### 4. Attaching policy -You can use policies defined above as import or export or distribtue policy by +You can use policies defined above as Import or Export or In policy by attaching them to neighbors. - Note: The distribute policy is applied only when the peer is Route Server client. + Note: The In policy is applied only when the peer is Route Server client. To attach policies to neighbors, you need to add policy's name to Neighbors.NeighborList.ApplyPolicy in the neighbor's setting. -This example attatches *policy1* to import policy and *policy2* to export policy and *policy3* is used as the distribute policy. +This example attatches *policy1* to Import policy and *policy2* to Export policy and *policy3* is used as the In policy. ``` [Neighbors] @@ -729,10 +729,10 @@ This example attatches *policy1* to import policy and *policy2* to export policy [Neighbors.NeighborList.ApplyPolicy.ApplyPolicyConfig] ImportPolicy = ["policy1"] ExportPolicy = ["policy2"] - DistributedPolicy = ["policy3"] + InPolicy = ["policy3"] DefaultImportPolicy = 0 DefaultExportPolicy = 0 - DefaultDistributePolicy = 0 + DefaultInPolicy = 0 ``` Neighbors.NeighborList has a section to specify policies and the section's name is ApplyPolicy. @@ -740,9 +740,9 @@ The ApplyPolicy has 6 elements. | Element | Description | Example | |-------------------------|---------------------------------------------------------------------------------------------|------------| -| ImportPolicy | PolicyDefinitions.PolicyDefinitionList.name for import policy | "policy1" | -| ExportPolicy | PolicyDefinitions.PolicyDefinitionList.name for export policy | "policy2" | -| DistributedPolicy | PolicyDefinitions.PolicyDefinitionList.name for distribute policy | "policy3" | -| DefaultImportPolicy | action when the route doesn't match any policy:<br> 0 means import,<br> 1 means reject | 0 | -| DefaultExportPolicy | action when the route doesn't match any policy:<br> 0 means export,<br> 1 means discard | 0 | -| DefaultDistributePolicy | action when the route doesn't match any policy:<br> 0 means distribute,<br> 1 means reject | 0 | +| ImportPolicy | PolicyDefinitions.PolicyDefinitionList.name for Import policy | "policy1" | +| ExportPolicy | PolicyDefinitions.PolicyDefinitionList.name for Export policy | "policy2" | +| InPolicy | PolicyDefinitions.PolicyDefinitionList.name for In policy | "policy3" | +| DefaultImportPolicy | action when the route doesn't match any policy:<br> 0 means Import,<br> 1 means reject | 0 | +| DefaultExportPolicy | action when the route doesn't match any policy:<br> 0 means Export,<br> 1 means discard | 0 | +| DefaultInPolicy | action when the route doesn't match any policy:<br> 0 means In,<br> 1 means reject | 0 | diff --git a/server/peer.go b/server/peer.go index 86479c99..0d7e2369 100644 --- a/server/peer.go +++ b/server/peer.go @@ -331,7 +331,7 @@ func (peer *Peer) setDistributePolicy(policyMap map[string]*policy.Policy) { // configure distribute policy policyConf := peer.conf.ApplyPolicy distPolicies := make([]*policy.Policy, 0) - for _, policyName := range policyConf.ApplyPolicyConfig.DistributePolicy { + for _, policyName := range policyConf.ApplyPolicyConfig.InPolicy { log.WithFields(log.Fields{ "Topic": "Peer", "Key": peer.conf.NeighborConfig.NeighborAddress, @@ -343,7 +343,7 @@ func (peer *Peer) setDistributePolicy(policyMap map[string]*policy.Policy) { } } peer.distPolicies = distPolicies - peer.defaultDistributePolicy = policyConf.ApplyPolicyConfig.DefaultDistributePolicy + peer.defaultDistributePolicy = policyConf.ApplyPolicyConfig.DefaultInPolicy } func (peer *Peer) applyDistributePolicies(original *table.Path) (bool, *table.Path) { diff --git a/server/server.go b/server/server.go index b6e8843a..502acae4 100644 --- a/server/server.go +++ b/server/server.go @@ -1302,7 +1302,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { conOutPolicyNames := peer.conf.ApplyPolicy.ApplyPolicyConfig.ExportPolicy resOutPolicies = extract(conOutPolicyNames) - distPolicyNames := peer.conf.ApplyPolicy.ApplyPolicyConfig.DistributePolicy + distPolicyNames := peer.conf.ApplyPolicy.ApplyPolicyConfig.InPolicy resDistPolicies = extract(distPolicyNames) defaultInPolicy := policy.ROUTE_REJECT @@ -1356,8 +1356,8 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if reqApplyPolicy.DefaultDistributePolicy != policy.ROUTE_ACCEPT { defDistPolicy = config.DEFAULT_POLICY_TYPE_REJECT_ROUTE } - applyPolicy.DefaultDistributePolicy = defDistPolicy - applyPolicy.DistributePolicy = policy.PoliciesToString(reqApplyPolicy.DistributePolicies) + applyPolicy.DefaultInPolicy = defDistPolicy + applyPolicy.InPolicy = policy.PoliciesToString(reqApplyPolicy.DistributePolicies) } else if grpcReq.RequestType == REQ_NEIGHBOR_POLICY_DEL_IMPORT { applyPolicy.DefaultImportPolicy = config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE applyPolicy.ImportPolicy = make([]string, 0) @@ -1365,8 +1365,8 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { applyPolicy.DefaultExportPolicy = config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE applyPolicy.ExportPolicy = make([]string, 0) } else if grpcReq.RequestType == REQ_NEIGHBOR_POLICY_DEL_DISTRIBUTE { - applyPolicy.DefaultDistributePolicy = config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE - applyPolicy.DistributePolicy = make([]string, 0) + applyPolicy.DefaultInPolicy = config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE + applyPolicy.InPolicy = make([]string, 0) } if grpcReq.RequestType == REQ_NEIGHBOR_POLICY_ADD_DISTRIBUTE || diff --git a/test/scenario_test/policy/policy_generator.go b/test/scenario_test/policy/policy_generator.go index af252031..4d94b470 100644 --- a/test/scenario_test/policy/policy_generator.go +++ b/test/scenario_test/policy/policy_generator.go @@ -47,12 +47,12 @@ func bindPolicy(outputDir, peer, target, policyName string, isReplace bool, defa } case "distribute": if isReplace { - ap.DistributePolicy = []string{policyName} + ap.InPolicy = []string{policyName} } else { - ap.DistributePolicy = append(ap.DistributePolicy, policyName) + ap.InPolicy = append(ap.InPolicy, policyName) } if defaultReject { - ap.DefaultDistributePolicy = 1 + ap.DefaultInPolicy = 1 } } newConf.Neighbors.NeighborList[idx] = neighbor |