diff options
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r-- | config/bgp_configs.go | 2736 |
1 files changed, 2691 insertions, 45 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index d5eb930d..63389547 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -633,51 +633,6 @@ func (v DefaultPolicyType) Validate() error { return nil } -// typedef for typedef bgp-pol:bgp-next-hop-type -type BgpNextHopType string - -// typedef for typedef bgp-pol:bgp-as-path-prepend-repeat -type BgpAsPathPrependRepeat uint8 - -// typedef for typedef bgp-pol:bgp-set-med-type -type BgpSetMedType string - -// typedef for identity bgp-pol:bgp-set-community-option-type -type BgpSetCommunityOptionType string - -const ( - BGP_SET_COMMUNITY_OPTION_TYPE_ADD BgpSetCommunityOptionType = "add" - BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE BgpSetCommunityOptionType = "remove" - BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE BgpSetCommunityOptionType = "replace" -) - -var BgpSetCommunityOptionTypeToIntMap = map[BgpSetCommunityOptionType]int{ - BGP_SET_COMMUNITY_OPTION_TYPE_ADD: 0, - BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: 1, - BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: 2, -} - -func (v BgpSetCommunityOptionType) ToInt() int { - i, ok := BgpSetCommunityOptionTypeToIntMap[v] - if !ok { - return -1 - } - return i -} - -var IntToBgpSetCommunityOptionTypeMap = map[int]BgpSetCommunityOptionType{ - 0: BGP_SET_COMMUNITY_OPTION_TYPE_ADD, - 1: BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, - 2: BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, -} - -func (v BgpSetCommunityOptionType) Validate() error { - if _, ok := BgpSetCommunityOptionTypeToIntMap[v]; !ok { - return fmt.Errorf("invalid BgpSetCommunityOptionType: %s", v) - } - return nil -} - // typedef for identity bgp:session-state type SessionState string @@ -759,6 +714,51 @@ func (v Mode) Validate() error { return nil } +// typedef for typedef bgp-pol:bgp-next-hop-type +type BgpNextHopType string + +// typedef for typedef bgp-pol:bgp-as-path-prepend-repeat +type BgpAsPathPrependRepeat uint8 + +// typedef for typedef bgp-pol:bgp-set-med-type +type BgpSetMedType string + +// typedef for identity bgp-pol:bgp-set-community-option-type +type BgpSetCommunityOptionType string + +const ( + BGP_SET_COMMUNITY_OPTION_TYPE_ADD BgpSetCommunityOptionType = "add" + BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE BgpSetCommunityOptionType = "remove" + BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE BgpSetCommunityOptionType = "replace" +) + +var BgpSetCommunityOptionTypeToIntMap = map[BgpSetCommunityOptionType]int{ + BGP_SET_COMMUNITY_OPTION_TYPE_ADD: 0, + BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: 1, + BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: 2, +} + +func (v BgpSetCommunityOptionType) ToInt() int { + i, ok := BgpSetCommunityOptionTypeToIntMap[v] + if !ok { + return -1 + } + return i +} + +var IntToBgpSetCommunityOptionTypeMap = map[int]BgpSetCommunityOptionType{ + 0: BGP_SET_COMMUNITY_OPTION_TYPE_ADD, + 1: BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, + 2: BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, +} + +func (v BgpSetCommunityOptionType) Validate() error { + if _, ok := BgpSetCommunityOptionTypeToIntMap[v]; !ok { + return fmt.Errorf("invalid BgpSetCommunityOptionType: %s", v) + } + return nil +} + // typedef for identity gobgp:bmp-route-monitoring-policy-type type BmpRouteMonitoringPolicyType string @@ -877,10 +877,33 @@ type Mrt struct { Interval uint64 `mapstructure:"interval"` } +func (lhs *Mrt) Equal(rhs *Mrt) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.DumpType != rhs.DumpType { + return false + } + if lhs.FileName != rhs.FileName { + return false + } + if lhs.Interval != rhs.Interval { + return false + } + return true +} + //struct for container gobgp:state type BmpServerState struct { } +func (lhs *BmpServerState) Equal(rhs *BmpServerState) bool { + if lhs == nil || rhs == nil { + return false + } + return true +} + //struct for container gobgp:config type BmpServerConfig struct { // original -> gobgp:address @@ -892,6 +915,22 @@ type BmpServerConfig struct { RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy"` } +func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Address != rhs.Address { + return false + } + if lhs.Port != rhs.Port { + return false + } + if lhs.RouteMonitoringPolicy != rhs.RouteMonitoringPolicy { + return false + } + return true +} + //struct for container gobgp:bmp-server type BmpServer struct { // original -> gobgp:address @@ -903,6 +942,22 @@ type BmpServer struct { State BmpServerState `mapstructure:"state"` } +func (lhs *BmpServer) Equal(rhs *BmpServer) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Address != rhs.Address { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container gobgp:rpki-received type RpkiReceived struct { // original -> gobgp:serial-notify @@ -921,6 +976,34 @@ type RpkiReceived struct { Error int64 `mapstructure:"error"` } +func (lhs *RpkiReceived) Equal(rhs *RpkiReceived) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SerialNotify != rhs.SerialNotify { + return false + } + if lhs.CacheReset != rhs.CacheReset { + return false + } + if lhs.CacheResponse != rhs.CacheResponse { + return false + } + if lhs.Ipv4Prefix != rhs.Ipv4Prefix { + return false + } + if lhs.Ipv6Prefix != rhs.Ipv6Prefix { + return false + } + if lhs.EndOfData != rhs.EndOfData { + return false + } + if lhs.Error != rhs.Error { + return false + } + return true +} + //struct for container gobgp:rpki-sent type RpkiSent struct { // original -> gobgp:serial-query @@ -931,6 +1014,22 @@ type RpkiSent struct { Error int64 `mapstructure:"error"` } +func (lhs *RpkiSent) Equal(rhs *RpkiSent) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SerialQuery != rhs.SerialQuery { + return false + } + if lhs.ResetQuery != rhs.ResetQuery { + return false + } + if lhs.Error != rhs.Error { + return false + } + return true +} + //struct for container gobgp:rpki-messages type RpkiMessages struct { // original -> gobgp:rpki-sent @@ -939,6 +1038,19 @@ type RpkiMessages struct { RpkiReceived RpkiReceived `mapstructure:"rpki-received"` } +func (lhs *RpkiMessages) Equal(rhs *RpkiMessages) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.RpkiSent.Equal(&(rhs.RpkiSent)) { + return false + } + if !lhs.RpkiReceived.Equal(&(rhs.RpkiReceived)) { + return false + } + return true +} + //struct for container gobgp:state type RpkiServerState struct { // original -> gobgp:uptime @@ -951,6 +1063,25 @@ type RpkiServerState struct { RpkiMessages RpkiMessages `mapstructure:"rpki-messages"` } +func (lhs *RpkiServerState) Equal(rhs *RpkiServerState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Uptime != rhs.Uptime { + return false + } + if lhs.Downtime != rhs.Downtime { + return false + } + if lhs.LastPduRecvTime != rhs.LastPduRecvTime { + return false + } + if !lhs.RpkiMessages.Equal(&(rhs.RpkiMessages)) { + return false + } + return true +} + //struct for container gobgp:config type RpkiServerConfig struct { // original -> gobgp:address @@ -968,6 +1099,31 @@ type RpkiServerConfig struct { Preference uint8 `mapstructure:"preference"` } +func (lhs *RpkiServerConfig) Equal(rhs *RpkiServerConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Address != rhs.Address { + return false + } + if lhs.Port != rhs.Port { + return false + } + if lhs.RefreshTime != rhs.RefreshTime { + return false + } + if lhs.HoldTime != rhs.HoldTime { + return false + } + if lhs.RecordLifetime != rhs.RecordLifetime { + return false + } + if lhs.Preference != rhs.Preference { + return false + } + return true +} + //struct for container gobgp:rpki-server type RpkiServer struct { // original -> gobgp:address @@ -979,6 +1135,22 @@ type RpkiServer struct { State RpkiServerState `mapstructure:"state"` } +func (lhs *RpkiServer) Equal(rhs *RpkiServer) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Address != rhs.Address { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type PeerGroupState struct { // original -> bgp:peer-as @@ -1008,6 +1180,46 @@ type PeerGroupState struct { TotalPrefixes uint32 `mapstructure:"total-prefixes"` } +func (lhs *PeerGroupState) Equal(rhs *PeerGroupState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PeerAs != rhs.PeerAs { + return false + } + if lhs.LocalAs != rhs.LocalAs { + return false + } + if lhs.PeerType != rhs.PeerType { + return false + } + if lhs.AuthPassword != rhs.AuthPassword { + return false + } + if lhs.RemovePrivateAs != rhs.RemovePrivateAs { + return false + } + if lhs.RouteFlapDamping != rhs.RouteFlapDamping { + return false + } + if lhs.SendCommunity != rhs.SendCommunity { + return false + } + if lhs.Description != rhs.Description { + return false + } + if lhs.PeerGroupName != rhs.PeerGroupName { + return false + } + if lhs.TotalPaths != rhs.TotalPaths { + return false + } + if lhs.TotalPrefixes != rhs.TotalPrefixes { + return false + } + return true +} + //struct for container bgp:config type PeerGroupConfig struct { // original -> bgp:peer-as @@ -1033,6 +1245,40 @@ type PeerGroupConfig struct { PeerGroupName string `mapstructure:"peer-group-name"` } +func (lhs *PeerGroupConfig) Equal(rhs *PeerGroupConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PeerAs != rhs.PeerAs { + return false + } + if lhs.LocalAs != rhs.LocalAs { + return false + } + if lhs.PeerType != rhs.PeerType { + return false + } + if lhs.AuthPassword != rhs.AuthPassword { + return false + } + if lhs.RemovePrivateAs != rhs.RemovePrivateAs { + return false + } + if lhs.RouteFlapDamping != rhs.RouteFlapDamping { + return false + } + if lhs.SendCommunity != rhs.SendCommunity { + return false + } + if lhs.Description != rhs.Description { + return false + } + if lhs.PeerGroupName != rhs.PeerGroupName { + return false + } + return true +} + //struct for container bgp:peer-group type PeerGroup struct { // original -> bgp:peer-group-name @@ -1069,6 +1315,74 @@ type PeerGroup struct { RouteServer RouteServer `mapstructure:"route-server"` } +func (lhs *PeerGroup) Equal(rhs *PeerGroup) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PeerGroupName != rhs.PeerGroupName { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + if !lhs.Timers.Equal(&(rhs.Timers)) { + return false + } + if !lhs.Transport.Equal(&(rhs.Transport)) { + return false + } + if !lhs.ErrorHandling.Equal(&(rhs.ErrorHandling)) { + return false + } + if !lhs.LoggingOptions.Equal(&(rhs.LoggingOptions)) { + return false + } + if !lhs.EbgpMultihop.Equal(&(rhs.EbgpMultihop)) { + return false + } + if !lhs.RouteReflector.Equal(&(rhs.RouteReflector)) { + return false + } + if !lhs.AsPathOptions.Equal(&(rhs.AsPathOptions)) { + return false + } + if !lhs.AddPaths.Equal(&(rhs.AddPaths)) { + return false + } + if len(lhs.AfiSafis) != len(rhs.AfiSafis) { + return false + } + { + lmap := make(map[string]*AfiSafi) + for _, l := range lhs.AfiSafis { + lmap[string(l.AfiSafiName)] = &l + } + for _, r := range rhs.AfiSafis { + if l, y := lmap[string(r.AfiSafiName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { + return false + } + if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { + return false + } + if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { + return false + } + if !lhs.RouteServer.Equal(&(rhs.RouteServer)) { + return false + } + return true +} + //struct for container gobgp:state type RouteServerState struct { // original -> gobgp:route-server-client @@ -1076,6 +1390,16 @@ type RouteServerState struct { RouteServerClient bool `mapstructure:"route-server-client"` } +func (lhs *RouteServerState) Equal(rhs *RouteServerState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.RouteServerClient != rhs.RouteServerClient { + return false + } + return true +} + //struct for container gobgp:config type RouteServerConfig struct { // original -> gobgp:route-server-client @@ -1083,6 +1407,16 @@ type RouteServerConfig struct { RouteServerClient bool `mapstructure:"route-server-client"` } +func (lhs *RouteServerConfig) Equal(rhs *RouteServerConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.RouteServerClient != rhs.RouteServerClient { + return false + } + return true +} + //struct for container gobgp:route-server type RouteServer struct { // original -> gobgp:route-server-config @@ -1091,6 +1425,19 @@ type RouteServer struct { State RouteServerState `mapstructure:"state"` } +func (lhs *RouteServer) Equal(rhs *RouteServer) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-op:prefixes type Prefixes struct { // original -> bgp-op:received @@ -1101,6 +1448,22 @@ type Prefixes struct { Installed uint32 `mapstructure:"installed"` } +func (lhs *Prefixes) Equal(rhs *Prefixes) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Received != rhs.Received { + return false + } + if lhs.Sent != rhs.Sent { + return false + } + if lhs.Installed != rhs.Installed { + return false + } + return true +} + //struct for container bgp:state type AddPathsState struct { // original -> bgp:receive @@ -1110,6 +1473,19 @@ type AddPathsState struct { SendMax uint8 `mapstructure:"send-max"` } +func (lhs *AddPathsState) Equal(rhs *AddPathsState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Receive != rhs.Receive { + return false + } + if lhs.SendMax != rhs.SendMax { + return false + } + return true +} + //struct for container bgp:config type AddPathsConfig struct { // original -> bgp:receive @@ -1119,6 +1495,19 @@ type AddPathsConfig struct { SendMax uint8 `mapstructure:"send-max"` } +func (lhs *AddPathsConfig) Equal(rhs *AddPathsConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Receive != rhs.Receive { + return false + } + if lhs.SendMax != rhs.SendMax { + return false + } + return true +} + //struct for container bgp:add-paths type AddPaths struct { // original -> bgp:add-paths-config @@ -1127,6 +1516,19 @@ type AddPaths struct { State AddPathsState `mapstructure:"state"` } +func (lhs *AddPaths) Equal(rhs *AddPaths) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type AsPathOptionsState struct { // original -> bgp:allow-own-as @@ -1136,6 +1538,19 @@ type AsPathOptionsState struct { ReplacePeerAs bool `mapstructure:"replace-peer-as"` } +func (lhs *AsPathOptionsState) Equal(rhs *AsPathOptionsState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AllowOwnAs != rhs.AllowOwnAs { + return false + } + if lhs.ReplacePeerAs != rhs.ReplacePeerAs { + return false + } + return true +} + //struct for container bgp:config type AsPathOptionsConfig struct { // original -> bgp:allow-own-as @@ -1145,6 +1560,19 @@ type AsPathOptionsConfig struct { ReplacePeerAs bool `mapstructure:"replace-peer-as"` } +func (lhs *AsPathOptionsConfig) Equal(rhs *AsPathOptionsConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AllowOwnAs != rhs.AllowOwnAs { + return false + } + if lhs.ReplacePeerAs != rhs.ReplacePeerAs { + return false + } + return true +} + //struct for container bgp:as-path-options type AsPathOptions struct { // original -> bgp:as-path-options-config @@ -1153,6 +1581,19 @@ type AsPathOptions struct { State AsPathOptionsState `mapstructure:"state"` } +func (lhs *AsPathOptions) Equal(rhs *AsPathOptions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type RouteReflectorState struct { // original -> bgp:route-reflector-cluster-id @@ -1162,6 +1603,19 @@ type RouteReflectorState struct { RouteReflectorClient bool `mapstructure:"route-reflector-client"` } +func (lhs *RouteReflectorState) Equal(rhs *RouteReflectorState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.RouteReflectorClusterId != rhs.RouteReflectorClusterId { + return false + } + if lhs.RouteReflectorClient != rhs.RouteReflectorClient { + return false + } + return true +} + //struct for container bgp:config type RouteReflectorConfig struct { // original -> bgp:route-reflector-cluster-id @@ -1171,6 +1625,19 @@ type RouteReflectorConfig struct { RouteReflectorClient bool `mapstructure:"route-reflector-client"` } +func (lhs *RouteReflectorConfig) Equal(rhs *RouteReflectorConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.RouteReflectorClusterId != rhs.RouteReflectorClusterId { + return false + } + if lhs.RouteReflectorClient != rhs.RouteReflectorClient { + return false + } + return true +} + //struct for container bgp:route-reflector type RouteReflector struct { // original -> bgp:route-reflector-config @@ -1179,6 +1646,19 @@ type RouteReflector struct { State RouteReflectorState `mapstructure:"state"` } +func (lhs *RouteReflector) Equal(rhs *RouteReflector) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type EbgpMultihopState struct { // original -> bgp:enabled @@ -1188,6 +1668,19 @@ type EbgpMultihopState struct { MultihopTtl uint8 `mapstructure:"multihop-ttl"` } +func (lhs *EbgpMultihopState) Equal(rhs *EbgpMultihopState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.MultihopTtl != rhs.MultihopTtl { + return false + } + return true +} + //struct for container bgp:config type EbgpMultihopConfig struct { // original -> bgp:enabled @@ -1197,6 +1690,19 @@ type EbgpMultihopConfig struct { MultihopTtl uint8 `mapstructure:"multihop-ttl"` } +func (lhs *EbgpMultihopConfig) Equal(rhs *EbgpMultihopConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.MultihopTtl != rhs.MultihopTtl { + return false + } + return true +} + //struct for container bgp:ebgp-multihop type EbgpMultihop struct { // original -> bgp:ebgp-multihop-config @@ -1205,6 +1711,19 @@ type EbgpMultihop struct { State EbgpMultihopState `mapstructure:"state"` } +func (lhs *EbgpMultihop) Equal(rhs *EbgpMultihop) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type LoggingOptionsState struct { // original -> bgp:log-neighbor-state-changes @@ -1212,6 +1731,16 @@ type LoggingOptionsState struct { LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes"` } +func (lhs *LoggingOptionsState) Equal(rhs *LoggingOptionsState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.LogNeighborStateChanges != rhs.LogNeighborStateChanges { + return false + } + return true +} + //struct for container bgp:config type LoggingOptionsConfig struct { // original -> bgp:log-neighbor-state-changes @@ -1219,6 +1748,16 @@ type LoggingOptionsConfig struct { LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes"` } +func (lhs *LoggingOptionsConfig) Equal(rhs *LoggingOptionsConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.LogNeighborStateChanges != rhs.LogNeighborStateChanges { + return false + } + return true +} + //struct for container bgp:logging-options type LoggingOptions struct { // original -> bgp:logging-options-config @@ -1227,6 +1766,19 @@ type LoggingOptions struct { State LoggingOptionsState `mapstructure:"state"` } +func (lhs *LoggingOptions) Equal(rhs *LoggingOptions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type ErrorHandlingState struct { // original -> bgp:treat-as-withdraw @@ -1236,6 +1788,19 @@ type ErrorHandlingState struct { ErroneousUpdateMessages uint32 `mapstructure:"erroneous-update-messages"` } +func (lhs *ErrorHandlingState) Equal(rhs *ErrorHandlingState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TreatAsWithdraw != rhs.TreatAsWithdraw { + return false + } + if lhs.ErroneousUpdateMessages != rhs.ErroneousUpdateMessages { + return false + } + return true +} + //struct for container bgp:config type ErrorHandlingConfig struct { // original -> bgp:treat-as-withdraw @@ -1243,6 +1808,16 @@ type ErrorHandlingConfig struct { TreatAsWithdraw bool `mapstructure:"treat-as-withdraw"` } +func (lhs *ErrorHandlingConfig) Equal(rhs *ErrorHandlingConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TreatAsWithdraw != rhs.TreatAsWithdraw { + return false + } + return true +} + //struct for container bgp:error-handling type ErrorHandling struct { // original -> bgp:error-handling-config @@ -1251,6 +1826,19 @@ type ErrorHandling struct { State ErrorHandlingState `mapstructure:"state"` } +func (lhs *ErrorHandling) Equal(rhs *ErrorHandling) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type TransportState struct { // original -> bgp:tcp-mss @@ -1275,6 +1863,34 @@ type TransportState struct { RemotePort uint16 `mapstructure:"remote-port"` } +func (lhs *TransportState) Equal(rhs *TransportState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TcpMss != rhs.TcpMss { + return false + } + if lhs.MtuDiscovery != rhs.MtuDiscovery { + return false + } + if lhs.PassiveMode != rhs.PassiveMode { + return false + } + if lhs.LocalAddress != rhs.LocalAddress { + return false + } + if lhs.LocalPort != rhs.LocalPort { + return false + } + if lhs.RemoteAddress != rhs.RemoteAddress { + return false + } + if lhs.RemotePort != rhs.RemotePort { + return false + } + return true +} + //struct for container bgp:config type TransportConfig struct { // original -> bgp:tcp-mss @@ -1290,6 +1906,25 @@ type TransportConfig struct { LocalAddress string `mapstructure:"local-address"` } +func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TcpMss != rhs.TcpMss { + return false + } + if lhs.MtuDiscovery != rhs.MtuDiscovery { + return false + } + if lhs.PassiveMode != rhs.PassiveMode { + return false + } + if lhs.LocalAddress != rhs.LocalAddress { + return false + } + return true +} + //struct for container bgp:transport type Transport struct { // original -> bgp:transport-config @@ -1298,6 +1933,19 @@ type Transport struct { State TransportState `mapstructure:"state"` } +func (lhs *Transport) Equal(rhs *Transport) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type TimersState struct { // original -> bgp:connect-retry @@ -1328,6 +1976,40 @@ type TimersState struct { UpdateRecvTime int64 `mapstructure:"update-recv-time"` } +func (lhs *TimersState) Equal(rhs *TimersState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ConnectRetry != rhs.ConnectRetry { + return false + } + if lhs.HoldTime != rhs.HoldTime { + return false + } + if lhs.KeepaliveInterval != rhs.KeepaliveInterval { + return false + } + if lhs.MinimumAdvertisementInterval != rhs.MinimumAdvertisementInterval { + return false + } + if lhs.Uptime != rhs.Uptime { + return false + } + if lhs.NegotiatedHoldTime != rhs.NegotiatedHoldTime { + return false + } + if lhs.IdleHoldTimeAfterReset != rhs.IdleHoldTimeAfterReset { + return false + } + if lhs.Downtime != rhs.Downtime { + return false + } + if lhs.UpdateRecvTime != rhs.UpdateRecvTime { + return false + } + return true +} + //struct for container bgp:config type TimersConfig struct { // original -> bgp:connect-retry @@ -1347,6 +2029,28 @@ type TimersConfig struct { IdleHoldTimeAfterReset float64 `mapstructure:"idle-hold-time-after-reset"` } +func (lhs *TimersConfig) Equal(rhs *TimersConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ConnectRetry != rhs.ConnectRetry { + return false + } + if lhs.HoldTime != rhs.HoldTime { + return false + } + if lhs.KeepaliveInterval != rhs.KeepaliveInterval { + return false + } + if lhs.MinimumAdvertisementInterval != rhs.MinimumAdvertisementInterval { + return false + } + if lhs.IdleHoldTimeAfterReset != rhs.IdleHoldTimeAfterReset { + return false + } + return true +} + //struct for container bgp:timers type Timers struct { // original -> bgp:timers-config @@ -1355,6 +2059,19 @@ type Timers struct { State TimersState `mapstructure:"state"` } +func (lhs *Timers) Equal(rhs *Timers) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:queues type Queues struct { // original -> bgp-op:input @@ -1363,6 +2080,19 @@ type Queues struct { Output uint32 `mapstructure:"output"` } +func (lhs *Queues) Equal(rhs *Queues) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Input != rhs.Input { + return false + } + if lhs.Output != rhs.Output { + return false + } + return true +} + //struct for container bgp:received type Received struct { // original -> bgp-op:UPDATE @@ -1383,6 +2113,37 @@ type Received struct { Total uint64 `mapstructure:"total"` } +func (lhs *Received) Equal(rhs *Received) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Update != rhs.Update { + return false + } + if lhs.Notification != rhs.Notification { + return false + } + if lhs.Open != rhs.Open { + return false + } + if lhs.Refresh != rhs.Refresh { + return false + } + if lhs.Keepalive != rhs.Keepalive { + return false + } + if lhs.DynamicCap != rhs.DynamicCap { + return false + } + if lhs.Discarded != rhs.Discarded { + return false + } + if lhs.Total != rhs.Total { + return false + } + return true +} + //struct for container bgp:sent type Sent struct { // original -> bgp-op:UPDATE @@ -1403,6 +2164,37 @@ type Sent struct { Total uint64 `mapstructure:"total"` } +func (lhs *Sent) Equal(rhs *Sent) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Update != rhs.Update { + return false + } + if lhs.Notification != rhs.Notification { + return false + } + if lhs.Open != rhs.Open { + return false + } + if lhs.Refresh != rhs.Refresh { + return false + } + if lhs.Keepalive != rhs.Keepalive { + return false + } + if lhs.DynamicCap != rhs.DynamicCap { + return false + } + if lhs.Discarded != rhs.Discarded { + return false + } + if lhs.Total != rhs.Total { + return false + } + return true +} + //struct for container bgp:messages type Messages struct { // original -> bgp:sent @@ -1411,6 +2203,19 @@ type Messages struct { Received Received `mapstructure:"received"` } +func (lhs *Messages) Equal(rhs *Messages) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Sent.Equal(&(rhs.Sent)) { + return false + } + if !lhs.Received.Equal(&(rhs.Received)) { + return false + } + return true +} + //struct for container bgp:state type NeighborState struct { // original -> bgp:peer-as @@ -1454,6 +2259,69 @@ type NeighborState struct { Flops uint32 `mapstructure:"flops"` } +func (lhs *NeighborState) Equal(rhs *NeighborState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PeerAs != rhs.PeerAs { + return false + } + if lhs.LocalAs != rhs.LocalAs { + return false + } + if lhs.PeerType != rhs.PeerType { + return false + } + if lhs.AuthPassword != rhs.AuthPassword { + return false + } + if lhs.RemovePrivateAs != rhs.RemovePrivateAs { + return false + } + if lhs.RouteFlapDamping != rhs.RouteFlapDamping { + return false + } + if lhs.SendCommunity != rhs.SendCommunity { + return false + } + if lhs.Description != rhs.Description { + return false + } + if lhs.PeerGroup != rhs.PeerGroup { + return false + } + if lhs.NeighborAddress != rhs.NeighborAddress { + return false + } + if lhs.SessionState != rhs.SessionState { + return false + } + if len(lhs.SupportedCapabilitiesList) != len(rhs.SupportedCapabilitiesList) { + return false + } + for idx, l := range lhs.SupportedCapabilitiesList { + if l != rhs.SupportedCapabilitiesList[idx] { + return false + } + } + if !lhs.Messages.Equal(&(rhs.Messages)) { + return false + } + if !lhs.Queues.Equal(&(rhs.Queues)) { + return false + } + if lhs.AdminDown != rhs.AdminDown { + return false + } + if lhs.EstablishedCount != rhs.EstablishedCount { + return false + } + if lhs.Flops != rhs.Flops { + return false + } + return true +} + //struct for container bgp:config type NeighborConfig struct { // original -> bgp:peer-as @@ -1485,6 +2353,46 @@ type NeighborConfig struct { NeighborPortNumber uint16 `mapstructure:"neighbor-port-number"` } +func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PeerAs != rhs.PeerAs { + return false + } + if lhs.LocalAs != rhs.LocalAs { + return false + } + if lhs.PeerType != rhs.PeerType { + return false + } + if lhs.AuthPassword != rhs.AuthPassword { + return false + } + if lhs.RemovePrivateAs != rhs.RemovePrivateAs { + return false + } + if lhs.RouteFlapDamping != rhs.RouteFlapDamping { + return false + } + if lhs.SendCommunity != rhs.SendCommunity { + return false + } + if lhs.Description != rhs.Description { + return false + } + if lhs.PeerGroup != rhs.PeerGroup { + return false + } + if lhs.NeighborAddress != rhs.NeighborAddress { + return false + } + if lhs.NeighborPortNumber != rhs.NeighborPortNumber { + return false + } + return true +} + //struct for container bgp:neighbor type Neighbor struct { // original -> bgp:neighbor-address @@ -1522,6 +2430,74 @@ type Neighbor struct { RouteServer RouteServer `mapstructure:"route-server"` } +func (lhs *Neighbor) Equal(rhs *Neighbor) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.NeighborAddress != rhs.NeighborAddress { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + if !lhs.Timers.Equal(&(rhs.Timers)) { + return false + } + if !lhs.Transport.Equal(&(rhs.Transport)) { + return false + } + if !lhs.ErrorHandling.Equal(&(rhs.ErrorHandling)) { + return false + } + if !lhs.LoggingOptions.Equal(&(rhs.LoggingOptions)) { + return false + } + if !lhs.EbgpMultihop.Equal(&(rhs.EbgpMultihop)) { + return false + } + if !lhs.RouteReflector.Equal(&(rhs.RouteReflector)) { + return false + } + if !lhs.AsPathOptions.Equal(&(rhs.AsPathOptions)) { + return false + } + if !lhs.AddPaths.Equal(&(rhs.AddPaths)) { + return false + } + if len(lhs.AfiSafis) != len(rhs.AfiSafis) { + return false + } + { + lmap := make(map[string]*AfiSafi) + for _, l := range lhs.AfiSafis { + lmap[string(l.AfiSafiName)] = &l + } + for _, r := range rhs.AfiSafis { + if l, y := lmap[string(r.AfiSafiName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { + return false + } + if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { + return false + } + if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { + return false + } + if !lhs.RouteServer.Equal(&(rhs.RouteServer)) { + return false + } + return true +} + //struct for container gobgp:listen-config type ListenConfig struct { // original -> gobgp:port @@ -1530,6 +2506,24 @@ type ListenConfig struct { LocalAddressList []string `mapstructure:"local-address-list"` } +func (lhs *ListenConfig) Equal(rhs *ListenConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Port != rhs.Port { + return false + } + if len(lhs.LocalAddressList) != len(rhs.LocalAddressList) { + return false + } + for idx, l := range lhs.LocalAddressList { + if l != rhs.LocalAddressList[idx] { + return false + } + } + return true +} + //struct for container gobgp:mpls-label-range type MplsLabelRange struct { // original -> gobgp:min-label @@ -1538,6 +2532,19 @@ type MplsLabelRange struct { MaxLabel uint32 `mapstructure:"max-label"` } +func (lhs *MplsLabelRange) Equal(rhs *MplsLabelRange) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.MinLabel != rhs.MinLabel { + return false + } + if lhs.MaxLabel != rhs.MaxLabel { + return false + } + return true +} + //struct for container gobgp:zebra type Zebra struct { // original -> gobgp:enabled @@ -1549,6 +2556,27 @@ type Zebra struct { RedistributeRouteTypeList []InstallProtocolType `mapstructure:"redistribute-route-type-list"` } +func (lhs *Zebra) Equal(rhs *Zebra) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.Url != rhs.Url { + return false + } + if len(lhs.RedistributeRouteTypeList) != len(rhs.RedistributeRouteTypeList) { + return false + } + for idx, l := range lhs.RedistributeRouteTypeList { + if l != rhs.RedistributeRouteTypeList[idx] { + return false + } + } + return true +} + //struct for container gobgp:collector type Collector struct { // original -> gobgp:enabled @@ -1556,54 +2584,144 @@ type Collector struct { Enabled bool `mapstructure:"enabled"` } +func (lhs *Collector) Equal(rhs *Collector) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + return true +} + //struct for container bgp-mp:l2vpn-evpn type L2vpnEvpn struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L2vpnEvpn) Equal(rhs *L2vpnEvpn) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:l2vpn-vpls type L2vpnVpls struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L2vpnVpls) Equal(rhs *L2vpnVpls) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:l3vpn-ipv6-multicast type L3vpnIpv6Multicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L3vpnIpv6Multicast) Equal(rhs *L3vpnIpv6Multicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:l3vpn-ipv4-multicast type L3vpnIpv4Multicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L3vpnIpv4Multicast) Equal(rhs *L3vpnIpv4Multicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:l3vpn-ipv6-unicast type L3vpnIpv6Unicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L3vpnIpv6Unicast) Equal(rhs *L3vpnIpv6Unicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:l3vpn-ipv4-unicast type L3vpnIpv4Unicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *L3vpnIpv4Unicast) Equal(rhs *L3vpnIpv4Unicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:ipv6-labelled-unicast type Ipv6LabelledUnicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *Ipv6LabelledUnicast) Equal(rhs *Ipv6LabelledUnicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:ipv4-labelled-unicast type Ipv4LabelledUnicast struct { // original -> bgp-mp:prefix-limit PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *Ipv4LabelledUnicast) Equal(rhs *Ipv4LabelledUnicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp-mp:state type Ipv6UnicastState struct { // original -> bgp-mp:send-default-route @@ -1611,6 +2729,16 @@ type Ipv6UnicastState struct { SendDefaultRoute bool `mapstructure:"send-default-route"` } +func (lhs *Ipv6UnicastState) Equal(rhs *Ipv6UnicastState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SendDefaultRoute != rhs.SendDefaultRoute { + return false + } + return true +} + //struct for container bgp-mp:config type Ipv6UnicastConfig struct { // original -> bgp-mp:send-default-route @@ -1618,6 +2746,16 @@ type Ipv6UnicastConfig struct { SendDefaultRoute bool `mapstructure:"send-default-route"` } +func (lhs *Ipv6UnicastConfig) Equal(rhs *Ipv6UnicastConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SendDefaultRoute != rhs.SendDefaultRoute { + return false + } + return true +} + //struct for container bgp-mp:ipv6-unicast type Ipv6Unicast struct { // original -> bgp-mp:prefix-limit @@ -1628,6 +2766,22 @@ type Ipv6Unicast struct { State Ipv6UnicastState `mapstructure:"state"` } +func (lhs *Ipv6Unicast) Equal(rhs *Ipv6Unicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type Ipv4UnicastState struct { // original -> bgp-mp:send-default-route @@ -1635,6 +2789,16 @@ type Ipv4UnicastState struct { SendDefaultRoute bool `mapstructure:"send-default-route"` } +func (lhs *Ipv4UnicastState) Equal(rhs *Ipv4UnicastState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SendDefaultRoute != rhs.SendDefaultRoute { + return false + } + return true +} + //struct for container bgp-mp:config type Ipv4UnicastConfig struct { // original -> bgp-mp:send-default-route @@ -1642,6 +2806,16 @@ type Ipv4UnicastConfig struct { SendDefaultRoute bool `mapstructure:"send-default-route"` } +func (lhs *Ipv4UnicastConfig) Equal(rhs *Ipv4UnicastConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SendDefaultRoute != rhs.SendDefaultRoute { + return false + } + return true +} + //struct for container bgp-mp:state type PrefixLimitState struct { // original -> bgp-mp:max-prefixes @@ -1653,6 +2827,22 @@ type PrefixLimitState struct { RestartTimer float64 `mapstructure:"restart-timer"` } +func (lhs *PrefixLimitState) Equal(rhs *PrefixLimitState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.MaxPrefixes != rhs.MaxPrefixes { + return false + } + if lhs.ShutdownThresholdPct != rhs.ShutdownThresholdPct { + return false + } + if lhs.RestartTimer != rhs.RestartTimer { + return false + } + return true +} + //struct for container bgp-mp:config type PrefixLimitConfig struct { // original -> bgp-mp:max-prefixes @@ -1664,6 +2854,22 @@ type PrefixLimitConfig struct { RestartTimer float64 `mapstructure:"restart-timer"` } +func (lhs *PrefixLimitConfig) Equal(rhs *PrefixLimitConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.MaxPrefixes != rhs.MaxPrefixes { + return false + } + if lhs.ShutdownThresholdPct != rhs.ShutdownThresholdPct { + return false + } + if lhs.RestartTimer != rhs.RestartTimer { + return false + } + return true +} + //struct for container bgp-mp:prefix-limit type PrefixLimit struct { // original -> bgp-mp:prefix-limit-config @@ -1672,6 +2878,19 @@ type PrefixLimit struct { State PrefixLimitState `mapstructure:"state"` } +func (lhs *PrefixLimit) Equal(rhs *PrefixLimit) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:ipv4-unicast type Ipv4Unicast struct { // original -> bgp-mp:prefix-limit @@ -1682,6 +2901,22 @@ type Ipv4Unicast struct { State Ipv4UnicastState `mapstructure:"state"` } +func (lhs *Ipv4Unicast) Equal(rhs *Ipv4Unicast) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container rpol:state type ApplyPolicyState struct { // original -> rpol:import-policy @@ -1698,6 +2933,46 @@ type ApplyPolicyState struct { DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy"` } +func (lhs *ApplyPolicyState) Equal(rhs *ApplyPolicyState) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.ImportPolicyList) != len(rhs.ImportPolicyList) { + return false + } + for idx, l := range lhs.ImportPolicyList { + if l != rhs.ImportPolicyList[idx] { + return false + } + } + if lhs.DefaultImportPolicy != rhs.DefaultImportPolicy { + return false + } + if len(lhs.ExportPolicyList) != len(rhs.ExportPolicyList) { + return false + } + for idx, l := range lhs.ExportPolicyList { + if l != rhs.ExportPolicyList[idx] { + return false + } + } + if lhs.DefaultExportPolicy != rhs.DefaultExportPolicy { + return false + } + if len(lhs.InPolicyList) != len(rhs.InPolicyList) { + return false + } + for idx, l := range lhs.InPolicyList { + if l != rhs.InPolicyList[idx] { + return false + } + } + if lhs.DefaultInPolicy != rhs.DefaultInPolicy { + return false + } + return true +} + //struct for container rpol:config type ApplyPolicyConfig struct { // original -> rpol:import-policy @@ -1714,6 +2989,46 @@ type ApplyPolicyConfig struct { DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy"` } +func (lhs *ApplyPolicyConfig) Equal(rhs *ApplyPolicyConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.ImportPolicyList) != len(rhs.ImportPolicyList) { + return false + } + for idx, l := range lhs.ImportPolicyList { + if l != rhs.ImportPolicyList[idx] { + return false + } + } + if lhs.DefaultImportPolicy != rhs.DefaultImportPolicy { + return false + } + if len(lhs.ExportPolicyList) != len(rhs.ExportPolicyList) { + return false + } + for idx, l := range lhs.ExportPolicyList { + if l != rhs.ExportPolicyList[idx] { + return false + } + } + if lhs.DefaultExportPolicy != rhs.DefaultExportPolicy { + return false + } + if len(lhs.InPolicyList) != len(rhs.InPolicyList) { + return false + } + for idx, l := range lhs.InPolicyList { + if l != rhs.InPolicyList[idx] { + return false + } + } + if lhs.DefaultInPolicy != rhs.DefaultInPolicy { + return false + } + return true +} + //struct for container rpol:apply-policy type ApplyPolicy struct { // original -> rpol:apply-policy-config @@ -1722,6 +3037,19 @@ type ApplyPolicy struct { State ApplyPolicyState `mapstructure:"state"` } +func (lhs *ApplyPolicy) Equal(rhs *ApplyPolicy) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type AfiSafiState struct { // original -> bgp-mp:afi-safi-name @@ -1735,6 +3063,25 @@ type AfiSafiState struct { TotalPrefixes uint32 `mapstructure:"total-prefixes"` } +func (lhs *AfiSafiState) Equal(rhs *AfiSafiState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AfiSafiName != rhs.AfiSafiName { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.TotalPaths != rhs.TotalPaths { + return false + } + if lhs.TotalPrefixes != rhs.TotalPrefixes { + return false + } + return true +} + //struct for container bgp-mp:config type AfiSafiConfig struct { // original -> bgp-mp:afi-safi-name @@ -1744,6 +3091,19 @@ type AfiSafiConfig struct { Enabled bool `mapstructure:"enabled"` } +func (lhs *AfiSafiConfig) Equal(rhs *AfiSafiConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AfiSafiName != rhs.AfiSafiName { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + return true +} + //struct for container bgp-mp:state type MpGracefulRestartState struct { // original -> bgp-mp:enabled @@ -1763,6 +3123,28 @@ type MpGracefulRestartState struct { EndOfRibSent bool `mapstructure:"end-of-rib-sent"` } +func (lhs *MpGracefulRestartState) Equal(rhs *MpGracefulRestartState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.Received != rhs.Received { + return false + } + if lhs.Advertised != rhs.Advertised { + return false + } + if lhs.EndOfRibReceived != rhs.EndOfRibReceived { + return false + } + if lhs.EndOfRibSent != rhs.EndOfRibSent { + return false + } + return true +} + //struct for container bgp-mp:config type MpGracefulRestartConfig struct { // original -> bgp-mp:enabled @@ -1770,6 +3152,16 @@ type MpGracefulRestartConfig struct { Enabled bool `mapstructure:"enabled"` } +func (lhs *MpGracefulRestartConfig) Equal(rhs *MpGracefulRestartConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + return true +} + //struct for container bgp-mp:graceful-restart type MpGracefulRestart struct { // original -> bgp-mp:mp-graceful-restart-config @@ -1778,6 +3170,19 @@ type MpGracefulRestart struct { State MpGracefulRestartState `mapstructure:"state"` } +func (lhs *MpGracefulRestart) Equal(rhs *MpGracefulRestart) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:afi-safi type AfiSafi struct { // original -> bgp-mp:afi-safi-name @@ -1818,6 +3223,67 @@ type AfiSafi struct { PrefixLimit PrefixLimit `mapstructure:"prefix-limit"` } +func (lhs *AfiSafi) Equal(rhs *AfiSafi) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AfiSafiName != rhs.AfiSafiName { + return false + } + if !lhs.MpGracefulRestart.Equal(&(rhs.MpGracefulRestart)) { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { + return false + } + if !lhs.Ipv4Unicast.Equal(&(rhs.Ipv4Unicast)) { + return false + } + if !lhs.Ipv6Unicast.Equal(&(rhs.Ipv6Unicast)) { + return false + } + if !lhs.Ipv4LabelledUnicast.Equal(&(rhs.Ipv4LabelledUnicast)) { + return false + } + if !lhs.Ipv6LabelledUnicast.Equal(&(rhs.Ipv6LabelledUnicast)) { + return false + } + if !lhs.L3vpnIpv4Unicast.Equal(&(rhs.L3vpnIpv4Unicast)) { + return false + } + if !lhs.L3vpnIpv6Unicast.Equal(&(rhs.L3vpnIpv6Unicast)) { + return false + } + if !lhs.L3vpnIpv4Multicast.Equal(&(rhs.L3vpnIpv4Multicast)) { + return false + } + if !lhs.L3vpnIpv6Multicast.Equal(&(rhs.L3vpnIpv6Multicast)) { + return false + } + if !lhs.L2vpnVpls.Equal(&(rhs.L2vpnVpls)) { + return false + } + if !lhs.L2vpnEvpn.Equal(&(rhs.L2vpnEvpn)) { + return false + } + if !lhs.RouteSelectionOptions.Equal(&(rhs.RouteSelectionOptions)) { + return false + } + if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { + return false + } + if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { + return false + } + return true +} + //struct for container bgp:state type GracefulRestartState struct { // original -> bgp:enabled @@ -1845,6 +3311,40 @@ type GracefulRestartState struct { DeferralTime uint16 `mapstructure:"deferral-time"` } +func (lhs *GracefulRestartState) Equal(rhs *GracefulRestartState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.RestartTime != rhs.RestartTime { + return false + } + if lhs.StaleRoutesTime != rhs.StaleRoutesTime { + return false + } + if lhs.HelperOnly != rhs.HelperOnly { + return false + } + if lhs.PeerRestartTime != rhs.PeerRestartTime { + return false + } + if lhs.PeerRestarting != rhs.PeerRestarting { + return false + } + if lhs.LocalRestarting != rhs.LocalRestarting { + return false + } + if lhs.Mode != rhs.Mode { + return false + } + if lhs.DeferralTime != rhs.DeferralTime { + return false + } + return true +} + //struct for container bgp:config type GracefulRestartConfig struct { // original -> bgp:enabled @@ -1862,6 +3362,28 @@ type GracefulRestartConfig struct { DeferralTime uint16 `mapstructure:"deferral-time"` } +func (lhs *GracefulRestartConfig) Equal(rhs *GracefulRestartConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.RestartTime != rhs.RestartTime { + return false + } + if lhs.StaleRoutesTime != rhs.StaleRoutesTime { + return false + } + if lhs.HelperOnly != rhs.HelperOnly { + return false + } + if lhs.DeferralTime != rhs.DeferralTime { + return false + } + return true +} + //struct for container bgp:graceful-restart type GracefulRestart struct { // original -> bgp:graceful-restart-config @@ -1870,18 +3392,51 @@ type GracefulRestart struct { State GracefulRestartState `mapstructure:"state"` } +func (lhs *GracefulRestart) Equal(rhs *GracefulRestart) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type IbgpState struct { // original -> bgp-mp:maximum-paths MaximumPaths uint32 `mapstructure:"maximum-paths"` } +func (lhs *IbgpState) Equal(rhs *IbgpState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.MaximumPaths != rhs.MaximumPaths { + return false + } + return true +} + //struct for container bgp-mp:config type IbgpConfig struct { // original -> bgp-mp:maximum-paths MaximumPaths uint32 `mapstructure:"maximum-paths"` } +func (lhs *IbgpConfig) Equal(rhs *IbgpConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.MaximumPaths != rhs.MaximumPaths { + return false + } + return true +} + //struct for container bgp-mp:ibgp type Ibgp struct { // original -> bgp-mp:ibgp-config @@ -1890,6 +3445,19 @@ type Ibgp struct { State IbgpState `mapstructure:"state"` } +func (lhs *Ibgp) Equal(rhs *Ibgp) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type EbgpState struct { // original -> bgp-mp:allow-multiple-as @@ -1899,6 +3467,19 @@ type EbgpState struct { MaximumPaths uint32 `mapstructure:"maximum-paths"` } +func (lhs *EbgpState) Equal(rhs *EbgpState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AllowMultipleAs != rhs.AllowMultipleAs { + return false + } + if lhs.MaximumPaths != rhs.MaximumPaths { + return false + } + return true +} + //struct for container bgp-mp:config type EbgpConfig struct { // original -> bgp-mp:allow-multiple-as @@ -1908,6 +3489,19 @@ type EbgpConfig struct { MaximumPaths uint32 `mapstructure:"maximum-paths"` } +func (lhs *EbgpConfig) Equal(rhs *EbgpConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AllowMultipleAs != rhs.AllowMultipleAs { + return false + } + if lhs.MaximumPaths != rhs.MaximumPaths { + return false + } + return true +} + //struct for container bgp-mp:ebgp type Ebgp struct { // original -> bgp-mp:ebgp-config @@ -1916,6 +3510,19 @@ type Ebgp struct { State EbgpState `mapstructure:"state"` } +func (lhs *Ebgp) Equal(rhs *Ebgp) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type UseMultiplePathsState struct { // original -> bgp-mp:enabled @@ -1923,6 +3530,16 @@ type UseMultiplePathsState struct { Enabled bool `mapstructure:"enabled"` } +func (lhs *UseMultiplePathsState) Equal(rhs *UseMultiplePathsState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + return true +} + //struct for container bgp-mp:config type UseMultiplePathsConfig struct { // original -> bgp-mp:enabled @@ -1930,6 +3547,16 @@ type UseMultiplePathsConfig struct { Enabled bool `mapstructure:"enabled"` } +func (lhs *UseMultiplePathsConfig) Equal(rhs *UseMultiplePathsConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + return true +} + //struct for container bgp-mp:use-multiple-paths type UseMultiplePaths struct { // original -> bgp-mp:use-multiple-paths-config @@ -1942,6 +3569,25 @@ type UseMultiplePaths struct { Ibgp Ibgp `mapstructure:"ibgp"` } +func (lhs *UseMultiplePaths) Equal(rhs *UseMultiplePaths) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + if !lhs.Ebgp.Equal(&(rhs.Ebgp)) { + return false + } + if !lhs.Ibgp.Equal(&(rhs.Ibgp)) { + return false + } + return true +} + //struct for container bgp:state type ConfederationState struct { // original -> bgp:enabled @@ -1955,6 +3601,27 @@ type ConfederationState struct { MemberAsList []uint32 `mapstructure:"member-as-list"` } +func (lhs *ConfederationState) Equal(rhs *ConfederationState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.Identifier != rhs.Identifier { + return false + } + if len(lhs.MemberAsList) != len(rhs.MemberAsList) { + return false + } + for idx, l := range lhs.MemberAsList { + if l != rhs.MemberAsList[idx] { + return false + } + } + return true +} + //struct for container bgp:config type ConfederationConfig struct { // original -> bgp:enabled @@ -1968,6 +3635,27 @@ type ConfederationConfig struct { MemberAsList []uint32 `mapstructure:"member-as-list"` } +func (lhs *ConfederationConfig) Equal(rhs *ConfederationConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Enabled != rhs.Enabled { + return false + } + if lhs.Identifier != rhs.Identifier { + return false + } + if len(lhs.MemberAsList) != len(rhs.MemberAsList) { + return false + } + for idx, l := range lhs.MemberAsList { + if l != rhs.MemberAsList[idx] { + return false + } + } + return true +} + //struct for container bgp:confederation type Confederation struct { // original -> bgp:confederation-config @@ -1976,6 +3664,19 @@ type Confederation struct { State ConfederationState `mapstructure:"state"` } +func (lhs *Confederation) Equal(rhs *Confederation) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type DefaultRouteDistanceState struct { // original -> bgp:external-route-distance @@ -1984,6 +3685,19 @@ type DefaultRouteDistanceState struct { InternalRouteDistance uint8 `mapstructure:"internal-route-distance"` } +func (lhs *DefaultRouteDistanceState) Equal(rhs *DefaultRouteDistanceState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ExternalRouteDistance != rhs.ExternalRouteDistance { + return false + } + if lhs.InternalRouteDistance != rhs.InternalRouteDistance { + return false + } + return true +} + //struct for container bgp:config type DefaultRouteDistanceConfig struct { // original -> bgp:external-route-distance @@ -1992,6 +3706,19 @@ type DefaultRouteDistanceConfig struct { InternalRouteDistance uint8 `mapstructure:"internal-route-distance"` } +func (lhs *DefaultRouteDistanceConfig) Equal(rhs *DefaultRouteDistanceConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ExternalRouteDistance != rhs.ExternalRouteDistance { + return false + } + if lhs.InternalRouteDistance != rhs.InternalRouteDistance { + return false + } + return true +} + //struct for container bgp:default-route-distance type DefaultRouteDistance struct { // original -> bgp:default-route-distance-config @@ -2000,6 +3727,19 @@ type DefaultRouteDistance struct { State DefaultRouteDistanceState `mapstructure:"state"` } +func (lhs *DefaultRouteDistance) Equal(rhs *DefaultRouteDistance) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp-mp:state type RouteSelectionOptionsState struct { // original -> bgp-mp:always-compare-med @@ -2022,6 +3762,31 @@ type RouteSelectionOptionsState struct { IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric"` } +func (lhs *RouteSelectionOptionsState) Equal(rhs *RouteSelectionOptionsState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AlwaysCompareMed != rhs.AlwaysCompareMed { + return false + } + if lhs.IgnoreAsPathLength != rhs.IgnoreAsPathLength { + return false + } + if lhs.ExternalCompareRouterId != rhs.ExternalCompareRouterId { + return false + } + if lhs.AdvertiseInactiveRoutes != rhs.AdvertiseInactiveRoutes { + return false + } + if lhs.EnableAigp != rhs.EnableAigp { + return false + } + if lhs.IgnoreNextHopIgpMetric != rhs.IgnoreNextHopIgpMetric { + return false + } + return true +} + //struct for container bgp-mp:config type RouteSelectionOptionsConfig struct { // original -> bgp-mp:always-compare-med @@ -2044,6 +3809,31 @@ type RouteSelectionOptionsConfig struct { IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric"` } +func (lhs *RouteSelectionOptionsConfig) Equal(rhs *RouteSelectionOptionsConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AlwaysCompareMed != rhs.AlwaysCompareMed { + return false + } + if lhs.IgnoreAsPathLength != rhs.IgnoreAsPathLength { + return false + } + if lhs.ExternalCompareRouterId != rhs.ExternalCompareRouterId { + return false + } + if lhs.AdvertiseInactiveRoutes != rhs.AdvertiseInactiveRoutes { + return false + } + if lhs.EnableAigp != rhs.EnableAigp { + return false + } + if lhs.IgnoreNextHopIgpMetric != rhs.IgnoreNextHopIgpMetric { + return false + } + return true +} + //struct for container bgp-mp:route-selection-options type RouteSelectionOptions struct { // original -> bgp-mp:route-selection-options-config @@ -2052,6 +3842,19 @@ type RouteSelectionOptions struct { State RouteSelectionOptionsState `mapstructure:"state"` } +func (lhs *RouteSelectionOptions) Equal(rhs *RouteSelectionOptions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + return true +} + //struct for container bgp:state type GlobalState struct { // original -> bgp:as @@ -2066,6 +3869,25 @@ type GlobalState struct { TotalPrefixes uint32 `mapstructure:"total-prefixes"` } +func (lhs *GlobalState) Equal(rhs *GlobalState) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.As != rhs.As { + return false + } + if lhs.RouterId != rhs.RouterId { + return false + } + if lhs.TotalPaths != rhs.TotalPaths { + return false + } + if lhs.TotalPrefixes != rhs.TotalPrefixes { + return false + } + return true +} + //struct for container bgp:config type GlobalConfig struct { // original -> bgp:as @@ -2076,6 +3898,19 @@ type GlobalConfig struct { RouterId string `mapstructure:"router-id"` } +func (lhs *GlobalConfig) Equal(rhs *GlobalConfig) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.As != rhs.As { + return false + } + if lhs.RouterId != rhs.RouterId { + return false + } + return true +} + //struct for container bgp:global type Global struct { // original -> bgp:global-config @@ -2106,6 +3941,65 @@ type Global struct { ListenConfig ListenConfig `mapstructure:"listen-config"` } +func (lhs *Global) Equal(rhs *Global) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { + return false + } + if !lhs.State.Equal(&(rhs.State)) { + return false + } + if !lhs.RouteSelectionOptions.Equal(&(rhs.RouteSelectionOptions)) { + return false + } + if !lhs.DefaultRouteDistance.Equal(&(rhs.DefaultRouteDistance)) { + return false + } + if !lhs.Confederation.Equal(&(rhs.Confederation)) { + return false + } + if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { + return false + } + if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { + return false + } + if len(lhs.AfiSafis) != len(rhs.AfiSafis) { + return false + } + { + lmap := make(map[string]*AfiSafi) + for _, l := range lhs.AfiSafis { + lmap[string(l.AfiSafiName)] = &l + } + for _, r := range rhs.AfiSafis { + if l, y := lmap[string(r.AfiSafiName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { + return false + } + if !lhs.Collector.Equal(&(rhs.Collector)) { + return false + } + if !lhs.Zebra.Equal(&(rhs.Zebra)) { + return false + } + if !lhs.MplsLabelRange.Equal(&(rhs.MplsLabelRange)) { + return false + } + if !lhs.ListenConfig.Equal(&(rhs.ListenConfig)) { + return false + } + return true +} + //struct for container bgp:bgp type Bgp struct { // original -> bgp:global @@ -2122,6 +4016,96 @@ type Bgp struct { MrtDump []Mrt `mapstructure:"mrt-dump"` } +func (lhs *Bgp) Equal(rhs *Bgp) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Global.Equal(&(rhs.Global)) { + return false + } + if len(lhs.Neighbors) != len(rhs.Neighbors) { + return false + } + { + lmap := make(map[string]*Neighbor) + for _, l := range lhs.Neighbors { + lmap[string(l.NeighborAddress)] = &l + } + for _, r := range rhs.Neighbors { + if l, y := lmap[string(r.NeighborAddress)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.PeerGroups) != len(rhs.PeerGroups) { + return false + } + { + lmap := make(map[string]*PeerGroup) + for _, l := range lhs.PeerGroups { + lmap[string(l.PeerGroupName)] = &l + } + for _, r := range rhs.PeerGroups { + if l, y := lmap[string(r.PeerGroupName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.RpkiServers) != len(rhs.RpkiServers) { + return false + } + { + lmap := make(map[string]*RpkiServer) + for _, l := range lhs.RpkiServers { + lmap[string(l.Address)] = &l + } + for _, r := range rhs.RpkiServers { + if l, y := lmap[string(r.Address)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.BmpServers) != len(rhs.BmpServers) { + return false + } + { + lmap := make(map[string]*BmpServer) + for _, l := range lhs.BmpServers { + lmap[string(l.Address)] = &l + } + for _, r := range rhs.BmpServers { + if l, y := lmap[string(r.Address)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.MrtDump) != len(rhs.MrtDump) { + return false + } + { + lmap := make(map[string]*Mrt) + for _, l := range lhs.MrtDump { + lmap[string(l.FileName)] = &l + } + for _, r := range rhs.MrtDump { + if l, y := lmap[string(r.FileName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} + //struct for container bgp-pol:set-ext-community-method type SetExtCommunityMethod struct { // original -> bgp-pol:communities @@ -2131,6 +4115,24 @@ type SetExtCommunityMethod struct { ExtCommunitySetRef string `mapstructure:"ext-community-set-ref"` } +func (lhs *SetExtCommunityMethod) Equal(rhs *SetExtCommunityMethod) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.CommunitiesList) != len(rhs.CommunitiesList) { + return false + } + for idx, l := range lhs.CommunitiesList { + if l != rhs.CommunitiesList[idx] { + return false + } + } + if lhs.ExtCommunitySetRef != rhs.ExtCommunitySetRef { + return false + } + return true +} + //struct for container bgp-pol:set-ext-community type SetExtCommunity struct { // original -> bgp-pol:set-ext-community-method @@ -2140,6 +4142,19 @@ type SetExtCommunity struct { Options string `mapstructure:"options"` } +func (lhs *SetExtCommunity) Equal(rhs *SetExtCommunity) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.SetExtCommunityMethod.Equal(&(rhs.SetExtCommunityMethod)) { + return false + } + if lhs.Options != rhs.Options { + return false + } + return true +} + //struct for container bgp-pol:set-community-method type SetCommunityMethod struct { // original -> bgp-pol:communities @@ -2149,6 +4164,24 @@ type SetCommunityMethod struct { CommunitySetRef string `mapstructure:"community-set-ref"` } +func (lhs *SetCommunityMethod) Equal(rhs *SetCommunityMethod) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.CommunitiesList) != len(rhs.CommunitiesList) { + return false + } + for idx, l := range lhs.CommunitiesList { + if l != rhs.CommunitiesList[idx] { + return false + } + } + if lhs.CommunitySetRef != rhs.CommunitySetRef { + return false + } + return true +} + //struct for container bgp-pol:set-community type SetCommunity struct { // original -> bgp-pol:set-community-method @@ -2158,6 +4191,19 @@ type SetCommunity struct { Options string `mapstructure:"options"` } +func (lhs *SetCommunity) Equal(rhs *SetCommunity) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.SetCommunityMethod.Equal(&(rhs.SetCommunityMethod)) { + return false + } + if lhs.Options != rhs.Options { + return false + } + return true +} + //struct for container bgp-pol:set-as-path-prepend type SetAsPathPrepend struct { // original -> bgp-pol:repeat-n @@ -2167,6 +4213,19 @@ type SetAsPathPrepend struct { As string `mapstructure:"as"` } +func (lhs *SetAsPathPrepend) Equal(rhs *SetAsPathPrepend) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.RepeatN != rhs.RepeatN { + return false + } + if lhs.As != rhs.As { + return false + } + return true +} + //struct for container bgp-pol:bgp-actions type BgpActions struct { // original -> bgp-pol:set-as-path-prepend @@ -2185,12 +4244,50 @@ type BgpActions struct { SetMed BgpSetMedType `mapstructure:"set-med"` } +func (lhs *BgpActions) Equal(rhs *BgpActions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.SetAsPathPrepend.Equal(&(rhs.SetAsPathPrepend)) { + return false + } + if !lhs.SetCommunity.Equal(&(rhs.SetCommunity)) { + return false + } + if !lhs.SetExtCommunity.Equal(&(rhs.SetExtCommunity)) { + return false + } + if lhs.SetRouteOrigin != rhs.SetRouteOrigin { + return false + } + if lhs.SetLocalPref != rhs.SetLocalPref { + return false + } + if lhs.SetNextHop != rhs.SetNextHop { + return false + } + if lhs.SetMed != rhs.SetMed { + return false + } + return true +} + //struct for container rpol:igp-actions type IgpActions struct { // original -> rpol:set-tag SetTag TagType `mapstructure:"set-tag"` } +func (lhs *IgpActions) Equal(rhs *IgpActions) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.SetTag != rhs.SetTag { + return false + } + return true +} + //struct for container rpol:route-disposition type RouteDisposition struct { // original -> rpol:accept-route @@ -2201,6 +4298,19 @@ type RouteDisposition struct { RejectRoute bool `mapstructure:"reject-route"` } +func (lhs *RouteDisposition) Equal(rhs *RouteDisposition) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AcceptRoute != rhs.AcceptRoute { + return false + } + if lhs.RejectRoute != rhs.RejectRoute { + return false + } + return true +} + //struct for container rpol:actions type Actions struct { // original -> rpol:route-disposition @@ -2211,6 +4321,22 @@ type Actions struct { BgpActions BgpActions `mapstructure:"bgp-actions"` } +func (lhs *Actions) Equal(rhs *Actions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.RouteDisposition.Equal(&(rhs.RouteDisposition)) { + return false + } + if !lhs.IgpActions.Equal(&(rhs.IgpActions)) { + return false + } + if !lhs.BgpActions.Equal(&(rhs.BgpActions)) { + return false + } + return true +} + //struct for container bgp-pol:as-path-length type AsPathLength struct { // original -> ptypes:operator @@ -2219,6 +4345,19 @@ type AsPathLength struct { Value uint32 `mapstructure:"value"` } +func (lhs *AsPathLength) Equal(rhs *AsPathLength) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Operator != rhs.Operator { + return false + } + if lhs.Value != rhs.Value { + return false + } + return true +} + //struct for container bgp-pol:community-count type CommunityCount struct { // original -> ptypes:operator @@ -2227,6 +4366,19 @@ type CommunityCount struct { Value uint32 `mapstructure:"value"` } +func (lhs *CommunityCount) Equal(rhs *CommunityCount) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Operator != rhs.Operator { + return false + } + if lhs.Value != rhs.Value { + return false + } + return true +} + //struct for container bgp-pol:match-as-path-set type MatchAsPathSet struct { // original -> bgp-pol:as-path-set @@ -2235,6 +4387,19 @@ type MatchAsPathSet struct { MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"` } +func (lhs *MatchAsPathSet) Equal(rhs *MatchAsPathSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AsPathSet != rhs.AsPathSet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container bgp-pol:match-ext-community-set type MatchExtCommunitySet struct { // original -> bgp-pol:ext-community-set @@ -2243,6 +4408,19 @@ type MatchExtCommunitySet struct { MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"` } +func (lhs *MatchExtCommunitySet) Equal(rhs *MatchExtCommunitySet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ExtCommunitySet != rhs.ExtCommunitySet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container bgp-pol:match-community-set type MatchCommunitySet struct { // original -> bgp-pol:community-set @@ -2251,6 +4429,19 @@ type MatchCommunitySet struct { MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options"` } +func (lhs *MatchCommunitySet) Equal(rhs *MatchCommunitySet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.CommunitySet != rhs.CommunitySet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container bgp-pol:bgp-conditions type BgpConditions struct { // original -> bgp-pol:match-community-set @@ -2280,10 +4471,70 @@ type BgpConditions struct { RpkiValidationResult RpkiValidationResultType `mapstructure:"rpki-validation-result"` } +func (lhs *BgpConditions) Equal(rhs *BgpConditions) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.MatchCommunitySet.Equal(&(rhs.MatchCommunitySet)) { + return false + } + if !lhs.MatchExtCommunitySet.Equal(&(rhs.MatchExtCommunitySet)) { + return false + } + if !lhs.MatchAsPathSet.Equal(&(rhs.MatchAsPathSet)) { + return false + } + if lhs.MedEq != rhs.MedEq { + return false + } + if lhs.OriginEq != rhs.OriginEq { + return false + } + if len(lhs.NextHopInList) != len(rhs.NextHopInList) { + return false + } + for idx, l := range lhs.NextHopInList { + if l != rhs.NextHopInList[idx] { + return false + } + } + if len(lhs.AfiSafiInList) != len(rhs.AfiSafiInList) { + return false + } + for idx, l := range lhs.AfiSafiInList { + if l != rhs.AfiSafiInList[idx] { + return false + } + } + if lhs.LocalPrefEq != rhs.LocalPrefEq { + return false + } + if !lhs.CommunityCount.Equal(&(rhs.CommunityCount)) { + return false + } + if !lhs.AsPathLength.Equal(&(rhs.AsPathLength)) { + return false + } + if lhs.RouteType != rhs.RouteType { + return false + } + if lhs.RpkiValidationResult != rhs.RpkiValidationResult { + return false + } + return true +} + //struct for container rpol:igp-conditions type IgpConditions struct { } +func (lhs *IgpConditions) Equal(rhs *IgpConditions) bool { + if lhs == nil || rhs == nil { + return false + } + return true +} + //struct for container rpol:match-tag-set type MatchTagSet struct { // original -> rpol:tag-set @@ -2292,6 +4543,19 @@ type MatchTagSet struct { MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"` } +func (lhs *MatchTagSet) Equal(rhs *MatchTagSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TagSet != rhs.TagSet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container rpol:match-neighbor-set type MatchNeighborSet struct { // original -> rpol:neighbor-set @@ -2300,6 +4564,19 @@ type MatchNeighborSet struct { MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"` } +func (lhs *MatchNeighborSet) Equal(rhs *MatchNeighborSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.NeighborSet != rhs.NeighborSet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container rpol:match-prefix-set type MatchPrefixSet struct { // original -> rpol:prefix-set @@ -2308,6 +4585,19 @@ type MatchPrefixSet struct { MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options"` } +func (lhs *MatchPrefixSet) Equal(rhs *MatchPrefixSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PrefixSet != rhs.PrefixSet { + return false + } + if lhs.MatchSetOptions != rhs.MatchSetOptions { + return false + } + return true +} + //struct for container rpol:conditions type Conditions struct { // original -> rpol:call-policy @@ -2326,6 +4616,34 @@ type Conditions struct { BgpConditions BgpConditions `mapstructure:"bgp-conditions"` } +func (lhs *Conditions) Equal(rhs *Conditions) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.CallPolicy != rhs.CallPolicy { + return false + } + if !lhs.MatchPrefixSet.Equal(&(rhs.MatchPrefixSet)) { + return false + } + if !lhs.MatchNeighborSet.Equal(&(rhs.MatchNeighborSet)) { + return false + } + if !lhs.MatchTagSet.Equal(&(rhs.MatchTagSet)) { + return false + } + if lhs.InstallProtocolEq != rhs.InstallProtocolEq { + return false + } + if !lhs.IgpConditions.Equal(&(rhs.IgpConditions)) { + return false + } + if !lhs.BgpConditions.Equal(&(rhs.BgpConditions)) { + return false + } + return true +} + //struct for container rpol:statement type Statement struct { // original -> rpol:name @@ -2336,6 +4654,22 @@ type Statement struct { Actions Actions `mapstructure:"actions"` } +func (lhs *Statement) Equal(rhs *Statement) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Name != rhs.Name { + return false + } + if !lhs.Conditions.Equal(&(rhs.Conditions)) { + return false + } + if !lhs.Actions.Equal(&(rhs.Actions)) { + return false + } + return true +} + //struct for container rpol:policy-definition type PolicyDefinition struct { // original -> rpol:name @@ -2344,6 +4678,32 @@ type PolicyDefinition struct { Statements []Statement `mapstructure:"statements"` } +func (lhs *PolicyDefinition) Equal(rhs *PolicyDefinition) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Name != rhs.Name { + return false + } + if len(lhs.Statements) != len(rhs.Statements) { + return false + } + { + lmap := make(map[string]*Statement) + for _, l := range lhs.Statements { + lmap[string(l.Name)] = &l + } + for _, r := range rhs.Statements { + if l, y := lmap[string(r.Name)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} + //struct for container bgp-pol:as-path-set type AsPathSet struct { // original -> bgp-pol:as-path-set-name @@ -2352,6 +4712,24 @@ type AsPathSet struct { AsPathList []string `mapstructure:"as-path-list"` } +func (lhs *AsPathSet) Equal(rhs *AsPathSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.AsPathSetName != rhs.AsPathSetName { + return false + } + if len(lhs.AsPathList) != len(rhs.AsPathList) { + return false + } + for idx, l := range lhs.AsPathList { + if l != rhs.AsPathList[idx] { + return false + } + } + return true +} + //struct for container bgp-pol:ext-community-set type ExtCommunitySet struct { // original -> bgp-pol:ext-community-set-name @@ -2360,6 +4738,24 @@ type ExtCommunitySet struct { ExtCommunityList []string `mapstructure:"ext-community-list"` } +func (lhs *ExtCommunitySet) Equal(rhs *ExtCommunitySet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.ExtCommunitySetName != rhs.ExtCommunitySetName { + return false + } + if len(lhs.ExtCommunityList) != len(rhs.ExtCommunityList) { + return false + } + for idx, l := range lhs.ExtCommunityList { + if l != rhs.ExtCommunityList[idx] { + return false + } + } + return true +} + //struct for container bgp-pol:community-set type CommunitySet struct { // original -> bgp-pol:community-set-name @@ -2368,6 +4764,24 @@ type CommunitySet struct { CommunityList []string `mapstructure:"community-list"` } +func (lhs *CommunitySet) Equal(rhs *CommunitySet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.CommunitySetName != rhs.CommunitySetName { + return false + } + if len(lhs.CommunityList) != len(rhs.CommunityList) { + return false + } + for idx, l := range lhs.CommunityList { + if l != rhs.CommunityList[idx] { + return false + } + } + return true +} + //struct for container bgp-pol:bgp-defined-sets type BgpDefinedSets struct { // original -> bgp-pol:community-sets @@ -2378,12 +4792,77 @@ type BgpDefinedSets struct { AsPathSets []AsPathSet `mapstructure:"as-path-sets"` } +func (lhs *BgpDefinedSets) Equal(rhs *BgpDefinedSets) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.CommunitySets) != len(rhs.CommunitySets) { + return false + } + { + lmap := make(map[string]*CommunitySet) + for _, l := range lhs.CommunitySets { + lmap[string(l.CommunitySetName)] = &l + } + for _, r := range rhs.CommunitySets { + if l, y := lmap[string(r.CommunitySetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.ExtCommunitySets) != len(rhs.ExtCommunitySets) { + return false + } + { + lmap := make(map[string]*ExtCommunitySet) + for _, l := range lhs.ExtCommunitySets { + lmap[string(l.ExtCommunitySetName)] = &l + } + for _, r := range rhs.ExtCommunitySets { + if l, y := lmap[string(r.ExtCommunitySetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.AsPathSets) != len(rhs.AsPathSets) { + return false + } + { + lmap := make(map[string]*AsPathSet) + for _, l := range lhs.AsPathSets { + lmap[string(l.AsPathSetName)] = &l + } + for _, r := range rhs.AsPathSets { + if l, y := lmap[string(r.AsPathSetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} + //struct for container rpol:tag type Tag struct { // original -> rpol:value Value TagType `mapstructure:"value"` } +func (lhs *Tag) Equal(rhs *Tag) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.Value != rhs.Value { + return false + } + return true +} + //struct for container rpol:tag-set type TagSet struct { // original -> rpol:tag-set-name @@ -2392,6 +4871,32 @@ type TagSet struct { TagList []Tag `mapstructure:"tag-list"` } +func (lhs *TagSet) Equal(rhs *TagSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.TagSetName != rhs.TagSetName { + return false + } + if len(lhs.TagList) != len(rhs.TagList) { + return false + } + { + lmap := make(map[string]*Tag) + for _, l := range lhs.TagList { + lmap[string(l.Value)] = &l + } + for _, r := range rhs.TagList { + if l, y := lmap[string(r.Value)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} + //struct for container rpol:neighbor-set type NeighborSet struct { // original -> rpol:neighbor-set-name @@ -2401,6 +4906,24 @@ type NeighborSet struct { NeighborInfoList []string `mapstructure:"neighbor-info-list"` } +func (lhs *NeighborSet) Equal(rhs *NeighborSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.NeighborSetName != rhs.NeighborSetName { + return false + } + if len(lhs.NeighborInfoList) != len(rhs.NeighborInfoList) { + return false + } + for idx, l := range lhs.NeighborInfoList { + if l != rhs.NeighborInfoList[idx] { + return false + } + } + return true +} + //struct for container rpol:prefix type Prefix struct { // original -> rpol:ip-prefix @@ -2410,6 +4933,19 @@ type Prefix struct { MasklengthRange string `mapstructure:"masklength-range"` } +func (lhs *Prefix) Equal(rhs *Prefix) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.IpPrefix != rhs.IpPrefix { + return false + } + if lhs.MasklengthRange != rhs.MasklengthRange { + return false + } + return true +} + //struct for container rpol:prefix-set type PrefixSet struct { // original -> rpol:prefix-set-name @@ -2418,6 +4954,32 @@ type PrefixSet struct { PrefixList []Prefix `mapstructure:"prefix-list"` } +func (lhs *PrefixSet) Equal(rhs *PrefixSet) bool { + if lhs == nil || rhs == nil { + return false + } + if lhs.PrefixSetName != rhs.PrefixSetName { + return false + } + if len(lhs.PrefixList) != len(rhs.PrefixList) { + return false + } + { + lmap := make(map[string]*Prefix) + for _, l := range lhs.PrefixList { + lmap[string(l.IpPrefix+l.MasklengthRange)] = &l + } + for _, r := range rhs.PrefixList { + if l, y := lmap[string(r.IpPrefix+r.MasklengthRange)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} + //struct for container rpol:defined-sets type DefinedSets struct { // original -> rpol:prefix-sets @@ -2430,6 +4992,64 @@ type DefinedSets struct { BgpDefinedSets BgpDefinedSets `mapstructure:"bgp-defined-sets"` } +func (lhs *DefinedSets) Equal(rhs *DefinedSets) bool { + if lhs == nil || rhs == nil { + return false + } + if len(lhs.PrefixSets) != len(rhs.PrefixSets) { + return false + } + { + lmap := make(map[string]*PrefixSet) + for _, l := range lhs.PrefixSets { + lmap[string(l.PrefixSetName)] = &l + } + for _, r := range rhs.PrefixSets { + if l, y := lmap[string(r.PrefixSetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.NeighborSets) != len(rhs.NeighborSets) { + return false + } + { + lmap := make(map[string]*NeighborSet) + for _, l := range lhs.NeighborSets { + lmap[string(l.NeighborSetName)] = &l + } + for _, r := range rhs.NeighborSets { + if l, y := lmap[string(r.NeighborSetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if len(lhs.TagSets) != len(rhs.TagSets) { + return false + } + { + lmap := make(map[string]*TagSet) + for _, l := range lhs.TagSets { + lmap[string(l.TagSetName)] = &l + } + for _, r := range rhs.TagSets { + if l, y := lmap[string(r.TagSetName)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + if !lhs.BgpDefinedSets.Equal(&(rhs.BgpDefinedSets)) { + return false + } + return true +} + //struct for container rpol:routing-policy type RoutingPolicy struct { // original -> rpol:defined-sets @@ -2437,3 +5057,29 @@ type RoutingPolicy struct { // original -> rpol:policy-definitions PolicyDefinitions []PolicyDefinition `mapstructure:"policy-definitions"` } + +func (lhs *RoutingPolicy) Equal(rhs *RoutingPolicy) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.DefinedSets.Equal(&(rhs.DefinedSets)) { + return false + } + if len(lhs.PolicyDefinitions) != len(rhs.PolicyDefinitions) { + return false + } + { + lmap := make(map[string]*PolicyDefinition) + for _, l := range lhs.PolicyDefinitions { + lmap[string(l.Name)] = &l + } + for _, r := range rhs.PolicyDefinitions { + if l, y := lmap[string(r.Name)]; !y { + return false + } else if !r.Equal(l) { + return false + } + } + } + return true +} |