diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-05 18:25:49 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-10 23:58:17 +0000 |
commit | aa79a4de21772f556450cfe7e55e6f400c3f9dec (patch) | |
tree | cc15bcd2297653ffac956fa7c847b5bb9f7c2f70 | |
parent | d4a82f70ba17b64b1841d801098bf38dc0c475e1 (diff) |
config: add PrefixLimit configuration knob to top-level of AfiSafi
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | config/bgp_configs.go | 92 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 3 |
2 files changed, 50 insertions, 45 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 4fa29bd4..3a5a1b6b 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -633,6 +633,51 @@ func (v DefaultPolicyType) Validate() error { return nil } +// typedef for typedef bgp-pol:bgp-next-hop-type +type BgpNextHopType string + +// typedef for typedef bgp-pol:bgp-as-path-prepend-repeat +type BgpAsPathPrependRepeat uint8 + +// typedef for typedef bgp-pol:bgp-set-med-type +type BgpSetMedType string + +// typedef for identity bgp-pol:bgp-set-community-option-type +type BgpSetCommunityOptionType string + +const ( + BGP_SET_COMMUNITY_OPTION_TYPE_ADD BgpSetCommunityOptionType = "add" + BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE BgpSetCommunityOptionType = "remove" + BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE BgpSetCommunityOptionType = "replace" +) + +var BgpSetCommunityOptionTypeToIntMap = map[BgpSetCommunityOptionType]int{ + BGP_SET_COMMUNITY_OPTION_TYPE_ADD: 0, + BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: 1, + BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: 2, +} + +func (v BgpSetCommunityOptionType) ToInt() int { + i, ok := BgpSetCommunityOptionTypeToIntMap[v] + if !ok { + return -1 + } + return i +} + +var IntToBgpSetCommunityOptionTypeMap = map[int]BgpSetCommunityOptionType{ + 0: BGP_SET_COMMUNITY_OPTION_TYPE_ADD, + 1: BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, + 2: BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, +} + +func (v BgpSetCommunityOptionType) Validate() error { + if _, ok := BgpSetCommunityOptionTypeToIntMap[v]; !ok { + return fmt.Errorf("invalid BgpSetCommunityOptionType: %s", v) + } + return nil +} + // typedef for identity bgp:session-state type SessionState string @@ -714,51 +759,6 @@ func (v Mode) Validate() error { return nil } -// typedef for typedef bgp-pol:bgp-next-hop-type -type BgpNextHopType string - -// typedef for typedef bgp-pol:bgp-as-path-prepend-repeat -type BgpAsPathPrependRepeat uint8 - -// typedef for typedef bgp-pol:bgp-set-med-type -type BgpSetMedType string - -// typedef for identity bgp-pol:bgp-set-community-option-type -type BgpSetCommunityOptionType string - -const ( - BGP_SET_COMMUNITY_OPTION_TYPE_ADD BgpSetCommunityOptionType = "add" - BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE BgpSetCommunityOptionType = "remove" - BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE BgpSetCommunityOptionType = "replace" -) - -var BgpSetCommunityOptionTypeToIntMap = map[BgpSetCommunityOptionType]int{ - BGP_SET_COMMUNITY_OPTION_TYPE_ADD: 0, - BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: 1, - BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: 2, -} - -func (v BgpSetCommunityOptionType) ToInt() int { - i, ok := BgpSetCommunityOptionTypeToIntMap[v] - if !ok { - return -1 - } - return i -} - -var IntToBgpSetCommunityOptionTypeMap = map[int]BgpSetCommunityOptionType{ - 0: BGP_SET_COMMUNITY_OPTION_TYPE_ADD, - 1: BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, - 2: BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, -} - -func (v BgpSetCommunityOptionType) Validate() error { - if _, ok := BgpSetCommunityOptionTypeToIntMap[v]; !ok { - return fmt.Errorf("invalid BgpSetCommunityOptionType: %s", v) - } - return nil -} - // typedef for identity gobgp:bmp-route-monitoring-policy-type type BmpRouteMonitoringPolicyType string @@ -1811,6 +1811,8 @@ type AfiSafi struct { RouteSelectionOptions RouteSelectionOptions `mapstructure:"route-selection-options"` // original -> bgp-mp:use-multiple-paths UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"` + // original -> bgp-mp:prefix-limit + PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } //struct for container bgp:state diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index 775d851d..d042792d 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -808,4 +808,7 @@ module gobgp { } } + augment "/bgp:bgp/bgp:global/bgp:afi-safis/bgp:afi-safi" { + uses bgp-mp:all-afi-safi-common; + } } |