diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-18 22:02:06 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-23 10:05:19 +0900 |
commit | 008c961ecd943739c5db63fcd931904804a45aa5 (patch) | |
tree | a56ebdc908ce1b387c030cf6223e7f5f5d76d5c8 /pkg/server/server_test.go | |
parent | 7e07240b292946c5fdd281fcc06d0cb8438c349a (diff) |
policy cleanup
- remove ReplaceDefinedSet and ReplaceStatement APIs; not intutive and
should create a new one instead of modifying the existing.
- Rename ReplacePolicyAssignment to SetPolicyAssignment API; we use
internally SetPolicy() name from the beginning.
- Rename UpdatePolicy() to SetPolicies() API; It doesn't update
anything so the name is confusing. It discards the all policies and
create policies from the argument.
- Changes some member names in structures for policy.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/server/server_test.go')
-rw-r--r-- | pkg/server/server_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index b12481bd..e56c6302 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -68,13 +68,13 @@ func TestModPolicyAssign(t *testing.T) { } r := f([]*config.PolicyDefinition{&config.PolicyDefinition{Name: "p1"}, &config.PolicyDefinition{Name: "p2"}, &config.PolicyDefinition{Name: "p3"}}) - r.Type = api.PolicyDirection_IMPORT - r.Default = api.RouteAction_ACCEPT + r.Direction = api.PolicyDirection_IMPORT + r.DefaultAction = api.RouteAction_ACCEPT r.Name = table.GLOBAL_RIB_NAME err = s.AddPolicyAssignment(context.Background(), &api.AddPolicyAssignmentRequest{Assignment: r}) assert.Nil(err) - r.Type = api.PolicyDirection_EXPORT + r.Direction = api.PolicyDirection_EXPORT err = s.AddPolicyAssignment(context.Background(), &api.AddPolicyAssignmentRequest{Assignment: r}) assert.Nil(err) @@ -85,8 +85,8 @@ func TestModPolicyAssign(t *testing.T) { assert.Equal(len(ps[0].Policies), 3) r = f([]*config.PolicyDefinition{&config.PolicyDefinition{Name: "p1"}}) - r.Type = api.PolicyDirection_IMPORT - r.Default = api.RouteAction_ACCEPT + r.Direction = api.PolicyDirection_IMPORT + r.DefaultAction = api.RouteAction_ACCEPT r.Name = table.GLOBAL_RIB_NAME err = s.DeletePolicyAssignment(context.Background(), &api.DeletePolicyAssignmentRequest{Assignment: r}) assert.Nil(err) @@ -135,10 +135,10 @@ func TestListPolicyAssignment(t *testing.T) { assert.Nil(err) pa := &api.PolicyAssignment{ - Type: api.PolicyDirection_IMPORT, - Default: api.RouteAction_ACCEPT, - Name: addr, - Policies: []*api.Policy{&api.Policy{Name: fmt.Sprintf("p%d", i)}}, + Direction: api.PolicyDirection_IMPORT, + DefaultAction: api.RouteAction_ACCEPT, + Name: addr, + Policies: []*api.Policy{&api.Policy{Name: fmt.Sprintf("p%d", i)}}, } err = s.AddPolicyAssignment(context.Background(), &api.AddPolicyAssignmentRequest{Assignment: pa}) assert.Nil(err) |