summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/bgp_configs.go984
-rw-r--r--config/default.go66
-rw-r--r--config/serve.go12
-rw-r--r--config/util.go10
-rw-r--r--gobgpd/main.go2
-rw-r--r--server/bmp.go8
-rw-r--r--server/fsm.go2
-rw-r--r--server/peer.go4
-rw-r--r--server/rpki.go8
-rw-r--r--server/server.go36
-rw-r--r--table/policy.go91
-rw-r--r--table/policy_test.go282
-rw-r--r--test/lib/gobgp.py84
-rw-r--r--test/scenario_test/route_server_policy_test.py696
-rw-r--r--tools/config/example_toml.go118
-rw-r--r--tools/pyang_plugins/README.rst2
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py25
-rw-r--r--tools/route-server/quagga-rsconfig.go2
18 files changed, 1171 insertions, 1261 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index c2ce2deb..d5f6975d 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -451,1416 +451,1386 @@ type BmpServerState struct {
type BmpServerConfig struct {
// original -> gobgp:address
//gobgp:address's original type is inet:ip-address
- Address string
+ Address string `mapstructure:"address"`
// original -> gobgp:port
- Port uint32
+ Port uint32 `mapstructure:"port"`
// original -> gobgp:route-monitoring-policy
- RouteMonitoringPolicy BmpRouteMonitoringPolicyType
+ RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy"`
}
//struct for container gobgp:bmp-server
type BmpServer struct {
// original -> gobgp:address
//gobgp:address's original type is inet:ip-address
- Address string
+ Address string `mapstructure:"address"`
// original -> gobgp:bmp-server-config
- Config BmpServerConfig
+ Config BmpServerConfig `mapstructure:"config"`
// original -> gobgp:bmp-server-state
- State BmpServerState
-}
-
-//struct for container gobgp:bmp-servers
-type BmpServers struct {
- // original -> gobgp:bmp-server
- BmpServerList []BmpServer
+ State BmpServerState `mapstructure:"state"`
}
//struct for container gobgp:rpki-received
type RpkiReceived struct {
// original -> gobgp:serial-notify
- SerialNotify int64
+ SerialNotify int64 `mapstructure:"serial-notify"`
// original -> gobgp:cache-reset
- CacheReset int64
+ CacheReset int64 `mapstructure:"cache-reset"`
// original -> gobgp:cache-response
- CacheResponse int64
+ CacheResponse int64 `mapstructure:"cache-response"`
// original -> gobgp:ipv4-prefix
- Ipv4Prefix int64
+ Ipv4Prefix int64 `mapstructure:"ipv4-prefix"`
// original -> gobgp:ipv6-prefix
- Ipv6Prefix int64
+ Ipv6Prefix int64 `mapstructure:"ipv6-prefix"`
// original -> gobgp:end-of-data
- EndOfData int64
+ EndOfData int64 `mapstructure:"end-of-data"`
// original -> gobgp:error
- Error int64
+ Error int64 `mapstructure:"error"`
}
//struct for container gobgp:rpki-sent
type RpkiSent struct {
// original -> gobgp:serial-query
- SerialQuery int64
+ SerialQuery int64 `mapstructure:"serial-query"`
// original -> gobgp:reset-query
- ResetQuery int64
+ ResetQuery int64 `mapstructure:"reset-query"`
// original -> gobgp:error
- Error int64
+ Error int64 `mapstructure:"error"`
}
//struct for container gobgp:rpki-messages
type RpkiMessages struct {
// original -> gobgp:rpki-sent
- RpkiSent RpkiSent
+ RpkiSent RpkiSent `mapstructure:"rpki-sent"`
// original -> gobgp:rpki-received
- RpkiReceived RpkiReceived
+ RpkiReceived RpkiReceived `mapstructure:"rpki-received"`
}
//struct for container gobgp:state
type RpkiServerState struct {
// original -> gobgp:uptime
- Uptime int64
+ Uptime int64 `mapstructure:"uptime"`
// original -> gobgp:downtime
- Downtime int64
+ Downtime int64 `mapstructure:"downtime"`
// original -> gobgp:last-pdu-recv-time
- LastPduRecvTime int64
+ LastPduRecvTime int64 `mapstructure:"last-pdu-recv-time"`
// original -> gobgp:rpki-messages
- RpkiMessages RpkiMessages
+ RpkiMessages RpkiMessages `mapstructure:"rpki-messages"`
}
//struct for container gobgp:config
type RpkiServerConfig struct {
// original -> gobgp:address
//gobgp:address's original type is inet:ip-address
- Address string
+ Address string `mapstructure:"address"`
// original -> gobgp:port
- Port uint32
+ Port uint32 `mapstructure:"port"`
// original -> gobgp:refresh-time
- RefreshTime int64
+ RefreshTime int64 `mapstructure:"refresh-time"`
// original -> gobgp:hold-time
- HoldTime int64
+ HoldTime int64 `mapstructure:"hold-time"`
// original -> gobgp:record-lifetime
- RecordLifetime int64
+ RecordLifetime int64 `mapstructure:"record-lifetime"`
// original -> gobgp:preference
- Preference uint8
+ Preference uint8 `mapstructure:"preference"`
}
//struct for container gobgp:rpki-server
type RpkiServer struct {
// original -> gobgp:address
//gobgp:address's original type is inet:ip-address
- Address string
+ Address string `mapstructure:"address"`
// original -> gobgp:rpki-server-config
- Config RpkiServerConfig
+ Config RpkiServerConfig `mapstructure:"config"`
// original -> gobgp:rpki-server-state
- State RpkiServerState
-}
-
-//struct for container gobgp:rpki-servers
-type RpkiServers struct {
- // original -> gobgp:rpki-server
- RpkiServerList []RpkiServer
+ State RpkiServerState `mapstructure:"state"`
}
//struct for container bgp:state
type PeerGroupState struct {
// original -> bgp:peer-as
//bgp:peer-as's original type is inet:as-number
- PeerAs uint32
+ PeerAs uint32 `mapstructure:"peer-as"`
// original -> bgp:local-as
//bgp:local-as's original type is inet:as-number
- LocalAs uint32
+ LocalAs uint32 `mapstructure:"local-as"`
// original -> bgp:peer-type
- PeerType PeerType
+ PeerType PeerType `mapstructure:"peer-type"`
// original -> bgp:auth-password
- AuthPassword string
+ AuthPassword string `mapstructure:"auth-password"`
// original -> bgp:remove-private-as
- RemovePrivateAs RemovePrivateAsOption
+ RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as"`
// original -> bgp:route-flap-damping
//bgp:route-flap-damping's original type is boolean
- RouteFlapDamping bool
+ RouteFlapDamping bool `mapstructure:"route-flap-damping"`
// original -> bgp:send-community
- SendCommunity CommunityType
+ SendCommunity CommunityType `mapstructure:"send-community"`
// original -> bgp:description
- Description string
+ Description string `mapstructure:"description"`
// original -> bgp:peer-group-name
- PeerGroupName string
+ PeerGroupName string `mapstructure:"peer-group-name"`
// original -> bgp-op:total-paths
- TotalPaths uint32
+ TotalPaths uint32 `mapstructure:"total-paths"`
// original -> bgp-op:total-prefixes
- TotalPrefixes uint32
+ TotalPrefixes uint32 `mapstructure:"total-prefixes"`
}
//struct for container bgp:config
type PeerGroupConfig struct {
// original -> bgp:peer-as
//bgp:peer-as's original type is inet:as-number
- PeerAs uint32
+ PeerAs uint32 `mapstructure:"peer-as"`
// original -> bgp:local-as
//bgp:local-as's original type is inet:as-number
- LocalAs uint32
+ LocalAs uint32 `mapstructure:"local-as"`
// original -> bgp:peer-type
- PeerType PeerType
+ PeerType PeerType `mapstructure:"peer-type"`
// original -> bgp:auth-password
- AuthPassword string
+ AuthPassword string `mapstructure:"auth-password"`
// original -> bgp:remove-private-as
- RemovePrivateAs RemovePrivateAsOption
+ RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as"`
// original -> bgp:route-flap-damping
//bgp:route-flap-damping's original type is boolean
- RouteFlapDamping bool
+ RouteFlapDamping bool `mapstructure:"route-flap-damping"`
// original -> bgp:send-community
- SendCommunity CommunityType
+ SendCommunity CommunityType `mapstructure:"send-community"`
// original -> bgp:description
- Description string
+ Description string `mapstructure:"description"`
// original -> bgp:peer-group-name
- PeerGroupName string
+ PeerGroupName string `mapstructure:"peer-group-name"`
}
//struct for container bgp:peer-group
type PeerGroup struct {
// original -> bgp:peer-group-name
- PeerGroupName string
+ PeerGroupName string `mapstructure:"peer-group-name"`
// original -> bgp:peer-group-config
- Config PeerGroupConfig
+ Config PeerGroupConfig `mapstructure:"config"`
// original -> bgp:peer-group-state
- State PeerGroupState
+ State PeerGroupState `mapstructure:"state"`
// original -> bgp:timers
- Timers Timers
+ Timers Timers `mapstructure:"timers"`
// original -> bgp:transport
- Transport Transport
+ Transport Transport `mapstructure:"transport"`
// original -> bgp:error-handling
- ErrorHandling ErrorHandling
+ ErrorHandling ErrorHandling `mapstructure:"error-handling"`
// original -> bgp:logging-options
- LoggingOptions LoggingOptions
+ LoggingOptions LoggingOptions `mapstructure:"logging-options"`
// original -> bgp:ebgp-multihop
- EbgpMultihop EbgpMultihop
+ EbgpMultihop EbgpMultihop `mapstructure:"ebgp-multihop"`
// original -> bgp:route-reflector
- RouteReflector RouteReflector
+ RouteReflector RouteReflector `mapstructure:"route-reflector"`
// original -> bgp:as-path-options
- AsPathOptions AsPathOptions
+ AsPathOptions AsPathOptions `mapstructure:"as-path-options"`
// original -> bgp:add-paths
- AddPaths AddPaths
+ AddPaths AddPaths `mapstructure:"add-paths"`
// original -> bgp:afi-safis
- AfiSafis AfiSafis
+ AfiSafis []AfiSafi `mapstructure:"afi-safis"`
// original -> bgp:graceful-restart
- GracefulRestart GracefulRestart
+ GracefulRestart GracefulRestart `mapstructure:"graceful-restart"`
// original -> rpol:apply-policy
- ApplyPolicy ApplyPolicy
+ ApplyPolicy ApplyPolicy `mapstructure:"apply-policy"`
// original -> bgp-mp:use-multiple-paths
- UseMultiplePaths UseMultiplePaths
+ UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"`
// original -> gobgp:route-server
- RouteServer RouteServer
-}
-
-//struct for container bgp:peer-groups
-type PeerGroups struct {
- // original -> bgp:peer-group
- PeerGroupList []PeerGroup
+ RouteServer RouteServer `mapstructure:"route-server"`
}
//struct for container gobgp:state
type RouteServerState struct {
// original -> gobgp:route-server-client
//gobgp:route-server-client's original type is boolean
- RouteServerClient bool
+ RouteServerClient bool `mapstructure:"route-server-client"`
}
//struct for container gobgp:config
type RouteServerConfig struct {
// original -> gobgp:route-server-client
//gobgp:route-server-client's original type is boolean
- RouteServerClient bool
+ RouteServerClient bool `mapstructure:"route-server-client"`
}
//struct for container gobgp:route-server
type RouteServer struct {
// original -> gobgp:route-server-config
- Config RouteServerConfig
+ Config RouteServerConfig `mapstructure:"config"`
// original -> gobgp:route-server-state
- State RouteServerState
+ State RouteServerState `mapstructure:"state"`
}
//struct for container bgp-op:prefixes
type Prefixes struct {
// original -> bgp-op:received
- Received uint32
+ Received uint32 `mapstructure:"received"`
// original -> bgp-op:sent
- Sent uint32
+ Sent uint32 `mapstructure:"sent"`
// original -> bgp-op:installed
- Installed uint32
+ Installed uint32 `mapstructure:"installed"`
}
//struct for container bgp:state
type AddPathsState struct {
// original -> bgp:receive
//bgp:receive's original type is boolean
- Receive bool
+ Receive bool `mapstructure:"receive"`
// original -> bgp:send-max
- SendMax uint8
+ SendMax uint8 `mapstructure:"send-max"`
}
//struct for container bgp:config
type AddPathsConfig struct {
// original -> bgp:receive
//bgp:receive's original type is boolean
- Receive bool
+ Receive bool `mapstructure:"receive"`
// original -> bgp:send-max
- SendMax uint8
+ SendMax uint8 `mapstructure:"send-max"`
}
//struct for container bgp:add-paths
type AddPaths struct {
// original -> bgp:add-paths-config
- Config AddPathsConfig
+ Config AddPathsConfig `mapstructure:"config"`
// original -> bgp:add-paths-state
- State AddPathsState
+ State AddPathsState `mapstructure:"state"`
}
//struct for container bgp:state
type AsPathOptionsState struct {
// original -> bgp:allow-own-as
- AllowOwnAs uint8
+ AllowOwnAs uint8 `mapstructure:"allow-own-as"`
// original -> bgp:replace-peer-as
//bgp:replace-peer-as's original type is boolean
- ReplacePeerAs bool
+ ReplacePeerAs bool `mapstructure:"replace-peer-as"`
}
//struct for container bgp:config
type AsPathOptionsConfig struct {
// original -> bgp:allow-own-as
- AllowOwnAs uint8
+ AllowOwnAs uint8 `mapstructure:"allow-own-as"`
// original -> bgp:replace-peer-as
//bgp:replace-peer-as's original type is boolean
- ReplacePeerAs bool
+ ReplacePeerAs bool `mapstructure:"replace-peer-as"`
}
//struct for container bgp:as-path-options
type AsPathOptions struct {
// original -> bgp:as-path-options-config
- Config AsPathOptionsConfig
+ Config AsPathOptionsConfig `mapstructure:"config"`
// original -> bgp:as-path-options-state
- State AsPathOptionsState
+ State AsPathOptionsState `mapstructure:"state"`
}
//struct for container bgp:state
type RouteReflectorState struct {
// original -> bgp:route-reflector-cluster-id
- RouteReflectorClusterId RrClusterIdType
+ RouteReflectorClusterId RrClusterIdType `mapstructure:"route-reflector-cluster-id"`
// original -> bgp:route-reflector-client
//bgp:route-reflector-client's original type is boolean
- RouteReflectorClient bool
+ RouteReflectorClient bool `mapstructure:"route-reflector-client"`
}
//struct for container bgp:config
type RouteReflectorConfig struct {
// original -> bgp:route-reflector-cluster-id
- RouteReflectorClusterId RrClusterIdType
+ RouteReflectorClusterId RrClusterIdType `mapstructure:"route-reflector-cluster-id"`
// original -> bgp:route-reflector-client
//bgp:route-reflector-client's original type is boolean
- RouteReflectorClient bool
+ RouteReflectorClient bool `mapstructure:"route-reflector-client"`
}
//struct for container bgp:route-reflector
type RouteReflector struct {
// original -> bgp:route-reflector-config
- Config RouteReflectorConfig
+ Config RouteReflectorConfig `mapstructure:"config"`
// original -> bgp:route-reflector-state
- State RouteReflectorState
+ State RouteReflectorState `mapstructure:"state"`
}
//struct for container bgp:state
type EbgpMultihopState struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:multihop-ttl
- MultihopTtl uint8
+ MultihopTtl uint8 `mapstructure:"multihop-ttl"`
}
//struct for container bgp:config
type EbgpMultihopConfig struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:multihop-ttl
- MultihopTtl uint8
+ MultihopTtl uint8 `mapstructure:"multihop-ttl"`
}
//struct for container bgp:ebgp-multihop
type EbgpMultihop struct {
// original -> bgp:ebgp-multihop-config
- Config EbgpMultihopConfig
+ Config EbgpMultihopConfig `mapstructure:"config"`
// original -> bgp:ebgp-multihop-state
- State EbgpMultihopState
+ State EbgpMultihopState `mapstructure:"state"`
}
//struct for container bgp:state
type LoggingOptionsState struct {
// original -> bgp:log-neighbor-state-changes
//bgp:log-neighbor-state-changes's original type is boolean
- LogNeighborStateChanges bool
+ LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes"`
}
//struct for container bgp:config
type LoggingOptionsConfig struct {
// original -> bgp:log-neighbor-state-changes
//bgp:log-neighbor-state-changes's original type is boolean
- LogNeighborStateChanges bool
+ LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes"`
}
//struct for container bgp:logging-options
type LoggingOptions struct {
// original -> bgp:logging-options-config
- Config LoggingOptionsConfig
+ Config LoggingOptionsConfig `mapstructure:"config"`
// original -> bgp:logging-options-state
- State LoggingOptionsState
+ State LoggingOptionsState `mapstructure:"state"`
}
//struct for container bgp:state
type ErrorHandlingState struct {
// original -> bgp:treat-as-withdraw
//bgp:treat-as-withdraw's original type is boolean
- TreatAsWithdraw bool
+ TreatAsWithdraw bool `mapstructure:"treat-as-withdraw"`
// original -> bgp-op:erroneous-update-messages
- ErroneousUpdateMessages uint32
+ ErroneousUpdateMessages uint32 `mapstructure:"erroneous-update-messages"`
}
//struct for container bgp:config
type ErrorHandlingConfig struct {
// original -> bgp:treat-as-withdraw
//bgp:treat-as-withdraw's original type is boolean
- TreatAsWithdraw bool
+ TreatAsWithdraw bool `mapstructure:"treat-as-withdraw"`
}
//struct for container bgp:error-handling
type ErrorHandling struct {
// original -> bgp:error-handling-config
- Config ErrorHandlingConfig
+ Config ErrorHandlingConfig `mapstructure:"config"`
// original -> bgp:error-handling-state
- State ErrorHandlingState
+ State ErrorHandlingState `mapstructure:"state"`
}
//struct for container bgp:state
type TransportState struct {
// original -> bgp:tcp-mss
- TcpMss uint16
+ TcpMss uint16 `mapstructure:"tcp-mss"`
// original -> bgp:mtu-discovery
//bgp:mtu-discovery's original type is boolean
- MtuDiscovery bool
+ MtuDiscovery bool `mapstructure:"mtu-discovery"`
// original -> bgp:passive-mode
//bgp:passive-mode's original type is boolean
- PassiveMode bool
+ PassiveMode bool `mapstructure:"passive-mode"`
// original -> bgp:local-address
//bgp:local-address's original type is union
- LocalAddress string
+ LocalAddress string `mapstructure:"local-address"`
// original -> bgp-op:local-port
//bgp-op:local-port's original type is inet:port-number
- LocalPort uint16
+ LocalPort uint16 `mapstructure:"local-port"`
// original -> bgp-op:remote-address
//bgp-op:remote-address's original type is inet:ip-address
- RemoteAddress string
+ RemoteAddress string `mapstructure:"remote-address"`
// original -> bgp-op:remote-port
//bgp-op:remote-port's original type is inet:port-number
- RemotePort uint16
+ RemotePort uint16 `mapstructure:"remote-port"`
}
//struct for container bgp:config
type TransportConfig struct {
// original -> bgp:tcp-mss
- TcpMss uint16
+ TcpMss uint16 `mapstructure:"tcp-mss"`
// original -> bgp:mtu-discovery
//bgp:mtu-discovery's original type is boolean
- MtuDiscovery bool
+ MtuDiscovery bool `mapstructure:"mtu-discovery"`
// original -> bgp:passive-mode
//bgp:passive-mode's original type is boolean
- PassiveMode bool
+ PassiveMode bool `mapstructure:"passive-mode"`
// original -> bgp:local-address
//bgp:local-address's original type is union
- LocalAddress string
+ LocalAddress string `mapstructure:"local-address"`
}
//struct for container bgp:transport
type Transport struct {
// original -> bgp:transport-config
- Config TransportConfig
+ Config TransportConfig `mapstructure:"config"`
// original -> bgp:transport-state
- State TransportState
+ State TransportState `mapstructure:"state"`
}
//struct for container bgp:state
type TimersState struct {
// original -> bgp:connect-retry
//bgp:connect-retry's original type is decimal64
- ConnectRetry float64
+ ConnectRetry float64 `mapstructure:"connect-retry"`
// original -> bgp:hold-time
//bgp:hold-time's original type is decimal64
- HoldTime float64
+ HoldTime float64 `mapstructure:"hold-time"`
// original -> bgp:keepalive-interval
//bgp:keepalive-interval's original type is decimal64
- KeepaliveInterval float64
+ KeepaliveInterval float64 `mapstructure:"keepalive-interval"`
// original -> bgp:minimum-advertisement-interval
//bgp:minimum-advertisement-interval's original type is decimal64
- MinimumAdvertisementInterval float64
+ MinimumAdvertisementInterval float64 `mapstructure:"minimum-advertisement-interval"`
// original -> bgp-op:uptime
//bgp-op:uptime's original type is yang:timeticks
- Uptime int64
+ Uptime int64 `mapstructure:"uptime"`
// original -> bgp-op:negotiated-hold-time
//bgp-op:negotiated-hold-time's original type is decimal64
- NegotiatedHoldTime float64
+ NegotiatedHoldTime float64 `mapstructure:"negotiated-hold-time"`
// original -> gobgp:idle-hold-time-after-reset
//gobgp:idle-hold-time-after-reset's original type is decimal64
- IdleHoldTimeAfterReset float64
+ IdleHoldTimeAfterReset float64 `mapstructure:"idle-hold-time-after-reset"`
// original -> gobgp:downtime
//gobgp:downtime's original type is yang:timeticks
- Downtime int64
+ Downtime int64 `mapstructure:"downtime"`
// original -> gobgp:update-recv-time
- UpdateRecvTime int64
+ UpdateRecvTime int64 `mapstructure:"update-recv-time"`
}
//struct for container bgp:config
type TimersConfig struct {
// original -> bgp:connect-retry
//bgp:connect-retry's original type is decimal64
- ConnectRetry float64
+ ConnectRetry float64 `mapstructure:"connect-retry"`
// original -> bgp:hold-time
//bgp:hold-time's original type is decimal64
- HoldTime float64
+ HoldTime float64 `mapstructure:"hold-time"`
// original -> bgp:keepalive-interval
//bgp:keepalive-interval's original type is decimal64
- KeepaliveInterval float64
+ KeepaliveInterval float64 `mapstructure:"keepalive-interval"`
// original -> bgp:minimum-advertisement-interval
//bgp:minimum-advertisement-interval's original type is decimal64
- MinimumAdvertisementInterval float64
+ MinimumAdvertisementInterval float64 `mapstructure:"minimum-advertisement-interval"`
// original -> gobgp:idle-hold-time-after-reset
//gobgp:idle-hold-time-after-reset's original type is decimal64
- IdleHoldTimeAfterReset float64
+ IdleHoldTimeAfterReset float64 `mapstructure:"idle-hold-time-after-reset"`
}
//struct for container bgp:timers
type Timers struct {
// original -> bgp:timers-config
- Config TimersConfig
+ Config TimersConfig `mapstructure:"config"`
// original -> bgp:timers-state
- State TimersState
+ State TimersState `mapstructure:"state"`
}
//struct for container bgp:queues
type Queues struct {
// original -> bgp-op:input
- Input uint32
+ Input uint32 `mapstructure:"input"`
// original -> bgp-op:output
- Output uint32
+ Output uint32 `mapstructure:"output"`
}
//struct for container bgp:received
type Received struct {
// original -> bgp-op:UPDATE
- Update uint64
+ Update uint64 `mapstructure:"update"`
// original -> bgp-op:NOTIFICATION
- Notification uint64
+ Notification uint64 `mapstructure:"notification"`
// original -> gobgp:OPEN
- Open uint64
+ Open uint64 `mapstructure:"open"`
// original -> gobgp:REFRESH
- Refresh uint64
+ Refresh uint64 `mapstructure:"refresh"`
// original -> gobgp:KEEPALIVE
- Keepalive uint64
+ Keepalive uint64 `mapstructure:"keepalive"`
// original -> gobgp:DYNAMIC-CAP
- DynamicCap uint64
+ DynamicCap uint64 `mapstructure:"dynamic-cap"`
// original -> gobgp:DISCARDED
- Discarded uint64
+ Discarded uint64 `mapstructure:"discarded"`
// original -> gobgp:TOTAL
- Total uint64
+ Total uint64 `mapstructure:"total"`
}
//struct for container bgp:sent
type Sent struct {
// original -> bgp-op:UPDATE
- Update uint64
+ Update uint64 `mapstructure:"update"`
// original -> bgp-op:NOTIFICATION
- Notification uint64
+ Notification uint64 `mapstructure:"notification"`
// original -> gobgp:OPEN
- Open uint64
+ Open uint64 `mapstructure:"open"`
// original -> gobgp:REFRESH
- Refresh uint64
+ Refresh uint64 `mapstructure:"refresh"`
// original -> gobgp:KEEPALIVE
- Keepalive uint64
+ Keepalive uint64 `mapstructure:"keepalive"`
// original -> gobgp:DYNAMIC-CAP
- DynamicCap uint64
+ DynamicCap uint64 `mapstructure:"dynamic-cap"`
// original -> gobgp:DISCARDED
- Discarded uint64
+ Discarded uint64 `mapstructure:"discarded"`
// original -> gobgp:TOTAL
- Total uint64
+ Total uint64 `mapstructure:"total"`
}
//struct for container bgp:messages
type Messages struct {
// original -> bgp:sent
- Sent Sent
+ Sent Sent `mapstructure:"sent"`
// original -> bgp:received
- Received Received
+ Received Received `mapstructure:"received"`
}
//struct for container bgp:state
type NeighborState struct {
// original -> bgp:peer-as
//bgp:peer-as's original type is inet:as-number
- PeerAs uint32
+ PeerAs uint32 `mapstructure:"peer-as"`
// original -> bgp:local-as
//bgp:local-as's original type is inet:as-number
- LocalAs uint32
+ LocalAs uint32 `mapstructure:"local-as"`
// original -> bgp:peer-type
- PeerType PeerType
+ PeerType PeerType `mapstructure:"peer-type"`
// original -> bgp:auth-password
- AuthPassword string
+ AuthPassword string `mapstructure:"auth-password"`
// original -> bgp:remove-private-as
- RemovePrivateAs RemovePrivateAsOption
+ RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as"`
// original -> bgp:route-flap-damping
//bgp:route-flap-damping's original type is boolean
- RouteFlapDamping bool
+ RouteFlapDamping bool `mapstructure:"route-flap-damping"`
// original -> bgp:send-community
- SendCommunity CommunityType
+ SendCommunity CommunityType `mapstructure:"send-community"`
// original -> bgp:description
- Description string
+ Description string `mapstructure:"description"`
// original -> bgp:peer-group
- PeerGroup string
+ PeerGroup string `mapstructure:"peer-group"`
// original -> bgp:neighbor-address
//bgp:neighbor-address's original type is inet:ip-address
- NeighborAddress string
+ NeighborAddress string `mapstructure:"neighbor-address"`
// original -> bgp-op:session-state
//bgp-op:session-state's original type is enumeration
- SessionState uint32
+ SessionState uint32 `mapstructure:"session-state"`
// original -> bgp-op:supported-capabilities
- //original type is list of identityref
- SupportedCapabilities []string
+ // original type is list of identityref
+ SupportedCapabilitiesList []string `mapstructure:"supported-capabilities-list"`
// original -> bgp:messages
- Messages Messages
+ Messages Messages `mapstructure:"messages"`
// original -> bgp:queues
- Queues Queues
+ Queues Queues `mapstructure:"queues"`
// original -> gobgp:admin-down
//gobgp:admin-down's original type is boolean
- AdminDown bool
+ AdminDown bool `mapstructure:"admin-down"`
// original -> gobgp:established-count
- EstablishedCount uint32
+ EstablishedCount uint32 `mapstructure:"established-count"`
// original -> gobgp:flops
- Flops uint32
+ Flops uint32 `mapstructure:"flops"`
}
//struct for container bgp:config
type NeighborConfig struct {
// original -> bgp:peer-as
//bgp:peer-as's original type is inet:as-number
- PeerAs uint32
+ PeerAs uint32 `mapstructure:"peer-as"`
// original -> bgp:local-as
//bgp:local-as's original type is inet:as-number
- LocalAs uint32
+ LocalAs uint32 `mapstructure:"local-as"`
// original -> bgp:peer-type
- PeerType PeerType
+ PeerType PeerType `mapstructure:"peer-type"`
// original -> bgp:auth-password
- AuthPassword string
+ AuthPassword string `mapstructure:"auth-password"`
// original -> bgp:remove-private-as
- RemovePrivateAs RemovePrivateAsOption
+ RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as"`
// original -> bgp:route-flap-damping
//bgp:route-flap-damping's original type is boolean
- RouteFlapDamping bool
+ RouteFlapDamping bool `mapstructure:"route-flap-damping"`
// original -> bgp:send-community
- SendCommunity CommunityType
+ SendCommunity CommunityType `mapstructure:"send-community"`
// original -> bgp:description
- Description string
+ Description string `mapstructure:"description"`
// original -> bgp:peer-group
- PeerGroup string
+ PeerGroup string `mapstructure:"peer-group"`
// original -> bgp:neighbor-address
//bgp:neighbor-address's original type is inet:ip-address
- NeighborAddress string
+ NeighborAddress string `mapstructure:"neighbor-address"`
}
//struct for container bgp:neighbor
type Neighbor struct {
// original -> bgp:neighbor-address
//bgp:neighbor-address's original type is inet:ip-address
- NeighborAddress string
+ NeighborAddress string `mapstructure:"neighbor-address"`
// original -> bgp:neighbor-config
- Config NeighborConfig
+ Config NeighborConfig `mapstructure:"config"`
// original -> bgp:neighbor-state
- State NeighborState
+ State NeighborState `mapstructure:"state"`
// original -> bgp:timers
- Timers Timers
+ Timers Timers `mapstructure:"timers"`
// original -> bgp:transport
- Transport Transport
+ Transport Transport `mapstructure:"transport"`
// original -> bgp:error-handling
- ErrorHandling ErrorHandling
+ ErrorHandling ErrorHandling `mapstructure:"error-handling"`
// original -> bgp:logging-options
- LoggingOptions LoggingOptions
+ LoggingOptions LoggingOptions `mapstructure:"logging-options"`
// original -> bgp:ebgp-multihop
- EbgpMultihop EbgpMultihop
+ EbgpMultihop EbgpMultihop `mapstructure:"ebgp-multihop"`
// original -> bgp:route-reflector
- RouteReflector RouteReflector
+ RouteReflector RouteReflector `mapstructure:"route-reflector"`
// original -> bgp:as-path-options
- AsPathOptions AsPathOptions
+ AsPathOptions AsPathOptions `mapstructure:"as-path-options"`
// original -> bgp:add-paths
- AddPaths AddPaths
+ AddPaths AddPaths `mapstructure:"add-paths"`
// original -> bgp:afi-safis
- AfiSafis AfiSafis
+ AfiSafis []AfiSafi `mapstructure:"afi-safis"`
// original -> bgp:graceful-restart
- GracefulRestart GracefulRestart
+ GracefulRestart GracefulRestart `mapstructure:"graceful-restart"`
// original -> rpol:apply-policy
- ApplyPolicy ApplyPolicy
+ ApplyPolicy ApplyPolicy `mapstructure:"apply-policy"`
// original -> bgp-mp:use-multiple-paths
- UseMultiplePaths UseMultiplePaths
+ UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"`
// original -> gobgp:route-server
- RouteServer RouteServer
-}
-
-//struct for container bgp:neighbors
-type Neighbors struct {
- // original -> bgp:neighbor
- NeighborList []Neighbor
+ RouteServer RouteServer `mapstructure:"route-server"`
}
//struct for container gobgp:listen-config
type ListenConfig struct {
// original -> gobgp:port
- Port int32
+ Port int32 `mapstructure:"port"`
}
//struct for container gobgp:mpls-label-range
type MplsLabelRange struct {
// original -> gobgp:min-label
- MinLabel uint32
+ MinLabel uint32 `mapstructure:"min-label"`
// original -> gobgp:max-label
- MaxLabel uint32
+ MaxLabel uint32 `mapstructure:"max-label"`
}
//struct for container gobgp:zebra
type Zebra struct {
// original -> gobgp:enabled
//gobgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> gobgp:url
- Url string
+ Url string `mapstructure:"url"`
// original -> gobgp:redistribute-route-type
- //original type is list of identityref
- RedistributeRouteType []string
+ // original type is list of identityref
+ RedistributeRouteTypeList []string `mapstructure:"redistribute-route-type-list"`
}
//struct for container gobgp:mrt
type Mrt struct {
// original -> gobgp:file-name
- FileName string
+ FileName string `mapstructure:"file-name"`
}
//struct for container bgp-mp:l2vpn-evpn
type L2vpnEvpn struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:l2vpn-vpls
type L2vpnVpls struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:l3vpn-ipv6-multicast
type L3vpnIpv6Multicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:l3vpn-ipv4-multicast
type L3vpnIpv4Multicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:l3vpn-ipv6-unicast
type L3vpnIpv6Unicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:l3vpn-ipv4-unicast
type L3vpnIpv4Unicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:ipv6-labelled-unicast
type Ipv6LabelledUnicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:ipv4-labelled-unicast
type Ipv4LabelledUnicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
}
//struct for container bgp-mp:state
type Ipv6UnicastState struct {
// original -> bgp-mp:send-default-route
//bgp-mp:send-default-route's original type is boolean
- SendDefaultRoute bool
+ SendDefaultRoute bool `mapstructure:"send-default-route"`
}
//struct for container bgp-mp:config
type Ipv6UnicastConfig struct {
// original -> bgp-mp:send-default-route
//bgp-mp:send-default-route's original type is boolean
- SendDefaultRoute bool
+ SendDefaultRoute bool `mapstructure:"send-default-route"`
}
//struct for container bgp-mp:ipv6-unicast
type Ipv6Unicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
// original -> bgp-mp:ipv6-unicast-config
- Config Ipv6UnicastConfig
+ Config Ipv6UnicastConfig `mapstructure:"config"`
// original -> bgp-mp:ipv6-unicast-state
- State Ipv6UnicastState
+ State Ipv6UnicastState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type Ipv4UnicastState struct {
// original -> bgp-mp:send-default-route
//bgp-mp:send-default-route's original type is boolean
- SendDefaultRoute bool
+ SendDefaultRoute bool `mapstructure:"send-default-route"`
}
//struct for container bgp-mp:config
type Ipv4UnicastConfig struct {
// original -> bgp-mp:send-default-route
//bgp-mp:send-default-route's original type is boolean
- SendDefaultRoute bool
+ SendDefaultRoute bool `mapstructure:"send-default-route"`
}
//struct for container bgp-mp:state
type PrefixLimitState struct {
// original -> bgp-mp:max-prefixes
- MaxPrefixes uint32
+ MaxPrefixes uint32 `mapstructure:"max-prefixes"`
// original -> bgp-mp:shutdown-threshold-pct
- ShutdownThresholdPct Percentage
+ ShutdownThresholdPct Percentage `mapstructure:"shutdown-threshold-pct"`
// original -> bgp-mp:restart-timer
//bgp-mp:restart-timer's original type is decimal64
- RestartTimer float64
+ RestartTimer float64 `mapstructure:"restart-timer"`
}
//struct for container bgp-mp:config
type PrefixLimitConfig struct {
// original -> bgp-mp:max-prefixes
- MaxPrefixes uint32
+ MaxPrefixes uint32 `mapstructure:"max-prefixes"`
// original -> bgp-mp:shutdown-threshold-pct
- ShutdownThresholdPct Percentage
+ ShutdownThresholdPct Percentage `mapstructure:"shutdown-threshold-pct"`
// original -> bgp-mp:restart-timer
//bgp-mp:restart-timer's original type is decimal64
- RestartTimer float64
+ RestartTimer float64 `mapstructure:"restart-timer"`
}
//struct for container bgp-mp:prefix-limit
type PrefixLimit struct {
// original -> bgp-mp:prefix-limit-config
- Config PrefixLimitConfig
+ Config PrefixLimitConfig `mapstructure:"config"`
// original -> bgp-mp:prefix-limit-state
- State PrefixLimitState
+ State PrefixLimitState `mapstructure:"state"`
}
//struct for container bgp-mp:ipv4-unicast
type Ipv4Unicast struct {
// original -> bgp-mp:prefix-limit
- PrefixLimit PrefixLimit
+ PrefixLimit PrefixLimit `mapstructure:"prefix-limit"`
// original -> bgp-mp:ipv4-unicast-config
- Config Ipv4UnicastConfig
+ Config Ipv4UnicastConfig `mapstructure:"config"`
// original -> bgp-mp:ipv4-unicast-state
- State Ipv4UnicastState
+ State Ipv4UnicastState `mapstructure:"state"`
}
//struct for container rpol:state
type ApplyPolicyState struct {
// original -> rpol:import-policy
- ImportPolicy []string
+ ImportPolicyList []string `mapstructure:"import-policy-list"`
// original -> rpol:default-import-policy
- DefaultImportPolicy DefaultPolicyType
+ DefaultImportPolicy DefaultPolicyType `mapstructure:"default-import-policy"`
// original -> rpol:export-policy
- ExportPolicy []string
+ ExportPolicyList []string `mapstructure:"export-policy-list"`
// original -> rpol:default-export-policy
- DefaultExportPolicy DefaultPolicyType
+ DefaultExportPolicy DefaultPolicyType `mapstructure:"default-export-policy"`
// original -> gobgp:in-policy
- InPolicy []string
+ InPolicyList []string `mapstructure:"in-policy-list"`
// original -> gobgp:default-in-policy
- DefaultInPolicy DefaultPolicyType
+ DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy"`
}
//struct for container rpol:config
type ApplyPolicyConfig struct {
// original -> rpol:import-policy
- ImportPolicy []string
+ ImportPolicyList []string `mapstructure:"import-policy-list"`
// original -> rpol:default-import-policy
- DefaultImportPolicy DefaultPolicyType
+ DefaultImportPolicy DefaultPolicyType `mapstructure:"default-import-policy"`
// original -> rpol:export-policy
- ExportPolicy []string
+ ExportPolicyList []string `mapstructure:"export-policy-list"`
// original -> rpol:default-export-policy
- DefaultExportPolicy DefaultPolicyType
+ DefaultExportPolicy DefaultPolicyType `mapstructure:"default-export-policy"`
// original -> gobgp:in-policy
- InPolicy []string
+ InPolicyList []string `mapstructure:"in-policy-list"`
// original -> gobgp:default-in-policy
- DefaultInPolicy DefaultPolicyType
+ DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy"`
}
//struct for container rpol:apply-policy
type ApplyPolicy struct {
// original -> rpol:apply-policy-config
- Config ApplyPolicyConfig
+ Config ApplyPolicyConfig `mapstructure:"config"`
// original -> rpol:apply-policy-state
- State ApplyPolicyState
+ State ApplyPolicyState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type AfiSafiState struct {
// original -> bgp-mp:afi-safi-name
- AfiSafiName string
+ AfiSafiName string `mapstructure:"afi-safi-name"`
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp-op:total-paths
- TotalPaths uint32
+ TotalPaths uint32 `mapstructure:"total-paths"`
// original -> bgp-op:total-prefixes
- TotalPrefixes uint32
+ TotalPrefixes uint32 `mapstructure:"total-prefixes"`
}
//struct for container bgp-mp:config
type AfiSafiConfig struct {
// original -> bgp-mp:afi-safi-name
- AfiSafiName string
+ AfiSafiName string `mapstructure:"afi-safi-name"`
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
}
//struct for container bgp-mp:state
type MpGracefulRestartState struct {
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp-op:received
//bgp-op:received's original type is boolean
- Received bool
+ Received bool `mapstructure:"received"`
// original -> bgp-op:advertised
//bgp-op:advertised's original type is boolean
- Advertised bool
+ Advertised bool `mapstructure:"advertised"`
}
//struct for container bgp-mp:config
type MpGracefulRestartConfig struct {
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
}
//struct for container bgp-mp:graceful-restart
type MpGracefulRestart struct {
// original -> bgp-mp:mp-graceful-restart-config
- Config MpGracefulRestartConfig
+ Config MpGracefulRestartConfig `mapstructure:"config"`
// original -> bgp-mp:mp-graceful-restart-state
- State MpGracefulRestartState
+ State MpGracefulRestartState `mapstructure:"state"`
}
//struct for container bgp-mp:afi-safi
type AfiSafi struct {
// original -> bgp-mp:afi-safi-name
//bgp-mp:afi-safi-name's original type is identityref
- AfiSafiName string
+ AfiSafiName string `mapstructure:"afi-safi-name"`
// original -> bgp-mp:mp-graceful-restart
- MpGracefulRestart MpGracefulRestart
+ MpGracefulRestart MpGracefulRestart `mapstructure:"mp-graceful-restart"`
// original -> bgp-mp:afi-safi-config
- Config AfiSafiConfig
+ Config AfiSafiConfig `mapstructure:"config"`
// original -> bgp-mp:afi-safi-state
- State AfiSafiState
+ State AfiSafiState `mapstructure:"state"`
// original -> rpol:apply-policy
- ApplyPolicy ApplyPolicy
+ ApplyPolicy ApplyPolicy `mapstructure:"apply-policy"`
// original -> bgp-mp:ipv4-unicast
- Ipv4Unicast Ipv4Unicast
+ Ipv4Unicast Ipv4Unicast `mapstructure:"ipv4-unicast"`
// original -> bgp-mp:ipv6-unicast
- Ipv6Unicast Ipv6Unicast
+ Ipv6Unicast Ipv6Unicast `mapstructure:"ipv6-unicast"`
// original -> bgp-mp:ipv4-labelled-unicast
- Ipv4LabelledUnicast Ipv4LabelledUnicast
+ Ipv4LabelledUnicast Ipv4LabelledUnicast `mapstructure:"ipv4-labelled-unicast"`
// original -> bgp-mp:ipv6-labelled-unicast
- Ipv6LabelledUnicast Ipv6LabelledUnicast
+ Ipv6LabelledUnicast Ipv6LabelledUnicast `mapstructure:"ipv6-labelled-unicast"`
// original -> bgp-mp:l3vpn-ipv4-unicast
- L3vpnIpv4Unicast L3vpnIpv4Unicast
+ L3vpnIpv4Unicast L3vpnIpv4Unicast `mapstructure:"l3vpn-ipv4-unicast"`
// original -> bgp-mp:l3vpn-ipv6-unicast
- L3vpnIpv6Unicast L3vpnIpv6Unicast
+ L3vpnIpv6Unicast L3vpnIpv6Unicast `mapstructure:"l3vpn-ipv6-unicast"`
// original -> bgp-mp:l3vpn-ipv4-multicast
- L3vpnIpv4Multicast L3vpnIpv4Multicast
+ L3vpnIpv4Multicast L3vpnIpv4Multicast `mapstructure:"l3vpn-ipv4-multicast"`
// original -> bgp-mp:l3vpn-ipv6-multicast
- L3vpnIpv6Multicast L3vpnIpv6Multicast
+ L3vpnIpv6Multicast L3vpnIpv6Multicast `mapstructure:"l3vpn-ipv6-multicast"`
// original -> bgp-mp:l2vpn-vpls
- L2vpnVpls L2vpnVpls
+ L2vpnVpls L2vpnVpls `mapstructure:"l2vpn-vpls"`
// original -> bgp-mp:l2vpn-evpn
- L2vpnEvpn L2vpnEvpn
+ L2vpnEvpn L2vpnEvpn `mapstructure:"l2vpn-evpn"`
// original -> bgp-mp:route-selection-options
- RouteSelectionOptions RouteSelectionOptions
+ RouteSelectionOptions RouteSelectionOptions `mapstructure:"route-selection-options"`
// original -> bgp-mp:use-multiple-paths
- UseMultiplePaths UseMultiplePaths
-}
-
-//struct for container bgp:afi-safis
-type AfiSafis struct {
- // original -> bgp-mp:afi-safi
- AfiSafiList []AfiSafi
+ UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"`
}
//struct for container bgp:state
type GracefulRestartState struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:restart-time
- RestartTime uint16
+ RestartTime uint16 `mapstructure:"restart-time"`
// original -> bgp:stale-routes-time
//bgp:stale-routes-time's original type is decimal64
- StaleRoutesTime float64
+ StaleRoutesTime float64 `mapstructure:"stale-routes-time"`
// original -> bgp:helper-only
//bgp:helper-only's original type is boolean
- HelperOnly bool
+ HelperOnly bool `mapstructure:"helper-only"`
// original -> bgp-op:peer-restart-time
- PeerRestartTime uint16
+ PeerRestartTime uint16 `mapstructure:"peer-restart-time"`
// original -> bgp-op:peer-restarting
//bgp-op:peer-restarting's original type is boolean
- PeerRestarting bool
+ PeerRestarting bool `mapstructure:"peer-restarting"`
// original -> bgp-op:local-restarting
//bgp-op:local-restarting's original type is boolean
- LocalRestarting bool
+ LocalRestarting bool `mapstructure:"local-restarting"`
// original -> bgp-op:mode
//bgp-op:mode's original type is enumeration
- Mode uint32
+ Mode uint32 `mapstructure:"mode"`
}
//struct for container bgp:config
type GracefulRestartConfig struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:restart-time
- RestartTime uint16
+ RestartTime uint16 `mapstructure:"restart-time"`
// original -> bgp:stale-routes-time
//bgp:stale-routes-time's original type is decimal64
- StaleRoutesTime float64
+ StaleRoutesTime float64 `mapstructure:"stale-routes-time"`
// original -> bgp:helper-only
//bgp:helper-only's original type is boolean
- HelperOnly bool
+ HelperOnly bool `mapstructure:"helper-only"`
}
//struct for container bgp:graceful-restart
type GracefulRestart struct {
// original -> bgp:graceful-restart-config
- Config GracefulRestartConfig
+ Config GracefulRestartConfig `mapstructure:"config"`
// original -> bgp:graceful-restart-state
- State GracefulRestartState
+ State GracefulRestartState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type IbgpState struct {
// original -> bgp-mp:maximum-paths
- MaximumPaths uint32
+ MaximumPaths uint32 `mapstructure:"maximum-paths"`
}
//struct for container bgp-mp:config
type IbgpConfig struct {
// original -> bgp-mp:maximum-paths
- MaximumPaths uint32
+ MaximumPaths uint32 `mapstructure:"maximum-paths"`
}
//struct for container bgp-mp:ibgp
type Ibgp struct {
// original -> bgp-mp:ibgp-config
- Config IbgpConfig
+ Config IbgpConfig `mapstructure:"config"`
// original -> bgp-mp:ibgp-state
- State IbgpState
+ State IbgpState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type EbgpState struct {
// original -> bgp-mp:allow-multiple-as
//bgp-mp:allow-multiple-as's original type is boolean
- AllowMultipleAs bool
+ AllowMultipleAs bool `mapstructure:"allow-multiple-as"`
// original -> bgp-mp:maximum-paths
- MaximumPaths uint32
+ MaximumPaths uint32 `mapstructure:"maximum-paths"`
}
//struct for container bgp-mp:config
type EbgpConfig struct {
// original -> bgp-mp:allow-multiple-as
//bgp-mp:allow-multiple-as's original type is boolean
- AllowMultipleAs bool
+ AllowMultipleAs bool `mapstructure:"allow-multiple-as"`
// original -> bgp-mp:maximum-paths
- MaximumPaths uint32
+ MaximumPaths uint32 `mapstructure:"maximum-paths"`
}
//struct for container bgp-mp:ebgp
type Ebgp struct {
// original -> bgp-mp:ebgp-config
- Config EbgpConfig
+ Config EbgpConfig `mapstructure:"config"`
// original -> bgp-mp:ebgp-state
- State EbgpState
+ State EbgpState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type UseMultiplePathsState struct {
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
}
//struct for container bgp-mp:config
type UseMultiplePathsConfig struct {
// original -> bgp-mp:enabled
//bgp-mp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
}
//struct for container bgp-mp:use-multiple-paths
type UseMultiplePaths struct {
// original -> bgp-mp:use-multiple-paths-config
- Config UseMultiplePathsConfig
+ Config UseMultiplePathsConfig `mapstructure:"config"`
// original -> bgp-mp:use-multiple-paths-state
- State UseMultiplePathsState
+ State UseMultiplePathsState `mapstructure:"state"`
// original -> bgp-mp:ebgp
- Ebgp Ebgp
+ Ebgp Ebgp `mapstructure:"ebgp"`
// original -> bgp-mp:ibgp
- Ibgp Ibgp
+ Ibgp Ibgp `mapstructure:"ibgp"`
}
//struct for container bgp:state
type ConfederationState struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:identifier
//bgp:identifier's original type is inet:as-number
- Identifier uint32
+ Identifier uint32 `mapstructure:"identifier"`
// original -> bgp:member-as
- //original type is list of inet:as-number
- MemberAs []uint32
+ // original type is list of inet:as-number
+ MemberAsList []uint32 `mapstructure:"member-as-list"`
}
//struct for container bgp:config
type ConfederationConfig struct {
// original -> bgp:enabled
//bgp:enabled's original type is boolean
- Enabled bool
+ Enabled bool `mapstructure:"enabled"`
// original -> bgp:identifier
//bgp:identifier's original type is inet:as-number
- Identifier uint32
+ Identifier uint32 `mapstructure:"identifier"`
// original -> bgp:member-as
- //original type is list of inet:as-number
- MemberAs []uint32
+ // original type is list of inet:as-number
+ MemberAsList []uint32 `mapstructure:"member-as-list"`
}
//struct for container bgp:confederation
type Confederation struct {
// original -> bgp:confederation-config
- Config ConfederationConfig
+ Config ConfederationConfig `mapstructure:"config"`
// original -> bgp:confederation-state
- State ConfederationState
+ State ConfederationState `mapstructure:"state"`
}
//struct for container bgp:state
type DefaultRouteDistanceState struct {
// original -> bgp:external-route-distance
- ExternalRouteDistance uint8
+ ExternalRouteDistance uint8 `mapstructure:"external-route-distance"`
// original -> bgp:internal-route-distance
- InternalRouteDistance uint8
+ InternalRouteDistance uint8 `mapstructure:"internal-route-distance"`
}
//struct for container bgp:config
type DefaultRouteDistanceConfig struct {
// original -> bgp:external-route-distance
- ExternalRouteDistance uint8
+ ExternalRouteDistance uint8 `mapstructure:"external-route-distance"`
// original -> bgp:internal-route-distance
- InternalRouteDistance uint8
+ InternalRouteDistance uint8 `mapstructure:"internal-route-distance"`
}
//struct for container bgp:default-route-distance
type DefaultRouteDistance struct {
// original -> bgp:default-route-distance-config
- Config DefaultRouteDistanceConfig
+ Config DefaultRouteDistanceConfig `mapstructure:"config"`
// original -> bgp:default-route-distance-state
- State DefaultRouteDistanceState
+ State DefaultRouteDistanceState `mapstructure:"state"`
}
//struct for container bgp-mp:state
type RouteSelectionOptionsState struct {
// original -> bgp-mp:always-compare-med
//bgp-mp:always-compare-med's original type is boolean
- AlwaysCompareMed bool
+ AlwaysCompareMed bool `mapstructure:"always-compare-med"`
// original -> bgp-mp:ignore-as-path-length
//bgp-mp:ignore-as-path-length's original type is boolean
- IgnoreAsPathLength bool
+ IgnoreAsPathLength bool `mapstructure:"ignore-as-path-length"`
// original -> bgp-mp:external-compare-router-id
//bgp-mp:external-compare-router-id's original type is boolean
- ExternalCompareRouterId bool
+ ExternalCompareRouterId bool `mapstructure:"external-compare-router-id"`
// original -> bgp-mp:advertise-inactive-routes
//bgp-mp:advertise-inactive-routes's original type is boolean
- AdvertiseInactiveRoutes bool
+ AdvertiseInactiveRoutes bool `mapstructure:"advertise-inactive-routes"`
// original -> bgp-mp:enable-aigp
//bgp-mp:enable-aigp's original type is boolean
- EnableAigp bool
+ EnableAigp bool `mapstructure:"enable-aigp"`
// original -> bgp-mp:ignore-next-hop-igp-metric
//bgp-mp:ignore-next-hop-igp-metric's original type is boolean
- IgnoreNextHopIgpMetric bool
+ IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric"`
}
//struct for container bgp-mp:config
type RouteSelectionOptionsConfig struct {
// original -> bgp-mp:always-compare-med
//bgp-mp:always-compare-med's original type is boolean
- AlwaysCompareMed bool
+ AlwaysCompareMed bool `mapstructure:"always-compare-med"`
// original -> bgp-mp:ignore-as-path-length
//bgp-mp:ignore-as-path-length's original type is boolean
- IgnoreAsPathLength bool
+ IgnoreAsPathLength bool `mapstructure:"ignore-as-path-length"`
// original -> bgp-mp:external-compare-router-id
//bgp-mp:external-compare-router-id's original type is boolean
- ExternalCompareRouterId bool
+ ExternalCompareRouterId bool `mapstructure:"external-compare-router-id"`
// original -> bgp-mp:advertise-inactive-routes
//bgp-mp:advertise-inactive-routes's original type is boolean
- AdvertiseInactiveRoutes bool
+ AdvertiseInactiveRoutes bool `mapstructure:"advertise-inactive-routes"`
// original -> bgp-mp:enable-aigp
//bgp-mp:enable-aigp's original type is boolean
- EnableAigp bool
+ EnableAigp bool `mapstructure:"enable-aigp"`
// original -> bgp-mp:ignore-next-hop-igp-metric
//bgp-mp:ignore-next-hop-igp-metric's original type is boolean
- IgnoreNextHopIgpMetric bool
+ IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric"`
}
//struct for container bgp-mp:route-selection-options
type RouteSelectionOptions struct {
// original -> bgp-mp:route-selection-options-config
- Config RouteSelectionOptionsConfig
+ Config RouteSelectionOptionsConfig `mapstructure:"config"`
// original -> bgp-mp:route-selection-options-state
- State RouteSelectionOptionsState
+ State RouteSelectionOptionsState `mapstructure:"state"`
}
//struct for container bgp:state
type GlobalState struct {
// original -> bgp:as
//bgp:as's original type is inet:as-number
- As uint32
+ As uint32 `mapstructure:"as"`
// original -> bgp:router-id
//bgp:router-id's original type is inet:ipv4-address
- RouterId string
+ RouterId string `mapstructure:"router-id"`
// original -> bgp-op:total-paths
- TotalPaths uint32
+ TotalPaths uint32 `mapstructure:"total-paths"`
// original -> bgp-op:total-prefixes
- TotalPrefixes uint32
+ TotalPrefixes uint32 `mapstructure:"total-prefixes"`
}
//struct for container bgp:config
type GlobalConfig struct {
// original -> bgp:as
//bgp:as's original type is inet:as-number
- As uint32
+ As uint32 `mapstructure:"as"`
// original -> bgp:router-id
//bgp:router-id's original type is inet:ipv4-address
- RouterId string
+ RouterId string `mapstructure:"router-id"`
}
//struct for container bgp:global
type Global struct {
// original -> bgp:global-config
- Config GlobalConfig
+ Config GlobalConfig `mapstructure:"config"`
// original -> bgp:global-state
- State GlobalState
+ State GlobalState `mapstructure:"state"`
// original -> bgp-mp:route-selection-options
- RouteSelectionOptions RouteSelectionOptions
+ RouteSelectionOptions RouteSelectionOptions `mapstructure:"route-selection-options"`
// original -> bgp:default-route-distance
- DefaultRouteDistance DefaultRouteDistance
+ DefaultRouteDistance DefaultRouteDistance `mapstructure:"default-route-distance"`
// original -> bgp:confederation
- Confederation Confederation
+ Confederation Confederation `mapstructure:"confederation"`
// original -> bgp-mp:use-multiple-paths
- UseMultiplePaths UseMultiplePaths
+ UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths"`
// original -> bgp:graceful-restart
- GracefulRestart GracefulRestart
+ GracefulRestart GracefulRestart `mapstructure:"graceful-restart"`
// original -> bgp:afi-safis
- AfiSafis AfiSafis
+ AfiSafis []AfiSafi `mapstructure:"afi-safis"`
// original -> rpol:apply-policy
- ApplyPolicy ApplyPolicy
+ ApplyPolicy ApplyPolicy `mapstructure:"apply-policy"`
// original -> gobgp:mrt
- Mrt Mrt
+ Mrt Mrt `mapstructure:"mrt"`
// original -> gobgp:zebra
- Zebra Zebra
+ Zebra Zebra `mapstructure:"zebra"`
// original -> gobgp:mpls-label-range
- MplsLabelRange MplsLabelRange
+ MplsLabelRange MplsLabelRange `mapstructure:"mpls-label-range"`
// original -> gobgp:listen-config
- ListenConfig ListenConfig
+ ListenConfig ListenConfig `mapstructure:"listen-config"`
}
//struct for container bgp:bgp
type Bgp struct {
// original -> bgp:global
- Global Global
+ Global Global `mapstructure:"global"`
// original -> bgp:neighbors
- Neighbors Neighbors
+ Neighbors []Neighbor `mapstructure:"neighbors"`
// original -> bgp:peer-groups
- PeerGroups PeerGroups
+ PeerGroups []PeerGroup `mapstructure:"peer-groups"`
// original -> gobgp:rpki-servers
- RpkiServers RpkiServers
+ RpkiServers []RpkiServer `mapstructure:"rpki-servers"`
// original -> gobgp:bmp-servers
- BmpServers BmpServers
+ BmpServers []BmpServer `mapstructure:"bmp-servers"`
}
//struct for container bgp-pol:set-ext-community-method
type SetExtCommunityMethod struct {
// original -> bgp-pol:communities
- //original type is list of union
- Communities []string
+ // original type is list of union
+ CommunitiesList []string `mapstructure:"communities-list"`
// original -> bgp-pol:ext-community-set-ref
- ExtCommunitySetRef string
+ ExtCommunitySetRef string `mapstructure:"ext-community-set-ref"`
}
//struct for container bgp-pol:set-ext-community
type SetExtCommunity struct {
// original -> bgp-pol:set-ext-community-method
- SetExtCommunityMethod SetExtCommunityMethod
+ SetExtCommunityMethod SetExtCommunityMethod `mapstructure:"set-ext-community-method"`
// original -> bgp-pol:options
//bgp-pol:options's original type is bgp-set-community-option-type
- Options string
+ Options string `mapstructure:"options"`
}
//struct for container bgp-pol:set-community-method
type SetCommunityMethod struct {
// original -> bgp-pol:communities
- //original type is list of union
- Communities []string
+ // original type is list of union
+ CommunitiesList []string `mapstructure:"communities-list"`
// original -> bgp-pol:community-set-ref
- CommunitySetRef string
+ CommunitySetRef string `mapstructure:"community-set-ref"`
}
//struct for container bgp-pol:set-community
type SetCommunity struct {
// original -> bgp-pol:set-community-method
- SetCommunityMethod SetCommunityMethod
+ SetCommunityMethod SetCommunityMethod `mapstructure:"set-community-method"`
// original -> bgp-pol:options
//bgp-pol:options's original type is bgp-set-community-option-type
- Options string
+ Options string `mapstructure:"options"`
}
//struct for container bgp-pol:set-as-path-prepend
type SetAsPathPrepend struct {
// original -> bgp-pol:repeat-n
- RepeatN uint8
+ RepeatN uint8 `mapstructure:"repeat-n"`
// original -> gobgp:as
//gobgp:as's original type is union
- As string
+ As string `mapstructure:"as"`
}
//struct for container bgp-pol:bgp-actions
type BgpActions struct {
// original -> bgp-pol:set-as-path-prepend
- SetAsPathPrepend SetAsPathPrepend
+ SetAsPathPrepend SetAsPathPrepend `mapstructure:"set-as-path-prepend"`
// original -> bgp-pol:set-community
- SetCommunity SetCommunity
+ SetCommunity SetCommunity `mapstructure:"set-community"`
// original -> bgp-pol:set-ext-community
- SetExtCommunity SetExtCommunity
+ SetExtCommunity SetExtCommunity `mapstructure:"set-ext-community"`
// original -> bgp-pol:set-route-origin
- SetRouteOrigin BgpOriginAttrType
+ SetRouteOrigin BgpOriginAttrType `mapstructure:"set-route-origin"`
// original -> bgp-pol:set-local-pref
- SetLocalPref uint32
+ SetLocalPref uint32 `mapstructure:"set-local-pref"`
// original -> bgp-pol:set-next-hop
- SetNextHop BgpNextHopType
+ SetNextHop BgpNextHopType `mapstructure:"set-next-hop"`
// original -> bgp-pol:set-med
- SetMed BgpSetMedType
+ SetMed BgpSetMedType `mapstructure:"set-med"`
}
//struct for container rpol:igp-actions
type IgpActions struct {
// original -> rpol:set-tag
- SetTag TagType
+ SetTag TagType `mapstructure:"set-tag"`
}
//struct for container rpol:route-disposition
type RouteDisposition struct {
// original -> rpol:accept-route
//rpol:accept-route's original type is empty
- AcceptRoute bool
+ AcceptRoute bool `mapstructure:"accept-route"`
// original -> rpol:reject-route
//rpol:reject-route's original type is empty
- RejectRoute bool
+ RejectRoute bool `mapstructure:"reject-route"`
}
//struct for container rpol:actions
type Actions struct {
// original -> rpol:route-disposition
- RouteDisposition RouteDisposition
+ RouteDisposition RouteDisposition `mapstructure:"route-disposition"`
// original -> rpol:igp-actions
- IgpActions IgpActions
+ IgpActions IgpActions `mapstructure:"igp-actions"`
// original -> bgp-pol:bgp-actions
- BgpActions BgpActions
+ BgpActions BgpActions `mapstructure:"bgp-actions"`
}
//struct for container bgp-pol:as-path-length
type AsPathLength struct {
// original -> ptypes:operator
- Operator string
+ Operator string `mapstructure:"operator"`
// original -> ptypes:value
- Value uint32
+ Value uint32 `mapstructure:"value"`
}
//struct for container bgp-pol:community-count
type CommunityCount struct {
// original -> ptypes:operator
- Operator string
+ Operator string `mapstructure:"operator"`
// original -> ptypes:value
- Value uint32
+ Value uint32 `mapstructure:"value"`
}
//struct for container bgp-pol:match-as-path-set
type MatchAsPathSet struct {
// original -> bgp-pol:as-path-set
- AsPathSet string
+ AsPathSet string `mapstructure:"as-path-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsType
+ MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"`
}
//struct for container bgp-pol:match-ext-community-set
type MatchExtCommunitySet struct {
// original -> bgp-pol:ext-community-set
- ExtCommunitySet string
+ ExtCommunitySet string `mapstructure:"ext-community-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsType
+ MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"`
}
//struct for container bgp-pol:match-community-set
type MatchCommunitySet struct {
// original -> bgp-pol:community-set
- CommunitySet string
+ CommunitySet string `mapstructure:"community-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsType
+ MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"`
}
//struct for container bgp-pol:bgp-conditions
type BgpConditions struct {
// original -> bgp-pol:match-community-set
- MatchCommunitySet MatchCommunitySet
+ MatchCommunitySet MatchCommunitySet `mapstructure:"match-community-set"`
// original -> bgp-pol:match-ext-community-set
- MatchExtCommunitySet MatchExtCommunitySet
+ MatchExtCommunitySet MatchExtCommunitySet `mapstructure:"match-ext-community-set"`
// original -> bgp-pol:match-as-path-set
- MatchAsPathSet MatchAsPathSet
+ MatchAsPathSet MatchAsPathSet `mapstructure:"match-as-path-set"`
// original -> bgp-pol:med-eq
- MedEq uint32
+ MedEq uint32 `mapstructure:"med-eq"`
// original -> bgp-pol:origin-eq
- OriginEq BgpOriginAttrType
+ OriginEq BgpOriginAttrType `mapstructure:"origin-eq"`
// original -> bgp-pol:next-hop-in
- //original type is list of inet:ip-address
- NextHopIn []string
+ // original type is list of inet:ip-address
+ NextHopInList []string `mapstructure:"next-hop-in-list"`
// original -> bgp-pol:afi-safi-in
- //original type is list of identityref
- AfiSafiIn []string
+ // original type is list of identityref
+ AfiSafiInList []string `mapstructure:"afi-safi-in-list"`
// original -> bgp-pol:local-pref-eq
- LocalPrefEq uint32
+ LocalPrefEq uint32 `mapstructure:"local-pref-eq"`
// original -> bgp-pol:community-count
- CommunityCount CommunityCount
+ CommunityCount CommunityCount `mapstructure:"community-count"`
// original -> bgp-pol:as-path-length
- AsPathLength AsPathLength
+ AsPathLength AsPathLength `mapstructure:"as-path-length"`
// original -> bgp-pol:route-type
//bgp-pol:route-type's original type is enumeration
- RouteType uint32
+ RouteType uint32 `mapstructure:"route-type"`
// original -> gobgp:rpki-validation-result
- RpkiValidationResult RpkiValidationResultType
+ RpkiValidationResult RpkiValidationResultType `mapstructure:"rpki-validation-result"`
}
//struct for container rpol:igp-conditions
@@ -1870,201 +1840,153 @@ type IgpConditions struct {
//struct for container rpol:match-tag-set
type MatchTagSet struct {
// original -> rpol:tag-set
- TagSet string
+ TagSet string `mapstructure:"tag-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsRestrictedType
+ MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"`
}
//struct for container rpol:match-neighbor-set
type MatchNeighborSet struct {
// original -> rpol:neighbor-set
- NeighborSet string
+ NeighborSet string `mapstructure:"neighbor-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsRestrictedType
+ MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"`
}
//struct for container rpol:match-prefix-set
type MatchPrefixSet struct {
// original -> rpol:prefix-set
- PrefixSet string
+ PrefixSet string `mapstructure:"prefix-set"`
// original -> rpol:match-set-options
- MatchSetOptions MatchSetOptionsRestrictedType
+ MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"`
}
//struct for container rpol:conditions
type Conditions struct {
// original -> rpol:call-policy
- CallPolicy string
+ CallPolicy string `mapstructure:"call-policy"`
// original -> rpol:match-prefix-set
- MatchPrefixSet MatchPrefixSet
+ MatchPrefixSet MatchPrefixSet `mapstructure:"match-prefix-set"`
// original -> rpol:match-neighbor-set
- MatchNeighborSet MatchNeighborSet
+ MatchNeighborSet MatchNeighborSet `mapstructure:"match-neighbor-set"`
// original -> rpol:match-tag-set
- MatchTagSet MatchTagSet
+ MatchTagSet MatchTagSet `mapstructure:"match-tag-set"`
// original -> rpol:install-protocol-eq
- InstallProtocolEq string
+ InstallProtocolEq string `mapstructure:"install-protocol-eq"`
// original -> rpol:igp-conditions
- IgpConditions IgpConditions
+ IgpConditions IgpConditions `mapstructure:"igp-conditions"`
// original -> bgp-pol:bgp-conditions
- BgpConditions BgpConditions
+ BgpConditions BgpConditions `mapstructure:"bgp-conditions"`
}
//struct for container rpol:statement
type Statement struct {
// original -> rpol:name
- Name string
+ Name string `mapstructure:"name"`
// original -> rpol:conditions
- Conditions Conditions
+ Conditions Conditions `mapstructure:"conditions"`
// original -> rpol:actions
- Actions Actions
-}
-
-//struct for container rpol:statements
-type Statements struct {
- // original -> rpol:statement
- StatementList []Statement
+ Actions Actions `mapstructure:"actions"`
}
//struct for container rpol:policy-definition
type PolicyDefinition struct {
// original -> rpol:name
- Name string
+ Name string `mapstructure:"name"`
// original -> rpol:statements
- Statements Statements
-}
-
-//struct for container rpol:policy-definitions
-type PolicyDefinitions struct {
- // original -> rpol:policy-definition
- PolicyDefinitionList []PolicyDefinition
+ Statements []Statement `mapstructure:"statements"`
}
//struct for container bgp-pol:as-path-set
type AsPathSet struct {
// original -> bgp-pol:as-path-set-name
- AsPathSetName string
+ AsPathSetName string `mapstructure:"as-path-set-name"`
// original -> gobgp:as-path
- AsPath []string
-}
-
-//struct for container bgp-pol:as-path-sets
-type AsPathSets struct {
- // original -> bgp-pol:as-path-set
- AsPathSetList []AsPathSet
+ AsPathList []string `mapstructure:"as-path-list"`
}
//struct for container bgp-pol:ext-community-set
type ExtCommunitySet struct {
// original -> bgp-pol:ext-community-set-name
- ExtCommunitySetName string
+ ExtCommunitySetName string `mapstructure:"ext-community-set-name"`
// original -> gobgp:ext-community
- ExtCommunity []string
-}
-
-//struct for container bgp-pol:ext-community-sets
-type ExtCommunitySets struct {
- // original -> bgp-pol:ext-community-set
- ExtCommunitySetList []ExtCommunitySet
+ ExtCommunityList []string `mapstructure:"ext-community-list"`
}
//struct for container bgp-pol:community-set
type CommunitySet struct {
// original -> bgp-pol:community-set-name
- CommunitySetName string
+ CommunitySetName string `mapstructure:"community-set-name"`
// original -> gobgp:community
- Community []string
-}
-
-//struct for container bgp-pol:community-sets
-type CommunitySets struct {
- // original -> bgp-pol:community-set
- CommunitySetList []CommunitySet
+ CommunityList []string `mapstructure:"community-list"`
}
//struct for container bgp-pol:bgp-defined-sets
type BgpDefinedSets struct {
// original -> bgp-pol:community-sets
- CommunitySets CommunitySets
+ CommunitySets []CommunitySet `mapstructure:"community-sets"`
// original -> bgp-pol:ext-community-sets
- ExtCommunitySets ExtCommunitySets
+ ExtCommunitySets []ExtCommunitySet `mapstructure:"ext-community-sets"`
// original -> bgp-pol:as-path-sets
- AsPathSets AsPathSets
+ AsPathSets []AsPathSet `mapstructure:"as-path-sets"`
}
//struct for container rpol:tag
type Tag struct {
// original -> rpol:value
- Value TagType
+ Value TagType `mapstructure:"value"`
}
//struct for container rpol:tag-set
type TagSet struct {
// original -> rpol:tag-set-name
- TagSetName string
+ TagSetName string `mapstructure:"tag-set-name"`
// original -> rpol:tag
- TagList []Tag
-}
-
-//struct for container rpol:tag-sets
-type TagSets struct {
- // original -> rpol:tag-set
- TagSetList []TagSet
+ TagList []Tag `mapstructure:"tag-list"`
}
//struct for container rpol:neighbor-set
type NeighborSet struct {
// original -> rpol:neighbor-set-name
- NeighborSetName string
+ NeighborSetName string `mapstructure:"neighbor-set-name"`
// original -> gobgp:neighbor-info
- //original type is list of inet:ip-address
- NeighborInfo []string
-}
-
-//struct for container rpol:neighbor-sets
-type NeighborSets struct {
- // original -> rpol:neighbor-set
- NeighborSetList []NeighborSet
+ // original type is list of inet:ip-address
+ NeighborInfoList []string `mapstructure:"neighbor-info-list"`
}
//struct for container rpol:prefix
type Prefix struct {
// original -> rpol:ip-prefix
//rpol:ip-prefix's original type is inet:ip-prefix
- IpPrefix string
+ IpPrefix string `mapstructure:"ip-prefix"`
// original -> rpol:masklength-range
- MasklengthRange string
+ MasklengthRange string `mapstructure:"masklength-range"`
}
//struct for container rpol:prefix-set
type PrefixSet struct {
// original -> rpol:prefix-set-name
- PrefixSetName string
+ PrefixSetName string `mapstructure:"prefix-set-name"`
// original -> rpol:prefix
- PrefixList []Prefix
-}
-
-//struct for container rpol:prefix-sets
-type PrefixSets struct {
- // original -> rpol:prefix-set
- PrefixSetList []PrefixSet
+ PrefixList []Prefix `mapstructure:"prefix-list"`
}
//struct for container rpol:defined-sets
type DefinedSets struct {
// original -> rpol:prefix-sets
- PrefixSets PrefixSets
+ PrefixSets []PrefixSet `mapstructure:"prefix-sets"`
// original -> rpol:neighbor-sets
- NeighborSets NeighborSets
+ NeighborSets []NeighborSet `mapstructure:"neighbor-sets"`
// original -> rpol:tag-sets
- TagSets TagSets
+ TagSets []TagSet `mapstructure:"tag-sets"`
// original -> bgp-pol:bgp-defined-sets
- BgpDefinedSets BgpDefinedSets
+ BgpDefinedSets BgpDefinedSets `mapstructure:"bgp-defined-sets"`
}
//struct for container rpol:routing-policy
type RoutingPolicy struct {
// original -> rpol:defined-sets
- DefinedSets DefinedSets
+ DefinedSets DefinedSets `mapstructure:"defined-sets"`
// original -> rpol:policy-definitions
- PolicyDefinitions PolicyDefinitions
+ PolicyDefinitions []PolicyDefinition `mapstructure:"policy-definitions"`
}
diff --git a/config/default.go b/config/default.go
index 0cc55680..82a17446 100644
--- a/config/default.go
+++ b/config/default.go
@@ -5,7 +5,6 @@ import (
"github.com/osrg/gobgp/packet"
"github.com/spf13/viper"
"net"
- "strings"
)
const (
@@ -20,8 +19,8 @@ func SetDefaultConfigValues(v *viper.Viper, b *Bgp) error {
if v == nil {
v = viper.New()
}
- if !v.IsSet("global.afisafis.afisafilist") {
- b.Global.AfiSafis.AfiSafiList = []AfiSafi{
+ if !v.IsSet("global.afi-safis") {
+ b.Global.AfiSafis = []AfiSafi{
AfiSafi{AfiSafiName: "ipv4-unicast"},
AfiSafi{AfiSafiName: "ipv6-unicast"},
AfiSafi{AfiSafiName: "l3vpn-ipv4-unicast"},
@@ -40,65 +39,66 @@ func SetDefaultConfigValues(v *viper.Viper, b *Bgp) error {
b.Global.ListenConfig.Port = bgp.BGP_PORT
}
- for idx, server := range b.BmpServers.BmpServerList {
+ for idx, server := range b.BmpServers {
if server.Config.Port == 0 {
server.Config.Port = bgp.BMP_DEFAULT_PORT
}
- b.BmpServers.BmpServerList[idx] = server
+ b.BmpServers[idx] = server
}
- if !v.IsSet("global.mplslabelrange.minlabel") {
+ if !v.IsSet("global.mpls-label-range.min-label") {
b.Global.MplsLabelRange.MinLabel = DEFAULT_MPLS_LABEL_MIN
}
- if !v.IsSet("global.mplslabelrange.maxlabel") {
+ if !v.IsSet("global.mpls-label-range.max-label") {
b.Global.MplsLabelRange.MaxLabel = DEFAULT_MPLS_LABEL_MAX
}
+
+ // yaml is decoded as []interface{}
+ // but toml is decoded as []map[string]interface{}.
+ // currently, viper can't hide this difference.
+ // handle the difference here.
var list []interface{}
- for k, val := range v.GetStringMap("neighbors") {
- if strings.ToLower(k) == "neighborlist" {
- var ok bool
- // yaml is decoded as []interface{}
- // but toml is decoded as []map[string]interface{}.
- // currently, viper can't hide this difference.
- // handle the difference here.
- list, ok = val.([]interface{})
+ intf := v.Get("neighbors")
+ if intf != nil {
+ var ok bool
+ list, ok = intf.([]interface{})
+ if !ok {
+ l, ok := intf.([]map[string]interface{})
if !ok {
- l, ok := val.([]map[string]interface{})
- if !ok {
- return fmt.Errorf("invalid configuration: neighborlist must be a list")
- }
- for _, m := range l {
- list = append(list, m)
- }
+ return fmt.Errorf("invalid configuration: neighborlist must be a list")
+ }
+ list = make([]interface{}, 0, len(l))
+ for _, m := range l {
+ list = append(list, m)
}
}
}
- for idx, n := range b.Neighbors.NeighborList {
+ for idx, n := range b.Neighbors {
vv := viper.New()
if len(list) > idx {
vv.Set("neighbor", list[idx])
}
- if !vv.IsSet("neighbor.timers.config.connectretry") {
+ if !vv.IsSet("neighbor.timers.config.connect-retry") {
n.Timers.Config.ConnectRetry = float64(DEFAULT_CONNECT_RETRY)
}
- if !vv.IsSet("neighbor.timers.config.holdtime") {
+ if !vv.IsSet("neighbor.timers.config.hold-time") {
n.Timers.Config.HoldTime = float64(DEFAULT_HOLDTIME)
}
- if !vv.IsSet("neighbor.timers.config.keepaliveinterval") {
+ if !vv.IsSet("neighbor.timers.config.keepalive-interval") {
n.Timers.Config.KeepaliveInterval = n.Timers.Config.HoldTime / 3
}
- if !vv.IsSet("neighbor.timers.config.idleholdtimeafterreset") {
+ if !vv.IsSet("neighbor.timers.config.idle-hold-time-after-reset") {
n.Timers.Config.IdleHoldTimeAfterReset = float64(DEFAULT_IDLE_HOLDTIME_AFTER_RESET)
}
- if !vv.IsSet("neighbor.afisafis.afisafilist") {
+ if !vv.IsSet("neighbor.afi-safis") {
if ip := net.ParseIP(n.Config.NeighborAddress); ip.To4() != nil {
- n.AfiSafis.AfiSafiList = []AfiSafi{
+ n.AfiSafis = []AfiSafi{
AfiSafi{AfiSafiName: "ipv4-unicast"},
}
} else if ip.To16() != nil {
- n.AfiSafis.AfiSafiList = []AfiSafi{
+ n.AfiSafis = []AfiSafi{
AfiSafi{AfiSafiName: "ipv6-unicast"},
}
} else {
@@ -106,17 +106,17 @@ func SetDefaultConfigValues(v *viper.Viper, b *Bgp) error {
}
}
- if !vv.IsSet("neighbor.config.peertype") {
+ if !vv.IsSet("neighbor.config.peer-type") {
if n.Config.PeerAs != b.Global.Config.As {
n.Config.PeerType = PEER_TYPE_EXTERNAL
} else {
n.Config.PeerType = PEER_TYPE_INTERNAL
}
}
- b.Neighbors.NeighborList[idx] = n
+ b.Neighbors[idx] = n
}
- for _, r := range b.RpkiServers.RpkiServerList {
+ for _, r := range b.RpkiServers {
if r.Config.Port == 0 {
r.Config.Port = bgp.RPKI_DEFAULT_PORT
}
diff --git a/config/serve.go b/config/serve.go
index 6de993b8..10eed911 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -78,23 +78,23 @@ func UpdateConfig(curC *Bgp, newC *Bgp) (*Bgp, []Neighbor, []Neighbor, []Neighbo
deleted := []Neighbor{}
updated := []Neighbor{}
- for _, n := range newC.Neighbors.NeighborList {
- if idx := inSlice(n, curC.Neighbors.NeighborList); idx < 0 {
+ for _, n := range newC.Neighbors {
+ if idx := inSlice(n, curC.Neighbors); idx < 0 {
added = append(added, n)
} else {
- if !reflect.DeepEqual(n.ApplyPolicy, curC.Neighbors.NeighborList[idx].ApplyPolicy) {
+ if !reflect.DeepEqual(n.ApplyPolicy, curC.Neighbors[idx].ApplyPolicy) {
updated = append(updated, n)
}
}
}
- for _, n := range curC.Neighbors.NeighborList {
- if inSlice(n, newC.Neighbors.NeighborList) < 0 {
+ for _, n := range curC.Neighbors {
+ if inSlice(n, newC.Neighbors) < 0 {
deleted = append(deleted, n)
}
}
- bgpConfig.Neighbors.NeighborList = newC.Neighbors.NeighborList
+ bgpConfig.Neighbors = newC.Neighbors
return &bgpConfig, added, deleted, updated
}
diff --git a/config/util.go b/config/util.go
index cc7cbba1..ca2ebe4c 100644
--- a/config/util.go
+++ b/config/util.go
@@ -21,7 +21,7 @@ import (
func IsConfederationMember(g *Global, p *Neighbor) bool {
if p.Config.PeerAs != g.Config.As {
- for _, member := range g.Confederation.Config.MemberAs {
+ for _, member := range g.Confederation.Config.MemberAsList {
if member == p.Config.PeerAs {
return true
}
@@ -34,9 +34,11 @@ func IsEBGPPeer(g *Global, p *Neighbor) bool {
return p.Config.PeerAs != g.Config.As
}
+type AfiSafis []AfiSafi
+
func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
- rfs := make([]bgp.RouteFamily, 0, len(c.AfiSafiList))
- for _, rf := range c.AfiSafiList {
+ rfs := make([]bgp.RouteFamily, 0, len(c))
+ for _, rf := range c {
k, err := bgp.GetRouteFamily(rf.AfiSafiName)
if err != nil {
return nil, err
@@ -47,7 +49,7 @@ func (c AfiSafis) ToRfList() ([]bgp.RouteFamily, error) {
}
func CreateRfMap(p *Neighbor) map[bgp.RouteFamily]bool {
- rfs, _ := p.AfiSafis.ToRfList()
+ rfs, _ := AfiSafis(p.AfiSafis).ToRfList()
rfMap := make(map[bgp.RouteFamily]bool)
for _, rf := range rfs {
rfMap[rf] = true
diff --git a/gobgpd/main.go b/gobgpd/main.go
index 110718ef..e32af2e8 100644
--- a/gobgpd/main.go
+++ b/gobgpd/main.go
@@ -187,7 +187,7 @@ func main() {
bgpConfig = &newConfig.Bgp
bgpServer.SetRpkiConfig(newConfig.Bgp.RpkiServers)
bgpServer.SetBmpConfig(newConfig.Bgp.BmpServers)
- added = newConfig.Bgp.Neighbors.NeighborList
+ added = newConfig.Bgp.Neighbors
deleted = []config.Neighbor{}
updated = []config.Neighbor{}
} else {
diff --git a/server/bmp.go b/server/bmp.go
index b439f1e6..86029983 100644
--- a/server/bmp.go
+++ b/server/bmp.go
@@ -45,9 +45,9 @@ type bmpClient struct {
connCh chan *bmpConn
}
-func newBMPClient(conf config.BmpServers, connCh chan *bmpConn) (*bmpClient, error) {
+func newBMPClient(servers []config.BmpServer, connCh chan *bmpConn) (*bmpClient, error) {
b := &bmpClient{}
- if len(conf.BmpServerList) == 0 {
+ if len(servers) == 0 {
return b, nil
}
@@ -87,7 +87,7 @@ func newBMPClient(conf config.BmpServers, connCh chan *bmpConn) (*bmpClient, err
}
}
- for _, c := range conf.BmpServerList {
+ for _, c := range servers {
b := c.Config
go tryConnect(net.JoinHostPort(b.Address, strconv.Itoa(int(b.Port))))
}
@@ -114,7 +114,7 @@ func newBMPClient(conf config.BmpServers, connCh chan *bmpConn) (*bmpClient, err
for _, msg := range m.msgList {
if msg.Header.Type == bgp.BMP_MSG_ROUTE_MONITORING {
c := func() *config.BmpServerConfig {
- for _, c := range conf.BmpServerList {
+ for _, c := range servers {
b := &c.Config
if host == net.JoinHostPort(b.Address, strconv.Itoa(int(b.Port))) {
return b
diff --git a/server/fsm.go b/server/fsm.go
index af635f83..93fa457a 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -421,7 +421,7 @@ func (h *FSMHandler) active() bgp.FSMState {
func capabilitiesFromConfig(gConf *config.Global, pConf *config.Neighbor) []bgp.ParameterCapabilityInterface {
caps := make([]bgp.ParameterCapabilityInterface, 0, 4)
caps = append(caps, bgp.NewCapRouteRefresh())
- for _, rf := range pConf.AfiSafis.AfiSafiList {
+ for _, rf := range pConf.AfiSafis {
k, _ := bgp.GetRouteFamily(rf.AfiSafiName)
caps = append(caps, bgp.NewCapMultiProtocol(k))
}
diff --git a/server/peer.go b/server/peer.go
index 518edefe..5233c892 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -58,7 +58,7 @@ func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager, pol
peer.tableId = tableId
conf.State.SessionState = uint32(bgp.BGP_FSM_IDLE)
conf.Timers.State.Downtime = time.Now().Unix()
- rfs, _ := conf.AfiSafis.ToRfList()
+ rfs, _ := config.AfiSafis(conf.AfiSafis).ToRfList()
peer.adjRibIn = table.NewAdjRib(peer.ID(), rfs)
peer.adjRibOut = table.NewAdjRib(peer.ID(), rfs)
peer.fsm = NewFSM(&g, &conf, policy)
@@ -94,7 +94,7 @@ func (peer *Peer) isRouteReflectorClient() bool {
}
func (peer *Peer) configuredRFlist() []bgp.RouteFamily {
- rfs, _ := peer.conf.AfiSafis.ToRfList()
+ rfs, _ := config.AfiSafis(peer.conf.AfiSafis).ToRfList()
return rfs
}
diff --git a/server/rpki.go b/server/rpki.go
index aa50a475..742dac91 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -106,23 +106,23 @@ type roaClientEvent struct {
type roaManager struct {
AS uint32
roas map[bgp.RouteFamily]*radix.Tree
- config config.RpkiServers
+ config []config.RpkiServer
eventCh chan *roaClientEvent
clientMap map[string]*roaClient
}
-func newROAManager(as uint32, conf config.RpkiServers) (*roaManager, error) {
+func newROAManager(as uint32, servers []config.RpkiServer) (*roaManager, error) {
m := &roaManager{
AS: as,
roas: make(map[bgp.RouteFamily]*radix.Tree),
- config: conf,
+ config: servers,
}
m.roas[bgp.RF_IPv4_UC] = radix.New()
m.roas[bgp.RF_IPv6_UC] = radix.New()
m.eventCh = make(chan *roaClientEvent)
m.clientMap = make(map[string]*roaClient)
- for _, entry := range conf.RpkiServerList {
+ for _, entry := range servers {
c := entry.Config
client := &roaClient{
host: net.JoinHostPort(c.Address, strconv.Itoa(int(c.Port))),
diff --git a/server/server.go b/server/server.go
index 6d9306a6..71eefced 100644
--- a/server/server.go
+++ b/server/server.go
@@ -82,8 +82,8 @@ type BgpServer struct {
updatedPeerCh chan config.Neighbor
fsmincomingCh chan *FsmMsg
fsmStateCh chan *FsmMsg
- rpkiConfigCh chan config.RpkiServers
- bmpConfigCh chan config.BmpServers
+ rpkiConfigCh chan []config.RpkiServer
+ bmpConfigCh chan []config.BmpServer
GrpcReqCh chan *GrpcRequest
policyUpdateCh chan config.RoutingPolicy
@@ -107,14 +107,14 @@ func NewBgpServer() *BgpServer {
b.addedPeerCh = make(chan config.Neighbor)
b.deletedPeerCh = make(chan config.Neighbor)
b.updatedPeerCh = make(chan config.Neighbor)
- b.rpkiConfigCh = make(chan config.RpkiServers)
- b.bmpConfigCh = make(chan config.BmpServers)
+ b.rpkiConfigCh = make(chan []config.RpkiServer)
+ b.bmpConfigCh = make(chan []config.BmpServer)
b.bmpConnCh = make(chan *bmpConn)
b.GrpcReqCh = make(chan *GrpcRequest, 1)
b.policyUpdateCh = make(chan config.RoutingPolicy)
b.neighborMap = make(map[string]*Peer)
b.watchers = make(map[watcherType]watcher)
- b.roaManager, _ = newROAManager(0, config.RpkiServers{})
+ b.roaManager, _ = newROAManager(0, nil)
b.policy = table.NewRoutingPolicy()
return &b
}
@@ -166,8 +166,8 @@ func (server *BgpServer) Serve() {
}
}
- server.bmpClient, _ = newBMPClient(config.BmpServers{BmpServerList: []config.BmpServer{}}, server.bmpConnCh)
- server.roaManager, _ = newROAManager(g.Config.As, config.RpkiServers{})
+ server.bmpClient, _ = newBMPClient(nil, server.bmpConnCh)
+ server.roaManager, _ = newROAManager(g.Config.As, nil)
if g.Mrt.FileName != "" {
w, err := newMrtWatcher(g.Mrt.FileName)
@@ -182,7 +182,7 @@ func (server *BgpServer) Serve() {
if g.Zebra.Url == "" {
g.Zebra.Url = "unix:/var/run/quagga/zserv.api"
}
- err := server.NewZclient(g.Zebra.Url, g.Zebra.RedistributeRouteType)
+ err := server.NewZclient(g.Zebra.Url, g.Zebra.RedistributeRouteTypeList)
if err != nil {
log.Error(err)
}
@@ -221,7 +221,7 @@ func (server *BgpServer) Serve() {
}
}(broadcastCh)
- rfs, _ := g.AfiSafis.ToRfList()
+ rfs, _ := config.AfiSafis(g.AfiSafis).ToRfList()
server.globalRib = table.NewTableManager(rfs, g.MplsLabelRange.MinLabel, g.MplsLabelRange.MaxLabel)
server.listenerMap = make(map[string]*net.TCPListener)
acceptCh := make(chan *net.TCPConn, 4096)
@@ -965,11 +965,11 @@ func (server *BgpServer) SetGlobalType(g config.Global) {
}
}
-func (server *BgpServer) SetRpkiConfig(c config.RpkiServers) {
+func (server *BgpServer) SetRpkiConfig(c []config.RpkiServer) {
server.rpkiConfigCh <- c
}
-func (server *BgpServer) SetBmpConfig(c config.BmpServers) {
+func (server *BgpServer) SetBmpConfig(c []config.BmpServer) {
server.bmpConfigCh <- c
}
@@ -2049,19 +2049,19 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
if a.ApplyPolicy.ImportPolicy != nil {
pconf.ApplyPolicy.Config.DefaultImportPolicy = config.DefaultPolicyType(a.ApplyPolicy.ImportPolicy.Default)
for _, p := range a.ApplyPolicy.ImportPolicy.Policies {
- pconf.ApplyPolicy.Config.ImportPolicy = append(pconf.ApplyPolicy.Config.ImportPolicy, p.Name)
+ pconf.ApplyPolicy.Config.ImportPolicyList = append(pconf.ApplyPolicy.Config.ImportPolicyList, p.Name)
}
}
if a.ApplyPolicy.ExportPolicy != nil {
pconf.ApplyPolicy.Config.DefaultExportPolicy = config.DefaultPolicyType(a.ApplyPolicy.ExportPolicy.Default)
for _, p := range a.ApplyPolicy.ExportPolicy.Policies {
- pconf.ApplyPolicy.Config.ExportPolicy = append(pconf.ApplyPolicy.Config.ExportPolicy, p.Name)
+ pconf.ApplyPolicy.Config.ExportPolicyList = append(pconf.ApplyPolicy.Config.ExportPolicyList, p.Name)
}
}
if a.ApplyPolicy.InPolicy != nil {
pconf.ApplyPolicy.Config.DefaultInPolicy = config.DefaultPolicyType(a.ApplyPolicy.InPolicy.Default)
for _, p := range a.ApplyPolicy.InPolicy.Policies {
- pconf.ApplyPolicy.Config.InPolicy = append(pconf.ApplyPolicy.Config.InPolicy, p.Name)
+ pconf.ApplyPolicy.Config.InPolicyList = append(pconf.ApplyPolicy.Config.InPolicyList, p.Name)
}
}
}
@@ -2072,14 +2072,14 @@ func (server *BgpServer) handleGrpcModNeighbor(grpcReq *GrpcRequest) (sMsgs []*S
return pconf, fmt.Errorf("invalid address family: %d", family)
}
cAfiSafi := config.AfiSafi{AfiSafiName: name}
- pconf.AfiSafis.AfiSafiList = append(pconf.AfiSafis.AfiSafiList, cAfiSafi)
+ pconf.AfiSafis = append(pconf.AfiSafis, cAfiSafi)
}
} else {
if net.ParseIP(a.Conf.NeighborAddress).To4() != nil {
- pconf.AfiSafis.AfiSafiList = []config.AfiSafi{
+ pconf.AfiSafis = []config.AfiSafi{
config.AfiSafi{AfiSafiName: "ipv4-unicast"}}
} else {
- pconf.AfiSafis.AfiSafiList = []config.AfiSafi{
+ pconf.AfiSafis = []config.AfiSafi{
config.AfiSafi{AfiSafiName: "ipv6-unicast"}}
}
}
@@ -2496,7 +2496,7 @@ func (server *BgpServer) handleModRpki(grpcReq *GrpcRequest) {
r := config.RpkiServer{}
r.Config.Address = arg.Address
r.Config.Port = arg.Port
- server.bgpConfig.RpkiServers.RpkiServerList = append(server.bgpConfig.RpkiServers.RpkiServerList, r)
+ server.bgpConfig.RpkiServers = append(server.bgpConfig.RpkiServers, r)
server.roaManager, _ = newROAManager(server.bgpConfig.Global.Config.As, server.bgpConfig.RpkiServers)
grpcDone(grpcReq, nil)
return
diff --git a/table/policy.go b/table/policy.go
index 263002c3..158d359e 100644
--- a/table/policy.go
+++ b/table/policy.go
@@ -510,13 +510,13 @@ func NewNeighborSetFromApiStruct(a *api.DefinedSet) (*NeighborSet, error) {
func NewNeighborSet(c config.NeighborSet) (*NeighborSet, error) {
name := c.NeighborSetName
if name == "" {
- if len(c.NeighborInfo) == 0 {
+ if len(c.NeighborInfoList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("empty neighbor set name")
}
- list := make([]net.IP, 0, len(c.NeighborInfo))
- for _, x := range c.NeighborInfo {
+ list := make([]net.IP, 0, len(c.NeighborInfoList))
+ for _, x := range c.NeighborInfoList {
addr := net.ParseIP(x)
if addr == nil {
return nil, fmt.Errorf("invalid address: %s", x)
@@ -697,7 +697,7 @@ func (s *AsPathSet) ToApiStruct() *api.DefinedSet {
func NewAsPathSetFromApiStruct(a *api.DefinedSet) (*AsPathSet, error) {
c := config.AsPathSet{
AsPathSetName: a.Name,
- AsPath: a.List,
+ AsPathList: a.List,
}
return NewAsPathSet(c)
}
@@ -705,14 +705,14 @@ func NewAsPathSetFromApiStruct(a *api.DefinedSet) (*AsPathSet, error) {
func NewAsPathSet(c config.AsPathSet) (*AsPathSet, error) {
name := c.AsPathSetName
if name == "" {
- if len(c.AsPath) == 0 {
+ if len(c.AsPathList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("empty as-path set name")
}
- list := make([]*regexp.Regexp, 0, len(c.AsPath))
- singleList := make([]*singleAsPathMatch, 0, len(c.AsPath))
- for _, x := range c.AsPath {
+ list := make([]*regexp.Regexp, 0, len(c.AsPathList))
+ singleList := make([]*singleAsPathMatch, 0, len(c.AsPathList))
+ for _, x := range c.AsPathList {
if s := NewSingleAsPathMatch(x); s != nil {
singleList = append(singleList, s)
} else {
@@ -899,7 +899,7 @@ func ParseExtCommunityRegexp(arg string) (bgp.ExtendedCommunityAttrSubType, *reg
func NewCommunitySetFromApiStruct(a *api.DefinedSet) (*CommunitySet, error) {
c := config.CommunitySet{
CommunitySetName: a.Name,
- Community: a.List,
+ CommunityList: a.List,
}
return NewCommunitySet(c)
}
@@ -907,13 +907,13 @@ func NewCommunitySetFromApiStruct(a *api.DefinedSet) (*CommunitySet, error) {
func NewCommunitySet(c config.CommunitySet) (*CommunitySet, error) {
name := c.CommunitySetName
if name == "" {
- if len(c.Community) == 0 {
+ if len(c.CommunityList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("empty community set name")
}
- list := make([]*regexp.Regexp, 0, len(c.Community))
- for _, x := range c.Community {
+ list := make([]*regexp.Regexp, 0, len(c.CommunityList))
+ for _, x := range c.CommunityList {
exp, err := ParseCommunityRegexp(x)
if err != nil {
return nil, err
@@ -959,7 +959,7 @@ func (s *ExtCommunitySet) ToApiStruct() *api.DefinedSet {
func NewExtCommunitySetFromApiStruct(a *api.DefinedSet) (*ExtCommunitySet, error) {
c := config.ExtCommunitySet{
ExtCommunitySetName: a.Name,
- ExtCommunity: a.List,
+ ExtCommunityList: a.List,
}
return NewExtCommunitySet(c)
}
@@ -967,14 +967,14 @@ func NewExtCommunitySetFromApiStruct(a *api.DefinedSet) (*ExtCommunitySet, error
func NewExtCommunitySet(c config.ExtCommunitySet) (*ExtCommunitySet, error) {
name := c.ExtCommunitySetName
if name == "" {
- if len(c.ExtCommunity) == 0 {
+ if len(c.ExtCommunityList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("empty ext-community set name")
}
- list := make([]*regexp.Regexp, 0, len(c.ExtCommunity))
- subtypeList := make([]bgp.ExtendedCommunityAttrSubType, 0, len(c.ExtCommunity))
- for _, x := range c.ExtCommunity {
+ list := make([]*regexp.Regexp, 0, len(c.ExtCommunityList))
+ subtypeList := make([]bgp.ExtendedCommunityAttrSubType, 0, len(c.ExtCommunityList))
+ for _, x := range c.ExtCommunityList {
subtype, exp, err := ParseExtCommunityRegexp(x)
if err != nil {
return nil, err
@@ -1741,7 +1741,7 @@ func NewCommunityActionFromApiStruct(a *api.CommunityAction) (*CommunityAction,
func NewCommunityAction(c config.SetCommunity) (*CommunityAction, error) {
a, ok := CommunityOptionValueMap[strings.ToLower(c.Options)]
if !ok {
- if len(c.SetCommunityMethod.Communities) == 0 {
+ if len(c.SetCommunityMethod.CommunitiesList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("invalid option name: %s", c.Options)
@@ -1749,11 +1749,11 @@ func NewCommunityAction(c config.SetCommunity) (*CommunityAction, error) {
var list []uint32
var removeList []*regexp.Regexp
if a == config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE {
- removeList = make([]*regexp.Regexp, 0, len(c.SetCommunityMethod.Communities))
+ removeList = make([]*regexp.Regexp, 0, len(c.SetCommunityMethod.CommunitiesList))
} else {
- list = make([]uint32, 0, len(c.SetCommunityMethod.Communities))
+ list = make([]uint32, 0, len(c.SetCommunityMethod.CommunitiesList))
}
- for _, x := range c.SetCommunityMethod.Communities {
+ for _, x := range c.SetCommunityMethod.CommunitiesList {
if a == config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE {
exp, err := ParseCommunityRegexp(x)
if err != nil {
@@ -1865,20 +1865,20 @@ func NewExtCommunityActionFromApiStruct(a *api.CommunityAction) (*ExtCommunityAc
func NewExtCommunityAction(c config.SetExtCommunity) (*ExtCommunityAction, error) {
a, ok := CommunityOptionValueMap[strings.ToLower(c.Options)]
if !ok {
- if len(c.SetExtCommunityMethod.Communities) == 0 {
+ if len(c.SetExtCommunityMethod.CommunitiesList) == 0 {
return nil, nil
}
return nil, fmt.Errorf("invalid option name: %s", c.Options)
}
var list []bgp.ExtendedCommunityInterface
var removeList []*regexp.Regexp
- subtypeList := make([]bgp.ExtendedCommunityAttrSubType, 0, len(c.SetExtCommunityMethod.Communities))
+ subtypeList := make([]bgp.ExtendedCommunityAttrSubType, 0, len(c.SetExtCommunityMethod.CommunitiesList))
if a == config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE {
- removeList = make([]*regexp.Regexp, 0, len(c.SetExtCommunityMethod.Communities))
+ removeList = make([]*regexp.Regexp, 0, len(c.SetExtCommunityMethod.CommunitiesList))
} else {
- list = make([]bgp.ExtendedCommunityInterface, 0, len(c.SetExtCommunityMethod.Communities))
+ list = make([]bgp.ExtendedCommunityInterface, 0, len(c.SetExtCommunityMethod.CommunitiesList))
}
- for _, x := range c.SetExtCommunityMethod.Communities {
+ for _, x := range c.SetExtCommunityMethod.CommunitiesList {
if a == config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE {
subtype, exp, err := ParseExtCommunityRegexp(x)
if err != nil {
@@ -2516,7 +2516,7 @@ func NewPolicy(c config.PolicyDefinition, dmap DefinedSetMap) (*Policy, error) {
return nil, fmt.Errorf("empty policy name")
}
var st []*Statement
- stmts := c.Statements.StatementList
+ stmts := c.Statements
if len(stmts) != 0 {
st = make([]*Statement, 0, len(stmts))
for idx, stmt := range stmts {
@@ -2654,13 +2654,13 @@ func (r *RoutingPolicy) GetAssignmentFromConfig(dir PolicyDirection, a config.Ap
c := a.Config
switch dir {
case POLICY_DIRECTION_IN:
- names = c.InPolicy
+ names = c.InPolicyList
cdef = c.DefaultInPolicy
case POLICY_DIRECTION_IMPORT:
- names = c.ImportPolicy
+ names = c.ImportPolicyList
cdef = c.DefaultImportPolicy
case POLICY_DIRECTION_EXPORT:
- names = c.ExportPolicy
+ names = c.ExportPolicyList
cdef = c.DefaultExportPolicy
default:
return nil, def, fmt.Errorf("invalid policy direction")
@@ -2708,23 +2708,29 @@ func (r *RoutingPolicy) Reload(c config.RoutingPolicy) error {
dmap := make(map[DefinedType]map[string]DefinedSet)
dmap[DEFINED_TYPE_PREFIX] = make(map[string]DefinedSet)
d := c.DefinedSets
- for _, x := range d.PrefixSets.PrefixSetList {
+ for _, x := range d.PrefixSets {
y, err := NewPrefixSet(x)
if err != nil {
return err
}
+ if y == nil {
+ return fmt.Errorf("empty prefix set")
+ }
dmap[DEFINED_TYPE_PREFIX][y.Name()] = y
}
dmap[DEFINED_TYPE_NEIGHBOR] = make(map[string]DefinedSet)
- for _, x := range d.NeighborSets.NeighborSetList {
+ for _, x := range d.NeighborSets {
y, err := NewNeighborSet(x)
if err != nil {
return err
}
+ if y == nil {
+ return fmt.Errorf("empty neighbor set")
+ }
dmap[DEFINED_TYPE_NEIGHBOR][y.Name()] = y
}
// dmap[DEFINED_TYPE_TAG] = make(map[string]DefinedSet)
- // for _, x := range c.DefinedSets.TagSets.TagSetList {
+ // for _, x := range c.DefinedSets.TagSets{
// y, err := NewTagSet(x)
// if err != nil {
// return nil, err
@@ -2733,32 +2739,41 @@ func (r *RoutingPolicy) Reload(c config.RoutingPolicy) error {
// }
bd := c.DefinedSets.BgpDefinedSets
dmap[DEFINED_TYPE_AS_PATH] = make(map[string]DefinedSet)
- for _, x := range bd.AsPathSets.AsPathSetList {
+ for _, x := range bd.AsPathSets {
y, err := NewAsPathSet(x)
if err != nil {
return err
}
+ if y == nil {
+ return fmt.Errorf("empty as path set")
+ }
dmap[DEFINED_TYPE_AS_PATH][y.Name()] = y
}
dmap[DEFINED_TYPE_COMMUNITY] = make(map[string]DefinedSet)
- for _, x := range bd.CommunitySets.CommunitySetList {
+ for _, x := range bd.CommunitySets {
y, err := NewCommunitySet(x)
if err != nil {
return err
}
+ if y == nil {
+ return fmt.Errorf("empty community set")
+ }
dmap[DEFINED_TYPE_COMMUNITY][y.Name()] = y
}
dmap[DEFINED_TYPE_EXT_COMMUNITY] = make(map[string]DefinedSet)
- for _, x := range bd.ExtCommunitySets.ExtCommunitySetList {
+ for _, x := range bd.ExtCommunitySets {
y, err := NewExtCommunitySet(x)
if err != nil {
return err
}
+ if y == nil {
+ return fmt.Errorf("empty ext-community set")
+ }
dmap[DEFINED_TYPE_EXT_COMMUNITY][y.Name()] = y
}
pmap := make(map[string]*Policy)
smap := make(map[string]*Statement)
- for _, x := range c.PolicyDefinitions.PolicyDefinitionList {
+ for _, x := range c.PolicyDefinitions {
y, err := NewPolicy(x, dmap)
if err != nil {
return err
@@ -2798,7 +2813,7 @@ func CanImportToVrf(v *Vrf, path *Path) bool {
}
set, _ := NewExtCommunitySet(config.ExtCommunitySet{
ExtCommunitySetName: v.Name,
- ExtCommunity: f(v.ImportRt),
+ ExtCommunityList: f(v.ImportRt),
})
matchSet := config.MatchExtCommunitySet{
ExtCommunitySet: v.Name,
diff --git a/table/policy_test.go b/table/policy_test.go
index 099804d7..4df99f86 100644
--- a/table/policy_test.go
+++ b/table/policy_test.go
@@ -232,8 +232,8 @@ func TestPolicyNotMatch(t *testing.T) {
ps := createPrefixSet("ps1", "10.3.0.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", false)
pd := createPolicyDefinition("pd1", s)
pl := createRoutingPolicy(ds, pd)
@@ -262,8 +262,8 @@ func TestPolicyMatchAndReject(t *testing.T) {
ps := createPrefixSet("ps1", "10.10.0.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", false)
pd := createPolicyDefinition("pd1", s)
@@ -293,8 +293,8 @@ func TestPolicyMatchAndAccept(t *testing.T) {
ps := createPrefixSet("ps1", "10.10.0.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
pd := createPolicyDefinition("pd1", s)
@@ -336,7 +336,7 @@ func TestPolicyRejectOnlyPrefixSet(t *testing.T) {
// create policy
ps := createPrefixSet("ps1", "10.10.1.0/16", "21..24")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
+ ds.PrefixSets = []config.PrefixSet{ps}
s := createStatement("statement1", "ps1", "", false)
pd := createPolicyDefinition("pd1", s)
@@ -383,7 +383,7 @@ func TestPolicyRejectOnlyNeighborSet(t *testing.T) {
// create policy
ns := createNeighborSet("ns1", "10.0.1.1")
ds := config.DefinedSets{}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "", "ns1", false)
pd := createPolicyDefinition("pd1", s)
@@ -433,8 +433,8 @@ func TestPolicyDifferentRoutefamilyOfPathAndPolicy(t *testing.T) {
nsIPv6 := createNeighborSet("nsIPv6", "2001::192:168:50:1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{psIPv4, psIPv6}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{nsIPv4, nsIPv6}
+ ds.PrefixSets = []config.PrefixSet{psIPv4, psIPv6}
+ ds.NeighborSets = []config.NeighborSet{nsIPv4, nsIPv6}
stIPv4 := createStatement("statement1", "psIPv4", "nsIPv4", false)
stIPv6 := createStatement("statement2", "psIPv6", "nsIPv6", false)
@@ -528,8 +528,8 @@ func TestAsPathLengthConditionWithOtherCondition(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
// create match condition
asPathLength := config.AsPathLength{
@@ -646,8 +646,8 @@ func TestAs4PathLengthConditionWithOtherCondition(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
// create match condition
asPathLength := config.AsPathLength{
@@ -663,7 +663,7 @@ func TestAs4PathLengthConditionWithOtherCondition(t *testing.T) {
//test
r := NewRoutingPolicy()
r.Reload(pl)
- p, _ := NewPolicy(pl.PolicyDefinitions.PolicyDefinitionList[0], r.DefinedSetMap)
+ p, _ := NewPolicy(pl.PolicyDefinitions[0], r.DefinedSetMap)
pType, newPath := p.Apply(path)
assert.Equal(t, ROUTE_TYPE_REJECT, pType)
assert.Equal(t, newPath, path)
@@ -700,32 +700,32 @@ func TestAsPathConditionEvaluate(t *testing.T) {
// create match condition
asPathSet1 := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{"^65001"},
+ AsPathList: []string{"^65001"},
}
asPathSet2 := config.AsPathSet{
AsPathSetName: "asset2",
- AsPath: []string{"65005$"},
+ AsPathList: []string{"65005$"},
}
asPathSet3 := config.AsPathSet{
AsPathSetName: "asset3",
- AsPath: []string{"65004", "65005$"},
+ AsPathList: []string{"65004", "65005$"},
}
asPathSet4 := config.AsPathSet{
AsPathSetName: "asset4",
- AsPath: []string{"65000$"},
+ AsPathList: []string{"65000$"},
}
asPathSet5 := config.AsPathSet{
AsPathSetName: "asset5",
- AsPath: []string{"65010"},
+ AsPathList: []string{"65010"},
}
asPathSet6 := config.AsPathSet{
AsPathSetName: "asset6",
- AsPath: []string{"^65010$"},
+ AsPathList: []string{"^65010$"},
}
m := make(map[string]DefinedSet)
@@ -785,47 +785,47 @@ func TestMultipleAsPathConditionEvaluate(t *testing.T) {
// create match condition
asPathSet1 := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{"^65001_65000"},
+ AsPathList: []string{"^65001_65000"},
}
asPathSet2 := config.AsPathSet{
AsPathSetName: "asset2",
- AsPath: []string{"65004_65005$"},
+ AsPathList: []string{"65004_65005$"},
}
asPathSet3 := config.AsPathSet{
AsPathSetName: "asset3",
- AsPath: []string{"65001_65000_54000"},
+ AsPathList: []string{"65001_65000_54000"},
}
asPathSet4 := config.AsPathSet{
AsPathSetName: "asset4",
- AsPath: []string{"54000_65004_65005"},
+ AsPathList: []string{"54000_65004_65005"},
}
asPathSet5 := config.AsPathSet{
AsPathSetName: "asset5",
- AsPath: []string{"^65001 65000 54000 65004 65005$"},
+ AsPathList: []string{"^65001 65000 54000 65004 65005$"},
}
asPathSet6 := config.AsPathSet{
AsPathSetName: "asset6",
- AsPath: []string{".*_[0-9]+_65005"},
+ AsPathList: []string{".*_[0-9]+_65005"},
}
asPathSet7 := config.AsPathSet{
AsPathSetName: "asset7",
- AsPath: []string{".*_5[0-9]+_[0-9]+"},
+ AsPathList: []string{".*_5[0-9]+_[0-9]+"},
}
asPathSet8 := config.AsPathSet{
AsPathSetName: "asset8",
- AsPath: []string{"6[0-9]+_6[0-9]+_5[0-9]+"},
+ AsPathList: []string{"6[0-9]+_6[0-9]+_5[0-9]+"},
}
asPathSet9 := config.AsPathSet{
AsPathSetName: "asset9",
- AsPath: []string{"6[0-9]+__6[0-9]+"},
+ AsPathList: []string{"6[0-9]+__6[0-9]+"},
}
m := make(map[string]DefinedSet)
@@ -914,7 +914,7 @@ func TestAsPathCondition(t *testing.T) {
for k, v := range tests {
s, _ := NewAsPathSet(config.AsPathSet{
AsPathSetName: k,
- AsPath: []string{k},
+ AsPathList: []string{k},
})
c, _ := NewAsPathCondition(config.MatchAsPathSet{
AsPathSet: k,
@@ -956,16 +956,16 @@ func TestAsPathConditionWithOtherCondition(t *testing.T) {
// create policy
asPathSet := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{"65005$"},
+ AsPathList: []string{"65005$"},
}
ps := createPrefixSet("ps1", "10.10.1.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
- ds.BgpDefinedSets.AsPathSets.AsPathSetList = []config.AsPathSet{asPathSet}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
+ ds.BgpDefinedSets.AsPathSets = []config.AsPathSet{asPathSet}
s := createStatement("statement1", "ps1", "ns1", false)
s.Conditions.BgpConditions.MatchAsPathSet.AsPathSet = "asset1"
@@ -1022,17 +1022,17 @@ func TestAs4PathConditionEvaluate(t *testing.T) {
// create match condition
asPathSet1 := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{fmt.Sprintf("^%d", createAs4Value("65001.1"))},
+ AsPathList: []string{fmt.Sprintf("^%d", createAs4Value("65001.1"))},
}
asPathSet2 := config.AsPathSet{
AsPathSetName: "asset2",
- AsPath: []string{fmt.Sprintf("%d$", createAs4Value("65005.1"))},
+ AsPathList: []string{fmt.Sprintf("%d$", createAs4Value("65005.1"))},
}
asPathSet3 := config.AsPathSet{
AsPathSetName: "asset3",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d", createAs4Value("65004.1")),
fmt.Sprintf("%d$", createAs4Value("65005.1")),
},
@@ -1040,21 +1040,21 @@ func TestAs4PathConditionEvaluate(t *testing.T) {
asPathSet4 := config.AsPathSet{
AsPathSetName: "asset4",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d$", createAs4Value("65000.1")),
},
}
asPathSet5 := config.AsPathSet{
AsPathSetName: "asset5",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d", createAs4Value("65010.1")),
},
}
asPathSet6 := config.AsPathSet{
AsPathSetName: "asset6",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d$", createAs4Value("65010.1")),
},
}
@@ -1125,59 +1125,59 @@ func TestMultipleAs4PathConditionEvaluate(t *testing.T) {
// create match condition
asPathSet1 := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("^%d_%d", createAs4Value("65001.1"), createAs4Value("65000.1")),
},
}
asPathSet2 := config.AsPathSet{
AsPathSetName: "asset2",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d_%d$", createAs4Value("65004.1"), createAs4Value("65005.1")),
},
}
asPathSet3 := config.AsPathSet{
AsPathSetName: "asset3",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d_%d_%d", createAs4Value("65001.1"), createAs4Value("65000.1"), createAs4Value("54000.1")),
},
}
asPathSet4 := config.AsPathSet{
AsPathSetName: "asset4",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("%d_%d_%d", createAs4Value("54000.1"), createAs4Value("65004.1"), createAs4Value("65005.1")),
},
}
asPathSet5 := config.AsPathSet{
AsPathSetName: "asset5",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf("^%d %d %d %d %d$", createAs4Value("65001.1"), createAs4Value("65000.1"), createAs4Value("54000.1"), createAs4Value("65004.1"), createAs4Value("65005.1")),
},
}
asPathSet6 := config.AsPathSet{
AsPathSetName: "asset6",
- AsPath: []string{
+ AsPathList: []string{
fmt.Sprintf(".*_[0-9]+_%d", createAs4Value("65005.1")),
},
}
asPathSet7 := config.AsPathSet{
AsPathSetName: "asset7",
- AsPath: []string{".*_3[0-9]+_[0-9]+"},
+ AsPathList: []string{".*_3[0-9]+_[0-9]+"},
}
asPathSet8 := config.AsPathSet{
AsPathSetName: "asset8",
- AsPath: []string{"4[0-9]+_4[0-9]+_3[0-9]+"},
+ AsPathList: []string{"4[0-9]+_4[0-9]+_3[0-9]+"},
}
asPathSet9 := config.AsPathSet{
AsPathSetName: "asset9",
- AsPath: []string{"4[0-9]+__4[0-9]+"},
+ AsPathList: []string{"4[0-9]+__4[0-9]+"},
}
m := make(map[string]DefinedSet)
@@ -1250,16 +1250,16 @@ func TestAs4PathConditionWithOtherCondition(t *testing.T) {
// create policy
asPathSet := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{fmt.Sprintf("%d$", createAs4Value("65005.1"))},
+ AsPathList: []string{fmt.Sprintf("%d$", createAs4Value("65005.1"))},
}
ps := createPrefixSet("ps1", "10.10.1.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
- ds.BgpDefinedSets.AsPathSets.AsPathSetList = []config.AsPathSet{asPathSet}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
+ ds.BgpDefinedSets.AsPathSets = []config.AsPathSet{asPathSet}
s := createStatement("statement1", "ps1", "ns1", false)
s.Conditions.BgpConditions.MatchAsPathSet.AsPathSet = "asset1"
@@ -1270,7 +1270,7 @@ func TestAs4PathConditionWithOtherCondition(t *testing.T) {
//test
r := NewRoutingPolicy()
r.Reload(pl)
- p, _ := NewPolicy(pl.PolicyDefinitions.PolicyDefinitionList[0], r.DefinedSetMap)
+ p, _ := NewPolicy(pl.PolicyDefinitions[0], r.DefinedSetMap)
pType, newPath := p.Apply(path)
assert.Equal(t, ROUTE_TYPE_REJECT, pType)
assert.Equal(t, newPath, path)
@@ -1308,37 +1308,37 @@ func TestAs4PathConditionEvaluateMixedWith2byteAS(t *testing.T) {
// create match condition
asPathSet1 := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{fmt.Sprintf("^%d", createAs4Value("65001.1"))},
+ AsPathList: []string{fmt.Sprintf("^%d", createAs4Value("65001.1"))},
}
asPathSet2 := config.AsPathSet{
AsPathSetName: "asset2",
- AsPath: []string{"4000$"},
+ AsPathList: []string{"4000$"},
}
asPathSet3 := config.AsPathSet{
AsPathSetName: "asset3",
- AsPath: []string{fmt.Sprintf("%d", createAs4Value("65004.1")), "4000$"},
+ AsPathList: []string{fmt.Sprintf("%d", createAs4Value("65004.1")), "4000$"},
}
asPathSet4 := config.AsPathSet{
AsPathSetName: "asset4",
- AsPath: []string{fmt.Sprintf("%d_%d_%d", createAs4Value("54000.1"), 100, 5000)},
+ AsPathList: []string{fmt.Sprintf("%d_%d_%d", createAs4Value("54000.1"), 100, 5000)},
}
asPathSet5 := config.AsPathSet{
AsPathSetName: "asset5",
- AsPath: []string{".*_[0-9]+_100"},
+ AsPathList: []string{".*_[0-9]+_100"},
}
asPathSet6 := config.AsPathSet{
AsPathSetName: "asset6",
- AsPath: []string{".*_3[0-9]+_[0]+"},
+ AsPathList: []string{".*_3[0-9]+_[0]+"},
}
asPathSet7 := config.AsPathSet{
AsPathSetName: "asset7",
- AsPath: []string{".*_3[0-9]+_[1]+"},
+ AsPathList: []string{".*_3[0-9]+_[1]+"},
}
m := make(map[string]DefinedSet)
@@ -1420,47 +1420,47 @@ func TestCommunityConditionEvaluate(t *testing.T) {
// create match condition
comSet1 := config.CommunitySet{
CommunitySetName: "comset1",
- Community: []string{"65001:10", "65001:50", "65001:100"},
+ CommunityList: []string{"65001:10", "65001:50", "65001:100"},
}
comSet2 := config.CommunitySet{
CommunitySetName: "comset2",
- Community: []string{"65001:200"},
+ CommunityList: []string{"65001:200"},
}
comSet3 := config.CommunitySet{
CommunitySetName: "comset3",
- Community: []string{"4259905936"},
+ CommunityList: []string{"4259905936"},
}
comSet4 := config.CommunitySet{
CommunitySetName: "comset4",
- Community: []string{"^[0-9]*:300$"},
+ CommunityList: []string{"^[0-9]*:300$"},
}
comSet5 := config.CommunitySet{
CommunitySetName: "comset5",
- Community: []string{"INTERNET"},
+ CommunityList: []string{"INTERNET"},
}
comSet6 := config.CommunitySet{
CommunitySetName: "comset6",
- Community: []string{"NO_EXPORT"},
+ CommunityList: []string{"NO_EXPORT"},
}
comSet7 := config.CommunitySet{
CommunitySetName: "comset7",
- Community: []string{"NO_ADVERTISE"},
+ CommunityList: []string{"NO_ADVERTISE"},
}
comSet8 := config.CommunitySet{
CommunitySetName: "comset8",
- Community: []string{"NO_EXPORT_SUBCONFED"},
+ CommunityList: []string{"NO_EXPORT_SUBCONFED"},
}
comSet9 := config.CommunitySet{
CommunitySetName: "comset9",
- Community: []string{
+ CommunityList: []string{
"65001:\\d+",
"\\d+:\\d00",
},
@@ -1468,7 +1468,7 @@ func TestCommunityConditionEvaluate(t *testing.T) {
comSet10 := config.CommunitySet{
CommunitySetName: "comset10",
- Community: []string{
+ CommunityList: []string{
"65001:1",
"65001:2",
"65001:3",
@@ -1552,27 +1552,27 @@ func TestCommunityConditionEvaluateWithOtherCondition(t *testing.T) {
// create policy
asPathSet := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{"65005$"},
+ AsPathList: []string{"65005$"},
}
comSet1 := config.CommunitySet{
CommunitySetName: "comset1",
- Community: []string{"65001:100", "65001:200", "65001:300"},
+ CommunityList: []string{"65001:100", "65001:200", "65001:300"},
}
comSet2 := config.CommunitySet{
CommunitySetName: "comset2",
- Community: []string{"65050:\\d+"},
+ CommunityList: []string{"65050:\\d+"},
}
ps := createPrefixSet("ps1", "10.10.0.0/16", "21..24")
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
- ds.BgpDefinedSets.AsPathSets.AsPathSetList = []config.AsPathSet{asPathSet}
- ds.BgpDefinedSets.CommunitySets.CommunitySetList = []config.CommunitySet{comSet1, comSet2}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
+ ds.BgpDefinedSets.AsPathSets = []config.AsPathSet{asPathSet}
+ ds.BgpDefinedSets.CommunitySets = []config.CommunitySet{comSet1, comSet2}
s1 := createStatement("statement1", "ps1", "ns1", false)
s1.Conditions.BgpConditions.MatchAsPathSet.AsPathSet = "asset1"
@@ -1620,8 +1620,8 @@ func TestPolicyMatchAndAddCommunities(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
community := "65000:100"
@@ -1665,8 +1665,8 @@ func TestPolicyMatchAndReplaceCommunities(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
community := "65000:100"
@@ -1712,8 +1712,8 @@ func TestPolicyMatchAndRemoveCommunities(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetCommunity = createSetCommunity("REMOVE", community1)
@@ -1758,8 +1758,8 @@ func TestPolicyMatchAndRemoveCommunitiesRegexp(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetCommunity = createSetCommunity("REMOVE", ".*:100")
@@ -1804,8 +1804,8 @@ func TestPolicyMatchAndRemoveCommunitiesRegexp2(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetCommunity = createSetCommunity("REMOVE", "^(0|45686):[0-9]+")
@@ -1848,13 +1848,13 @@ func TestPolicyMatchAndClearCommunities(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
// action NULL is obsolate
s.Actions.BgpActions.SetCommunity.Options = "REPLACE"
- s.Actions.BgpActions.SetCommunity.SetCommunityMethod.Communities = nil
+ s.Actions.BgpActions.SetCommunity.SetCommunityMethod.CommunitiesList = nil
pd := createPolicyDefinition("pd1", s)
pl := createRoutingPolicy(ds, pd)
@@ -1960,48 +1960,48 @@ func TestExtCommunityConditionEvaluate(t *testing.T) {
// create match condition
ecomSet1 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet1",
- ExtCommunity: []string{"RT:65001:200"},
+ ExtCommunityList: []string{"RT:65001:200"},
}
ecomSet2 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet2",
- ExtCommunity: []string{"RT:10.0.0.1:300"},
+ ExtCommunityList: []string{"RT:10.0.0.1:300"},
}
ecomSet3 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet3",
- ExtCommunity: []string{fmt.Sprintf("RT:%s:200", convUintStr(65030000))},
+ ExtCommunityList: []string{fmt.Sprintf("RT:%s:200", convUintStr(65030000))},
}
ecomSet4 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet4",
- ExtCommunity: []string{"RT:65002:200"},
+ ExtCommunityList: []string{"RT:65002:200"},
}
ecomSet5 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet5",
- ExtCommunity: []string{"RT:10.0.0.2:300"},
+ ExtCommunityList: []string{"RT:10.0.0.2:300"},
}
ecomSet6 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet6",
- ExtCommunity: []string{fmt.Sprintf("RT:%s:200", convUintStr(65030001))},
+ ExtCommunityList: []string{fmt.Sprintf("RT:%s:200", convUintStr(65030001))},
}
ecomSet7 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet7",
- ExtCommunity: []string{"SoO:65010:300"},
+ ExtCommunityList: []string{"SoO:65010:300"},
}
ecomSet8 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet8",
- ExtCommunity: []string{"SoO:10.0.10.10:[0-9]+"},
+ ExtCommunityList: []string{"SoO:10.0.10.10:[0-9]+"},
}
ecomSet9 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet9",
- ExtCommunity: []string{"RT:[0-9]+:[0-9]+"},
+ ExtCommunityList: []string{"RT:[0-9]+:[0-9]+"},
}
ecomSet10 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet10",
- ExtCommunity: []string{"RT:.+:\\d00", "SoO:.+:\\d00"},
+ ExtCommunityList: []string{"RT:.+:\\d00", "SoO:.+:\\d00"},
}
ecomSet11 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet11",
- ExtCommunity: []string{"RT:65001:2", "SoO:11.0.10.10:[0-9]+"},
+ ExtCommunityList: []string{"RT:65001:2", "SoO:11.0.10.10:[0-9]+"},
}
m := make(map[string]DefinedSet)
@@ -2132,26 +2132,26 @@ func TestExtCommunityConditionEvaluateWithOtherCondition(t *testing.T) {
// create policy
asPathSet := config.AsPathSet{
AsPathSetName: "asset1",
- AsPath: []string{"65005$"},
+ AsPathList: []string{"65005$"},
}
ecomSet1 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet1",
- ExtCommunity: []string{"RT:65001:201"},
+ ExtCommunityList: []string{"RT:65001:201"},
}
ecomSet2 := config.ExtCommunitySet{
ExtCommunitySetName: "ecomSet2",
- ExtCommunity: []string{"RT:[0-9]+:[0-9]+"},
+ ExtCommunityList: []string{"RT:[0-9]+:[0-9]+"},
}
ps := createPrefixSet("ps1", "10.10.1.0/16", "21..24")
ns := createNeighborSet("ns1", "10.2.1.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
- ds.BgpDefinedSets.AsPathSets.AsPathSetList = []config.AsPathSet{asPathSet}
- ds.BgpDefinedSets.ExtCommunitySets.ExtCommunitySetList = []config.ExtCommunitySet{ecomSet1, ecomSet2}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
+ ds.BgpDefinedSets.AsPathSets = []config.AsPathSet{asPathSet}
+ ds.BgpDefinedSets.ExtCommunitySets = []config.ExtCommunitySet{ecomSet1, ecomSet2}
s1 := createStatement("statement1", "ps1", "ns1", false)
s1.Conditions.BgpConditions.MatchAsPathSet.AsPathSet = "asset1"
@@ -2199,8 +2199,8 @@ func TestPolicyMatchAndReplaceMed(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := "200"
s := createStatement("statement1", "ps1", "ns1", true)
@@ -2243,8 +2243,8 @@ func TestPolicyMatchAndAddingMed(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := "+200"
ma := "300"
@@ -2287,8 +2287,8 @@ func TestPolicyMatchAndAddingMedOverFlow(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := fmt.Sprintf("+%d", math.MaxUint32)
ma := "1"
@@ -2333,8 +2333,8 @@ func TestPolicyMatchAndSubtractMed(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := "-50"
ma := "50"
@@ -2379,8 +2379,8 @@ func TestPolicyMatchAndSubtractMedUnderFlow(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := "-101"
ma := "100"
@@ -2424,8 +2424,8 @@ func TestPolicyMatchWhenPathHaveNotMed(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
m := "-50"
s := createStatement("statement1", "ps1", "ns1", true)
@@ -2472,8 +2472,8 @@ func TestPolicyAsPathPrepend(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetAsPathPrepend.As = "65002"
@@ -2516,8 +2516,8 @@ func TestPolicyAsPathPrependLastAs(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetAsPathPrepend.As = "last-as"
@@ -2566,8 +2566,8 @@ func TestPolicyAs4PathPrepend(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetAsPathPrepend.As = fmt.Sprintf("%d", createAs4Value("65002.1"))
@@ -2578,7 +2578,7 @@ func TestPolicyAs4PathPrepend(t *testing.T) {
//test
r := NewRoutingPolicy()
r.Reload(pl)
- p, _ := NewPolicy(pl.PolicyDefinitions.PolicyDefinitionList[0], r.DefinedSetMap)
+ p, _ := NewPolicy(pl.PolicyDefinitions[0], r.DefinedSetMap)
pType, newPath := p.Apply(path)
assert.Equal(ROUTE_TYPE_ACCEPT, pType)
@@ -2621,8 +2621,8 @@ func TestPolicyAs4PathPrependLastAs(t *testing.T) {
ns := createNeighborSet("ns1", "10.0.0.1")
ds := config.DefinedSets{}
- ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps}
- ds.NeighborSets.NeighborSetList = []config.NeighborSet{ns}
+ ds.PrefixSets = []config.PrefixSet{ps}
+ ds.NeighborSets = []config.NeighborSet{ns}
s := createStatement("statement1", "ps1", "ns1", true)
s.Actions.BgpActions.SetAsPathPrepend.As = "last-as"
@@ -2633,7 +2633,7 @@ func TestPolicyAs4PathPrependLastAs(t *testing.T) {
//test
r := NewRoutingPolicy()
r.Reload(pl)
- p, _ := NewPolicy(pl.PolicyDefinitions.PolicyDefinitionList[0], r.DefinedSetMap)
+ p, _ := NewPolicy(pl.PolicyDefinitions[0], r.DefinedSetMap)
pType, newPath := p.Apply(path)
assert.Equal(ROUTE_TYPE_ACCEPT, pType)
@@ -2674,7 +2674,7 @@ func createSetCommunity(operation string, community ...string) config.SetCommuni
s := config.SetCommunity{
SetCommunityMethod: config.SetCommunityMethod{
- Communities: community,
+ CommunitiesList: community,
},
Options: operation,
}
@@ -2690,20 +2690,16 @@ func stringToCommunityValue(comStr string) uint32 {
func createPolicyDefinition(defName string, stmt ...config.Statement) config.PolicyDefinition {
pd := config.PolicyDefinition{
- Name: defName,
- Statements: config.Statements{
- StatementList: stmt,
- },
+ Name: defName,
+ Statements: []config.Statement(stmt),
}
return pd
}
func createRoutingPolicy(ds config.DefinedSets, pd ...config.PolicyDefinition) config.RoutingPolicy {
pl := config.RoutingPolicy{
- DefinedSets: ds,
- PolicyDefinitions: config.PolicyDefinitions{
- PolicyDefinitionList: pd,
- },
+ DefinedSets: ds,
+ PolicyDefinitions: []config.PolicyDefinition(pd),
}
return pl
}
@@ -2722,8 +2718,8 @@ func createPrefixSet(name string, prefix string, maskLength string) config.Prefi
func createNeighborSet(name string, addr string) config.NeighborSet {
ns := config.NeighborSet{
- NeighborSetName: name,
- NeighborInfo: []string{addr},
+ NeighborSetName: name,
+ NeighborInfoList: []string{addr},
}
return ns
}
diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py
index 06924edd..18e7ddc8 100644
--- a/test/lib/gobgp.py
+++ b/test/lib/gobgp.py
@@ -174,51 +174,51 @@ class GoBGPContainer(BGPContainer):
self._create_config_zebra()
def _create_config_bgp(self):
- config = {'Global': {'Config': {'As': self.asn, 'RouterId': self.router_id}}}
+ config = {'global': {'config': {'as': self.asn, 'router-id': self.router_id}}}
for peer, info in self.peers.iteritems():
afi_safi_list = []
version = netaddr.IPNetwork(info['neigh_addr']).version
if version == 4:
- afi_safi_list.append({'AfiSafiName': 'ipv4-unicast'})
+ afi_safi_list.append({'afi-safi-name': 'ipv4-unicast'})
elif version == 6:
- afi_safi_list.append({'AfiSafiName': 'ipv6-unicast'})
+ afi_safi_list.append({'afi-safi-name': 'ipv6-unicast'})
else:
Exception('invalid ip address version. {0}'.format(version))
if info['evpn']:
- afi_safi_list.append({'AfiSafiName': 'l2vpn-evpn'})
- afi_safi_list.append({'AfiSafiName': 'encap'})
- afi_safi_list.append({'AfiSafiName': 'rtc'})
+ afi_safi_list.append({'afi-safi-name': 'l2vpn-evpn'})
+ afi_safi_list.append({'afi-safi-name': 'encap'})
+ afi_safi_list.append({'afi-safi-name': 'rtc'})
if info['flowspec']:
- afi_safi_list.append({'AfiSafiName': 'ipv4-flowspec'})
- afi_safi_list.append({'AfiSafiName': 'l3vpn-ipv4-flowspec'})
- afi_safi_list.append({'AfiSafiName': 'ipv6-flowspec'})
- afi_safi_list.append({'AfiSafiName': 'l3vpn-ipv6-flowspec'})
-
- n = {'Config':
- {'NeighborAddress': info['neigh_addr'].split('/')[0],
- 'PeerAs': peer.asn,
- 'AuthPassword': info['passwd'],
+ afi_safi_list.append({'afi-safi-name': 'ipv4-flowspec'})
+ afi_safi_list.append({'afi-safi-name': 'l3vpn-ipv4-flowspec'})
+ afi_safi_list.append({'afi-safi-name': 'ipv6-flowspec'})
+ afi_safi_list.append({'afi-safi-name': 'l3vpn-ipv6-flowspec'})
+
+ n = {'config':
+ {'neighbor-address': info['neigh_addr'].split('/')[0],
+ 'peer-as': peer.asn,
+ 'auth-password': info['passwd'],
},
- 'AfiSafis': {'AfiSafiList': afi_safi_list},
- 'Timers': {'Config': {
- 'ConnectRetry': 10,
- }},
+ 'afi-safis': afi_safi_list,
+ 'timers': {'config': {
+ 'connect-retry': 10,
+ }},
}
if info['passive']:
- n['Transport'] = {'Config': {'PassiveMode': True}}
+ n['transport'] = {'config': {'passive-mode': True}}
if info['is_rs_client']:
- n['RouteServer'] = {'Config': {'RouteServerClient': True}}
+ n['route-server'] = {'config': {'route-server-client': True}}
if info['is_rr_client']:
clusterId = self.router_id
if 'cluster_id' in info and info['cluster_id'] is not None:
clusterId = info['cluster_id']
- n['RouteReflector'] = {'Config' : {'RouteReflectorClient': True,
- 'RouteReflectorClusterId': clusterId}}
+ n['route-reflector'] = {'config' : {'route-reflector-client': True,
+ 'route-reflector-cluster-id': clusterId}}
f = lambda typ: [p for p in info['policies'].itervalues() if p['type'] == typ]
import_policies = f('import')
@@ -231,16 +231,16 @@ class GoBGPContainer(BGPContainer):
if len(import_policies) + len(export_policies) + len(in_policies) + len(default_import_policy) \
+ len(default_export_policy) + len(default_in_policy) > 0:
- n['ApplyPolicy'] = {'Config': {}}
+ n['apply-policy'] = {'config': {}}
if len(import_policies) > 0:
- n['ApplyPolicy']['Config']['ImportPolicy'] = [p['name'] for p in import_policies]
+ n['apply-policy']['config']['import-policy-list'] = [p['name'] for p in import_policies]
if len(export_policies) > 0:
- n['ApplyPolicy']['Config']['ExportPolicy'] = [p['name'] for p in export_policies]
+ n['apply-policy']['config']['export-policy-list'] = [p['name'] for p in export_policies]
if len(in_policies) > 0:
- n['ApplyPolicy']['Config']['InPolicy'] = [p['name'] for p in in_policies]
+ n['apply-policy']['config']['in-policy-list'] = [p['name'] for p in in_policies]
def f(v):
if v == 'reject':
@@ -250,41 +250,41 @@ class GoBGPContainer(BGPContainer):
raise Exception('invalid default policy type {0}'.format(v))
if len(default_import_policy) > 0:
- n['ApplyPolicy']['Config']['DefaultImportPolicy'] = f(default_import_policy[0])
+ n['apply-policy']['config']['default-import-policy'] = f(default_import_policy[0])
if len(default_export_policy) > 0:
- n['ApplyPolicy']['Config']['DefaultExportPolicy'] = f(default_export_policy[0])
+ n['apply-policy']['config']['default-export-policy'] = f(default_export_policy[0])
if len(default_in_policy) > 0:
- n['ApplyPolicy']['Config']['DefaultInPolicy'] = f(default_in_policy[0])
+ n['apply-policy']['config']['default-in-policy'] = f(default_in_policy[0])
- if 'Neighbors' not in config:
- config['Neighbors'] = {'NeighborList': []}
+ if 'neighbors' not in config:
+ config['neighbors'] = []
- config['Neighbors']['NeighborList'].append(n)
+ config['neighbors'].append(n)
- config['DefinedSets'] = {}
+ config['defined-sets'] = {}
if self.prefix_set:
- config['DefinedSets']['PrefixSets'] = {'PrefixSetList': [self.prefix_set]}
+ config['defined-sets']['prefix-sets'] = [self.prefix_set]
if self.neighbor_set:
- config['DefinedSets']['NeighborSets'] = {'NeighborSetList': [self.neighbor_set]}
+ config['defined-sets']['neighbor-sets'] = [self.neighbor_set]
if self.bgp_set:
- config['DefinedSets']['BgpDefinedSets'] = self.bgp_set
+ config['defined-sets']['bgp-defined-sets'] = self.bgp_set
policy_list = []
for p in self.policies.itervalues():
- policy = {'Name': p['name'],
- 'Statements':{'StatementList': p['statements']}}
+ policy = {'name': p['name'],
+ 'statements': p['statements']}
policy_list.append(policy)
if len(policy_list) > 0:
- config['PolicyDefinitions'] = {'PolicyDefinitionList': policy_list}
+ config['policy-definitions'] = policy_list
if self.zebra:
- config['Global']['Zebra'] = {'Enabled': True,
- 'RedistributeRouteType':['connect']}
+ config['global']['zebra'] = {'enabled': True,
+ 'redistribute-route-type-list':['connect']}
with open('{0}/gobgpd.conf'.format(self.config_dir), 'w') as f:
print colors.yellow('[{0}\'s new config]'.format(self.name))
diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py
index 0fdc3967..f01d63e3 100644
--- a/test/scenario_test/route_server_policy_test.py
+++ b/test/scenario_test/route_server_policy_test.py
@@ -99,22 +99,22 @@ class ImportPolicy(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.0.0/16',
- 'MasklengthRange': '16..24'}
+ p0 = {'ip-prefix': '192.168.0.0/16',
+ 'masklength-range': '16..24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -166,22 +166,22 @@ class ExportPolicy(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.0.0/16',
- 'MasklengthRange': '16..24'}
+ p0 = {'ip-prefix': '192.168.0.0/16',
+ 'masklength-range': '16..24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -253,22 +253,22 @@ class ImportPolicyUpdate(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
- p1 = {'IpPrefix': '192.168.200.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
+ p1 = {'ip-prefix': '192.168.200.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0, p1]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0, p1]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -303,20 +303,20 @@ class ImportPolicyUpdate(object):
q2 = env.q2
g1.clear_policy()
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -383,21 +383,21 @@ class ExportPolicyUpdate(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
- p1 = {'IpPrefix': '192.168.200.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
+ p1 = {'ip-prefix': '192.168.200.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0, p1]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0, p1]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -432,20 +432,20 @@ class ExportPolicyUpdate(object):
q2 = env.q2
g1.clear_policy()
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -527,22 +527,22 @@ class ImportPolicyIPV6(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001::/32',
- 'MasklengthRange': '64..128'}
+ p0 = {'ip-prefix': '2001::/32',
+ 'masklength-range': '64..128'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -597,22 +597,22 @@ class ExportPolicyIPV6(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001::/32',
- 'MasklengthRange': '64..128'}
+ p0 = {'ip-prefix': '2001::/32',
+ 'masklength-range': '64..128'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -680,22 +680,22 @@ class ImportPolicyIPV6Update(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001:0:10:2::/64'}
- p1 = {'IpPrefix': '2001:0:10:20::/64'}
+ p0 = {'ip-prefix': '2001:0:10:2::/64'}
+ p1 = {'ip-prefix': '2001:0:10:20::/64'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0, p1]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0, p1]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -725,22 +725,22 @@ class ImportPolicyIPV6Update(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001:0:10:2::/64'}
+ p0 = {'ip-prefix': '2001:0:10:2::/64'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {
- 'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {
+ 'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -803,22 +803,22 @@ class ExportPolicyIPv6Update(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001:0:10:2::/64'}
- p1 = {'IpPrefix': '2001:0:10:20::/64'}
+ p0 = {'ip-prefix': '2001:0:10:2::/64'}
+ p1 = {'ip-prefix': '2001:0:10:20::/64'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0, p1]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0, p1]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -848,21 +848,21 @@ class ExportPolicyIPv6Update(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '2001:0:10:2::/64'}
+ p0 = {'ip-prefix': '2001:0:10:2::/64'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[q2]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -911,10 +911,10 @@ class ImportPolicyAsPathLengthCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'AsPathLength': {'Operator': 'ge',
- 'Value': 10}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'as-path-length': {'operator': 'ge',
+ 'value': 10}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -969,13 +969,13 @@ class ImportPolicyAsPathCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- as0 = {'AsPathSets': {'AsPathSetList': [{'AsPathSetName': 'as0', 'AsPath': ['^{0}'.format(e1.asn)]}]}}
+ as0 = {'as-path-sets': [{'as-path-set-name': 'as0', 'as-path-list': ['^{0}'.format(e1.asn)]}]}
g1.set_bgp_defined_set(as0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-as-path-set': {'as-path-set': 'as0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1022,13 +1022,13 @@ class ImportPolicyAsPathAnyCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- as0 = {'AsPathSets': {'AsPathSetList': [{'AsPathSetName': 'as0', 'AsPath': ['65098']}]}}
+ as0 = {'as-path-sets': [{'as-path-set-name': 'as0', 'as-path-list': ['65098']}]}
g1.set_bgp_defined_set(as0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-as-path-set': {'as-path-set': 'as0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1075,13 +1075,13 @@ class ImportPolicyAsPathOriginCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- as0 = {'AsPathSets': {'AsPathSetList': [{'AsPathSetName': 'as0', 'AsPath': ['65090$']}]}}
+ as0 = {'as-path-sets': [{'as-path-set-name': 'as0', 'as-path-list': ['65090$']}]}
g1.set_bgp_defined_set(as0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-as-path-set': {'as-path-set': 'as0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1128,13 +1128,13 @@ class ImportPolicyAsPathOnlyCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- as0 = {'AsPathSets': {'AsPathSetList': [{'AsPathSetName': 'as0', 'AsPath': ['^65100$']}]}}
+ as0 = {'as-path-sets': [{'as-path-set-name': 'as0', 'as-path-list': ['^65100$']}]}
g1.set_bgp_defined_set(as0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-as-path-set': {'as-path-set': 'as0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1182,15 +1182,14 @@ class ImportPolicyAsPathMismatchCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList':
- [{'CommunitySetName': 'cs0',
- 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0',
+ 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1245,14 +1244,13 @@ class ImportPolicyCommunityCondition(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets':
- {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1300,13 +1298,13 @@ class ImportPolicyCommunityRegexp(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['6[0-9]+:[0-9]+']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['6[0-9]+:[0-9]+']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1362,15 +1360,15 @@ class ImportPolicyCommunityAction(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'ADD',
- 'SetCommunityMethod': {'Communities': ['65100:20']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0', 'match-set-options': 'any'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'add',
+ 'set-community-method': {'communities-list': ['65100:20']}}}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1437,15 +1435,15 @@ class ImportPolicyCommunityReplace(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REPLACE',
- 'SetCommunityMethod': {'Communities': ['65100:20']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REPLACE',
+ 'set-community-method': {'communities-list': ['65100:20']}}}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1504,15 +1502,15 @@ class ImportPolicyCommunityRemove(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REMOVE',
- 'SetCommunityMethod': {'Communities': ['65100:10', '65100:20']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REMOVE',
+ 'set-community-method': {'communities-list': ['65100:10', '65100:20']}}}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1589,15 +1587,15 @@ class ImportPolicyCommunityNull(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REPLACE',
- 'SetCommunityMethod': {'Communities': []}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REPLACE',
+ 'set-community-method': {'communities-list': []}}}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -1664,15 +1662,15 @@ class ExportPolicyCommunityAdd(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'ADD',
- 'SetCommunityMethod': {'Communities': ['65100:20']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'add',
+ 'set-community-method': {'communities-list': ['65100:20']}}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -1738,15 +1736,15 @@ class ExportPolicyCommunityReplace(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REPLACE',
- 'SetCommunityMethod': {'Communities': ['65100:20']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REPLACE',
+ 'set-community-method': {'communities-list': ['65100:20']}}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -1812,15 +1810,15 @@ class ExportPolicyCommunityRemove(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REMOVE',
- 'SetCommunityMethod': {'Communities': ['65100:20', '65100:30']}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REMOVE',
+ 'set-community-method': {'communities-list': ['65100:20', '65100:30']}}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -1889,15 +1887,15 @@ class ExportPolicyCommunityNull(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetCommunity': {'Options': 'REPLACE',
- 'SetCommunityMethod': {'Communities': []}}}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-community': {'options': 'REPLACE',
+ 'set-community-method': {'communities-list': []}}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -1973,9 +1971,9 @@ class ImportPolicyMedReplace(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '100'}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2035,9 +2033,9 @@ class ImportPolicyMedAdd(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '+100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '+100'}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2097,9 +2095,9 @@ class ImportPolicyMedSub(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '-100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '-100'}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2159,9 +2157,9 @@ class ExportPolicyMedReplace(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '100'}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -2221,9 +2219,9 @@ class ExportPolicyMedAdd(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '+100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '+100'}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -2283,9 +2281,9 @@ class ExportPolicyMedSub(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- st0 = {'Name': 'st0',
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetMed': '-100'}}}
+ st0 = {'name': 'st0',
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-med': '-100'}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -2344,13 +2342,13 @@ class InPolicyReject(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'in',
@@ -2404,13 +2402,13 @@ class InPolicyAccept(object):
e1 = env.e1
q1 = env.q1
q2 = env.q2
- cs0 = {'CommunitySets': {'CommunitySetList': [{'CommunitySetName': 'cs0', 'Community': ['65100:10']}]}}
+ cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]}
g1.set_bgp_defined_set(cs0)
- st0 = {'Name': 'st0',
- 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}},
- 'Actions':{'RouteDisposition': {'AcceptRoute': True}}}
+ st0 = {'name': 'st0',
+ 'conditions':{'bgp-conditions':{'match-community-set':{'community-set': 'cs0'}}},
+ 'actions':{'route-disposition': {'accept-route': True}}}
policy = {'name': 'policy0',
'type': 'in',
@@ -2472,22 +2470,22 @@ class InPolicyUpdate(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
- p1 = {'IpPrefix': '192.168.200.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
+ p1 = {'ip-prefix': '192.168.200.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0, p1]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0, p1]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'in',
@@ -2523,20 +2521,20 @@ class InPolicyUpdate(object):
q2 = env.q2
g1.clear_policy()
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- ns0 = {'NeighborSetName': 'ns0',
- 'NeighborInfo': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
+ ns0 = {'neighbor-set-name': 'ns0',
+ 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]}
g1.set_neighbor_set(ns0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']},
- 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']},
+ 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'in',
@@ -2589,16 +2587,16 @@ class ExportPolicyAsPathPrepend(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetAsPathPrepend': {'RepeatN': 5, 'As': "65005"}}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-as-path-prepend': {'repeat-n': 5, 'as': "65005"}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -2677,16 +2675,16 @@ class ImportPolicyAsPathPrependLastAS(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetAsPathPrepend': {'RepeatN': 5, 'As': "last-as"}}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-as-path-prepend': {'repeat-n': 5, 'as': "last-as"}}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2755,16 +2753,16 @@ class ExportPolicyAsPathPrependLastAS(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.20.0/24'}
+ p0 = {'ip-prefix': '192.168.20.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- st0 = {'Name': 'st0',
- 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {'SetAsPathPrepend': {'RepeatN': 5, 'As': "last-as"}}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': True},
+ 'bgp-actions': {'set-as-path-prepend': {'repeat-n': 5, 'as': "last-as"}}}}
policy = {'name': 'policy0',
'type': 'export',
@@ -2832,14 +2830,14 @@ class ImportPolicyExCommunityOriginCondition(object):
q1 = env.q1
q2 = env.q2
- es0 = {'ExtCommunitySets': {'ExtCommunitySetList': [{'ExtCommunitySetName': 'es0',
- 'ExtCommunity': ['SoO:65001.65100:200']}]}}
+ es0 = {'ext-community-sets': [{'ext-community-set-name': 'es0',
+ 'ext-community-list': ['SoO:65001.65100:200']}]}
g1.set_bgp_defined_set(es0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions':{'match-ext-community-set':{'ext-community-set': 'es0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2884,14 +2882,14 @@ class ImportPolicyExCommunityTargetCondition(object):
q1 = env.q1
q2 = env.q2
- es0 = {'ExtCommunitySets': {'ExtCommunitySetList': [{'ExtCommunitySetName': 'es0',
- 'ExtCommunity': ['RT:6[0-9]+:3[0-9]+']}]}}
+ es0 = {'ext-community-sets': [{'ext-community-set-name': 'es0',
+ 'ext-community-list': ['RT:6[0-9]+:3[0-9]+']}]}
g1.set_bgp_defined_set(es0)
- st0 = {'Name': 'st0',
- 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {'bgp-conditions':{'match-ext-community-set':{'ext-community-set': 'es0'}}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'import',
@@ -2936,16 +2934,16 @@ class InPolicyPrefixCondition(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.10.0/24'}
+ p0 = {'ip-prefix': '192.168.10.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
- st0 = {'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}},
- 'Actions': {'RouteDisposition': {'AcceptRoute': False}}}
+ st0 = {'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}},
+ 'actions': {'route-disposition': {'accept-route': False}}}
policy = {'name': 'policy0',
'type': 'in',
@@ -3004,26 +3002,26 @@ class ImportPolicyExCommunityAdd(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.10.0/24'}
+ p0 = {'ip-prefix': '192.168.10.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
st0 = {
- 'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {
- 'PrefixSet': ps0['PrefixSetName']
+ 'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {
+ 'prefix-set': ps0['prefix-set-name']
}
},
- 'Actions': {
- 'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {
- 'SetExtCommunity': {
- 'Options': 'ADD',
- 'SetExtCommunityMethod': {
- 'Communities': ['rt:65000:1'],
+ 'actions': {
+ 'route-disposition': {'accept-route': True},
+ 'bgp-actions': {
+ 'set-ext-community': {
+ 'options': 'add',
+ 'set-ext-community-method': {
+ 'communities-list': ['rt:65000:1'],
}
},
}
@@ -3085,26 +3083,26 @@ class ImportPolicyExCommunityAdd2(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.10.0/24'}
+ p0 = {'ip-prefix': '192.168.10.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
st0 = {
- 'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {
- 'PrefixSet': ps0['PrefixSetName']
+ 'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {
+ 'prefix-set': ps0['prefix-set-name']
}
},
- 'Actions': {
- 'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {
- 'SetExtCommunity': {
- 'Options': 'ADD',
- 'SetExtCommunityMethod': {
- 'Communities': ['rt:65100:100'],
+ 'actions': {
+ 'route-disposition': {'accept-route': True},
+ 'bgp-actions': {
+ 'set-ext-community': {
+ 'options': 'add',
+ 'set-ext-community-method': {
+ 'communities-list': ['rt:65100:100'],
}
},
}
@@ -3171,26 +3169,26 @@ class ImportPolicyExCommunityMultipleAdd(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.10.0/24'}
+ p0 = {'ip-prefix': '192.168.10.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
st0 = {
- 'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {
- 'PrefixSet': ps0['PrefixSetName']
+ 'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {
+ 'prefix-set': ps0['prefix-set-name']
}
},
- 'Actions': {
- 'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {
- 'SetExtCommunity': {
- 'Options': 'ADD',
- 'SetExtCommunityMethod': {
- 'Communities': ['rt:65100:100', 'rt:100:100'],
+ 'actions': {
+ 'route-disposition': {'accept-route': True},
+ 'bgp-actions': {
+ 'set-ext-community': {
+ 'options': 'add',
+ 'set-ext-community-method': {
+ 'communities-list': ['rt:65100:100', 'rt:100:100'],
}
},
}
@@ -3257,26 +3255,26 @@ class ExportPolicyExCommunityAdd(object):
q1 = env.q1
q2 = env.q2
- p0 = {'IpPrefix': '192.168.10.0/24'}
+ p0 = {'ip-prefix': '192.168.10.0/24'}
- ps0 = {'PrefixSetName': 'ps0',
- 'PrefixList': [p0]}
+ ps0 = {'prefix-set-name': 'ps0',
+ 'prefix-list': [p0]}
g1.set_prefix_set(ps0)
st0 = {
- 'Name': 'st0',
- 'Conditions': {
- 'MatchPrefixSet': {
- 'PrefixSet': ps0['PrefixSetName']
+ 'name': 'st0',
+ 'conditions': {
+ 'match-prefix-set': {
+ 'prefix-set': ps0['prefix-set-name']
}
},
- 'Actions': {
- 'RouteDisposition': {'AcceptRoute': True},
- 'BgpActions': {
- 'SetExtCommunity': {
- 'Options': 'ADD',
- 'SetExtCommunityMethod': {
- 'Communities': ['rt:65000:1'],
+ 'actions': {
+ 'route-disposition': {'accept-route': True},
+ 'bgp-actions': {
+ 'set-ext-community': {
+ 'options': 'add',
+ 'set-ext-community-method': {
+ 'communities-list': ['rt:65000:1'],
}
},
}
diff --git a/tools/config/example_toml.go b/tools/config/example_toml.go
index 50abc3cb..01999f21 100644
--- a/tools/config/example_toml.go
+++ b/tools/config/example_toml.go
@@ -15,44 +15,39 @@ func main() {
RouterId: "10.0.0.1",
},
},
- Neighbors: config.Neighbors{
- NeighborList: []config.Neighbor{
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12333,
- AuthPassword: "apple",
- NeighborAddress: "192.168.177.33",
- },
- AfiSafis: config.AfiSafis{
-
- AfiSafiList: []config.AfiSafi{
- config.AfiSafi{AfiSafiName: "ipv4-unicast"},
- config.AfiSafi{AfiSafiName: "ipv6-unicast"},
- },
- },
- ApplyPolicy: config.ApplyPolicy{
+ Neighbors: []config.Neighbor{
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12333,
+ AuthPassword: "apple",
+ NeighborAddress: "192.168.177.33",
+ },
+ AfiSafis: []config.AfiSafi{
+ config.AfiSafi{AfiSafiName: "ipv4-unicast"},
+ config.AfiSafi{AfiSafiName: "ipv6-unicast"},
+ },
+ ApplyPolicy: config.ApplyPolicy{
- Config: config.ApplyPolicyConfig{
- ImportPolicy: []string{"pd1"},
- DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE,
- },
+ Config: config.ApplyPolicyConfig{
+ ImportPolicyList: []string{"pd1"},
+ DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE,
},
},
+ },
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12334,
- AuthPassword: "orange",
- NeighborAddress: "192.168.177.32",
- },
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12334,
+ AuthPassword: "orange",
+ NeighborAddress: "192.168.177.32",
},
+ },
- config.Neighbor{
- Config: config.NeighborConfig{
- PeerAs: 12335,
- AuthPassword: "grape",
- NeighborAddress: "192.168.177.34",
- },
+ config.Neighbor{
+ Config: config.NeighborConfig{
+ PeerAs: 12335,
+ AuthPassword: "grape",
+ NeighborAddress: "192.168.177.34",
},
},
},
@@ -84,59 +79,34 @@ func policy() config.RoutingPolicy {
}
ns := config.NeighborSet{
- NeighborSetName: "ns1",
- NeighborInfoList: []config.NeighborInfo{
- config.NeighborInfo{
- Address: "10.0.0.2",
- }},
+ NeighborSetName: "ns1",
+ NeighborInfoList: []string{"10.0.0.2"},
}
cs := config.CommunitySet{
CommunitySetName: "community1",
- CommunityList: []config.Community{
- config.Community{Community: "65100:10"},
- },
+ CommunityList: []string{"65100:10"},
}
ecs := config.ExtCommunitySet{
ExtCommunitySetName: "ecommunity1",
- ExtCommunityList: []config.ExtCommunity{
- config.ExtCommunity{ExtCommunity: "RT:65001:200"},
- },
+ ExtCommunityList: []string{"RT:65001:200"},
}
as := config.AsPathSet{
AsPathSetName: "aspath1",
- AsPathList: []config.AsPath{
- config.AsPath{AsPath: "^65100"},
- },
+ AsPathList: []string{"^65100"},
}
bds := config.BgpDefinedSets{
-
- CommunitySets: config.CommunitySets{
- CommunitySetList: []config.CommunitySet{cs},
- },
-
- ExtCommunitySets: config.ExtCommunitySets{
- ExtCommunitySetList: []config.ExtCommunitySet{ecs},
- },
-
- AsPathSets: config.AsPathSets{
- AsPathSetList: []config.AsPathSet{as},
- },
+ CommunitySets: []config.CommunitySet{cs},
+ ExtCommunitySets: []config.ExtCommunitySet{ecs},
+ AsPathSets: []config.AsPathSet{as},
}
ds := config.DefinedSets{
-
- PrefixSets: config.PrefixSets{
- PrefixSetList: []config.PrefixSet{ps},
- },
-
- NeighborSets: config.NeighborSets{
- NeighborSetList: []config.NeighborSet{ns},
- },
-
+ PrefixSets: []config.PrefixSet{ps},
+ NeighborSets: []config.NeighborSet{ns},
BgpDefinedSets: bds,
}
@@ -185,7 +155,7 @@ func policy() config.RoutingPolicy {
BgpActions: config.BgpActions{
SetCommunity: config.SetCommunity{
SetCommunityMethod: config.SetCommunityMethod{
- Communities: []string{"65100:20"},
+ CommunitiesList: []string{"65100:20"},
},
Options: "ADD",
},
@@ -195,17 +165,13 @@ func policy() config.RoutingPolicy {
}
pd := config.PolicyDefinition{
- Name: "pd1",
- Statements: config.Statements{
- StatementList: []config.Statement{s},
- },
+ Name: "pd1",
+ Statements: []config.Statement{s},
}
p := config.RoutingPolicy{
- DefinedSets: ds,
- PolicyDefinitions: config.PolicyDefinitions{
- PolicyDefinitionList: []config.PolicyDefinition{pd},
- },
+ DefinedSets: ds,
+ PolicyDefinitions: []config.PolicyDefinition{pd},
}
return p
diff --git a/tools/pyang_plugins/README.rst b/tools/pyang_plugins/README.rst
index b7dcf7ab..fae7c71e 100644
--- a/tools/pyang_plugins/README.rst
+++ b/tools/pyang_plugins/README.rst
@@ -1,7 +1,7 @@
What's this ?
=============
This is a pyang plugin to generate config/bgp_configs.go from
-openconfig yang files (see [https://github.com/openconfig/public](https://github.com/openconfig/public))
+openconfig yang files (see https://github.com/openconfig/public).
How to use
==========
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py
index 5c06a154..cc2b81f2 100644
--- a/tools/pyang_plugins/bgpyang2golang.py
+++ b/tools/pyang_plugins/bgpyang2golang.py
@@ -128,6 +128,10 @@ def dig_leafref(type_obj):
def emit_class_def(ctx, yang_statement, struct_name, prefix):
o = StringIO.StringIO()
+
+ if len(yang_statement.i_children) == 1 and is_list(yang_statement.i_children[0]):
+ return
+
print >> o, '//struct for container %s:%s' % (prefix, yang_statement.arg)
print >> o, 'type %s struct {' % convert_to_golang(struct_name)
for child in yang_statement.i_children:
@@ -138,6 +142,7 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
container_or_list_name = child.uniq_name
val_name_go = convert_to_golang(child.arg)
child_prefix = get_orig_prefix(child.i_orig_module)
+ tag_name = child.uniq_name.lower()
print >> o, ' // original -> %s:%s' % \
(child_prefix, container_or_list_name)
@@ -197,7 +202,7 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
# case translation required
elif is_translation_required(type_obj):
- print >> o, ' //original type is list of %s' % (type_obj.arg)
+ print >> o, ' // original type is list of %s' % (type_obj.arg)
emit_type_name = '[]'+translate_type(type_name)
# case other primitives
@@ -214,24 +219,30 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
elif is_container(child) or is_choice(child):
key = child_prefix+':'+container_or_list_name
t = ctx.golang_struct_names[key]
- emit_type_name = t.golang_name
+ val_name_go = t.golang_name
+ if len(t.i_children) == 1 and is_list(t.i_children[0]):
+ l = t.i_children[0]
+ emit_type_name = '[]' + l.golang_name
+ else:
+ emit_type_name = t.golang_name
# case list
elif is_list(child):
key = child_prefix+':'+container_or_list_name
t = ctx.golang_struct_names[key]
val_name_go = val_name_go + 'List'
+ tag_name += '-list'
emit_type_name = '[]' + t.golang_name
if is_container(child):
name = emit_type_name
if name.startswith(convert_to_golang(struct_name)) and name.endswith("Config"):
- name = 'Config'
+ tag_name = 'config'
+ val_name_go = 'Config'
elif name.startswith(convert_to_golang(struct_name)) and name.endswith("State"):
- name = 'State'
- print >> o, ' %s\t%s' % (name, emit_type_name)
- else:
- print >> o, ' %s\t%s' % (val_name_go, emit_type_name)
+ tag_name = 'state'
+ val_name_go = 'State'
+ print >> o, ' {0}\t{1} `mapstructure:"{2}"`'.format(val_name_go, emit_type_name, tag_name)
print >> o, '}'
print o.getvalue()
diff --git a/tools/route-server/quagga-rsconfig.go b/tools/route-server/quagga-rsconfig.go
index b104af8a..efd17cb3 100644
--- a/tools/route-server/quagga-rsconfig.go
+++ b/tools/route-server/quagga-rsconfig.go
@@ -57,7 +57,7 @@ func create_config_files(nr int, outputDir string) {
c.Config.NeighborAddress = fmt.Sprintf("10.0.0.%d", i)
c.Config.AuthPassword = fmt.Sprintf("hoge%d", i)
- gobgpConf.Neighbors.NeighborList = append(gobgpConf.Neighbors.NeighborList, c)
+ gobgpConf.Neighbors = append(gobgpConf.Neighbors, c)
q := NewQuaggaConfig(i, &gobgpConf.Global, &c, net.ParseIP("10.0.255.1"))
quaggaConfigList = append(quaggaConfigList, q)
os.Mkdir(fmt.Sprintf("%s/q%d", outputDir, i), 0755)