diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-17 11:41:53 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-08-17 19:29:41 +0900 |
commit | 75254037d47ca8a6cf86604d8371d5db5db8464d (patch) | |
tree | 79049601d9de0d7d3e0a06056b41a766d47a8876 /internal/pkg/table/policy.go | |
parent | f61858a3acf5a8567148e274a44c1851f6c01809 (diff) |
table: remove DIRECTION_IN completely
so overdue.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'internal/pkg/table/policy.go')
-rw-r--r-- | internal/pkg/table/policy.go | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/internal/pkg/table/policy.go b/internal/pkg/table/policy.go index 1f5be006..23186a09 100644 --- a/internal/pkg/table/policy.go +++ b/internal/pkg/table/policy.go @@ -77,15 +77,12 @@ type PolicyDirection int const ( POLICY_DIRECTION_NONE PolicyDirection = iota - POLICY_DIRECTION_IN POLICY_DIRECTION_IMPORT POLICY_DIRECTION_EXPORT ) func (d PolicyDirection) String() string { switch d { - case POLICY_DIRECTION_IN: - return "in" case POLICY_DIRECTION_IMPORT: return "import" case POLICY_DIRECTION_EXPORT: @@ -3102,8 +3099,6 @@ func (p Policies) Less(i, j int) bool { } type Assignment struct { - inPolicies []*Policy - defaultInPolicy RouteType importPolicies []*Policy defaultImportPolicy RouteType exportPolicies []*Policy @@ -3154,8 +3149,6 @@ func (r *RoutingPolicy) getPolicy(id string, dir PolicyDirection) []*Policy { return nil } switch dir { - case POLICY_DIRECTION_IN: - return a.inPolicies case POLICY_DIRECTION_IMPORT: return a.importPolicies case POLICY_DIRECTION_EXPORT: @@ -3171,8 +3164,6 @@ func (r *RoutingPolicy) getDefaultPolicy(id string, dir PolicyDirection) RouteTy return ROUTE_TYPE_NONE } switch dir { - case POLICY_DIRECTION_IN: - return a.defaultInPolicy case POLICY_DIRECTION_IMPORT: return a.defaultImportPolicy case POLICY_DIRECTION_EXPORT: @@ -3189,8 +3180,6 @@ func (r *RoutingPolicy) setPolicy(id string, dir PolicyDirection, policies []*Po a = &Assignment{} } switch dir { - case POLICY_DIRECTION_IN: - a.inPolicies = policies case POLICY_DIRECTION_IMPORT: a.importPolicies = policies case POLICY_DIRECTION_EXPORT: @@ -3206,8 +3195,6 @@ func (r *RoutingPolicy) setDefaultPolicy(id string, dir PolicyDirection, typ Rou a = &Assignment{} } switch dir { - case POLICY_DIRECTION_IN: - a.defaultInPolicy = typ case POLICY_DIRECTION_IMPORT: a.defaultImportPolicy = typ case POLICY_DIRECTION_EXPORT: @@ -3223,9 +3210,6 @@ func (r *RoutingPolicy) getAssignmentFromConfig(dir PolicyDirection, a config.Ap def := ROUTE_TYPE_ACCEPT c := a.Config switch dir { - case POLICY_DIRECTION_IN: - names = c.InPolicyList - cdef = c.DefaultInPolicy case POLICY_DIRECTION_IMPORT: names = c.ImportPolicyList cdef = c.DefaultImportPolicy @@ -3712,7 +3696,7 @@ func (r *RoutingPolicy) DeletePolicy(x *Policy, all, preserve bool, activeId []s } inUse := func(ids []string) bool { for _, id := range ids { - for _, dir := range []PolicyDirection{POLICY_DIRECTION_IN, POLICY_DIRECTION_EXPORT, POLICY_DIRECTION_EXPORT} { + for _, dir := range []PolicyDirection{POLICY_DIRECTION_EXPORT, POLICY_DIRECTION_EXPORT} { for _, y := range r.getPolicy(id, dir) { if x.Name == y.Name { return true @@ -3946,7 +3930,7 @@ func (r *RoutingPolicy) Reset(rp *config.RoutingPolicy, ap map[string]config.App } for id, c := range ap { - for _, dir := range []PolicyDirection{POLICY_DIRECTION_IN, POLICY_DIRECTION_IMPORT, POLICY_DIRECTION_EXPORT} { + for _, dir := range []PolicyDirection{POLICY_DIRECTION_IMPORT, POLICY_DIRECTION_EXPORT} { ps, def, err := r.getAssignmentFromConfig(dir, c) if err != nil { log.WithFields(log.Fields{ |