diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 06:50:15 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 06:50:15 +0900 |
commit | 4635014cbb1f403d4582698f1b0a23f5a879d5d0 (patch) | |
tree | 39a4a770865d576aca7278f2a8b33dac1eefa657 /server/server_test.go | |
parent | c7c8f5612bb726ca8fe85389c688bb5d412e8fdb (diff) |
remove gRPC dependency from table/
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server_test.go')
-rw-r--r-- | server/server_test.go | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/server/server_test.go b/server/server_test.go index 48d7e52d..9a55f775 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -16,7 +16,6 @@ package server import ( - api "github.com/osrg/gobgp/api" "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/table" "github.com/stretchr/testify/assert" @@ -33,50 +32,21 @@ func TestModPolicyAssign(t *testing.T) { RouterId: "1.1.1.1", }, }) - _, err := s.handleGrpcAddPolicy(&GrpcRequest{ - Data: &api.AddPolicyRequest{ - Policy: &api.Policy{ - Name: "p1", - }, - }, - }) + err := s.AddPolicy(&table.Policy{Name: "p1"}, false) assert.Nil(err) - _, err = s.handleGrpcAddPolicy(&GrpcRequest{ - Data: &api.AddPolicyRequest{ - Policy: &api.Policy{ - Name: "p2", - }, - }, - }) + + err = s.AddPolicy(&table.Policy{Name: "p2"}, false) assert.Nil(err) - _, err = s.handleGrpcAddPolicy(&GrpcRequest{ - Data: &api.AddPolicyRequest{ - Policy: &api.Policy{ - Name: "p3", - }, - }, - }) + + err = s.AddPolicy(&table.Policy{Name: "p3"}, false) assert.Nil(err) - _, err = s.handleGrpcAddPolicyAssignment(&GrpcRequest{ - Data: &api.AddPolicyAssignmentRequest{ - Assignment: &api.PolicyAssignment{ - Type: api.PolicyType_IMPORT, - Resource: api.Resource_GLOBAL, - Policies: []*api.Policy{&api.Policy{Name: "p1"}, &api.Policy{Name: "p2"}, &api.Policy{Name: "p3"}}, - }, - }, - }) + + err = s.AddPolicyAssignment("", table.POLICY_DIRECTION_IMPORT, + []*config.PolicyDefinition{&config.PolicyDefinition{Name: "p1"}, &config.PolicyDefinition{Name: "p2"}, &config.PolicyDefinition{Name: "p3"}}, table.ROUTE_TYPE_ACCEPT) assert.Nil(err) - _, err = s.handleGrpcDeletePolicyAssignment(&GrpcRequest{ - Data: &api.DeletePolicyAssignmentRequest{ - Assignment: &api.PolicyAssignment{ - Type: api.PolicyType_IMPORT, - Resource: api.Resource_GLOBAL, - Policies: []*api.Policy{&api.Policy{Name: "p1"}}, - }, - }, - }) + err = s.DeletePolicyAssignment("", table.POLICY_DIRECTION_IMPORT, + []*config.PolicyDefinition{&config.PolicyDefinition{Name: "p1"}}, false) assert.Nil(err) ps := s.policy.GetPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_IMPORT) |