diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-17 22:43:30 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-18 21:32:24 +0900 |
commit | d6a5e9f1572aff35d8ab47c896f71c06871c2b15 (patch) | |
tree | 250640c970be55ce34f96b3f9a04b08f7a4b703d /cmd | |
parent | cbfa5c5ed261058b12518e4fbe0bea39f36399a1 (diff) |
pkg/server: ListPolicyAssignment() returns all assignments by default
Like other ListPolicy*() functions, if no conditions are specified,
all assignments are returned.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgp/cmd/common.go | 2 | ||||
-rw-r--r-- | cmd/gobgp/cmd/neighbor.go | 2 | ||||
-rw-r--r-- | cmd/gobgpd/main.go | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/cmd/gobgp/cmd/common.go b/cmd/gobgp/cmd/common.go index a1104836..f4a72b1e 100644 --- a/cmd/gobgp/cmd/common.go +++ b/cmd/gobgp/cmd/common.go @@ -32,6 +32,8 @@ import ( "github.com/osrg/gobgp/pkg/packet/bgp" ) +const GLOBAL_RIB_NAME = "global" + const ( CMD_GLOBAL = "global" CMD_NEIGHBOR = "neighbor" diff --git a/cmd/gobgp/cmd/neighbor.go b/cmd/gobgp/cmd/neighbor.go index 6bd531a6..e863003a 100644 --- a/cmd/gobgp/cmd/neighbor.go +++ b/cmd/gobgp/cmd/neighbor.go @@ -1072,6 +1072,8 @@ func modNeighborPolicy(remoteIP, policyType, cmdType string, args []string) erro resource := api.Resource_GLOBAL if remoteIP != "" { resource = api.Resource_LOCAL + } else { + remoteIP = GLOBAL_RIB_NAME } assign := &api.PolicyAssignment{ diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 146facad..463387b9 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -334,7 +334,7 @@ func main() { ps := toPolicies(a.ImportPolicyList) apiServer.ReplacePolicyAssignment(context.Background(), &api.ReplacePolicyAssignmentRequest{ Assignment: server.NewAPIPolicyAssignmentFromTableStruct(&table.PolicyAssignment{ - Name: "", + Name: table.GLOBAL_RIB_NAME, Type: table.POLICY_DIRECTION_IMPORT, Policies: ps, Default: def, @@ -345,7 +345,7 @@ func main() { ps = toPolicies(a.ExportPolicyList) apiServer.ReplacePolicyAssignment(context.Background(), &api.ReplacePolicyAssignmentRequest{ Assignment: server.NewAPIPolicyAssignmentFromTableStruct(&table.PolicyAssignment{ - Name: "", + Name: table.GLOBAL_RIB_NAME, Type: table.POLICY_DIRECTION_EXPORT, Policies: ps, Default: def, |