summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2018-12-23 23:12:49 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2018-12-23 23:40:37 +0900
commit8d0a8b0ffa696a3838740fec7accc54ccfb452ab (patch)
treecc9dd2da324045dba80bb6dc1d1149ed0114c639 /internal
parentababf3068c48d665e2d9d7816cbb521c74fc47c5 (diff)
make the usage of type name in protobuf consistent
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/pkg/config/util.go36
-rw-r--r--internal/pkg/table/policy.go38
2 files changed, 37 insertions, 37 deletions
diff --git a/internal/pkg/config/util.go b/internal/pkg/config/util.go
index 0cd8e2a9..6d3af91b 100644
--- a/internal/pkg/config/util.go
+++ b/internal/pkg/config/util.go
@@ -675,50 +675,50 @@ func NewAPIDefinedSetsFromConfigStruct(t *DefinedSets) ([]*api.DefinedSet, error
prefixes = append(prefixes, ap)
}
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_PREFIX,
- Name: ps.PrefixSetName,
- Prefixes: prefixes,
+ DefinedType: api.DefinedType_PREFIX,
+ Name: ps.PrefixSetName,
+ Prefixes: prefixes,
})
}
for _, ns := range t.NeighborSets {
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_NEIGHBOR,
- Name: ns.NeighborSetName,
- List: ns.NeighborInfoList,
+ DefinedType: api.DefinedType_NEIGHBOR,
+ Name: ns.NeighborSetName,
+ List: ns.NeighborInfoList,
})
}
bs := t.BgpDefinedSets
for _, cs := range bs.CommunitySets {
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_COMMUNITY,
- Name: cs.CommunitySetName,
- List: cs.CommunityList,
+ DefinedType: api.DefinedType_COMMUNITY,
+ Name: cs.CommunitySetName,
+ List: cs.CommunityList,
})
}
for _, es := range bs.ExtCommunitySets {
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_EXT_COMMUNITY,
- Name: es.ExtCommunitySetName,
- List: es.ExtCommunityList,
+ DefinedType: api.DefinedType_EXT_COMMUNITY,
+ Name: es.ExtCommunitySetName,
+ List: es.ExtCommunityList,
})
}
for _, ls := range bs.LargeCommunitySets {
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_LARGE_COMMUNITY,
- Name: ls.LargeCommunitySetName,
- List: ls.LargeCommunityList,
+ DefinedType: api.DefinedType_LARGE_COMMUNITY,
+ Name: ls.LargeCommunitySetName,
+ List: ls.LargeCommunityList,
})
}
for _, as := range bs.AsPathSets {
definedSets = append(definedSets, &api.DefinedSet{
- Type: api.DefinedType_AS_PATH,
- Name: as.AsPathSetName,
- List: as.AsPathList,
+ DefinedType: api.DefinedType_AS_PATH,
+ Name: as.AsPathSetName,
+ List: as.AsPathList,
})
}
diff --git a/internal/pkg/table/policy.go b/internal/pkg/table/policy.go
index 6c4ca0b0..af07b784 100644
--- a/internal/pkg/table/policy.go
+++ b/internal/pkg/table/policy.go
@@ -3907,45 +3907,45 @@ func toStatementApi(s *config.Statement) *api.Statement {
o, _ := NewMatchOption(s.Conditions.MatchPrefixSet.MatchSetOptions)
if s.Conditions.MatchPrefixSet.PrefixSet != "" {
cs.PrefixSet = &api.MatchSet{
- Type: api.MatchType(o),
- Name: s.Conditions.MatchPrefixSet.PrefixSet,
+ MatchType: api.MatchType(o),
+ Name: s.Conditions.MatchPrefixSet.PrefixSet,
}
}
if s.Conditions.MatchNeighborSet.NeighborSet != "" {
o, _ := NewMatchOption(s.Conditions.MatchNeighborSet.MatchSetOptions)
cs.NeighborSet = &api.MatchSet{
- Type: api.MatchType(o),
- Name: s.Conditions.MatchNeighborSet.NeighborSet,
+ MatchType: api.MatchType(o),
+ Name: s.Conditions.MatchNeighborSet.NeighborSet,
}
}
if s.Conditions.BgpConditions.AsPathLength.Operator != "" {
cs.AsPathLength = &api.AsPathLength{
- Length: s.Conditions.BgpConditions.AsPathLength.Value,
- Type: api.AsPathLengthType(s.Conditions.BgpConditions.AsPathLength.Operator.ToInt()),
+ Length: s.Conditions.BgpConditions.AsPathLength.Value,
+ LengthType: api.AsPathLengthType(s.Conditions.BgpConditions.AsPathLength.Operator.ToInt()),
}
}
if s.Conditions.BgpConditions.MatchAsPathSet.AsPathSet != "" {
cs.AsPathSet = &api.MatchSet{
- Type: api.MatchType(s.Conditions.BgpConditions.MatchAsPathSet.MatchSetOptions.ToInt()),
- Name: s.Conditions.BgpConditions.MatchAsPathSet.AsPathSet,
+ MatchType: api.MatchType(s.Conditions.BgpConditions.MatchAsPathSet.MatchSetOptions.ToInt()),
+ Name: s.Conditions.BgpConditions.MatchAsPathSet.AsPathSet,
}
}
if s.Conditions.BgpConditions.MatchCommunitySet.CommunitySet != "" {
cs.CommunitySet = &api.MatchSet{
- Type: api.MatchType(s.Conditions.BgpConditions.MatchCommunitySet.MatchSetOptions.ToInt()),
- Name: s.Conditions.BgpConditions.MatchCommunitySet.CommunitySet,
+ MatchType: api.MatchType(s.Conditions.BgpConditions.MatchCommunitySet.MatchSetOptions.ToInt()),
+ Name: s.Conditions.BgpConditions.MatchCommunitySet.CommunitySet,
}
}
if s.Conditions.BgpConditions.MatchExtCommunitySet.ExtCommunitySet != "" {
cs.ExtCommunitySet = &api.MatchSet{
- Type: api.MatchType(s.Conditions.BgpConditions.MatchExtCommunitySet.MatchSetOptions.ToInt()),
- Name: s.Conditions.BgpConditions.MatchExtCommunitySet.ExtCommunitySet,
+ MatchType: api.MatchType(s.Conditions.BgpConditions.MatchExtCommunitySet.MatchSetOptions.ToInt()),
+ Name: s.Conditions.BgpConditions.MatchExtCommunitySet.ExtCommunitySet,
}
}
if s.Conditions.BgpConditions.MatchLargeCommunitySet.LargeCommunitySet != "" {
cs.LargeCommunitySet = &api.MatchSet{
- Type: api.MatchType(s.Conditions.BgpConditions.MatchLargeCommunitySet.MatchSetOptions.ToInt()),
- Name: s.Conditions.BgpConditions.MatchLargeCommunitySet.LargeCommunitySet,
+ MatchType: api.MatchType(s.Conditions.BgpConditions.MatchLargeCommunitySet.MatchSetOptions.ToInt()),
+ Name: s.Conditions.BgpConditions.MatchLargeCommunitySet.LargeCommunitySet,
}
}
if s.Conditions.BgpConditions.RouteType != "" {
@@ -3980,7 +3980,7 @@ func toStatementApi(s *config.Statement) *api.Statement {
return nil
}
return &api.CommunityAction{
- Type: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetCommunity.Options)]),
+ ActionType: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetCommunity.Options)]),
Communities: s.Actions.BgpActions.SetCommunity.SetCommunityMethod.CommunitiesList}
}(),
Med: func() *api.MedAction {
@@ -4002,8 +4002,8 @@ func toStatementApi(s *config.Statement) *api.Statement {
return nil
}
return &api.MedAction{
- Value: value,
- Type: action,
+ Value: value,
+ ActionType: action,
}
}(),
AsPrepend: func() *api.AsPrependAction {
@@ -4028,7 +4028,7 @@ func toStatementApi(s *config.Statement) *api.Statement {
return nil
}
return &api.CommunityAction{
- Type: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetExtCommunity.Options)]),
+ ActionType: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetExtCommunity.Options)]),
Communities: s.Actions.BgpActions.SetExtCommunity.SetExtCommunityMethod.CommunitiesList,
}
}(),
@@ -4037,7 +4037,7 @@ func toStatementApi(s *config.Statement) *api.Statement {
return nil
}
return &api.CommunityAction{
- Type: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetLargeCommunity.Options)]),
+ ActionType: api.CommunityActionType(config.BgpSetCommunityOptionTypeToIntMap[config.BgpSetCommunityOptionType(s.Actions.BgpActions.SetLargeCommunity.Options)]),
Communities: s.Actions.BgpActions.SetLargeCommunity.SetLargeCommunityMethod.CommunitiesList,
}
}(),