github.com/osrg/gobgp@v2.0.0+incompatible/internal/pkg/config/bgp_configs.go (about) 1 // DO NOT EDIT 2 // generated by pyang using OpenConfig https://github.com/openconfig/public 3 // 4 // Copyright (C) 2014-2016 Nippon Telegraph and Telephone Corporation. 5 // 6 // Licensed under the Apache License, Version 2.0 (the "License"); 7 // you may not use this file except in compliance with the License. 8 // You may obtain a copy of the License at 9 // 10 // http://www.apache.org/licenses/LICENSE-2.0 11 // 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 15 // implied. 16 // See the License for the specific language governing permissions and 17 // limitations under the License. 18 19 package config 20 21 import ( 22 "fmt" 23 24 "github.com/osrg/gobgp/pkg/packet/bgp" 25 ) 26 27 func mapkey(index int, name string) string { 28 if name != "" { 29 return name 30 } 31 return fmt.Sprintf("%v", index) 32 } 33 34 // typedef for typedef openconfig-types:std-regexp. 35 type StdRegexp string 36 37 // typedef for typedef openconfig-types:percentage. 38 type Percentage uint8 39 40 // typedef for typedef bgp-types:rr-cluster-id-type. 41 type RrClusterIdType string 42 43 // typedef for identity bgp-types:remove-private-as-option. 44 // set of options for configuring how private AS path numbers 45 // are removed from advertisements. 46 type RemovePrivateAsOption string 47 48 const ( 49 REMOVE_PRIVATE_AS_OPTION_ALL RemovePrivateAsOption = "all" 50 REMOVE_PRIVATE_AS_OPTION_REPLACE RemovePrivateAsOption = "replace" 51 ) 52 53 var RemovePrivateAsOptionToIntMap = map[RemovePrivateAsOption]int{ 54 REMOVE_PRIVATE_AS_OPTION_ALL: 0, 55 REMOVE_PRIVATE_AS_OPTION_REPLACE: 1, 56 } 57 58 var IntToRemovePrivateAsOptionMap = map[int]RemovePrivateAsOption{ 59 0: REMOVE_PRIVATE_AS_OPTION_ALL, 60 1: REMOVE_PRIVATE_AS_OPTION_REPLACE, 61 } 62 63 func (v RemovePrivateAsOption) Validate() error { 64 if _, ok := RemovePrivateAsOptionToIntMap[v]; !ok { 65 return fmt.Errorf("invalid RemovePrivateAsOption: %s", v) 66 } 67 return nil 68 } 69 70 func (v RemovePrivateAsOption) ToInt() int { 71 i, ok := RemovePrivateAsOptionToIntMap[v] 72 if !ok { 73 return -1 74 } 75 return i 76 } 77 78 // typedef for typedef bgp-types:bgp-community-regexp-type. 79 type BgpCommunityRegexpType StdRegexp 80 81 // typedef for identity bgp-types:community-type. 82 // type describing variations of community attributes: 83 // STANDARD: standard BGP community [rfc1997] 84 // EXTENDED: extended BGP community [rfc4360] 85 // BOTH: both standard and extended community. 86 type CommunityType string 87 88 const ( 89 COMMUNITY_TYPE_STANDARD CommunityType = "standard" 90 COMMUNITY_TYPE_EXTENDED CommunityType = "extended" 91 COMMUNITY_TYPE_BOTH CommunityType = "both" 92 COMMUNITY_TYPE_NONE CommunityType = "none" 93 ) 94 95 var CommunityTypeToIntMap = map[CommunityType]int{ 96 COMMUNITY_TYPE_STANDARD: 0, 97 COMMUNITY_TYPE_EXTENDED: 1, 98 COMMUNITY_TYPE_BOTH: 2, 99 COMMUNITY_TYPE_NONE: 3, 100 } 101 102 var IntToCommunityTypeMap = map[int]CommunityType{ 103 0: COMMUNITY_TYPE_STANDARD, 104 1: COMMUNITY_TYPE_EXTENDED, 105 2: COMMUNITY_TYPE_BOTH, 106 3: COMMUNITY_TYPE_NONE, 107 } 108 109 func (v CommunityType) Validate() error { 110 if _, ok := CommunityTypeToIntMap[v]; !ok { 111 return fmt.Errorf("invalid CommunityType: %s", v) 112 } 113 return nil 114 } 115 116 func (v CommunityType) ToInt() int { 117 i, ok := CommunityTypeToIntMap[v] 118 if !ok { 119 return -1 120 } 121 return i 122 } 123 124 // typedef for typedef bgp-types:bgp-ext-community-type. 125 type BgpExtCommunityType string 126 127 // typedef for typedef bgp-types:bgp-std-community-type. 128 type BgpStdCommunityType string 129 130 // typedef for identity bgp-types:peer-type. 131 // labels a peer or peer group as explicitly internal or 132 // external. 133 type PeerType string 134 135 const ( 136 PEER_TYPE_INTERNAL PeerType = "internal" 137 PEER_TYPE_EXTERNAL PeerType = "external" 138 ) 139 140 var PeerTypeToIntMap = map[PeerType]int{ 141 PEER_TYPE_INTERNAL: 0, 142 PEER_TYPE_EXTERNAL: 1, 143 } 144 145 var IntToPeerTypeMap = map[int]PeerType{ 146 0: PEER_TYPE_INTERNAL, 147 1: PEER_TYPE_EXTERNAL, 148 } 149 150 func (v PeerType) Validate() error { 151 if _, ok := PeerTypeToIntMap[v]; !ok { 152 return fmt.Errorf("invalid PeerType: %s", v) 153 } 154 return nil 155 } 156 157 func (v PeerType) ToInt() int { 158 i, ok := PeerTypeToIntMap[v] 159 if !ok { 160 return -1 161 } 162 return i 163 } 164 165 // typedef for identity bgp-types:bgp-session-direction. 166 // Type to describe the direction of NLRI transmission. 167 type BgpSessionDirection string 168 169 const ( 170 BGP_SESSION_DIRECTION_INBOUND BgpSessionDirection = "inbound" 171 BGP_SESSION_DIRECTION_OUTBOUND BgpSessionDirection = "outbound" 172 ) 173 174 var BgpSessionDirectionToIntMap = map[BgpSessionDirection]int{ 175 BGP_SESSION_DIRECTION_INBOUND: 0, 176 BGP_SESSION_DIRECTION_OUTBOUND: 1, 177 } 178 179 var IntToBgpSessionDirectionMap = map[int]BgpSessionDirection{ 180 0: BGP_SESSION_DIRECTION_INBOUND, 181 1: BGP_SESSION_DIRECTION_OUTBOUND, 182 } 183 184 func (v BgpSessionDirection) Validate() error { 185 if _, ok := BgpSessionDirectionToIntMap[v]; !ok { 186 return fmt.Errorf("invalid BgpSessionDirection: %s", v) 187 } 188 return nil 189 } 190 191 func (v BgpSessionDirection) ToInt() int { 192 i, ok := BgpSessionDirectionToIntMap[v] 193 if !ok { 194 return -1 195 } 196 return i 197 } 198 199 // typedef for identity bgp-types:bgp-origin-attr-type. 200 // Type definition for standard BGP origin attribute. 201 type BgpOriginAttrType string 202 203 const ( 204 BGP_ORIGIN_ATTR_TYPE_IGP BgpOriginAttrType = "igp" 205 BGP_ORIGIN_ATTR_TYPE_EGP BgpOriginAttrType = "egp" 206 BGP_ORIGIN_ATTR_TYPE_INCOMPLETE BgpOriginAttrType = "incomplete" 207 ) 208 209 var BgpOriginAttrTypeToIntMap = map[BgpOriginAttrType]int{ 210 BGP_ORIGIN_ATTR_TYPE_IGP: 0, 211 BGP_ORIGIN_ATTR_TYPE_EGP: 1, 212 BGP_ORIGIN_ATTR_TYPE_INCOMPLETE: 2, 213 } 214 215 var IntToBgpOriginAttrTypeMap = map[int]BgpOriginAttrType{ 216 0: BGP_ORIGIN_ATTR_TYPE_IGP, 217 1: BGP_ORIGIN_ATTR_TYPE_EGP, 218 2: BGP_ORIGIN_ATTR_TYPE_INCOMPLETE, 219 } 220 221 func (v BgpOriginAttrType) Validate() error { 222 if _, ok := BgpOriginAttrTypeToIntMap[v]; !ok { 223 return fmt.Errorf("invalid BgpOriginAttrType: %s", v) 224 } 225 return nil 226 } 227 228 func (v BgpOriginAttrType) ToInt() int { 229 i, ok := BgpOriginAttrTypeToIntMap[v] 230 if !ok { 231 return -1 232 } 233 return i 234 } 235 236 // typedef for identity bgp-types:afi-safi-type. 237 // Base identity type for AFI,SAFI tuples for BGP-4. 238 type AfiSafiType string 239 240 const ( 241 AFI_SAFI_TYPE_IPV4_UNICAST AfiSafiType = "ipv4-unicast" 242 AFI_SAFI_TYPE_IPV6_UNICAST AfiSafiType = "ipv6-unicast" 243 AFI_SAFI_TYPE_IPV4_LABELLED_UNICAST AfiSafiType = "ipv4-labelled-unicast" 244 AFI_SAFI_TYPE_IPV6_LABELLED_UNICAST AfiSafiType = "ipv6-labelled-unicast" 245 AFI_SAFI_TYPE_L3VPN_IPV4_UNICAST AfiSafiType = "l3vpn-ipv4-unicast" 246 AFI_SAFI_TYPE_L3VPN_IPV6_UNICAST AfiSafiType = "l3vpn-ipv6-unicast" 247 AFI_SAFI_TYPE_L3VPN_IPV4_MULTICAST AfiSafiType = "l3vpn-ipv4-multicast" 248 AFI_SAFI_TYPE_L3VPN_IPV6_MULTICAST AfiSafiType = "l3vpn-ipv6-multicast" 249 AFI_SAFI_TYPE_L2VPN_VPLS AfiSafiType = "l2vpn-vpls" 250 AFI_SAFI_TYPE_L2VPN_EVPN AfiSafiType = "l2vpn-evpn" 251 AFI_SAFI_TYPE_IPV4_MULTICAST AfiSafiType = "ipv4-multicast" 252 AFI_SAFI_TYPE_IPV6_MULTICAST AfiSafiType = "ipv6-multicast" 253 AFI_SAFI_TYPE_RTC AfiSafiType = "rtc" 254 AFI_SAFI_TYPE_IPV4_ENCAP AfiSafiType = "ipv4-encap" 255 AFI_SAFI_TYPE_IPV6_ENCAP AfiSafiType = "ipv6-encap" 256 AFI_SAFI_TYPE_IPV4_FLOWSPEC AfiSafiType = "ipv4-flowspec" 257 AFI_SAFI_TYPE_L3VPN_IPV4_FLOWSPEC AfiSafiType = "l3vpn-ipv4-flowspec" 258 AFI_SAFI_TYPE_IPV6_FLOWSPEC AfiSafiType = "ipv6-flowspec" 259 AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC AfiSafiType = "l3vpn-ipv6-flowspec" 260 AFI_SAFI_TYPE_L2VPN_FLOWSPEC AfiSafiType = "l2vpn-flowspec" 261 AFI_SAFI_TYPE_OPAQUE AfiSafiType = "opaque" 262 ) 263 264 var AfiSafiTypeToIntMap = map[AfiSafiType]int{ 265 AFI_SAFI_TYPE_IPV4_UNICAST: 0, 266 AFI_SAFI_TYPE_IPV6_UNICAST: 1, 267 AFI_SAFI_TYPE_IPV4_LABELLED_UNICAST: 2, 268 AFI_SAFI_TYPE_IPV6_LABELLED_UNICAST: 3, 269 AFI_SAFI_TYPE_L3VPN_IPV4_UNICAST: 4, 270 AFI_SAFI_TYPE_L3VPN_IPV6_UNICAST: 5, 271 AFI_SAFI_TYPE_L3VPN_IPV4_MULTICAST: 6, 272 AFI_SAFI_TYPE_L3VPN_IPV6_MULTICAST: 7, 273 AFI_SAFI_TYPE_L2VPN_VPLS: 8, 274 AFI_SAFI_TYPE_L2VPN_EVPN: 9, 275 AFI_SAFI_TYPE_IPV4_MULTICAST: 10, 276 AFI_SAFI_TYPE_IPV6_MULTICAST: 11, 277 AFI_SAFI_TYPE_RTC: 12, 278 AFI_SAFI_TYPE_IPV4_ENCAP: 13, 279 AFI_SAFI_TYPE_IPV6_ENCAP: 14, 280 AFI_SAFI_TYPE_IPV4_FLOWSPEC: 15, 281 AFI_SAFI_TYPE_L3VPN_IPV4_FLOWSPEC: 16, 282 AFI_SAFI_TYPE_IPV6_FLOWSPEC: 17, 283 AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC: 18, 284 AFI_SAFI_TYPE_L2VPN_FLOWSPEC: 19, 285 AFI_SAFI_TYPE_OPAQUE: 20, 286 } 287 288 var IntToAfiSafiTypeMap = map[int]AfiSafiType{ 289 0: AFI_SAFI_TYPE_IPV4_UNICAST, 290 1: AFI_SAFI_TYPE_IPV6_UNICAST, 291 2: AFI_SAFI_TYPE_IPV4_LABELLED_UNICAST, 292 3: AFI_SAFI_TYPE_IPV6_LABELLED_UNICAST, 293 4: AFI_SAFI_TYPE_L3VPN_IPV4_UNICAST, 294 5: AFI_SAFI_TYPE_L3VPN_IPV6_UNICAST, 295 6: AFI_SAFI_TYPE_L3VPN_IPV4_MULTICAST, 296 7: AFI_SAFI_TYPE_L3VPN_IPV6_MULTICAST, 297 8: AFI_SAFI_TYPE_L2VPN_VPLS, 298 9: AFI_SAFI_TYPE_L2VPN_EVPN, 299 10: AFI_SAFI_TYPE_IPV4_MULTICAST, 300 11: AFI_SAFI_TYPE_IPV6_MULTICAST, 301 12: AFI_SAFI_TYPE_RTC, 302 13: AFI_SAFI_TYPE_IPV4_ENCAP, 303 14: AFI_SAFI_TYPE_IPV6_ENCAP, 304 15: AFI_SAFI_TYPE_IPV4_FLOWSPEC, 305 16: AFI_SAFI_TYPE_L3VPN_IPV4_FLOWSPEC, 306 17: AFI_SAFI_TYPE_IPV6_FLOWSPEC, 307 18: AFI_SAFI_TYPE_L3VPN_IPV6_FLOWSPEC, 308 19: AFI_SAFI_TYPE_L2VPN_FLOWSPEC, 309 20: AFI_SAFI_TYPE_OPAQUE, 310 } 311 312 func (v AfiSafiType) Validate() error { 313 if _, ok := AfiSafiTypeToIntMap[v]; !ok { 314 return fmt.Errorf("invalid AfiSafiType: %s", v) 315 } 316 return nil 317 } 318 319 func (v AfiSafiType) ToInt() int { 320 i, ok := AfiSafiTypeToIntMap[v] 321 if !ok { 322 return -1 323 } 324 return i 325 } 326 327 // typedef for identity bgp-types:bgp-capability. 328 // Base identity for a BGP capability. 329 type BgpCapability string 330 331 const ( 332 BGP_CAPABILITY_MPBGP BgpCapability = "mpbgp" 333 BGP_CAPABILITY_ROUTE_REFRESH BgpCapability = "route-refresh" 334 BGP_CAPABILITY_ASN32 BgpCapability = "asn32" 335 BGP_CAPABILITY_GRACEFUL_RESTART BgpCapability = "graceful-restart" 336 BGP_CAPABILITY_ADD_PATHS BgpCapability = "add-paths" 337 ) 338 339 var BgpCapabilityToIntMap = map[BgpCapability]int{ 340 BGP_CAPABILITY_MPBGP: 0, 341 BGP_CAPABILITY_ROUTE_REFRESH: 1, 342 BGP_CAPABILITY_ASN32: 2, 343 BGP_CAPABILITY_GRACEFUL_RESTART: 3, 344 BGP_CAPABILITY_ADD_PATHS: 4, 345 } 346 347 var IntToBgpCapabilityMap = map[int]BgpCapability{ 348 0: BGP_CAPABILITY_MPBGP, 349 1: BGP_CAPABILITY_ROUTE_REFRESH, 350 2: BGP_CAPABILITY_ASN32, 351 3: BGP_CAPABILITY_GRACEFUL_RESTART, 352 4: BGP_CAPABILITY_ADD_PATHS, 353 } 354 355 func (v BgpCapability) Validate() error { 356 if _, ok := BgpCapabilityToIntMap[v]; !ok { 357 return fmt.Errorf("invalid BgpCapability: %s", v) 358 } 359 return nil 360 } 361 362 func (v BgpCapability) ToInt() int { 363 i, ok := BgpCapabilityToIntMap[v] 364 if !ok { 365 return -1 366 } 367 return i 368 } 369 370 // typedef for identity bgp-types:bgp-well-known-std-community. 371 // Reserved communities within the standard community space 372 // defined by RFC1997. These communities must fall within the 373 // range 0x00000000 to 0xFFFFFFFF. 374 type BgpWellKnownStdCommunity string 375 376 const ( 377 BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT BgpWellKnownStdCommunity = "no_export" 378 BGP_WELL_KNOWN_STD_COMMUNITY_NO_ADVERTISE BgpWellKnownStdCommunity = "no_advertise" 379 BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT_SUBCONFED BgpWellKnownStdCommunity = "no_export_subconfed" 380 BGP_WELL_KNOWN_STD_COMMUNITY_NOPEER BgpWellKnownStdCommunity = "nopeer" 381 ) 382 383 var BgpWellKnownStdCommunityToIntMap = map[BgpWellKnownStdCommunity]int{ 384 BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT: 0, 385 BGP_WELL_KNOWN_STD_COMMUNITY_NO_ADVERTISE: 1, 386 BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT_SUBCONFED: 2, 387 BGP_WELL_KNOWN_STD_COMMUNITY_NOPEER: 3, 388 } 389 390 var IntToBgpWellKnownStdCommunityMap = map[int]BgpWellKnownStdCommunity{ 391 0: BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT, 392 1: BGP_WELL_KNOWN_STD_COMMUNITY_NO_ADVERTISE, 393 2: BGP_WELL_KNOWN_STD_COMMUNITY_NO_EXPORT_SUBCONFED, 394 3: BGP_WELL_KNOWN_STD_COMMUNITY_NOPEER, 395 } 396 397 func (v BgpWellKnownStdCommunity) Validate() error { 398 if _, ok := BgpWellKnownStdCommunityToIntMap[v]; !ok { 399 return fmt.Errorf("invalid BgpWellKnownStdCommunity: %s", v) 400 } 401 return nil 402 } 403 404 func (v BgpWellKnownStdCommunity) ToInt() int { 405 i, ok := BgpWellKnownStdCommunityToIntMap[v] 406 if !ok { 407 return -1 408 } 409 return i 410 } 411 412 // typedef for identity ptypes:match-set-options-restricted-type. 413 // Options that govern the behavior of a match statement. The 414 // default behavior is ANY, i.e., the given value matches any 415 // of the members of the defined set. Note this type is a 416 // restricted version of the match-set-options-type. 417 type MatchSetOptionsRestrictedType string 418 419 const ( 420 MATCH_SET_OPTIONS_RESTRICTED_TYPE_ANY MatchSetOptionsRestrictedType = "any" 421 MATCH_SET_OPTIONS_RESTRICTED_TYPE_INVERT MatchSetOptionsRestrictedType = "invert" 422 ) 423 424 var MatchSetOptionsRestrictedTypeToIntMap = map[MatchSetOptionsRestrictedType]int{ 425 MATCH_SET_OPTIONS_RESTRICTED_TYPE_ANY: 0, 426 MATCH_SET_OPTIONS_RESTRICTED_TYPE_INVERT: 1, 427 } 428 429 var IntToMatchSetOptionsRestrictedTypeMap = map[int]MatchSetOptionsRestrictedType{ 430 0: MATCH_SET_OPTIONS_RESTRICTED_TYPE_ANY, 431 1: MATCH_SET_OPTIONS_RESTRICTED_TYPE_INVERT, 432 } 433 434 func (v MatchSetOptionsRestrictedType) Validate() error { 435 if _, ok := MatchSetOptionsRestrictedTypeToIntMap[v]; !ok { 436 return fmt.Errorf("invalid MatchSetOptionsRestrictedType: %s", v) 437 } 438 return nil 439 } 440 441 func (v MatchSetOptionsRestrictedType) Default() MatchSetOptionsRestrictedType { 442 return MATCH_SET_OPTIONS_RESTRICTED_TYPE_ANY 443 } 444 445 func (v MatchSetOptionsRestrictedType) DefaultAsNeeded() MatchSetOptionsRestrictedType { 446 if string(v) == "" { 447 return v.Default() 448 } 449 return v 450 } 451 func (v MatchSetOptionsRestrictedType) ToInt() int { 452 _v := v.DefaultAsNeeded() 453 i, ok := MatchSetOptionsRestrictedTypeToIntMap[_v] 454 if !ok { 455 return -1 456 } 457 return i 458 } 459 460 // typedef for identity ptypes:match-set-options-type. 461 // Options that govern the behavior of a match statement. The 462 // default behavior is ANY, i.e., the given value matches any 463 // of the members of the defined set. 464 type MatchSetOptionsType string 465 466 const ( 467 MATCH_SET_OPTIONS_TYPE_ANY MatchSetOptionsType = "any" 468 MATCH_SET_OPTIONS_TYPE_ALL MatchSetOptionsType = "all" 469 MATCH_SET_OPTIONS_TYPE_INVERT MatchSetOptionsType = "invert" 470 ) 471 472 var MatchSetOptionsTypeToIntMap = map[MatchSetOptionsType]int{ 473 MATCH_SET_OPTIONS_TYPE_ANY: 0, 474 MATCH_SET_OPTIONS_TYPE_ALL: 1, 475 MATCH_SET_OPTIONS_TYPE_INVERT: 2, 476 } 477 478 var IntToMatchSetOptionsTypeMap = map[int]MatchSetOptionsType{ 479 0: MATCH_SET_OPTIONS_TYPE_ANY, 480 1: MATCH_SET_OPTIONS_TYPE_ALL, 481 2: MATCH_SET_OPTIONS_TYPE_INVERT, 482 } 483 484 func (v MatchSetOptionsType) Validate() error { 485 if _, ok := MatchSetOptionsTypeToIntMap[v]; !ok { 486 return fmt.Errorf("invalid MatchSetOptionsType: %s", v) 487 } 488 return nil 489 } 490 491 func (v MatchSetOptionsType) Default() MatchSetOptionsType { 492 return MATCH_SET_OPTIONS_TYPE_ANY 493 } 494 495 func (v MatchSetOptionsType) DefaultAsNeeded() MatchSetOptionsType { 496 if string(v) == "" { 497 return v.Default() 498 } 499 return v 500 } 501 func (v MatchSetOptionsType) ToInt() int { 502 _v := v.DefaultAsNeeded() 503 i, ok := MatchSetOptionsTypeToIntMap[_v] 504 if !ok { 505 return -1 506 } 507 return i 508 } 509 510 // typedef for typedef ptypes:tag-type. 511 type TagType string 512 513 // typedef for identity ptypes:install-protocol-type. 514 // Base type for protocols which can install prefixes into the 515 // RIB. 516 type InstallProtocolType string 517 518 const ( 519 INSTALL_PROTOCOL_TYPE_BGP InstallProtocolType = "bgp" 520 INSTALL_PROTOCOL_TYPE_ISIS InstallProtocolType = "isis" 521 INSTALL_PROTOCOL_TYPE_OSPF InstallProtocolType = "ospf" 522 INSTALL_PROTOCOL_TYPE_OSPF3 InstallProtocolType = "ospf3" 523 INSTALL_PROTOCOL_TYPE_STATIC InstallProtocolType = "static" 524 INSTALL_PROTOCOL_TYPE_DIRECTLY_CONNECTED InstallProtocolType = "directly-connected" 525 INSTALL_PROTOCOL_TYPE_LOCAL_AGGREGATE InstallProtocolType = "local-aggregate" 526 ) 527 528 var InstallProtocolTypeToIntMap = map[InstallProtocolType]int{ 529 INSTALL_PROTOCOL_TYPE_BGP: 0, 530 INSTALL_PROTOCOL_TYPE_ISIS: 1, 531 INSTALL_PROTOCOL_TYPE_OSPF: 2, 532 INSTALL_PROTOCOL_TYPE_OSPF3: 3, 533 INSTALL_PROTOCOL_TYPE_STATIC: 4, 534 INSTALL_PROTOCOL_TYPE_DIRECTLY_CONNECTED: 5, 535 INSTALL_PROTOCOL_TYPE_LOCAL_AGGREGATE: 6, 536 } 537 538 var IntToInstallProtocolTypeMap = map[int]InstallProtocolType{ 539 0: INSTALL_PROTOCOL_TYPE_BGP, 540 1: INSTALL_PROTOCOL_TYPE_ISIS, 541 2: INSTALL_PROTOCOL_TYPE_OSPF, 542 3: INSTALL_PROTOCOL_TYPE_OSPF3, 543 4: INSTALL_PROTOCOL_TYPE_STATIC, 544 5: INSTALL_PROTOCOL_TYPE_DIRECTLY_CONNECTED, 545 6: INSTALL_PROTOCOL_TYPE_LOCAL_AGGREGATE, 546 } 547 548 func (v InstallProtocolType) Validate() error { 549 if _, ok := InstallProtocolTypeToIntMap[v]; !ok { 550 return fmt.Errorf("invalid InstallProtocolType: %s", v) 551 } 552 return nil 553 } 554 555 func (v InstallProtocolType) ToInt() int { 556 i, ok := InstallProtocolTypeToIntMap[v] 557 if !ok { 558 return -1 559 } 560 return i 561 } 562 563 // typedef for identity ptypes:attribute-comparison. 564 // base type for supported comparison operators on route 565 // attributes. 566 type AttributeComparison string 567 568 const ( 569 ATTRIBUTE_COMPARISON_ATTRIBUTE_EQ AttributeComparison = "attribute-eq" 570 ATTRIBUTE_COMPARISON_ATTRIBUTE_GE AttributeComparison = "attribute-ge" 571 ATTRIBUTE_COMPARISON_ATTRIBUTE_LE AttributeComparison = "attribute-le" 572 ATTRIBUTE_COMPARISON_EQ AttributeComparison = "eq" 573 ATTRIBUTE_COMPARISON_GE AttributeComparison = "ge" 574 ATTRIBUTE_COMPARISON_LE AttributeComparison = "le" 575 ) 576 577 var AttributeComparisonToIntMap = map[AttributeComparison]int{ 578 ATTRIBUTE_COMPARISON_ATTRIBUTE_EQ: 0, 579 ATTRIBUTE_COMPARISON_ATTRIBUTE_GE: 1, 580 ATTRIBUTE_COMPARISON_ATTRIBUTE_LE: 2, 581 ATTRIBUTE_COMPARISON_EQ: 3, 582 ATTRIBUTE_COMPARISON_GE: 4, 583 ATTRIBUTE_COMPARISON_LE: 5, 584 } 585 586 var IntToAttributeComparisonMap = map[int]AttributeComparison{ 587 0: ATTRIBUTE_COMPARISON_ATTRIBUTE_EQ, 588 1: ATTRIBUTE_COMPARISON_ATTRIBUTE_GE, 589 2: ATTRIBUTE_COMPARISON_ATTRIBUTE_LE, 590 3: ATTRIBUTE_COMPARISON_EQ, 591 4: ATTRIBUTE_COMPARISON_GE, 592 5: ATTRIBUTE_COMPARISON_LE, 593 } 594 595 func (v AttributeComparison) Validate() error { 596 if _, ok := AttributeComparisonToIntMap[v]; !ok { 597 return fmt.Errorf("invalid AttributeComparison: %s", v) 598 } 599 return nil 600 } 601 602 func (v AttributeComparison) ToInt() int { 603 i, ok := AttributeComparisonToIntMap[v] 604 if !ok { 605 return -1 606 } 607 return i 608 } 609 610 // typedef for identity rpol:route-disposition. 611 // Select the final disposition for the route, either 612 // accept or reject. 613 type RouteDisposition string 614 615 const ( 616 ROUTE_DISPOSITION_NONE RouteDisposition = "none" 617 ROUTE_DISPOSITION_ACCEPT_ROUTE RouteDisposition = "accept-route" 618 ROUTE_DISPOSITION_REJECT_ROUTE RouteDisposition = "reject-route" 619 ) 620 621 var RouteDispositionToIntMap = map[RouteDisposition]int{ 622 ROUTE_DISPOSITION_NONE: 0, 623 ROUTE_DISPOSITION_ACCEPT_ROUTE: 1, 624 ROUTE_DISPOSITION_REJECT_ROUTE: 2, 625 } 626 627 var IntToRouteDispositionMap = map[int]RouteDisposition{ 628 0: ROUTE_DISPOSITION_NONE, 629 1: ROUTE_DISPOSITION_ACCEPT_ROUTE, 630 2: ROUTE_DISPOSITION_REJECT_ROUTE, 631 } 632 633 func (v RouteDisposition) Validate() error { 634 if _, ok := RouteDispositionToIntMap[v]; !ok { 635 return fmt.Errorf("invalid RouteDisposition: %s", v) 636 } 637 return nil 638 } 639 640 func (v RouteDisposition) ToInt() int { 641 i, ok := RouteDispositionToIntMap[v] 642 if !ok { 643 return -1 644 } 645 return i 646 } 647 648 // typedef for identity rpol:route-type. 649 // Condition to check the route type in the route update. 650 type RouteType string 651 652 const ( 653 ROUTE_TYPE_NONE RouteType = "none" 654 ROUTE_TYPE_INTERNAL RouteType = "internal" 655 ROUTE_TYPE_EXTERNAL RouteType = "external" 656 ROUTE_TYPE_LOCAL RouteType = "local" 657 ) 658 659 var RouteTypeToIntMap = map[RouteType]int{ 660 ROUTE_TYPE_NONE: 0, 661 ROUTE_TYPE_INTERNAL: 1, 662 ROUTE_TYPE_EXTERNAL: 2, 663 ROUTE_TYPE_LOCAL: 3, 664 } 665 666 var IntToRouteTypeMap = map[int]RouteType{ 667 0: ROUTE_TYPE_NONE, 668 1: ROUTE_TYPE_INTERNAL, 669 2: ROUTE_TYPE_EXTERNAL, 670 3: ROUTE_TYPE_LOCAL, 671 } 672 673 func (v RouteType) Validate() error { 674 if _, ok := RouteTypeToIntMap[v]; !ok { 675 return fmt.Errorf("invalid RouteType: %s", v) 676 } 677 return nil 678 } 679 680 func (v RouteType) ToInt() int { 681 i, ok := RouteTypeToIntMap[v] 682 if !ok { 683 return -1 684 } 685 return i 686 } 687 688 // typedef for identity rpol:default-policy-type. 689 // type used to specify default route disposition in 690 // a policy chain. 691 type DefaultPolicyType string 692 693 const ( 694 DEFAULT_POLICY_TYPE_ACCEPT_ROUTE DefaultPolicyType = "accept-route" 695 DEFAULT_POLICY_TYPE_REJECT_ROUTE DefaultPolicyType = "reject-route" 696 ) 697 698 var DefaultPolicyTypeToIntMap = map[DefaultPolicyType]int{ 699 DEFAULT_POLICY_TYPE_ACCEPT_ROUTE: 0, 700 DEFAULT_POLICY_TYPE_REJECT_ROUTE: 1, 701 } 702 703 var IntToDefaultPolicyTypeMap = map[int]DefaultPolicyType{ 704 0: DEFAULT_POLICY_TYPE_ACCEPT_ROUTE, 705 1: DEFAULT_POLICY_TYPE_REJECT_ROUTE, 706 } 707 708 func (v DefaultPolicyType) Validate() error { 709 if _, ok := DefaultPolicyTypeToIntMap[v]; !ok { 710 return fmt.Errorf("invalid DefaultPolicyType: %s", v) 711 } 712 return nil 713 } 714 715 func (v DefaultPolicyType) ToInt() int { 716 i, ok := DefaultPolicyTypeToIntMap[v] 717 if !ok { 718 return -1 719 } 720 return i 721 } 722 723 // typedef for identity bgp:session-state. 724 // Operational state of the BGP peer. 725 type SessionState string 726 727 const ( 728 SESSION_STATE_IDLE SessionState = "idle" 729 SESSION_STATE_CONNECT SessionState = "connect" 730 SESSION_STATE_ACTIVE SessionState = "active" 731 SESSION_STATE_OPENSENT SessionState = "opensent" 732 SESSION_STATE_OPENCONFIRM SessionState = "openconfirm" 733 SESSION_STATE_ESTABLISHED SessionState = "established" 734 ) 735 736 var SessionStateToIntMap = map[SessionState]int{ 737 SESSION_STATE_IDLE: 0, 738 SESSION_STATE_CONNECT: 1, 739 SESSION_STATE_ACTIVE: 2, 740 SESSION_STATE_OPENSENT: 3, 741 SESSION_STATE_OPENCONFIRM: 4, 742 SESSION_STATE_ESTABLISHED: 5, 743 } 744 745 var IntToSessionStateMap = map[int]SessionState{ 746 0: SESSION_STATE_IDLE, 747 1: SESSION_STATE_CONNECT, 748 2: SESSION_STATE_ACTIVE, 749 3: SESSION_STATE_OPENSENT, 750 4: SESSION_STATE_OPENCONFIRM, 751 5: SESSION_STATE_ESTABLISHED, 752 } 753 754 func (v SessionState) Validate() error { 755 if _, ok := SessionStateToIntMap[v]; !ok { 756 return fmt.Errorf("invalid SessionState: %s", v) 757 } 758 return nil 759 } 760 761 func (v SessionState) ToInt() int { 762 i, ok := SessionStateToIntMap[v] 763 if !ok { 764 return -1 765 } 766 return i 767 } 768 769 // typedef for identity bgp:admin-state. 770 type AdminState string 771 772 const ( 773 ADMIN_STATE_UP AdminState = "up" 774 ADMIN_STATE_DOWN AdminState = "down" 775 ADMIN_STATE_PFX_CT AdminState = "pfx_ct" 776 ) 777 778 var AdminStateToIntMap = map[AdminState]int{ 779 ADMIN_STATE_UP: 0, 780 ADMIN_STATE_DOWN: 1, 781 ADMIN_STATE_PFX_CT: 2, 782 } 783 784 var IntToAdminStateMap = map[int]AdminState{ 785 0: ADMIN_STATE_UP, 786 1: ADMIN_STATE_DOWN, 787 2: ADMIN_STATE_PFX_CT, 788 } 789 790 func (v AdminState) Validate() error { 791 if _, ok := AdminStateToIntMap[v]; !ok { 792 return fmt.Errorf("invalid AdminState: %s", v) 793 } 794 return nil 795 } 796 797 func (v AdminState) ToInt() int { 798 i, ok := AdminStateToIntMap[v] 799 if !ok { 800 return -1 801 } 802 return i 803 } 804 805 // typedef for identity bgp:mode. 806 // Ths leaf indicates the mode of operation of BGP graceful 807 // restart with the peer. 808 type Mode string 809 810 const ( 811 MODE_HELPER_ONLY Mode = "helper-only" 812 MODE_BILATERAL Mode = "bilateral" 813 MODE_REMOTE_HELPER Mode = "remote-helper" 814 ) 815 816 var ModeToIntMap = map[Mode]int{ 817 MODE_HELPER_ONLY: 0, 818 MODE_BILATERAL: 1, 819 MODE_REMOTE_HELPER: 2, 820 } 821 822 var IntToModeMap = map[int]Mode{ 823 0: MODE_HELPER_ONLY, 824 1: MODE_BILATERAL, 825 2: MODE_REMOTE_HELPER, 826 } 827 828 func (v Mode) Validate() error { 829 if _, ok := ModeToIntMap[v]; !ok { 830 return fmt.Errorf("invalid Mode: %s", v) 831 } 832 return nil 833 } 834 835 func (v Mode) ToInt() int { 836 i, ok := ModeToIntMap[v] 837 if !ok { 838 return -1 839 } 840 return i 841 } 842 843 // typedef for typedef bgp-pol:bgp-next-hop-type. 844 type BgpNextHopType string 845 846 // typedef for typedef bgp-pol:bgp-as-path-prepend-repeat. 847 type BgpAsPathPrependRepeat uint8 848 849 // typedef for typedef bgp-pol:bgp-set-med-type. 850 type BgpSetMedType string 851 852 // typedef for identity bgp-pol:bgp-set-community-option-type. 853 // Type definition for options when setting the community 854 // attribute in a policy action. 855 type BgpSetCommunityOptionType string 856 857 const ( 858 BGP_SET_COMMUNITY_OPTION_TYPE_ADD BgpSetCommunityOptionType = "add" 859 BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE BgpSetCommunityOptionType = "remove" 860 BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE BgpSetCommunityOptionType = "replace" 861 ) 862 863 var BgpSetCommunityOptionTypeToIntMap = map[BgpSetCommunityOptionType]int{ 864 BGP_SET_COMMUNITY_OPTION_TYPE_ADD: 0, 865 BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: 1, 866 BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: 2, 867 } 868 869 var IntToBgpSetCommunityOptionTypeMap = map[int]BgpSetCommunityOptionType{ 870 0: BGP_SET_COMMUNITY_OPTION_TYPE_ADD, 871 1: BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, 872 2: BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, 873 } 874 875 func (v BgpSetCommunityOptionType) Validate() error { 876 if _, ok := BgpSetCommunityOptionTypeToIntMap[v]; !ok { 877 return fmt.Errorf("invalid BgpSetCommunityOptionType: %s", v) 878 } 879 return nil 880 } 881 882 func (v BgpSetCommunityOptionType) ToInt() int { 883 i, ok := BgpSetCommunityOptionTypeToIntMap[v] 884 if !ok { 885 return -1 886 } 887 return i 888 } 889 890 // typedef for identity gobgp:bmp-route-monitoring-policy-type. 891 type BmpRouteMonitoringPolicyType string 892 893 const ( 894 BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY BmpRouteMonitoringPolicyType = "pre-policy" 895 BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY BmpRouteMonitoringPolicyType = "post-policy" 896 BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH BmpRouteMonitoringPolicyType = "both" 897 BMP_ROUTE_MONITORING_POLICY_TYPE_LOCAL_RIB BmpRouteMonitoringPolicyType = "local-rib" 898 BMP_ROUTE_MONITORING_POLICY_TYPE_ALL BmpRouteMonitoringPolicyType = "all" 899 ) 900 901 var BmpRouteMonitoringPolicyTypeToIntMap = map[BmpRouteMonitoringPolicyType]int{ 902 BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY: 0, 903 BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY: 1, 904 BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH: 2, 905 BMP_ROUTE_MONITORING_POLICY_TYPE_LOCAL_RIB: 3, 906 BMP_ROUTE_MONITORING_POLICY_TYPE_ALL: 4, 907 } 908 909 var IntToBmpRouteMonitoringPolicyTypeMap = map[int]BmpRouteMonitoringPolicyType{ 910 0: BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY, 911 1: BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY, 912 2: BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH, 913 3: BMP_ROUTE_MONITORING_POLICY_TYPE_LOCAL_RIB, 914 4: BMP_ROUTE_MONITORING_POLICY_TYPE_ALL, 915 } 916 917 func (v BmpRouteMonitoringPolicyType) Validate() error { 918 if _, ok := BmpRouteMonitoringPolicyTypeToIntMap[v]; !ok { 919 return fmt.Errorf("invalid BmpRouteMonitoringPolicyType: %s", v) 920 } 921 return nil 922 } 923 924 func (v BmpRouteMonitoringPolicyType) ToInt() int { 925 i, ok := BmpRouteMonitoringPolicyTypeToIntMap[v] 926 if !ok { 927 return -1 928 } 929 return i 930 } 931 932 // typedef for identity gobgp:mrt-type. 933 type MrtType string 934 935 const ( 936 MRT_TYPE_UPDATES MrtType = "updates" 937 MRT_TYPE_TABLE MrtType = "table" 938 ) 939 940 var MrtTypeToIntMap = map[MrtType]int{ 941 MRT_TYPE_UPDATES: 0, 942 MRT_TYPE_TABLE: 1, 943 } 944 945 var IntToMrtTypeMap = map[int]MrtType{ 946 0: MRT_TYPE_UPDATES, 947 1: MRT_TYPE_TABLE, 948 } 949 950 func (v MrtType) Validate() error { 951 if _, ok := MrtTypeToIntMap[v]; !ok { 952 return fmt.Errorf("invalid MrtType: %s", v) 953 } 954 return nil 955 } 956 957 func (v MrtType) ToInt() int { 958 i, ok := MrtTypeToIntMap[v] 959 if !ok { 960 return -1 961 } 962 return i 963 } 964 965 // typedef for identity gobgp:rpki-validation-result-type. 966 // indicate the validation result of RPKI based on ROA. 967 type RpkiValidationResultType string 968 969 const ( 970 RPKI_VALIDATION_RESULT_TYPE_NONE RpkiValidationResultType = "none" 971 RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND RpkiValidationResultType = "not-found" 972 RPKI_VALIDATION_RESULT_TYPE_VALID RpkiValidationResultType = "valid" 973 RPKI_VALIDATION_RESULT_TYPE_INVALID RpkiValidationResultType = "invalid" 974 ) 975 976 var RpkiValidationResultTypeToIntMap = map[RpkiValidationResultType]int{ 977 RPKI_VALIDATION_RESULT_TYPE_NONE: 0, 978 RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND: 1, 979 RPKI_VALIDATION_RESULT_TYPE_VALID: 2, 980 RPKI_VALIDATION_RESULT_TYPE_INVALID: 3, 981 } 982 983 var IntToRpkiValidationResultTypeMap = map[int]RpkiValidationResultType{ 984 0: RPKI_VALIDATION_RESULT_TYPE_NONE, 985 1: RPKI_VALIDATION_RESULT_TYPE_NOT_FOUND, 986 2: RPKI_VALIDATION_RESULT_TYPE_VALID, 987 3: RPKI_VALIDATION_RESULT_TYPE_INVALID, 988 } 989 990 func (v RpkiValidationResultType) Validate() error { 991 if _, ok := RpkiValidationResultTypeToIntMap[v]; !ok { 992 return fmt.Errorf("invalid RpkiValidationResultType: %s", v) 993 } 994 return nil 995 } 996 997 func (v RpkiValidationResultType) ToInt() int { 998 i, ok := RpkiValidationResultTypeToIntMap[v] 999 if !ok { 1000 return -1 1001 } 1002 return i 1003 } 1004 1005 // struct for container gobgp:state. 1006 type DynamicNeighborState struct { 1007 // original -> gobgp:prefix 1008 Prefix string `mapstructure:"prefix" json:"prefix,omitempty"` 1009 // original -> gobgp:peer-group 1010 PeerGroup string `mapstructure:"peer-group" json:"peer-group,omitempty"` 1011 } 1012 1013 // struct for container gobgp:config. 1014 type DynamicNeighborConfig struct { 1015 // original -> gobgp:prefix 1016 Prefix string `mapstructure:"prefix" json:"prefix,omitempty"` 1017 // original -> gobgp:peer-group 1018 PeerGroup string `mapstructure:"peer-group" json:"peer-group,omitempty"` 1019 } 1020 1021 func (lhs *DynamicNeighborConfig) Equal(rhs *DynamicNeighborConfig) bool { 1022 if lhs == nil || rhs == nil { 1023 return false 1024 } 1025 if lhs.Prefix != rhs.Prefix { 1026 return false 1027 } 1028 if lhs.PeerGroup != rhs.PeerGroup { 1029 return false 1030 } 1031 return true 1032 } 1033 1034 // struct for container gobgp:dynamic-neighbor. 1035 type DynamicNeighbor struct { 1036 // original -> gobgp:prefix 1037 // original -> gobgp:dynamic-neighbor-config 1038 Config DynamicNeighborConfig `mapstructure:"config" json:"config,omitempty"` 1039 // original -> gobgp:dynamic-neighbor-state 1040 State DynamicNeighborState `mapstructure:"state" json:"state,omitempty"` 1041 } 1042 1043 func (lhs *DynamicNeighbor) Equal(rhs *DynamicNeighbor) bool { 1044 if lhs == nil || rhs == nil { 1045 return false 1046 } 1047 if !lhs.Config.Equal(&(rhs.Config)) { 1048 return false 1049 } 1050 return true 1051 } 1052 1053 // struct for container gobgp:state. 1054 type CollectorState struct { 1055 // original -> gobgp:url 1056 Url string `mapstructure:"url" json:"url,omitempty"` 1057 // original -> gobgp:db-name 1058 DbName string `mapstructure:"db-name" json:"db-name,omitempty"` 1059 // original -> gobgp:table-dump-interval 1060 TableDumpInterval uint64 `mapstructure:"table-dump-interval" json:"table-dump-interval,omitempty"` 1061 } 1062 1063 // struct for container gobgp:config. 1064 type CollectorConfig struct { 1065 // original -> gobgp:url 1066 Url string `mapstructure:"url" json:"url,omitempty"` 1067 // original -> gobgp:db-name 1068 DbName string `mapstructure:"db-name" json:"db-name,omitempty"` 1069 // original -> gobgp:table-dump-interval 1070 TableDumpInterval uint64 `mapstructure:"table-dump-interval" json:"table-dump-interval,omitempty"` 1071 } 1072 1073 func (lhs *CollectorConfig) Equal(rhs *CollectorConfig) bool { 1074 if lhs == nil || rhs == nil { 1075 return false 1076 } 1077 if lhs.Url != rhs.Url { 1078 return false 1079 } 1080 if lhs.DbName != rhs.DbName { 1081 return false 1082 } 1083 if lhs.TableDumpInterval != rhs.TableDumpInterval { 1084 return false 1085 } 1086 return true 1087 } 1088 1089 // struct for container gobgp:collector. 1090 type Collector struct { 1091 // original -> gobgp:collector-config 1092 Config CollectorConfig `mapstructure:"config" json:"config,omitempty"` 1093 // original -> gobgp:collector-state 1094 State CollectorState `mapstructure:"state" json:"state,omitempty"` 1095 } 1096 1097 func (lhs *Collector) Equal(rhs *Collector) bool { 1098 if lhs == nil || rhs == nil { 1099 return false 1100 } 1101 if !lhs.Config.Equal(&(rhs.Config)) { 1102 return false 1103 } 1104 return true 1105 } 1106 1107 // struct for container gobgp:state. 1108 type ZebraState struct { 1109 // original -> gobgp:enabled 1110 // gobgp:enabled's original type is boolean. 1111 // Configure enabling to connect to zebra. 1112 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 1113 // original -> gobgp:url 1114 // Configure url for zebra. 1115 Url string `mapstructure:"url" json:"url,omitempty"` 1116 // original -> gobgp:redistribute-route-type 1117 RedistributeRouteTypeList []string `mapstructure:"redistribute-route-type-list" json:"redistribute-route-type-list,omitempty"` 1118 // original -> gobgp:version 1119 // Configure version of zebra protocol. Default is 2. Supported up to 3. 1120 Version uint8 `mapstructure:"version" json:"version,omitempty"` 1121 // original -> gobgp:nexthop-trigger-enable 1122 // gobgp:nexthop-trigger-enable's original type is boolean. 1123 NexthopTriggerEnable bool `mapstructure:"nexthop-trigger-enable" json:"nexthop-trigger-enable,omitempty"` 1124 // original -> gobgp:nexthop-trigger-delay 1125 NexthopTriggerDelay uint8 `mapstructure:"nexthop-trigger-delay" json:"nexthop-trigger-delay,omitempty"` 1126 } 1127 1128 // struct for container gobgp:config. 1129 type ZebraConfig struct { 1130 // original -> gobgp:enabled 1131 // gobgp:enabled's original type is boolean. 1132 // Configure enabling to connect to zebra. 1133 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 1134 // original -> gobgp:url 1135 // Configure url for zebra. 1136 Url string `mapstructure:"url" json:"url,omitempty"` 1137 // original -> gobgp:redistribute-route-type 1138 RedistributeRouteTypeList []string `mapstructure:"redistribute-route-type-list" json:"redistribute-route-type-list,omitempty"` 1139 // original -> gobgp:version 1140 // Configure version of zebra protocol. Default is 2. Supported up to 3. 1141 Version uint8 `mapstructure:"version" json:"version,omitempty"` 1142 // original -> gobgp:nexthop-trigger-enable 1143 // gobgp:nexthop-trigger-enable's original type is boolean. 1144 NexthopTriggerEnable bool `mapstructure:"nexthop-trigger-enable" json:"nexthop-trigger-enable,omitempty"` 1145 // original -> gobgp:nexthop-trigger-delay 1146 NexthopTriggerDelay uint8 `mapstructure:"nexthop-trigger-delay" json:"nexthop-trigger-delay,omitempty"` 1147 } 1148 1149 func (lhs *ZebraConfig) Equal(rhs *ZebraConfig) bool { 1150 if lhs == nil || rhs == nil { 1151 return false 1152 } 1153 if lhs.Enabled != rhs.Enabled { 1154 return false 1155 } 1156 if lhs.Url != rhs.Url { 1157 return false 1158 } 1159 if len(lhs.RedistributeRouteTypeList) != len(rhs.RedistributeRouteTypeList) { 1160 return false 1161 } 1162 for idx, l := range lhs.RedistributeRouteTypeList { 1163 if l != rhs.RedistributeRouteTypeList[idx] { 1164 return false 1165 } 1166 } 1167 if lhs.Version != rhs.Version { 1168 return false 1169 } 1170 if lhs.NexthopTriggerEnable != rhs.NexthopTriggerEnable { 1171 return false 1172 } 1173 if lhs.NexthopTriggerDelay != rhs.NexthopTriggerDelay { 1174 return false 1175 } 1176 return true 1177 } 1178 1179 // struct for container gobgp:zebra. 1180 type Zebra struct { 1181 // original -> gobgp:zebra-config 1182 Config ZebraConfig `mapstructure:"config" json:"config,omitempty"` 1183 // original -> gobgp:zebra-state 1184 State ZebraState `mapstructure:"state" json:"state,omitempty"` 1185 } 1186 1187 func (lhs *Zebra) Equal(rhs *Zebra) bool { 1188 if lhs == nil || rhs == nil { 1189 return false 1190 } 1191 if !lhs.Config.Equal(&(rhs.Config)) { 1192 return false 1193 } 1194 return true 1195 } 1196 1197 // struct for container gobgp:config. 1198 type MrtConfig struct { 1199 // original -> gobgp:dump-type 1200 DumpType MrtType `mapstructure:"dump-type" json:"dump-type,omitempty"` 1201 // original -> gobgp:file-name 1202 // Configures a file name to be written. 1203 FileName string `mapstructure:"file-name" json:"file-name,omitempty"` 1204 // original -> gobgp:table-name 1205 // specify the table name with route server setup. 1206 TableName string `mapstructure:"table-name" json:"table-name,omitempty"` 1207 // original -> gobgp:dump-interval 1208 DumpInterval uint64 `mapstructure:"dump-interval" json:"dump-interval,omitempty"` 1209 // original -> gobgp:rotation-interval 1210 RotationInterval uint64 `mapstructure:"rotation-interval" json:"rotation-interval,omitempty"` 1211 } 1212 1213 func (lhs *MrtConfig) Equal(rhs *MrtConfig) bool { 1214 if lhs == nil || rhs == nil { 1215 return false 1216 } 1217 if lhs.DumpType != rhs.DumpType { 1218 return false 1219 } 1220 if lhs.FileName != rhs.FileName { 1221 return false 1222 } 1223 if lhs.TableName != rhs.TableName { 1224 return false 1225 } 1226 if lhs.DumpInterval != rhs.DumpInterval { 1227 return false 1228 } 1229 if lhs.RotationInterval != rhs.RotationInterval { 1230 return false 1231 } 1232 return true 1233 } 1234 1235 // struct for container gobgp:mrt. 1236 type Mrt struct { 1237 // original -> gobgp:file-name 1238 // original -> gobgp:mrt-config 1239 Config MrtConfig `mapstructure:"config" json:"config,omitempty"` 1240 } 1241 1242 func (lhs *Mrt) Equal(rhs *Mrt) bool { 1243 if lhs == nil || rhs == nil { 1244 return false 1245 } 1246 if !lhs.Config.Equal(&(rhs.Config)) { 1247 return false 1248 } 1249 return true 1250 } 1251 1252 // struct for container gobgp:state. 1253 // Configured states of VRF. 1254 type VrfState struct { 1255 // original -> gobgp:name 1256 // Unique name among all VRF instances. 1257 Name string `mapstructure:"name" json:"name,omitempty"` 1258 // original -> gobgp:id 1259 // Unique identifier among all VRF instances. 1260 Id uint32 `mapstructure:"id" json:"id,omitempty"` 1261 // original -> gobgp:rd 1262 // Route Distinguisher for this VRF. 1263 Rd string `mapstructure:"rd" json:"rd,omitempty"` 1264 // original -> gobgp:import-rt 1265 // List of import Route Targets for this VRF. 1266 ImportRtList []string `mapstructure:"import-rt-list" json:"import-rt-list,omitempty"` 1267 // original -> gobgp:export-rt 1268 // List of export Route Targets for this VRF. 1269 ExportRtList []string `mapstructure:"export-rt-list" json:"export-rt-list,omitempty"` 1270 } 1271 1272 // struct for container gobgp:config. 1273 // Configuration parameters for VRF. 1274 type VrfConfig struct { 1275 // original -> gobgp:name 1276 // Unique name among all VRF instances. 1277 Name string `mapstructure:"name" json:"name,omitempty"` 1278 // original -> gobgp:id 1279 // Unique identifier among all VRF instances. 1280 Id uint32 `mapstructure:"id" json:"id,omitempty"` 1281 // original -> gobgp:rd 1282 // Route Distinguisher for this VRF. 1283 Rd string `mapstructure:"rd" json:"rd,omitempty"` 1284 // original -> gobgp:import-rt 1285 // List of import Route Targets for this VRF. 1286 ImportRtList []string `mapstructure:"import-rt-list" json:"import-rt-list,omitempty"` 1287 // original -> gobgp:export-rt 1288 // List of export Route Targets for this VRF. 1289 ExportRtList []string `mapstructure:"export-rt-list" json:"export-rt-list,omitempty"` 1290 // original -> gobgp:both-rt 1291 // List of both import and export Route Targets for this VRF. Each 1292 // configuration for import and export Route Targets will be preferred. 1293 BothRtList []string `mapstructure:"both-rt-list" json:"both-rt-list,omitempty"` 1294 } 1295 1296 func (lhs *VrfConfig) Equal(rhs *VrfConfig) bool { 1297 if lhs == nil || rhs == nil { 1298 return false 1299 } 1300 if lhs.Name != rhs.Name { 1301 return false 1302 } 1303 if lhs.Id != rhs.Id { 1304 return false 1305 } 1306 if lhs.Rd != rhs.Rd { 1307 return false 1308 } 1309 if len(lhs.ImportRtList) != len(rhs.ImportRtList) { 1310 return false 1311 } 1312 for idx, l := range lhs.ImportRtList { 1313 if l != rhs.ImportRtList[idx] { 1314 return false 1315 } 1316 } 1317 if len(lhs.ExportRtList) != len(rhs.ExportRtList) { 1318 return false 1319 } 1320 for idx, l := range lhs.ExportRtList { 1321 if l != rhs.ExportRtList[idx] { 1322 return false 1323 } 1324 } 1325 if len(lhs.BothRtList) != len(rhs.BothRtList) { 1326 return false 1327 } 1328 for idx, l := range lhs.BothRtList { 1329 if l != rhs.BothRtList[idx] { 1330 return false 1331 } 1332 } 1333 return true 1334 } 1335 1336 // struct for container gobgp:vrf. 1337 // VRF instance configurations on the local system. 1338 type Vrf struct { 1339 // original -> gobgp:name 1340 // original -> gobgp:vrf-config 1341 // Configuration parameters for VRF. 1342 Config VrfConfig `mapstructure:"config" json:"config,omitempty"` 1343 // original -> gobgp:vrf-state 1344 // Configured states of VRF. 1345 State VrfState `mapstructure:"state" json:"state,omitempty"` 1346 } 1347 1348 func (lhs *Vrf) Equal(rhs *Vrf) bool { 1349 if lhs == nil || rhs == nil { 1350 return false 1351 } 1352 if !lhs.Config.Equal(&(rhs.Config)) { 1353 return false 1354 } 1355 return true 1356 } 1357 1358 // struct for container gobgp:state. 1359 // Configuration parameters relating to BMP server. 1360 type BmpServerState struct { 1361 // original -> gobgp:address 1362 // gobgp:address's original type is inet:ip-address. 1363 // Reference to the address of the BMP server used as 1364 // a key in the BMP server list. 1365 Address string `mapstructure:"address" json:"address,omitempty"` 1366 // original -> gobgp:port 1367 // Reference to the port of the BMP server. 1368 Port uint32 `mapstructure:"port" json:"port,omitempty"` 1369 // original -> gobgp:route-monitoring-policy 1370 RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy" json:"route-monitoring-policy,omitempty"` 1371 // original -> gobgp:statistics-timeout 1372 // Interval seconds of statistics messages sent to BMP server. 1373 StatisticsTimeout uint16 `mapstructure:"statistics-timeout" json:"statistics-timeout,omitempty"` 1374 // original -> gobgp:route-mirroring-enabled 1375 // gobgp:route-mirroring-enabled's original type is boolean. 1376 // Enable feature for mirroring of received BGP messages 1377 // mainly for debugging purpose. 1378 RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"` 1379 } 1380 1381 // struct for container gobgp:config. 1382 // Configuration parameters relating to BMP server. 1383 type BmpServerConfig struct { 1384 // original -> gobgp:address 1385 // gobgp:address's original type is inet:ip-address. 1386 // Reference to the address of the BMP server used as 1387 // a key in the BMP server list. 1388 Address string `mapstructure:"address" json:"address,omitempty"` 1389 // original -> gobgp:port 1390 // Reference to the port of the BMP server. 1391 Port uint32 `mapstructure:"port" json:"port,omitempty"` 1392 // original -> gobgp:route-monitoring-policy 1393 RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy" json:"route-monitoring-policy,omitempty"` 1394 // original -> gobgp:statistics-timeout 1395 // Interval seconds of statistics messages sent to BMP server. 1396 StatisticsTimeout uint16 `mapstructure:"statistics-timeout" json:"statistics-timeout,omitempty"` 1397 // original -> gobgp:route-mirroring-enabled 1398 // gobgp:route-mirroring-enabled's original type is boolean. 1399 // Enable feature for mirroring of received BGP messages 1400 // mainly for debugging purpose. 1401 RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"` 1402 } 1403 1404 func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool { 1405 if lhs == nil || rhs == nil { 1406 return false 1407 } 1408 if lhs.Address != rhs.Address { 1409 return false 1410 } 1411 if lhs.Port != rhs.Port { 1412 return false 1413 } 1414 if lhs.RouteMonitoringPolicy != rhs.RouteMonitoringPolicy { 1415 return false 1416 } 1417 if lhs.StatisticsTimeout != rhs.StatisticsTimeout { 1418 return false 1419 } 1420 if lhs.RouteMirroringEnabled != rhs.RouteMirroringEnabled { 1421 return false 1422 } 1423 return true 1424 } 1425 1426 // struct for container gobgp:bmp-server. 1427 // List of BMP servers configured on the local system. 1428 type BmpServer struct { 1429 // original -> gobgp:address 1430 // original -> gobgp:bmp-server-config 1431 // Configuration parameters relating to BMP server. 1432 Config BmpServerConfig `mapstructure:"config" json:"config,omitempty"` 1433 // original -> gobgp:bmp-server-state 1434 // Configuration parameters relating to BMP server. 1435 State BmpServerState `mapstructure:"state" json:"state,omitempty"` 1436 } 1437 1438 func (lhs *BmpServer) Equal(rhs *BmpServer) bool { 1439 if lhs == nil || rhs == nil { 1440 return false 1441 } 1442 if !lhs.Config.Equal(&(rhs.Config)) { 1443 return false 1444 } 1445 return true 1446 } 1447 1448 // struct for container gobgp:rpki-received. 1449 // Counters for reception RPKI Message types. 1450 type RpkiReceived struct { 1451 // original -> gobgp:serial-notify 1452 // Number of serial notify message received from RPKI server. 1453 SerialNotify int64 `mapstructure:"serial-notify" json:"serial-notify,omitempty"` 1454 // original -> gobgp:cache-reset 1455 // Number of cache reset message received from RPKI server. 1456 CacheReset int64 `mapstructure:"cache-reset" json:"cache-reset,omitempty"` 1457 // original -> gobgp:cache-response 1458 // Number of cache response message received from RPKI server. 1459 CacheResponse int64 `mapstructure:"cache-response" json:"cache-response,omitempty"` 1460 // original -> gobgp:ipv4-prefix 1461 // Number of ipv4 prefix message received from RPKI server. 1462 Ipv4Prefix int64 `mapstructure:"ipv4-prefix" json:"ipv4-prefix,omitempty"` 1463 // original -> gobgp:ipv6-prefix 1464 // Number of ipv6 prefix message received from RPKI server. 1465 Ipv6Prefix int64 `mapstructure:"ipv6-prefix" json:"ipv6-prefix,omitempty"` 1466 // original -> gobgp:end-of-data 1467 // Number of end of data message received from RPKI server. 1468 EndOfData int64 `mapstructure:"end-of-data" json:"end-of-data,omitempty"` 1469 // original -> gobgp:error 1470 // Number of error message received from RPKI server. 1471 Error int64 `mapstructure:"error" json:"error,omitempty"` 1472 } 1473 1474 func (lhs *RpkiReceived) Equal(rhs *RpkiReceived) bool { 1475 if lhs == nil || rhs == nil { 1476 return false 1477 } 1478 if lhs.SerialNotify != rhs.SerialNotify { 1479 return false 1480 } 1481 if lhs.CacheReset != rhs.CacheReset { 1482 return false 1483 } 1484 if lhs.CacheResponse != rhs.CacheResponse { 1485 return false 1486 } 1487 if lhs.Ipv4Prefix != rhs.Ipv4Prefix { 1488 return false 1489 } 1490 if lhs.Ipv6Prefix != rhs.Ipv6Prefix { 1491 return false 1492 } 1493 if lhs.EndOfData != rhs.EndOfData { 1494 return false 1495 } 1496 if lhs.Error != rhs.Error { 1497 return false 1498 } 1499 return true 1500 } 1501 1502 // struct for container gobgp:rpki-sent. 1503 // Counters for transmission RPKI Message types. 1504 type RpkiSent struct { 1505 // original -> gobgp:serial-query 1506 // Number of serial query message sent to RPKI server. 1507 SerialQuery int64 `mapstructure:"serial-query" json:"serial-query,omitempty"` 1508 // original -> gobgp:reset-query 1509 // Number of reset query message sent to RPKI server. 1510 ResetQuery int64 `mapstructure:"reset-query" json:"reset-query,omitempty"` 1511 // original -> gobgp:error 1512 // Number of error message sent to RPKI server. 1513 Error int64 `mapstructure:"error" json:"error,omitempty"` 1514 } 1515 1516 func (lhs *RpkiSent) Equal(rhs *RpkiSent) bool { 1517 if lhs == nil || rhs == nil { 1518 return false 1519 } 1520 if lhs.SerialQuery != rhs.SerialQuery { 1521 return false 1522 } 1523 if lhs.ResetQuery != rhs.ResetQuery { 1524 return false 1525 } 1526 if lhs.Error != rhs.Error { 1527 return false 1528 } 1529 return true 1530 } 1531 1532 // struct for container gobgp:rpki-messages. 1533 // Counters for transmission and reception RPKI Message types. 1534 type RpkiMessages struct { 1535 // original -> gobgp:rpki-sent 1536 // Counters for transmission RPKI Message types. 1537 RpkiSent RpkiSent `mapstructure:"rpki-sent" json:"rpki-sent,omitempty"` 1538 // original -> gobgp:rpki-received 1539 // Counters for reception RPKI Message types. 1540 RpkiReceived RpkiReceived `mapstructure:"rpki-received" json:"rpki-received,omitempty"` 1541 } 1542 1543 func (lhs *RpkiMessages) Equal(rhs *RpkiMessages) bool { 1544 if lhs == nil || rhs == nil { 1545 return false 1546 } 1547 if !lhs.RpkiSent.Equal(&(rhs.RpkiSent)) { 1548 return false 1549 } 1550 if !lhs.RpkiReceived.Equal(&(rhs.RpkiReceived)) { 1551 return false 1552 } 1553 return true 1554 } 1555 1556 // struct for container gobgp:state. 1557 // State information relating to RPKI server. 1558 type RpkiServerState struct { 1559 // original -> gobgp:up 1560 // gobgp:up's original type is boolean. 1561 Up bool `mapstructure:"up" json:"up,omitempty"` 1562 // original -> gobgp:serial-number 1563 SerialNumber uint32 `mapstructure:"serial-number" json:"serial-number,omitempty"` 1564 // original -> gobgp:records-v4 1565 RecordsV4 uint32 `mapstructure:"records-v4" json:"records-v4,omitempty"` 1566 // original -> gobgp:records-v6 1567 RecordsV6 uint32 `mapstructure:"records-v6" json:"records-v6,omitempty"` 1568 // original -> gobgp:prefixes-v4 1569 PrefixesV4 uint32 `mapstructure:"prefixes-v4" json:"prefixes-v4,omitempty"` 1570 // original -> gobgp:prefixes-v6 1571 PrefixesV6 uint32 `mapstructure:"prefixes-v6" json:"prefixes-v6,omitempty"` 1572 // original -> gobgp:uptime 1573 // This timer determines the amount of time since the 1574 // RPKI last transitioned in of the Established state. 1575 Uptime int64 `mapstructure:"uptime" json:"uptime,omitempty"` 1576 // original -> gobgp:downtime 1577 // This timer determines the amount of time since the 1578 // RPKI last transitioned out of the Established state. 1579 Downtime int64 `mapstructure:"downtime" json:"downtime,omitempty"` 1580 // original -> gobgp:last-pdu-recv-time 1581 // last time the received an pdu message from RPKI server. 1582 LastPduRecvTime int64 `mapstructure:"last-pdu-recv-time" json:"last-pdu-recv-time,omitempty"` 1583 // original -> gobgp:rpki-messages 1584 // Counters for transmission and reception RPKI Message types. 1585 RpkiMessages RpkiMessages `mapstructure:"rpki-messages" json:"rpki-messages,omitempty"` 1586 } 1587 1588 // struct for container gobgp:config. 1589 // Configuration parameters relating to RPKI server. 1590 type RpkiServerConfig struct { 1591 // original -> gobgp:address 1592 // gobgp:address's original type is inet:ip-address. 1593 // Reference to the address of the RPKI server used as 1594 // a key in the RPKI server list. 1595 Address string `mapstructure:"address" json:"address,omitempty"` 1596 // original -> gobgp:port 1597 // Reference to the port of the RPKI server. 1598 Port uint32 `mapstructure:"port" json:"port,omitempty"` 1599 // original -> gobgp:refresh-time 1600 // Check interval for a configured RPKI server. 1601 RefreshTime int64 `mapstructure:"refresh-time" json:"refresh-time,omitempty"` 1602 // original -> gobgp:hold-time 1603 // Specify the length of time in seconds that the session between 1604 // the router and RPKI server is to be considered operational 1605 // without any activity. 1606 HoldTime int64 `mapstructure:"hold-time" json:"hold-time,omitempty"` 1607 // original -> gobgp:record-lifetime 1608 // Indicate the expiration date of the route validation recode 1609 // received from RPKI server. 1610 RecordLifetime int64 `mapstructure:"record-lifetime" json:"record-lifetime,omitempty"` 1611 // original -> gobgp:preference 1612 // RPKI server has a static preference. 1613 // Higher the preference values indicates a higher priority RPKI server. 1614 Preference uint8 `mapstructure:"preference" json:"preference,omitempty"` 1615 } 1616 1617 func (lhs *RpkiServerConfig) Equal(rhs *RpkiServerConfig) bool { 1618 if lhs == nil || rhs == nil { 1619 return false 1620 } 1621 if lhs.Address != rhs.Address { 1622 return false 1623 } 1624 if lhs.Port != rhs.Port { 1625 return false 1626 } 1627 if lhs.RefreshTime != rhs.RefreshTime { 1628 return false 1629 } 1630 if lhs.HoldTime != rhs.HoldTime { 1631 return false 1632 } 1633 if lhs.RecordLifetime != rhs.RecordLifetime { 1634 return false 1635 } 1636 if lhs.Preference != rhs.Preference { 1637 return false 1638 } 1639 return true 1640 } 1641 1642 // struct for container gobgp:rpki-server. 1643 // List of RPKI servers configured on the local system. 1644 type RpkiServer struct { 1645 // original -> gobgp:address 1646 // original -> gobgp:rpki-server-config 1647 // Configuration parameters relating to RPKI server. 1648 Config RpkiServerConfig `mapstructure:"config" json:"config,omitempty"` 1649 // original -> gobgp:rpki-server-state 1650 // State information relating to RPKI server. 1651 State RpkiServerState `mapstructure:"state" json:"state,omitempty"` 1652 } 1653 1654 func (lhs *RpkiServer) Equal(rhs *RpkiServer) bool { 1655 if lhs == nil || rhs == nil { 1656 return false 1657 } 1658 if !lhs.Config.Equal(&(rhs.Config)) { 1659 return false 1660 } 1661 return true 1662 } 1663 1664 // struct for container bgp:state. 1665 // State information relating to the BGP neighbor or group. 1666 type PeerGroupState struct { 1667 // original -> bgp:peer-as 1668 // bgp:peer-as's original type is inet:as-number. 1669 // AS number of the peer. 1670 PeerAs uint32 `mapstructure:"peer-as" json:"peer-as,omitempty"` 1671 // original -> bgp:local-as 1672 // bgp:local-as's original type is inet:as-number. 1673 // The local autonomous system number that is to be used 1674 // when establishing sessions with the remote peer or peer 1675 // group, if this differs from the global BGP router 1676 // autonomous system number. 1677 LocalAs uint32 `mapstructure:"local-as" json:"local-as,omitempty"` 1678 // original -> bgp:peer-type 1679 // Explicitly designate the peer or peer group as internal 1680 // (iBGP) or external (eBGP). 1681 PeerType PeerType `mapstructure:"peer-type" json:"peer-type,omitempty"` 1682 // original -> bgp:auth-password 1683 // Configures an MD5 authentication password for use with 1684 // neighboring devices. 1685 AuthPassword string `mapstructure:"auth-password" json:"auth-password,omitempty"` 1686 // original -> bgp:remove-private-as 1687 // Remove private AS numbers from updates sent to peers. 1688 RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as" json:"remove-private-as,omitempty"` 1689 // original -> bgp:route-flap-damping 1690 // bgp:route-flap-damping's original type is boolean. 1691 // Enable route flap damping. 1692 RouteFlapDamping bool `mapstructure:"route-flap-damping" json:"route-flap-damping,omitempty"` 1693 // original -> bgp:send-community 1694 // Specify which types of community should be sent to the 1695 // neighbor or group. The default is to not send the 1696 // community attribute. 1697 SendCommunity CommunityType `mapstructure:"send-community" json:"send-community,omitempty"` 1698 // original -> bgp:description 1699 // An optional textual description (intended primarily for use 1700 // with a peer or group. 1701 Description string `mapstructure:"description" json:"description,omitempty"` 1702 // original -> bgp:peer-group-name 1703 // Name of the BGP peer-group. 1704 PeerGroupName string `mapstructure:"peer-group-name" json:"peer-group-name,omitempty"` 1705 // original -> bgp-op:total-paths 1706 // Total number of BGP paths within the context. 1707 TotalPaths uint32 `mapstructure:"total-paths" json:"total-paths,omitempty"` 1708 // original -> bgp-op:total-prefixes 1709 // . 1710 TotalPrefixes uint32 `mapstructure:"total-prefixes" json:"total-prefixes,omitempty"` 1711 } 1712 1713 // struct for container bgp:config. 1714 // Configuration parameters relating to the BGP neighbor or 1715 // group. 1716 type PeerGroupConfig struct { 1717 // original -> bgp:peer-as 1718 // bgp:peer-as's original type is inet:as-number. 1719 // AS number of the peer. 1720 PeerAs uint32 `mapstructure:"peer-as" json:"peer-as,omitempty"` 1721 // original -> bgp:local-as 1722 // bgp:local-as's original type is inet:as-number. 1723 // The local autonomous system number that is to be used 1724 // when establishing sessions with the remote peer or peer 1725 // group, if this differs from the global BGP router 1726 // autonomous system number. 1727 LocalAs uint32 `mapstructure:"local-as" json:"local-as,omitempty"` 1728 // original -> bgp:peer-type 1729 // Explicitly designate the peer or peer group as internal 1730 // (iBGP) or external (eBGP). 1731 PeerType PeerType `mapstructure:"peer-type" json:"peer-type,omitempty"` 1732 // original -> bgp:auth-password 1733 // Configures an MD5 authentication password for use with 1734 // neighboring devices. 1735 AuthPassword string `mapstructure:"auth-password" json:"auth-password,omitempty"` 1736 // original -> bgp:remove-private-as 1737 // Remove private AS numbers from updates sent to peers. 1738 RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as" json:"remove-private-as,omitempty"` 1739 // original -> bgp:route-flap-damping 1740 // bgp:route-flap-damping's original type is boolean. 1741 // Enable route flap damping. 1742 RouteFlapDamping bool `mapstructure:"route-flap-damping" json:"route-flap-damping,omitempty"` 1743 // original -> bgp:send-community 1744 // Specify which types of community should be sent to the 1745 // neighbor or group. The default is to not send the 1746 // community attribute. 1747 SendCommunity CommunityType `mapstructure:"send-community" json:"send-community,omitempty"` 1748 // original -> bgp:description 1749 // An optional textual description (intended primarily for use 1750 // with a peer or group. 1751 Description string `mapstructure:"description" json:"description,omitempty"` 1752 // original -> bgp:peer-group-name 1753 // Name of the BGP peer-group. 1754 PeerGroupName string `mapstructure:"peer-group-name" json:"peer-group-name,omitempty"` 1755 } 1756 1757 func (lhs *PeerGroupConfig) Equal(rhs *PeerGroupConfig) bool { 1758 if lhs == nil || rhs == nil { 1759 return false 1760 } 1761 if lhs.PeerAs != rhs.PeerAs { 1762 return false 1763 } 1764 if lhs.LocalAs != rhs.LocalAs { 1765 return false 1766 } 1767 if lhs.PeerType != rhs.PeerType { 1768 return false 1769 } 1770 if lhs.AuthPassword != rhs.AuthPassword { 1771 return false 1772 } 1773 if lhs.RemovePrivateAs != rhs.RemovePrivateAs { 1774 return false 1775 } 1776 if lhs.RouteFlapDamping != rhs.RouteFlapDamping { 1777 return false 1778 } 1779 if lhs.SendCommunity != rhs.SendCommunity { 1780 return false 1781 } 1782 if lhs.Description != rhs.Description { 1783 return false 1784 } 1785 if lhs.PeerGroupName != rhs.PeerGroupName { 1786 return false 1787 } 1788 return true 1789 } 1790 1791 // struct for container bgp:peer-group. 1792 // List of BGP peer-groups configured on the local system - 1793 // uniquely identified by peer-group name. 1794 type PeerGroup struct { 1795 // original -> bgp:peer-group-name 1796 // original -> bgp:peer-group-config 1797 // Configuration parameters relating to the BGP neighbor or 1798 // group. 1799 Config PeerGroupConfig `mapstructure:"config" json:"config,omitempty"` 1800 // original -> bgp:peer-group-state 1801 // State information relating to the BGP neighbor or group. 1802 State PeerGroupState `mapstructure:"state" json:"state,omitempty"` 1803 // original -> bgp:timers 1804 // Timers related to a BGP neighbor or group. 1805 Timers Timers `mapstructure:"timers" json:"timers,omitempty"` 1806 // original -> bgp:transport 1807 // Transport session parameters for the BGP neighbor or group. 1808 Transport Transport `mapstructure:"transport" json:"transport,omitempty"` 1809 // original -> bgp:error-handling 1810 // Error handling parameters used for the BGP neighbor or 1811 // group. 1812 ErrorHandling ErrorHandling `mapstructure:"error-handling" json:"error-handling,omitempty"` 1813 // original -> bgp:logging-options 1814 // Logging options for events related to the BGP neighbor or 1815 // group. 1816 LoggingOptions LoggingOptions `mapstructure:"logging-options" json:"logging-options,omitempty"` 1817 // original -> bgp:ebgp-multihop 1818 // eBGP multi-hop parameters for the BGP neighbor or group. 1819 EbgpMultihop EbgpMultihop `mapstructure:"ebgp-multihop" json:"ebgp-multihop,omitempty"` 1820 // original -> bgp:route-reflector 1821 // Route reflector parameters for the BGP neighbor or group. 1822 RouteReflector RouteReflector `mapstructure:"route-reflector" json:"route-reflector,omitempty"` 1823 // original -> bgp:as-path-options 1824 // AS_PATH manipulation parameters for the BGP neighbor or 1825 // group. 1826 AsPathOptions AsPathOptions `mapstructure:"as-path-options" json:"as-path-options,omitempty"` 1827 // original -> bgp:add-paths 1828 // Parameters relating to the advertisement and receipt of 1829 // multiple paths for a single NLRI (add-paths). 1830 AddPaths AddPaths `mapstructure:"add-paths" json:"add-paths,omitempty"` 1831 // original -> bgp:afi-safis 1832 // Per-address-family configuration parameters associated with 1833 // the neighbor or group. 1834 AfiSafis []AfiSafi `mapstructure:"afi-safis" json:"afi-safis,omitempty"` 1835 // original -> bgp:graceful-restart 1836 // Parameters relating the graceful restart mechanism for BGP. 1837 GracefulRestart GracefulRestart `mapstructure:"graceful-restart" json:"graceful-restart,omitempty"` 1838 // original -> rpol:apply-policy 1839 // Anchor point for routing policies in the model. 1840 // Import and export policies are with respect to the local 1841 // routing table, i.e., export (send) and import (receive), 1842 // depending on the context. 1843 ApplyPolicy ApplyPolicy `mapstructure:"apply-policy" json:"apply-policy,omitempty"` 1844 // original -> bgp-mp:use-multiple-paths 1845 // Parameters related to the use of multiple paths for the 1846 // same NLRI. 1847 UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths" json:"use-multiple-paths,omitempty"` 1848 // original -> gobgp:route-server 1849 // Configure the local router as a route server. 1850 RouteServer RouteServer `mapstructure:"route-server" json:"route-server,omitempty"` 1851 // original -> gobgp:ttl-security 1852 // Configure TTL Security feature. 1853 TtlSecurity TtlSecurity `mapstructure:"ttl-security" json:"ttl-security,omitempty"` 1854 } 1855 1856 func (lhs *PeerGroup) Equal(rhs *PeerGroup) bool { 1857 if lhs == nil || rhs == nil { 1858 return false 1859 } 1860 if !lhs.Config.Equal(&(rhs.Config)) { 1861 return false 1862 } 1863 if !lhs.Timers.Equal(&(rhs.Timers)) { 1864 return false 1865 } 1866 if !lhs.Transport.Equal(&(rhs.Transport)) { 1867 return false 1868 } 1869 if !lhs.ErrorHandling.Equal(&(rhs.ErrorHandling)) { 1870 return false 1871 } 1872 if !lhs.LoggingOptions.Equal(&(rhs.LoggingOptions)) { 1873 return false 1874 } 1875 if !lhs.EbgpMultihop.Equal(&(rhs.EbgpMultihop)) { 1876 return false 1877 } 1878 if !lhs.RouteReflector.Equal(&(rhs.RouteReflector)) { 1879 return false 1880 } 1881 if !lhs.AsPathOptions.Equal(&(rhs.AsPathOptions)) { 1882 return false 1883 } 1884 if !lhs.AddPaths.Equal(&(rhs.AddPaths)) { 1885 return false 1886 } 1887 if len(lhs.AfiSafis) != len(rhs.AfiSafis) { 1888 return false 1889 } 1890 { 1891 lmap := make(map[string]*AfiSafi) 1892 for i, l := range lhs.AfiSafis { 1893 lmap[mapkey(i, string(l.Config.AfiSafiName))] = &lhs.AfiSafis[i] 1894 } 1895 for i, r := range rhs.AfiSafis { 1896 if l, y := lmap[mapkey(i, string(r.Config.AfiSafiName))]; !y { 1897 return false 1898 } else if !r.Equal(l) { 1899 return false 1900 } 1901 } 1902 } 1903 if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { 1904 return false 1905 } 1906 if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { 1907 return false 1908 } 1909 if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { 1910 return false 1911 } 1912 if !lhs.RouteServer.Equal(&(rhs.RouteServer)) { 1913 return false 1914 } 1915 if !lhs.TtlSecurity.Equal(&(rhs.TtlSecurity)) { 1916 return false 1917 } 1918 return true 1919 } 1920 1921 // struct for container gobgp:state. 1922 // State information for TTL Security. 1923 type TtlSecurityState struct { 1924 // original -> gobgp:enabled 1925 // gobgp:enabled's original type is boolean. 1926 // Enable features for TTL Security. 1927 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 1928 // original -> gobgp:ttl-min 1929 // Reference to the port of the BMP server. 1930 TtlMin uint8 `mapstructure:"ttl-min" json:"ttl-min,omitempty"` 1931 } 1932 1933 // struct for container gobgp:config. 1934 // Configuration parameters for TTL Security. 1935 type TtlSecurityConfig struct { 1936 // original -> gobgp:enabled 1937 // gobgp:enabled's original type is boolean. 1938 // Enable features for TTL Security. 1939 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 1940 // original -> gobgp:ttl-min 1941 // Reference to the port of the BMP server. 1942 TtlMin uint8 `mapstructure:"ttl-min" json:"ttl-min,omitempty"` 1943 } 1944 1945 func (lhs *TtlSecurityConfig) Equal(rhs *TtlSecurityConfig) bool { 1946 if lhs == nil || rhs == nil { 1947 return false 1948 } 1949 if lhs.Enabled != rhs.Enabled { 1950 return false 1951 } 1952 if lhs.TtlMin != rhs.TtlMin { 1953 return false 1954 } 1955 return true 1956 } 1957 1958 // struct for container gobgp:ttl-security. 1959 // Configure TTL Security feature. 1960 type TtlSecurity struct { 1961 // original -> gobgp:ttl-security-config 1962 // Configuration parameters for TTL Security. 1963 Config TtlSecurityConfig `mapstructure:"config" json:"config,omitempty"` 1964 // original -> gobgp:ttl-security-state 1965 // State information for TTL Security. 1966 State TtlSecurityState `mapstructure:"state" json:"state,omitempty"` 1967 } 1968 1969 func (lhs *TtlSecurity) Equal(rhs *TtlSecurity) bool { 1970 if lhs == nil || rhs == nil { 1971 return false 1972 } 1973 if !lhs.Config.Equal(&(rhs.Config)) { 1974 return false 1975 } 1976 return true 1977 } 1978 1979 // struct for container gobgp:state. 1980 // State information relating to route server 1981 // client(s) used for the BGP neighbor. 1982 type RouteServerState struct { 1983 // original -> gobgp:route-server-client 1984 // gobgp:route-server-client's original type is boolean. 1985 // Configure the neighbor as a route server client. 1986 RouteServerClient bool `mapstructure:"route-server-client" json:"route-server-client,omitempty"` 1987 } 1988 1989 // struct for container gobgp:config. 1990 // Configuration parameters relating to route server 1991 // client(s) used for the BGP neighbor. 1992 type RouteServerConfig struct { 1993 // original -> gobgp:route-server-client 1994 // gobgp:route-server-client's original type is boolean. 1995 // Configure the neighbor as a route server client. 1996 RouteServerClient bool `mapstructure:"route-server-client" json:"route-server-client,omitempty"` 1997 } 1998 1999 func (lhs *RouteServerConfig) Equal(rhs *RouteServerConfig) bool { 2000 if lhs == nil || rhs == nil { 2001 return false 2002 } 2003 if lhs.RouteServerClient != rhs.RouteServerClient { 2004 return false 2005 } 2006 return true 2007 } 2008 2009 // struct for container gobgp:route-server. 2010 // Configure the local router as a route server. 2011 type RouteServer struct { 2012 // original -> gobgp:route-server-config 2013 // Configuration parameters relating to route server 2014 // client(s) used for the BGP neighbor. 2015 Config RouteServerConfig `mapstructure:"config" json:"config,omitempty"` 2016 // original -> gobgp:route-server-state 2017 // State information relating to route server 2018 // client(s) used for the BGP neighbor. 2019 State RouteServerState `mapstructure:"state" json:"state,omitempty"` 2020 } 2021 2022 func (lhs *RouteServer) Equal(rhs *RouteServer) bool { 2023 if lhs == nil || rhs == nil { 2024 return false 2025 } 2026 if !lhs.Config.Equal(&(rhs.Config)) { 2027 return false 2028 } 2029 return true 2030 } 2031 2032 // struct for container bgp-op:prefixes. 2033 // Prefix counters for the BGP session. 2034 type Prefixes struct { 2035 // original -> bgp-op:received 2036 // The number of prefixes received from the neighbor. 2037 Received uint32 `mapstructure:"received" json:"received,omitempty"` 2038 // original -> bgp-op:sent 2039 // The number of prefixes advertised to the neighbor. 2040 Sent uint32 `mapstructure:"sent" json:"sent,omitempty"` 2041 // original -> bgp-op:installed 2042 // The number of advertised prefixes installed in the 2043 // Loc-RIB. 2044 Installed uint32 `mapstructure:"installed" json:"installed,omitempty"` 2045 } 2046 2047 func (lhs *Prefixes) Equal(rhs *Prefixes) bool { 2048 if lhs == nil || rhs == nil { 2049 return false 2050 } 2051 if lhs.Received != rhs.Received { 2052 return false 2053 } 2054 if lhs.Sent != rhs.Sent { 2055 return false 2056 } 2057 if lhs.Installed != rhs.Installed { 2058 return false 2059 } 2060 return true 2061 } 2062 2063 // struct for container bgp:state. 2064 // State information associated with ADD_PATHS. 2065 type AddPathsState struct { 2066 // original -> bgp:receive 2067 // bgp:receive's original type is boolean. 2068 // Enable ability to receive multiple path advertisements 2069 // for an NLRI from the neighbor or group. 2070 Receive bool `mapstructure:"receive" json:"receive,omitempty"` 2071 // original -> bgp:send-max 2072 // The maximum number of paths to advertise to neighbors 2073 // for a single NLRI. 2074 SendMax uint8 `mapstructure:"send-max" json:"send-max,omitempty"` 2075 } 2076 2077 // struct for container bgp:config. 2078 // Configuration parameters relating to ADD_PATHS. 2079 type AddPathsConfig struct { 2080 // original -> bgp:receive 2081 // bgp:receive's original type is boolean. 2082 // Enable ability to receive multiple path advertisements 2083 // for an NLRI from the neighbor or group. 2084 Receive bool `mapstructure:"receive" json:"receive,omitempty"` 2085 // original -> bgp:send-max 2086 // The maximum number of paths to advertise to neighbors 2087 // for a single NLRI. 2088 SendMax uint8 `mapstructure:"send-max" json:"send-max,omitempty"` 2089 } 2090 2091 func (lhs *AddPathsConfig) Equal(rhs *AddPathsConfig) bool { 2092 if lhs == nil || rhs == nil { 2093 return false 2094 } 2095 if lhs.Receive != rhs.Receive { 2096 return false 2097 } 2098 if lhs.SendMax != rhs.SendMax { 2099 return false 2100 } 2101 return true 2102 } 2103 2104 // struct for container bgp:add-paths. 2105 // Parameters relating to the advertisement and receipt of 2106 // multiple paths for a single NLRI (add-paths). 2107 type AddPaths struct { 2108 // original -> bgp:add-paths-config 2109 // Configuration parameters relating to ADD_PATHS. 2110 Config AddPathsConfig `mapstructure:"config" json:"config,omitempty"` 2111 // original -> bgp:add-paths-state 2112 // State information associated with ADD_PATHS. 2113 State AddPathsState `mapstructure:"state" json:"state,omitempty"` 2114 } 2115 2116 func (lhs *AddPaths) Equal(rhs *AddPaths) bool { 2117 if lhs == nil || rhs == nil { 2118 return false 2119 } 2120 if !lhs.Config.Equal(&(rhs.Config)) { 2121 return false 2122 } 2123 return true 2124 } 2125 2126 // struct for container bgp:state. 2127 // State information relating to the AS_PATH manipulation 2128 // mechanisms for the BGP peer or group. 2129 type AsPathOptionsState struct { 2130 // original -> bgp:allow-own-as 2131 // Specify the number of occurrences of the local BGP speaker's 2132 // AS that can occur within the AS_PATH before it is rejected. 2133 AllowOwnAs uint8 `mapstructure:"allow-own-as" json:"allow-own-as,omitempty"` 2134 // original -> bgp:replace-peer-as 2135 // bgp:replace-peer-as's original type is boolean. 2136 // Replace occurrences of the peer's AS in the AS_PATH 2137 // with the local autonomous system number. 2138 ReplacePeerAs bool `mapstructure:"replace-peer-as" json:"replace-peer-as,omitempty"` 2139 } 2140 2141 // struct for container bgp:config. 2142 // Configuration parameters relating to AS_PATH manipulation 2143 // for the BGP peer or group. 2144 type AsPathOptionsConfig struct { 2145 // original -> bgp:allow-own-as 2146 // Specify the number of occurrences of the local BGP speaker's 2147 // AS that can occur within the AS_PATH before it is rejected. 2148 AllowOwnAs uint8 `mapstructure:"allow-own-as" json:"allow-own-as,omitempty"` 2149 // original -> bgp:replace-peer-as 2150 // bgp:replace-peer-as's original type is boolean. 2151 // Replace occurrences of the peer's AS in the AS_PATH 2152 // with the local autonomous system number. 2153 ReplacePeerAs bool `mapstructure:"replace-peer-as" json:"replace-peer-as,omitempty"` 2154 } 2155 2156 func (lhs *AsPathOptionsConfig) Equal(rhs *AsPathOptionsConfig) bool { 2157 if lhs == nil || rhs == nil { 2158 return false 2159 } 2160 if lhs.AllowOwnAs != rhs.AllowOwnAs { 2161 return false 2162 } 2163 if lhs.ReplacePeerAs != rhs.ReplacePeerAs { 2164 return false 2165 } 2166 return true 2167 } 2168 2169 // struct for container bgp:as-path-options. 2170 // AS_PATH manipulation parameters for the BGP neighbor or 2171 // group. 2172 type AsPathOptions struct { 2173 // original -> bgp:as-path-options-config 2174 // Configuration parameters relating to AS_PATH manipulation 2175 // for the BGP peer or group. 2176 Config AsPathOptionsConfig `mapstructure:"config" json:"config,omitempty"` 2177 // original -> bgp:as-path-options-state 2178 // State information relating to the AS_PATH manipulation 2179 // mechanisms for the BGP peer or group. 2180 State AsPathOptionsState `mapstructure:"state" json:"state,omitempty"` 2181 } 2182 2183 func (lhs *AsPathOptions) Equal(rhs *AsPathOptions) bool { 2184 if lhs == nil || rhs == nil { 2185 return false 2186 } 2187 if !lhs.Config.Equal(&(rhs.Config)) { 2188 return false 2189 } 2190 return true 2191 } 2192 2193 // struct for container bgp:state. 2194 // State information relating to route reflection for the 2195 // BGP neighbor or group. 2196 type RouteReflectorState struct { 2197 // original -> bgp:route-reflector-cluster-id 2198 // route-reflector cluster id to use when local router is 2199 // configured as a route reflector. Commonly set at the group 2200 // level, but allows a different cluster 2201 // id to be set for each neighbor. 2202 RouteReflectorClusterId RrClusterIdType `mapstructure:"route-reflector-cluster-id" json:"route-reflector-cluster-id,omitempty"` 2203 // original -> bgp:route-reflector-client 2204 // bgp:route-reflector-client's original type is boolean. 2205 // Configure the neighbor as a route reflector client. 2206 RouteReflectorClient bool `mapstructure:"route-reflector-client" json:"route-reflector-client,omitempty"` 2207 } 2208 2209 // struct for container bgp:config. 2210 // Configuraton parameters relating to route reflection 2211 // for the BGP neighbor or group. 2212 type RouteReflectorConfig struct { 2213 // original -> bgp:route-reflector-cluster-id 2214 // route-reflector cluster id to use when local router is 2215 // configured as a route reflector. Commonly set at the group 2216 // level, but allows a different cluster 2217 // id to be set for each neighbor. 2218 RouteReflectorClusterId RrClusterIdType `mapstructure:"route-reflector-cluster-id" json:"route-reflector-cluster-id,omitempty"` 2219 // original -> bgp:route-reflector-client 2220 // bgp:route-reflector-client's original type is boolean. 2221 // Configure the neighbor as a route reflector client. 2222 RouteReflectorClient bool `mapstructure:"route-reflector-client" json:"route-reflector-client,omitempty"` 2223 } 2224 2225 func (lhs *RouteReflectorConfig) Equal(rhs *RouteReflectorConfig) bool { 2226 if lhs == nil || rhs == nil { 2227 return false 2228 } 2229 if lhs.RouteReflectorClusterId != rhs.RouteReflectorClusterId { 2230 return false 2231 } 2232 if lhs.RouteReflectorClient != rhs.RouteReflectorClient { 2233 return false 2234 } 2235 return true 2236 } 2237 2238 // struct for container bgp:route-reflector. 2239 // Route reflector parameters for the BGP neighbor or group. 2240 type RouteReflector struct { 2241 // original -> bgp:route-reflector-config 2242 // Configuraton parameters relating to route reflection 2243 // for the BGP neighbor or group. 2244 Config RouteReflectorConfig `mapstructure:"config" json:"config,omitempty"` 2245 // original -> bgp:route-reflector-state 2246 // State information relating to route reflection for the 2247 // BGP neighbor or group. 2248 State RouteReflectorState `mapstructure:"state" json:"state,omitempty"` 2249 } 2250 2251 func (lhs *RouteReflector) Equal(rhs *RouteReflector) bool { 2252 if lhs == nil || rhs == nil { 2253 return false 2254 } 2255 if !lhs.Config.Equal(&(rhs.Config)) { 2256 return false 2257 } 2258 return true 2259 } 2260 2261 // struct for container bgp:state. 2262 // State information for eBGP multihop, for the BGP neighbor 2263 // or group. 2264 type EbgpMultihopState struct { 2265 // original -> bgp:enabled 2266 // bgp:enabled's original type is boolean. 2267 // When enabled the referenced group or neighbors are permitted 2268 // to be indirectly connected - including cases where the TTL 2269 // can be decremented between the BGP peers. 2270 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 2271 // original -> bgp:multihop-ttl 2272 // Time-to-live value to use when packets are sent to the 2273 // referenced group or neighbors and ebgp-multihop is enabled. 2274 MultihopTtl uint8 `mapstructure:"multihop-ttl" json:"multihop-ttl,omitempty"` 2275 } 2276 2277 // struct for container bgp:config. 2278 // Configuration parameters relating to eBGP multihop for the 2279 // BGP neighbor or group. 2280 type EbgpMultihopConfig struct { 2281 // original -> bgp:enabled 2282 // bgp:enabled's original type is boolean. 2283 // When enabled the referenced group or neighbors are permitted 2284 // to be indirectly connected - including cases where the TTL 2285 // can be decremented between the BGP peers. 2286 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 2287 // original -> bgp:multihop-ttl 2288 // Time-to-live value to use when packets are sent to the 2289 // referenced group or neighbors and ebgp-multihop is enabled. 2290 MultihopTtl uint8 `mapstructure:"multihop-ttl" json:"multihop-ttl,omitempty"` 2291 } 2292 2293 func (lhs *EbgpMultihopConfig) Equal(rhs *EbgpMultihopConfig) bool { 2294 if lhs == nil || rhs == nil { 2295 return false 2296 } 2297 if lhs.Enabled != rhs.Enabled { 2298 return false 2299 } 2300 if lhs.MultihopTtl != rhs.MultihopTtl { 2301 return false 2302 } 2303 return true 2304 } 2305 2306 // struct for container bgp:ebgp-multihop. 2307 // eBGP multi-hop parameters for the BGP neighbor or group. 2308 type EbgpMultihop struct { 2309 // original -> bgp:ebgp-multihop-config 2310 // Configuration parameters relating to eBGP multihop for the 2311 // BGP neighbor or group. 2312 Config EbgpMultihopConfig `mapstructure:"config" json:"config,omitempty"` 2313 // original -> bgp:ebgp-multihop-state 2314 // State information for eBGP multihop, for the BGP neighbor 2315 // or group. 2316 State EbgpMultihopState `mapstructure:"state" json:"state,omitempty"` 2317 } 2318 2319 func (lhs *EbgpMultihop) Equal(rhs *EbgpMultihop) bool { 2320 if lhs == nil || rhs == nil { 2321 return false 2322 } 2323 if !lhs.Config.Equal(&(rhs.Config)) { 2324 return false 2325 } 2326 return true 2327 } 2328 2329 // struct for container bgp:state. 2330 // State information relating to logging for the BGP neighbor 2331 // or group. 2332 type LoggingOptionsState struct { 2333 // original -> bgp:log-neighbor-state-changes 2334 // bgp:log-neighbor-state-changes's original type is boolean. 2335 // Configure logging of peer state changes. Default is 2336 // to enable logging of peer state changes. 2337 LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes" json:"log-neighbor-state-changes,omitempty"` 2338 } 2339 2340 // struct for container bgp:config. 2341 // Configuration parameters enabling or modifying logging 2342 // for events relating to the BGP neighbor or group. 2343 type LoggingOptionsConfig struct { 2344 // original -> bgp:log-neighbor-state-changes 2345 // bgp:log-neighbor-state-changes's original type is boolean. 2346 // Configure logging of peer state changes. Default is 2347 // to enable logging of peer state changes. 2348 LogNeighborStateChanges bool `mapstructure:"log-neighbor-state-changes" json:"log-neighbor-state-changes,omitempty"` 2349 } 2350 2351 func (lhs *LoggingOptionsConfig) Equal(rhs *LoggingOptionsConfig) bool { 2352 if lhs == nil || rhs == nil { 2353 return false 2354 } 2355 if lhs.LogNeighborStateChanges != rhs.LogNeighborStateChanges { 2356 return false 2357 } 2358 return true 2359 } 2360 2361 // struct for container bgp:logging-options. 2362 // Logging options for events related to the BGP neighbor or 2363 // group. 2364 type LoggingOptions struct { 2365 // original -> bgp:logging-options-config 2366 // Configuration parameters enabling or modifying logging 2367 // for events relating to the BGP neighbor or group. 2368 Config LoggingOptionsConfig `mapstructure:"config" json:"config,omitempty"` 2369 // original -> bgp:logging-options-state 2370 // State information relating to logging for the BGP neighbor 2371 // or group. 2372 State LoggingOptionsState `mapstructure:"state" json:"state,omitempty"` 2373 } 2374 2375 func (lhs *LoggingOptions) Equal(rhs *LoggingOptions) bool { 2376 if lhs == nil || rhs == nil { 2377 return false 2378 } 2379 if !lhs.Config.Equal(&(rhs.Config)) { 2380 return false 2381 } 2382 return true 2383 } 2384 2385 // struct for container bgp:state. 2386 // State information relating to enhanced error handling 2387 // mechanisms for the BGP neighbor or group. 2388 type ErrorHandlingState struct { 2389 // original -> bgp:treat-as-withdraw 2390 // bgp:treat-as-withdraw's original type is boolean. 2391 // Specify whether erroneous UPDATE messages for which the 2392 // NLRI can be extracted are reated as though the NLRI is 2393 // withdrawn - avoiding session reset. 2394 TreatAsWithdraw bool `mapstructure:"treat-as-withdraw" json:"treat-as-withdraw,omitempty"` 2395 // original -> bgp-op:erroneous-update-messages 2396 // The number of BGP UPDATE messages for which the 2397 // treat-as-withdraw mechanism has been applied based 2398 // on erroneous message contents. 2399 ErroneousUpdateMessages uint32 `mapstructure:"erroneous-update-messages" json:"erroneous-update-messages,omitempty"` 2400 } 2401 2402 // struct for container bgp:config. 2403 // Configuration parameters enabling or modifying the 2404 // behavior or enhanced error handling mechanisms for the BGP 2405 // neighbor or group. 2406 type ErrorHandlingConfig struct { 2407 // original -> bgp:treat-as-withdraw 2408 // bgp:treat-as-withdraw's original type is boolean. 2409 // Specify whether erroneous UPDATE messages for which the 2410 // NLRI can be extracted are reated as though the NLRI is 2411 // withdrawn - avoiding session reset. 2412 TreatAsWithdraw bool `mapstructure:"treat-as-withdraw" json:"treat-as-withdraw,omitempty"` 2413 } 2414 2415 func (lhs *ErrorHandlingConfig) Equal(rhs *ErrorHandlingConfig) bool { 2416 if lhs == nil || rhs == nil { 2417 return false 2418 } 2419 if lhs.TreatAsWithdraw != rhs.TreatAsWithdraw { 2420 return false 2421 } 2422 return true 2423 } 2424 2425 // struct for container bgp:error-handling. 2426 // Error handling parameters used for the BGP neighbor or 2427 // group. 2428 type ErrorHandling struct { 2429 // original -> bgp:error-handling-config 2430 // Configuration parameters enabling or modifying the 2431 // behavior or enhanced error handling mechanisms for the BGP 2432 // neighbor or group. 2433 Config ErrorHandlingConfig `mapstructure:"config" json:"config,omitempty"` 2434 // original -> bgp:error-handling-state 2435 // State information relating to enhanced error handling 2436 // mechanisms for the BGP neighbor or group. 2437 State ErrorHandlingState `mapstructure:"state" json:"state,omitempty"` 2438 } 2439 2440 func (lhs *ErrorHandling) Equal(rhs *ErrorHandling) bool { 2441 if lhs == nil || rhs == nil { 2442 return false 2443 } 2444 if !lhs.Config.Equal(&(rhs.Config)) { 2445 return false 2446 } 2447 return true 2448 } 2449 2450 // struct for container bgp:state. 2451 // State information relating to the transport session(s) 2452 // used for the BGP neighbor or group. 2453 type TransportState struct { 2454 // original -> bgp:tcp-mss 2455 // Sets the max segment size for BGP TCP sessions. 2456 TcpMss uint16 `mapstructure:"tcp-mss" json:"tcp-mss,omitempty"` 2457 // original -> bgp:mtu-discovery 2458 // bgp:mtu-discovery's original type is boolean. 2459 // Turns path mtu discovery for BGP TCP sessions on (true) 2460 // or off (false). 2461 MtuDiscovery bool `mapstructure:"mtu-discovery" json:"mtu-discovery,omitempty"` 2462 // original -> bgp:passive-mode 2463 // bgp:passive-mode's original type is boolean. 2464 // Wait for peers to issue requests to open a BGP session, 2465 // rather than initiating sessions from the local router. 2466 PassiveMode bool `mapstructure:"passive-mode" json:"passive-mode,omitempty"` 2467 // original -> bgp:local-address 2468 // bgp:local-address's original type is union. 2469 // Set the local IP (either IPv4 or IPv6) address to use 2470 // for the session when sending BGP update messages. This 2471 // may be expressed as either an IP address or reference 2472 // to the name of an interface. 2473 LocalAddress string `mapstructure:"local-address" json:"local-address,omitempty"` 2474 // original -> bgp-op:local-port 2475 // bgp-op:local-port's original type is inet:port-number. 2476 // Local TCP port being used for the TCP session supporting 2477 // the BGP session. 2478 LocalPort uint16 `mapstructure:"local-port" json:"local-port,omitempty"` 2479 // original -> bgp-op:remote-address 2480 // bgp-op:remote-address's original type is inet:ip-address. 2481 // Remote address to which the BGP session has been 2482 // established. 2483 RemoteAddress string `mapstructure:"remote-address" json:"remote-address,omitempty"` 2484 // original -> bgp-op:remote-port 2485 // bgp-op:remote-port's original type is inet:port-number. 2486 // Remote port being used by the peer for the TCP session 2487 // supporting the BGP session. 2488 RemotePort uint16 `mapstructure:"remote-port" json:"remote-port,omitempty"` 2489 } 2490 2491 // struct for container bgp:config. 2492 // Configuration parameters relating to the transport 2493 // session(s) used for the BGP neighbor or group. 2494 type TransportConfig struct { 2495 // original -> bgp:tcp-mss 2496 // Sets the max segment size for BGP TCP sessions. 2497 TcpMss uint16 `mapstructure:"tcp-mss" json:"tcp-mss,omitempty"` 2498 // original -> bgp:mtu-discovery 2499 // bgp:mtu-discovery's original type is boolean. 2500 // Turns path mtu discovery for BGP TCP sessions on (true) 2501 // or off (false). 2502 MtuDiscovery bool `mapstructure:"mtu-discovery" json:"mtu-discovery,omitempty"` 2503 // original -> bgp:passive-mode 2504 // bgp:passive-mode's original type is boolean. 2505 // Wait for peers to issue requests to open a BGP session, 2506 // rather than initiating sessions from the local router. 2507 PassiveMode bool `mapstructure:"passive-mode" json:"passive-mode,omitempty"` 2508 // original -> bgp:local-address 2509 // bgp:local-address's original type is union. 2510 // Set the local IP (either IPv4 or IPv6) address to use 2511 // for the session when sending BGP update messages. This 2512 // may be expressed as either an IP address or reference 2513 // to the name of an interface. 2514 LocalAddress string `mapstructure:"local-address" json:"local-address,omitempty"` 2515 // original -> gobgp:remote-port 2516 // gobgp:remote-port's original type is inet:port-number. 2517 RemotePort uint16 `mapstructure:"remote-port" json:"remote-port,omitempty"` 2518 // original -> gobgp:ttl 2519 // TTL value for BGP packets. 2520 Ttl uint8 `mapstructure:"ttl" json:"ttl,omitempty"` 2521 } 2522 2523 func (lhs *TransportConfig) Equal(rhs *TransportConfig) bool { 2524 if lhs == nil || rhs == nil { 2525 return false 2526 } 2527 if lhs.TcpMss != rhs.TcpMss { 2528 return false 2529 } 2530 if lhs.MtuDiscovery != rhs.MtuDiscovery { 2531 return false 2532 } 2533 if lhs.PassiveMode != rhs.PassiveMode { 2534 return false 2535 } 2536 if lhs.LocalAddress != rhs.LocalAddress { 2537 return false 2538 } 2539 if lhs.RemotePort != rhs.RemotePort { 2540 return false 2541 } 2542 if lhs.Ttl != rhs.Ttl { 2543 return false 2544 } 2545 return true 2546 } 2547 2548 // struct for container bgp:transport. 2549 // Transport session parameters for the BGP neighbor or group. 2550 type Transport struct { 2551 // original -> bgp:transport-config 2552 // Configuration parameters relating to the transport 2553 // session(s) used for the BGP neighbor or group. 2554 Config TransportConfig `mapstructure:"config" json:"config,omitempty"` 2555 // original -> bgp:transport-state 2556 // State information relating to the transport session(s) 2557 // used for the BGP neighbor or group. 2558 State TransportState `mapstructure:"state" json:"state,omitempty"` 2559 } 2560 2561 func (lhs *Transport) Equal(rhs *Transport) bool { 2562 if lhs == nil || rhs == nil { 2563 return false 2564 } 2565 if !lhs.Config.Equal(&(rhs.Config)) { 2566 return false 2567 } 2568 return true 2569 } 2570 2571 // struct for container bgp:state. 2572 // State information relating to the timers used for the BGP 2573 // neighbor or group. 2574 type TimersState struct { 2575 // original -> bgp:connect-retry 2576 // bgp:connect-retry's original type is decimal64. 2577 // Time interval in seconds between attempts to establish a 2578 // session with the peer. 2579 ConnectRetry float64 `mapstructure:"connect-retry" json:"connect-retry,omitempty"` 2580 // original -> bgp:hold-time 2581 // bgp:hold-time's original type is decimal64. 2582 // Time interval in seconds that a BGP session will be 2583 // considered active in the absence of keepalive or other 2584 // messages from the peer. The hold-time is typically 2585 // set to 3x the keepalive-interval. 2586 HoldTime float64 `mapstructure:"hold-time" json:"hold-time,omitempty"` 2587 // original -> bgp:keepalive-interval 2588 // bgp:keepalive-interval's original type is decimal64. 2589 // Time interval in seconds between transmission of keepalive 2590 // messages to the neighbor. Typically set to 1/3 the 2591 // hold-time. 2592 KeepaliveInterval float64 `mapstructure:"keepalive-interval" json:"keepalive-interval,omitempty"` 2593 // original -> bgp:minimum-advertisement-interval 2594 // bgp:minimum-advertisement-interval's original type is decimal64. 2595 // Minimum time which must elapse between subsequent UPDATE 2596 // messages relating to a common set of NLRI being transmitted 2597 // to a peer. This timer is referred to as 2598 // MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to 2599 // reduce the number of UPDATE messages transmitted when a 2600 // particular set of NLRI exhibit instability. 2601 MinimumAdvertisementInterval float64 `mapstructure:"minimum-advertisement-interval" json:"minimum-advertisement-interval,omitempty"` 2602 // original -> bgp-op:uptime 2603 // bgp-op:uptime's original type is yang:timeticks. 2604 // This timer determines the amount of time since the 2605 // BGP last transitioned in or out of the Established 2606 // state. 2607 Uptime int64 `mapstructure:"uptime" json:"uptime,omitempty"` 2608 // original -> bgp-op:negotiated-hold-time 2609 // bgp-op:negotiated-hold-time's original type is decimal64. 2610 // The negotiated hold-time for the BGP session. 2611 NegotiatedHoldTime float64 `mapstructure:"negotiated-hold-time" json:"negotiated-hold-time,omitempty"` 2612 // original -> gobgp:idle-hold-time-after-reset 2613 // gobgp:idle-hold-time-after-reset's original type is decimal64. 2614 // Time interval in seconds that a BGP session will be 2615 // in idle state after neighbor reset operation. 2616 IdleHoldTimeAfterReset float64 `mapstructure:"idle-hold-time-after-reset" json:"idle-hold-time-after-reset,omitempty"` 2617 // original -> gobgp:downtime 2618 // gobgp:downtime's original type is yang:timeticks. 2619 // This timer determines the amount of time since the 2620 // BGP last transitioned out of the Established state. 2621 Downtime int64 `mapstructure:"downtime" json:"downtime,omitempty"` 2622 // original -> gobgp:update-recv-time 2623 // The number of seconds elasped since January 1, 1970 UTC 2624 // last time the BGP session received an UPDATE message. 2625 UpdateRecvTime int64 `mapstructure:"update-recv-time" json:"update-recv-time,omitempty"` 2626 } 2627 2628 // struct for container bgp:config. 2629 // Configuration parameters relating to timers used for the 2630 // BGP neighbor or group. 2631 type TimersConfig struct { 2632 // original -> bgp:connect-retry 2633 // bgp:connect-retry's original type is decimal64. 2634 // Time interval in seconds between attempts to establish a 2635 // session with the peer. 2636 ConnectRetry float64 `mapstructure:"connect-retry" json:"connect-retry,omitempty"` 2637 // original -> bgp:hold-time 2638 // bgp:hold-time's original type is decimal64. 2639 // Time interval in seconds that a BGP session will be 2640 // considered active in the absence of keepalive or other 2641 // messages from the peer. The hold-time is typically 2642 // set to 3x the keepalive-interval. 2643 HoldTime float64 `mapstructure:"hold-time" json:"hold-time,omitempty"` 2644 // original -> bgp:keepalive-interval 2645 // bgp:keepalive-interval's original type is decimal64. 2646 // Time interval in seconds between transmission of keepalive 2647 // messages to the neighbor. Typically set to 1/3 the 2648 // hold-time. 2649 KeepaliveInterval float64 `mapstructure:"keepalive-interval" json:"keepalive-interval,omitempty"` 2650 // original -> bgp:minimum-advertisement-interval 2651 // bgp:minimum-advertisement-interval's original type is decimal64. 2652 // Minimum time which must elapse between subsequent UPDATE 2653 // messages relating to a common set of NLRI being transmitted 2654 // to a peer. This timer is referred to as 2655 // MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to 2656 // reduce the number of UPDATE messages transmitted when a 2657 // particular set of NLRI exhibit instability. 2658 MinimumAdvertisementInterval float64 `mapstructure:"minimum-advertisement-interval" json:"minimum-advertisement-interval,omitempty"` 2659 // original -> gobgp:idle-hold-time-after-reset 2660 // gobgp:idle-hold-time-after-reset's original type is decimal64. 2661 // Time interval in seconds that a BGP session will be 2662 // in idle state after neighbor reset operation. 2663 IdleHoldTimeAfterReset float64 `mapstructure:"idle-hold-time-after-reset" json:"idle-hold-time-after-reset,omitempty"` 2664 } 2665 2666 func (lhs *TimersConfig) Equal(rhs *TimersConfig) bool { 2667 if lhs == nil || rhs == nil { 2668 return false 2669 } 2670 if lhs.ConnectRetry != rhs.ConnectRetry { 2671 return false 2672 } 2673 if lhs.HoldTime != rhs.HoldTime { 2674 return false 2675 } 2676 if lhs.KeepaliveInterval != rhs.KeepaliveInterval { 2677 return false 2678 } 2679 if lhs.MinimumAdvertisementInterval != rhs.MinimumAdvertisementInterval { 2680 return false 2681 } 2682 if lhs.IdleHoldTimeAfterReset != rhs.IdleHoldTimeAfterReset { 2683 return false 2684 } 2685 return true 2686 } 2687 2688 // struct for container bgp:timers. 2689 // Timers related to a BGP neighbor or group. 2690 type Timers struct { 2691 // original -> bgp:timers-config 2692 // Configuration parameters relating to timers used for the 2693 // BGP neighbor or group. 2694 Config TimersConfig `mapstructure:"config" json:"config,omitempty"` 2695 // original -> bgp:timers-state 2696 // State information relating to the timers used for the BGP 2697 // neighbor or group. 2698 State TimersState `mapstructure:"state" json:"state,omitempty"` 2699 } 2700 2701 func (lhs *Timers) Equal(rhs *Timers) bool { 2702 if lhs == nil || rhs == nil { 2703 return false 2704 } 2705 if !lhs.Config.Equal(&(rhs.Config)) { 2706 return false 2707 } 2708 return true 2709 } 2710 2711 // struct for container gobgp:adj-table. 2712 type AdjTable struct { 2713 // original -> gobgp:ADVERTISED 2714 Advertised uint32 `mapstructure:"advertised" json:"advertised,omitempty"` 2715 // original -> gobgp:FILTERED 2716 Filtered uint32 `mapstructure:"filtered" json:"filtered,omitempty"` 2717 // original -> gobgp:RECEIVED 2718 Received uint32 `mapstructure:"received" json:"received,omitempty"` 2719 // original -> gobgp:ACCEPTED 2720 Accepted uint32 `mapstructure:"accepted" json:"accepted,omitempty"` 2721 } 2722 2723 func (lhs *AdjTable) Equal(rhs *AdjTable) bool { 2724 if lhs == nil || rhs == nil { 2725 return false 2726 } 2727 if lhs.Advertised != rhs.Advertised { 2728 return false 2729 } 2730 if lhs.Filtered != rhs.Filtered { 2731 return false 2732 } 2733 if lhs.Received != rhs.Received { 2734 return false 2735 } 2736 if lhs.Accepted != rhs.Accepted { 2737 return false 2738 } 2739 return true 2740 } 2741 2742 // struct for container bgp:queues. 2743 // Counters related to queued messages associated with the 2744 // BGP neighbor. 2745 type Queues struct { 2746 // original -> bgp-op:input 2747 // The number of messages received from the peer currently 2748 // queued. 2749 Input uint32 `mapstructure:"input" json:"input,omitempty"` 2750 // original -> bgp-op:output 2751 // The number of messages queued to be sent to the peer. 2752 Output uint32 `mapstructure:"output" json:"output,omitempty"` 2753 } 2754 2755 func (lhs *Queues) Equal(rhs *Queues) bool { 2756 if lhs == nil || rhs == nil { 2757 return false 2758 } 2759 if lhs.Input != rhs.Input { 2760 return false 2761 } 2762 if lhs.Output != rhs.Output { 2763 return false 2764 } 2765 return true 2766 } 2767 2768 // struct for container bgp:received. 2769 // Counters for BGP messages received from the neighbor. 2770 type Received struct { 2771 // original -> bgp-op:UPDATE 2772 // Number of BGP UPDATE messages announcing, withdrawing 2773 // or modifying paths exchanged. 2774 Update uint64 `mapstructure:"update" json:"update,omitempty"` 2775 // original -> bgp-op:NOTIFICATION 2776 // Number of BGP NOTIFICATION messages indicating an 2777 // error condition has occurred exchanged. 2778 Notification uint64 `mapstructure:"notification" json:"notification,omitempty"` 2779 // original -> gobgp:OPEN 2780 // Number of BGP open messages announcing, withdrawing 2781 // or modifying paths exchanged. 2782 Open uint64 `mapstructure:"open" json:"open,omitempty"` 2783 // original -> gobgp:REFRESH 2784 // Number of BGP Route-Refresh messages indicating an 2785 // error condition has occurred exchanged. 2786 Refresh uint64 `mapstructure:"refresh" json:"refresh,omitempty"` 2787 // original -> gobgp:KEEPALIVE 2788 // Number of BGP Keepalive messages indicating an 2789 // error condition has occurred exchanged. 2790 Keepalive uint64 `mapstructure:"keepalive" json:"keepalive,omitempty"` 2791 // original -> gobgp:DYNAMIC-CAP 2792 // Number of BGP dynamic-cap messages indicating an 2793 // error condition has occurred exchanged. 2794 DynamicCap uint64 `mapstructure:"dynamic-cap" json:"dynamic-cap,omitempty"` 2795 // original -> gobgp:WITHDRAW-UPDATE 2796 // Number of updates subjected to treat-as-withdraw treatment. 2797 WithdrawUpdate uint32 `mapstructure:"withdraw-update" json:"withdraw-update,omitempty"` 2798 // original -> gobgp:WITHDRAW-PREFIX 2799 // Number of prefixes subjected to treat-as-withdraw treatment. 2800 WithdrawPrefix uint32 `mapstructure:"withdraw-prefix" json:"withdraw-prefix,omitempty"` 2801 // original -> gobgp:DISCARDED 2802 // Number of discarded messages indicating an 2803 // error condition has occurred exchanged. 2804 Discarded uint64 `mapstructure:"discarded" json:"discarded,omitempty"` 2805 // original -> gobgp:TOTAL 2806 // Number of total messages indicating an 2807 // error condition has occurred exchanged. 2808 Total uint64 `mapstructure:"total" json:"total,omitempty"` 2809 } 2810 2811 func (lhs *Received) Equal(rhs *Received) bool { 2812 if lhs == nil || rhs == nil { 2813 return false 2814 } 2815 if lhs.Update != rhs.Update { 2816 return false 2817 } 2818 if lhs.Notification != rhs.Notification { 2819 return false 2820 } 2821 if lhs.Open != rhs.Open { 2822 return false 2823 } 2824 if lhs.Refresh != rhs.Refresh { 2825 return false 2826 } 2827 if lhs.Keepalive != rhs.Keepalive { 2828 return false 2829 } 2830 if lhs.DynamicCap != rhs.DynamicCap { 2831 return false 2832 } 2833 if lhs.WithdrawUpdate != rhs.WithdrawUpdate { 2834 return false 2835 } 2836 if lhs.WithdrawPrefix != rhs.WithdrawPrefix { 2837 return false 2838 } 2839 if lhs.Discarded != rhs.Discarded { 2840 return false 2841 } 2842 if lhs.Total != rhs.Total { 2843 return false 2844 } 2845 return true 2846 } 2847 2848 // struct for container bgp:sent. 2849 // Counters relating to BGP messages sent to the neighbor. 2850 type Sent struct { 2851 // original -> bgp-op:UPDATE 2852 // Number of BGP UPDATE messages announcing, withdrawing 2853 // or modifying paths exchanged. 2854 Update uint64 `mapstructure:"update" json:"update,omitempty"` 2855 // original -> bgp-op:NOTIFICATION 2856 // Number of BGP NOTIFICATION messages indicating an 2857 // error condition has occurred exchanged. 2858 Notification uint64 `mapstructure:"notification" json:"notification,omitempty"` 2859 // original -> gobgp:OPEN 2860 // Number of BGP open messages announcing, withdrawing 2861 // or modifying paths exchanged. 2862 Open uint64 `mapstructure:"open" json:"open,omitempty"` 2863 // original -> gobgp:REFRESH 2864 // Number of BGP Route-Refresh messages indicating an 2865 // error condition has occurred exchanged. 2866 Refresh uint64 `mapstructure:"refresh" json:"refresh,omitempty"` 2867 // original -> gobgp:KEEPALIVE 2868 // Number of BGP Keepalive messages indicating an 2869 // error condition has occurred exchanged. 2870 Keepalive uint64 `mapstructure:"keepalive" json:"keepalive,omitempty"` 2871 // original -> gobgp:DYNAMIC-CAP 2872 // Number of BGP dynamic-cap messages indicating an 2873 // error condition has occurred exchanged. 2874 DynamicCap uint64 `mapstructure:"dynamic-cap" json:"dynamic-cap,omitempty"` 2875 // original -> gobgp:WITHDRAW-UPDATE 2876 // Number of updates subjected to treat-as-withdraw treatment. 2877 WithdrawUpdate uint32 `mapstructure:"withdraw-update" json:"withdraw-update,omitempty"` 2878 // original -> gobgp:WITHDRAW-PREFIX 2879 // Number of prefixes subjected to treat-as-withdraw treatment. 2880 WithdrawPrefix uint32 `mapstructure:"withdraw-prefix" json:"withdraw-prefix,omitempty"` 2881 // original -> gobgp:DISCARDED 2882 // Number of discarded messages indicating an 2883 // error condition has occurred exchanged. 2884 Discarded uint64 `mapstructure:"discarded" json:"discarded,omitempty"` 2885 // original -> gobgp:TOTAL 2886 // Number of total messages indicating an 2887 // error condition has occurred exchanged. 2888 Total uint64 `mapstructure:"total" json:"total,omitempty"` 2889 } 2890 2891 func (lhs *Sent) Equal(rhs *Sent) bool { 2892 if lhs == nil || rhs == nil { 2893 return false 2894 } 2895 if lhs.Update != rhs.Update { 2896 return false 2897 } 2898 if lhs.Notification != rhs.Notification { 2899 return false 2900 } 2901 if lhs.Open != rhs.Open { 2902 return false 2903 } 2904 if lhs.Refresh != rhs.Refresh { 2905 return false 2906 } 2907 if lhs.Keepalive != rhs.Keepalive { 2908 return false 2909 } 2910 if lhs.DynamicCap != rhs.DynamicCap { 2911 return false 2912 } 2913 if lhs.WithdrawUpdate != rhs.WithdrawUpdate { 2914 return false 2915 } 2916 if lhs.WithdrawPrefix != rhs.WithdrawPrefix { 2917 return false 2918 } 2919 if lhs.Discarded != rhs.Discarded { 2920 return false 2921 } 2922 if lhs.Total != rhs.Total { 2923 return false 2924 } 2925 return true 2926 } 2927 2928 // struct for container bgp:messages. 2929 // Counters for BGP messages sent and received from the 2930 // neighbor. 2931 type Messages struct { 2932 // original -> bgp:sent 2933 // Counters relating to BGP messages sent to the neighbor. 2934 Sent Sent `mapstructure:"sent" json:"sent,omitempty"` 2935 // original -> bgp:received 2936 // Counters for BGP messages received from the neighbor. 2937 Received Received `mapstructure:"received" json:"received,omitempty"` 2938 } 2939 2940 func (lhs *Messages) Equal(rhs *Messages) bool { 2941 if lhs == nil || rhs == nil { 2942 return false 2943 } 2944 if !lhs.Sent.Equal(&(rhs.Sent)) { 2945 return false 2946 } 2947 if !lhs.Received.Equal(&(rhs.Received)) { 2948 return false 2949 } 2950 return true 2951 } 2952 2953 // struct for container bgp:state. 2954 // State information relating to the BGP neighbor or group. 2955 type NeighborState struct { 2956 // original -> bgp:peer-as 2957 // bgp:peer-as's original type is inet:as-number. 2958 // AS number of the peer. 2959 PeerAs uint32 `mapstructure:"peer-as" json:"peer-as,omitempty"` 2960 // original -> bgp:local-as 2961 // bgp:local-as's original type is inet:as-number. 2962 // The local autonomous system number that is to be used 2963 // when establishing sessions with the remote peer or peer 2964 // group, if this differs from the global BGP router 2965 // autonomous system number. 2966 LocalAs uint32 `mapstructure:"local-as" json:"local-as,omitempty"` 2967 // original -> bgp:peer-type 2968 // Explicitly designate the peer or peer group as internal 2969 // (iBGP) or external (eBGP). 2970 PeerType PeerType `mapstructure:"peer-type" json:"peer-type,omitempty"` 2971 // original -> bgp:auth-password 2972 // Configures an MD5 authentication password for use with 2973 // neighboring devices. 2974 AuthPassword string `mapstructure:"auth-password" json:"auth-password,omitempty"` 2975 // original -> bgp:remove-private-as 2976 // Remove private AS numbers from updates sent to peers. 2977 RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as" json:"remove-private-as,omitempty"` 2978 // original -> bgp:route-flap-damping 2979 // bgp:route-flap-damping's original type is boolean. 2980 // Enable route flap damping. 2981 RouteFlapDamping bool `mapstructure:"route-flap-damping" json:"route-flap-damping,omitempty"` 2982 // original -> bgp:send-community 2983 // Specify which types of community should be sent to the 2984 // neighbor or group. The default is to not send the 2985 // community attribute. 2986 SendCommunity CommunityType `mapstructure:"send-community" json:"send-community,omitempty"` 2987 // original -> bgp:description 2988 // An optional textual description (intended primarily for use 2989 // with a peer or group. 2990 Description string `mapstructure:"description" json:"description,omitempty"` 2991 // original -> bgp:peer-group 2992 // The peer-group with which this neighbor is associated. 2993 PeerGroup string `mapstructure:"peer-group" json:"peer-group,omitempty"` 2994 // original -> bgp:neighbor-address 2995 // bgp:neighbor-address's original type is inet:ip-address. 2996 // Address of the BGP peer, either in IPv4 or IPv6. 2997 NeighborAddress string `mapstructure:"neighbor-address" json:"neighbor-address,omitempty"` 2998 // original -> bgp-op:session-state 2999 // Operational state of the BGP peer. 3000 SessionState SessionState `mapstructure:"session-state" json:"session-state,omitempty"` 3001 // original -> bgp-op:supported-capabilities 3002 // BGP capabilities negotiated as supported with the peer. 3003 SupportedCapabilitiesList []BgpCapability `mapstructure:"supported-capabilities-list" json:"supported-capabilities-list,omitempty"` 3004 // original -> bgp:messages 3005 // Counters for BGP messages sent and received from the 3006 // neighbor. 3007 Messages Messages `mapstructure:"messages" json:"messages,omitempty"` 3008 // original -> bgp:queues 3009 // Counters related to queued messages associated with the 3010 // BGP neighbor. 3011 Queues Queues `mapstructure:"queues" json:"queues,omitempty"` 3012 // original -> gobgp:adj-table 3013 AdjTable AdjTable `mapstructure:"adj-table" json:"adj-table,omitempty"` 3014 // original -> gobgp:remote-capability 3015 // original type is list of bgp-capability 3016 RemoteCapabilityList []bgp.ParameterCapabilityInterface `mapstructure:"remote-capability-list" json:"remote-capability-list,omitempty"` 3017 // original -> gobgp:local-capability 3018 // original type is list of bgp-capability 3019 LocalCapabilityList []bgp.ParameterCapabilityInterface `mapstructure:"local-capability-list" json:"local-capability-list,omitempty"` 3020 // original -> gobgp:received-open-message 3021 // gobgp:received-open-message's original type is bgp-open-message. 3022 ReceivedOpenMessage *bgp.BGPMessage `mapstructure:"received-open-message" json:"received-open-message,omitempty"` 3023 // original -> gobgp:admin-down 3024 // gobgp:admin-down's original type is boolean. 3025 // The state of administrative operation. If the state is true, it indicates the neighbor is disabled by the administrator. 3026 AdminDown bool `mapstructure:"admin-down" json:"admin-down,omitempty"` 3027 // original -> gobgp:admin-state 3028 AdminState AdminState `mapstructure:"admin-state" json:"admin-state,omitempty"` 3029 // original -> gobgp:established-count 3030 // The number of how many the peer became established state. 3031 EstablishedCount uint32 `mapstructure:"established-count" json:"established-count,omitempty"` 3032 // original -> gobgp:flops 3033 // The number of flip-flops. 3034 Flops uint32 `mapstructure:"flops" json:"flops,omitempty"` 3035 // original -> gobgp:neighbor-interface 3036 NeighborInterface string `mapstructure:"neighbor-interface" json:"neighbor-interface,omitempty"` 3037 // original -> gobgp:vrf 3038 Vrf string `mapstructure:"vrf" json:"vrf,omitempty"` 3039 // original -> gobgp:remote-router-id 3040 RemoteRouterId string `mapstructure:"remote-router-id" json:"remote-router-id,omitempty"` 3041 } 3042 3043 // struct for container bgp:config. 3044 // Configuration parameters relating to the BGP neighbor or 3045 // group. 3046 type NeighborConfig struct { 3047 // original -> bgp:peer-as 3048 // bgp:peer-as's original type is inet:as-number. 3049 // AS number of the peer. 3050 PeerAs uint32 `mapstructure:"peer-as" json:"peer-as,omitempty"` 3051 // original -> bgp:local-as 3052 // bgp:local-as's original type is inet:as-number. 3053 // The local autonomous system number that is to be used 3054 // when establishing sessions with the remote peer or peer 3055 // group, if this differs from the global BGP router 3056 // autonomous system number. 3057 LocalAs uint32 `mapstructure:"local-as" json:"local-as,omitempty"` 3058 // original -> bgp:peer-type 3059 // Explicitly designate the peer or peer group as internal 3060 // (iBGP) or external (eBGP). 3061 PeerType PeerType `mapstructure:"peer-type" json:"peer-type,omitempty"` 3062 // original -> bgp:auth-password 3063 // Configures an MD5 authentication password for use with 3064 // neighboring devices. 3065 AuthPassword string `mapstructure:"auth-password" json:"auth-password,omitempty"` 3066 // original -> bgp:remove-private-as 3067 // Remove private AS numbers from updates sent to peers. 3068 RemovePrivateAs RemovePrivateAsOption `mapstructure:"remove-private-as" json:"remove-private-as,omitempty"` 3069 // original -> bgp:route-flap-damping 3070 // bgp:route-flap-damping's original type is boolean. 3071 // Enable route flap damping. 3072 RouteFlapDamping bool `mapstructure:"route-flap-damping" json:"route-flap-damping,omitempty"` 3073 // original -> bgp:send-community 3074 // Specify which types of community should be sent to the 3075 // neighbor or group. The default is to not send the 3076 // community attribute. 3077 SendCommunity CommunityType `mapstructure:"send-community" json:"send-community,omitempty"` 3078 // original -> bgp:description 3079 // An optional textual description (intended primarily for use 3080 // with a peer or group. 3081 Description string `mapstructure:"description" json:"description,omitempty"` 3082 // original -> bgp:peer-group 3083 // The peer-group with which this neighbor is associated. 3084 PeerGroup string `mapstructure:"peer-group" json:"peer-group,omitempty"` 3085 // original -> bgp:neighbor-address 3086 // bgp:neighbor-address's original type is inet:ip-address. 3087 // Address of the BGP peer, either in IPv4 or IPv6. 3088 NeighborAddress string `mapstructure:"neighbor-address" json:"neighbor-address,omitempty"` 3089 // original -> gobgp:admin-down 3090 // gobgp:admin-down's original type is boolean. 3091 // The config of administrative operation. If state, indicates the neighbor is disabled by the administrator. 3092 AdminDown bool `mapstructure:"admin-down" json:"admin-down,omitempty"` 3093 // original -> gobgp:neighbor-interface 3094 NeighborInterface string `mapstructure:"neighbor-interface" json:"neighbor-interface,omitempty"` 3095 // original -> gobgp:vrf 3096 Vrf string `mapstructure:"vrf" json:"vrf,omitempty"` 3097 } 3098 3099 func (lhs *NeighborConfig) Equal(rhs *NeighborConfig) bool { 3100 if lhs == nil || rhs == nil { 3101 return false 3102 } 3103 if lhs.PeerAs != rhs.PeerAs { 3104 return false 3105 } 3106 if lhs.LocalAs != rhs.LocalAs { 3107 return false 3108 } 3109 if lhs.PeerType != rhs.PeerType { 3110 return false 3111 } 3112 if lhs.AuthPassword != rhs.AuthPassword { 3113 return false 3114 } 3115 if lhs.RemovePrivateAs != rhs.RemovePrivateAs { 3116 return false 3117 } 3118 if lhs.RouteFlapDamping != rhs.RouteFlapDamping { 3119 return false 3120 } 3121 if lhs.SendCommunity != rhs.SendCommunity { 3122 return false 3123 } 3124 if lhs.Description != rhs.Description { 3125 return false 3126 } 3127 if lhs.PeerGroup != rhs.PeerGroup { 3128 return false 3129 } 3130 if lhs.NeighborAddress != rhs.NeighborAddress { 3131 return false 3132 } 3133 if lhs.AdminDown != rhs.AdminDown { 3134 return false 3135 } 3136 if lhs.NeighborInterface != rhs.NeighborInterface { 3137 return false 3138 } 3139 if lhs.Vrf != rhs.Vrf { 3140 return false 3141 } 3142 return true 3143 } 3144 3145 // struct for container bgp:neighbor. 3146 // List of BGP neighbors configured on the local system, 3147 // uniquely identified by peer IPv[46] address. 3148 type Neighbor struct { 3149 // original -> bgp:neighbor-address 3150 // original -> bgp:neighbor-config 3151 // Configuration parameters relating to the BGP neighbor or 3152 // group. 3153 Config NeighborConfig `mapstructure:"config" json:"config,omitempty"` 3154 // original -> bgp:neighbor-state 3155 // State information relating to the BGP neighbor or group. 3156 State NeighborState `mapstructure:"state" json:"state,omitempty"` 3157 // original -> bgp:timers 3158 // Timers related to a BGP neighbor or group. 3159 Timers Timers `mapstructure:"timers" json:"timers,omitempty"` 3160 // original -> bgp:transport 3161 // Transport session parameters for the BGP neighbor or group. 3162 Transport Transport `mapstructure:"transport" json:"transport,omitempty"` 3163 // original -> bgp:error-handling 3164 // Error handling parameters used for the BGP neighbor or 3165 // group. 3166 ErrorHandling ErrorHandling `mapstructure:"error-handling" json:"error-handling,omitempty"` 3167 // original -> bgp:logging-options 3168 // Logging options for events related to the BGP neighbor or 3169 // group. 3170 LoggingOptions LoggingOptions `mapstructure:"logging-options" json:"logging-options,omitempty"` 3171 // original -> bgp:ebgp-multihop 3172 // eBGP multi-hop parameters for the BGP neighbor or group. 3173 EbgpMultihop EbgpMultihop `mapstructure:"ebgp-multihop" json:"ebgp-multihop,omitempty"` 3174 // original -> bgp:route-reflector 3175 // Route reflector parameters for the BGP neighbor or group. 3176 RouteReflector RouteReflector `mapstructure:"route-reflector" json:"route-reflector,omitempty"` 3177 // original -> bgp:as-path-options 3178 // AS_PATH manipulation parameters for the BGP neighbor or 3179 // group. 3180 AsPathOptions AsPathOptions `mapstructure:"as-path-options" json:"as-path-options,omitempty"` 3181 // original -> bgp:add-paths 3182 // Parameters relating to the advertisement and receipt of 3183 // multiple paths for a single NLRI (add-paths). 3184 AddPaths AddPaths `mapstructure:"add-paths" json:"add-paths,omitempty"` 3185 // original -> bgp:afi-safis 3186 // Per-address-family configuration parameters associated with 3187 // the neighbor or group. 3188 AfiSafis []AfiSafi `mapstructure:"afi-safis" json:"afi-safis,omitempty"` 3189 // original -> bgp:graceful-restart 3190 // Parameters relating the graceful restart mechanism for BGP. 3191 GracefulRestart GracefulRestart `mapstructure:"graceful-restart" json:"graceful-restart,omitempty"` 3192 // original -> rpol:apply-policy 3193 // Anchor point for routing policies in the model. 3194 // Import and export policies are with respect to the local 3195 // routing table, i.e., export (send) and import (receive), 3196 // depending on the context. 3197 ApplyPolicy ApplyPolicy `mapstructure:"apply-policy" json:"apply-policy,omitempty"` 3198 // original -> bgp-mp:use-multiple-paths 3199 // Parameters related to the use of multiple-paths for the same 3200 // NLRI when they are received only from this neighbor. 3201 UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths" json:"use-multiple-paths,omitempty"` 3202 // original -> gobgp:route-server 3203 // Configure the local router as a route server. 3204 RouteServer RouteServer `mapstructure:"route-server" json:"route-server,omitempty"` 3205 // original -> gobgp:ttl-security 3206 // Configure TTL Security feature. 3207 TtlSecurity TtlSecurity `mapstructure:"ttl-security" json:"ttl-security,omitempty"` 3208 } 3209 3210 func (lhs *Neighbor) Equal(rhs *Neighbor) bool { 3211 if lhs == nil || rhs == nil { 3212 return false 3213 } 3214 if !lhs.Config.Equal(&(rhs.Config)) { 3215 return false 3216 } 3217 if !lhs.Timers.Equal(&(rhs.Timers)) { 3218 return false 3219 } 3220 if !lhs.Transport.Equal(&(rhs.Transport)) { 3221 return false 3222 } 3223 if !lhs.ErrorHandling.Equal(&(rhs.ErrorHandling)) { 3224 return false 3225 } 3226 if !lhs.LoggingOptions.Equal(&(rhs.LoggingOptions)) { 3227 return false 3228 } 3229 if !lhs.EbgpMultihop.Equal(&(rhs.EbgpMultihop)) { 3230 return false 3231 } 3232 if !lhs.RouteReflector.Equal(&(rhs.RouteReflector)) { 3233 return false 3234 } 3235 if !lhs.AsPathOptions.Equal(&(rhs.AsPathOptions)) { 3236 return false 3237 } 3238 if !lhs.AddPaths.Equal(&(rhs.AddPaths)) { 3239 return false 3240 } 3241 if len(lhs.AfiSafis) != len(rhs.AfiSafis) { 3242 return false 3243 } 3244 { 3245 lmap := make(map[string]*AfiSafi) 3246 for i, l := range lhs.AfiSafis { 3247 lmap[mapkey(i, string(l.Config.AfiSafiName))] = &lhs.AfiSafis[i] 3248 } 3249 for i, r := range rhs.AfiSafis { 3250 if l, y := lmap[mapkey(i, string(r.Config.AfiSafiName))]; !y { 3251 return false 3252 } else if !r.Equal(l) { 3253 return false 3254 } 3255 } 3256 } 3257 if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { 3258 return false 3259 } 3260 if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { 3261 return false 3262 } 3263 if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { 3264 return false 3265 } 3266 if !lhs.RouteServer.Equal(&(rhs.RouteServer)) { 3267 return false 3268 } 3269 if !lhs.TtlSecurity.Equal(&(rhs.TtlSecurity)) { 3270 return false 3271 } 3272 return true 3273 } 3274 3275 // struct for container gobgp:state. 3276 type LongLivedGracefulRestartState struct { 3277 // original -> gobgp:enabled 3278 // gobgp:enabled's original type is boolean. 3279 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3280 // original -> gobgp:received 3281 // gobgp:received's original type is boolean. 3282 Received bool `mapstructure:"received" json:"received,omitempty"` 3283 // original -> gobgp:advertised 3284 // gobgp:advertised's original type is boolean. 3285 Advertised bool `mapstructure:"advertised" json:"advertised,omitempty"` 3286 // original -> gobgp:peer-restart-time 3287 PeerRestartTime uint32 `mapstructure:"peer-restart-time" json:"peer-restart-time,omitempty"` 3288 // original -> gobgp:peer-restart-timer-expired 3289 // gobgp:peer-restart-timer-expired's original type is boolean. 3290 PeerRestartTimerExpired bool `mapstructure:"peer-restart-timer-expired" json:"peer-restart-timer-expired,omitempty"` 3291 } 3292 3293 // struct for container gobgp:config. 3294 type LongLivedGracefulRestartConfig struct { 3295 // original -> gobgp:enabled 3296 // gobgp:enabled's original type is boolean. 3297 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3298 // original -> gobgp:restart-time 3299 RestartTime uint32 `mapstructure:"restart-time" json:"restart-time,omitempty"` 3300 } 3301 3302 func (lhs *LongLivedGracefulRestartConfig) Equal(rhs *LongLivedGracefulRestartConfig) bool { 3303 if lhs == nil || rhs == nil { 3304 return false 3305 } 3306 if lhs.Enabled != rhs.Enabled { 3307 return false 3308 } 3309 if lhs.RestartTime != rhs.RestartTime { 3310 return false 3311 } 3312 return true 3313 } 3314 3315 // struct for container gobgp:long-lived-graceful-restart. 3316 type LongLivedGracefulRestart struct { 3317 // original -> gobgp:long-lived-graceful-restart-config 3318 Config LongLivedGracefulRestartConfig `mapstructure:"config" json:"config,omitempty"` 3319 // original -> gobgp:long-lived-graceful-restart-state 3320 State LongLivedGracefulRestartState `mapstructure:"state" json:"state,omitempty"` 3321 } 3322 3323 func (lhs *LongLivedGracefulRestart) Equal(rhs *LongLivedGracefulRestart) bool { 3324 if lhs == nil || rhs == nil { 3325 return false 3326 } 3327 if !lhs.Config.Equal(&(rhs.Config)) { 3328 return false 3329 } 3330 return true 3331 } 3332 3333 // struct for container gobgp:state. 3334 type RouteTargetMembershipState struct { 3335 // original -> gobgp:deferral-time 3336 DeferralTime uint16 `mapstructure:"deferral-time" json:"deferral-time,omitempty"` 3337 } 3338 3339 // struct for container gobgp:config. 3340 type RouteTargetMembershipConfig struct { 3341 // original -> gobgp:deferral-time 3342 DeferralTime uint16 `mapstructure:"deferral-time" json:"deferral-time,omitempty"` 3343 } 3344 3345 func (lhs *RouteTargetMembershipConfig) Equal(rhs *RouteTargetMembershipConfig) bool { 3346 if lhs == nil || rhs == nil { 3347 return false 3348 } 3349 if lhs.DeferralTime != rhs.DeferralTime { 3350 return false 3351 } 3352 return true 3353 } 3354 3355 // struct for container gobgp:route-target-membership. 3356 type RouteTargetMembership struct { 3357 // original -> gobgp:route-target-membership-config 3358 Config RouteTargetMembershipConfig `mapstructure:"config" json:"config,omitempty"` 3359 // original -> gobgp:route-target-membership-state 3360 State RouteTargetMembershipState `mapstructure:"state" json:"state,omitempty"` 3361 } 3362 3363 func (lhs *RouteTargetMembership) Equal(rhs *RouteTargetMembership) bool { 3364 if lhs == nil || rhs == nil { 3365 return false 3366 } 3367 if !lhs.Config.Equal(&(rhs.Config)) { 3368 return false 3369 } 3370 return true 3371 } 3372 3373 // struct for container bgp-mp:l2vpn-evpn. 3374 // BGP EVPN configuration options. 3375 type L2vpnEvpn struct { 3376 // original -> bgp-mp:prefix-limit 3377 // Configure the maximum number of prefixes that will be 3378 // accepted from a peer. 3379 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3380 } 3381 3382 func (lhs *L2vpnEvpn) Equal(rhs *L2vpnEvpn) bool { 3383 if lhs == nil || rhs == nil { 3384 return false 3385 } 3386 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3387 return false 3388 } 3389 return true 3390 } 3391 3392 // struct for container bgp-mp:l2vpn-vpls. 3393 // BGP-signalled VPLS configuration options. 3394 type L2vpnVpls struct { 3395 // original -> bgp-mp:prefix-limit 3396 // Configure the maximum number of prefixes that will be 3397 // accepted from a peer. 3398 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3399 } 3400 3401 func (lhs *L2vpnVpls) Equal(rhs *L2vpnVpls) bool { 3402 if lhs == nil || rhs == nil { 3403 return false 3404 } 3405 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3406 return false 3407 } 3408 return true 3409 } 3410 3411 // struct for container bgp-mp:l3vpn-ipv6-multicast. 3412 // Multicast IPv6 L3VPN configuration options. 3413 type L3vpnIpv6Multicast struct { 3414 // original -> bgp-mp:prefix-limit 3415 // Configure the maximum number of prefixes that will be 3416 // accepted from a peer. 3417 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3418 } 3419 3420 func (lhs *L3vpnIpv6Multicast) Equal(rhs *L3vpnIpv6Multicast) bool { 3421 if lhs == nil || rhs == nil { 3422 return false 3423 } 3424 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3425 return false 3426 } 3427 return true 3428 } 3429 3430 // struct for container bgp-mp:l3vpn-ipv4-multicast. 3431 // Multicast IPv4 L3VPN configuration options. 3432 type L3vpnIpv4Multicast struct { 3433 // original -> bgp-mp:prefix-limit 3434 // Configure the maximum number of prefixes that will be 3435 // accepted from a peer. 3436 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3437 } 3438 3439 func (lhs *L3vpnIpv4Multicast) Equal(rhs *L3vpnIpv4Multicast) bool { 3440 if lhs == nil || rhs == nil { 3441 return false 3442 } 3443 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3444 return false 3445 } 3446 return true 3447 } 3448 3449 // struct for container bgp-mp:l3vpn-ipv6-unicast. 3450 // Unicast IPv6 L3VPN configuration options. 3451 type L3vpnIpv6Unicast struct { 3452 // original -> bgp-mp:prefix-limit 3453 // Configure the maximum number of prefixes that will be 3454 // accepted from a peer. 3455 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3456 } 3457 3458 func (lhs *L3vpnIpv6Unicast) Equal(rhs *L3vpnIpv6Unicast) bool { 3459 if lhs == nil || rhs == nil { 3460 return false 3461 } 3462 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3463 return false 3464 } 3465 return true 3466 } 3467 3468 // struct for container bgp-mp:l3vpn-ipv4-unicast. 3469 // Unicast IPv4 L3VPN configuration options. 3470 type L3vpnIpv4Unicast struct { 3471 // original -> bgp-mp:prefix-limit 3472 // Configure the maximum number of prefixes that will be 3473 // accepted from a peer. 3474 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3475 } 3476 3477 func (lhs *L3vpnIpv4Unicast) Equal(rhs *L3vpnIpv4Unicast) bool { 3478 if lhs == nil || rhs == nil { 3479 return false 3480 } 3481 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3482 return false 3483 } 3484 return true 3485 } 3486 3487 // struct for container bgp-mp:ipv6-labelled-unicast. 3488 // IPv6 Labelled Unicast configuration options. 3489 type Ipv6LabelledUnicast struct { 3490 // original -> bgp-mp:prefix-limit 3491 // Configure the maximum number of prefixes that will be 3492 // accepted from a peer. 3493 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3494 } 3495 3496 func (lhs *Ipv6LabelledUnicast) Equal(rhs *Ipv6LabelledUnicast) bool { 3497 if lhs == nil || rhs == nil { 3498 return false 3499 } 3500 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3501 return false 3502 } 3503 return true 3504 } 3505 3506 // struct for container bgp-mp:ipv4-labelled-unicast. 3507 // IPv4 Labelled Unicast configuration options. 3508 type Ipv4LabelledUnicast struct { 3509 // original -> bgp-mp:prefix-limit 3510 // Configure the maximum number of prefixes that will be 3511 // accepted from a peer. 3512 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3513 } 3514 3515 func (lhs *Ipv4LabelledUnicast) Equal(rhs *Ipv4LabelledUnicast) bool { 3516 if lhs == nil || rhs == nil { 3517 return false 3518 } 3519 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3520 return false 3521 } 3522 return true 3523 } 3524 3525 // struct for container bgp-mp:state. 3526 // State information for common IPv4 and IPv6 unicast 3527 // parameters. 3528 type Ipv6UnicastState struct { 3529 // original -> bgp-mp:send-default-route 3530 // bgp-mp:send-default-route's original type is boolean. 3531 // If set to true, send the default-route to the neighbour(s). 3532 SendDefaultRoute bool `mapstructure:"send-default-route" json:"send-default-route,omitempty"` 3533 } 3534 3535 // struct for container bgp-mp:config. 3536 // Configuration parameters for common IPv4 and IPv6 unicast 3537 // AFI-SAFI options. 3538 type Ipv6UnicastConfig struct { 3539 // original -> bgp-mp:send-default-route 3540 // bgp-mp:send-default-route's original type is boolean. 3541 // If set to true, send the default-route to the neighbour(s). 3542 SendDefaultRoute bool `mapstructure:"send-default-route" json:"send-default-route,omitempty"` 3543 } 3544 3545 func (lhs *Ipv6UnicastConfig) Equal(rhs *Ipv6UnicastConfig) bool { 3546 if lhs == nil || rhs == nil { 3547 return false 3548 } 3549 if lhs.SendDefaultRoute != rhs.SendDefaultRoute { 3550 return false 3551 } 3552 return true 3553 } 3554 3555 // struct for container bgp-mp:ipv6-unicast. 3556 // IPv6 unicast configuration options. 3557 type Ipv6Unicast struct { 3558 // original -> bgp-mp:prefix-limit 3559 // Configure the maximum number of prefixes that will be 3560 // accepted from a peer. 3561 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3562 // original -> bgp-mp:ipv6-unicast-config 3563 // Configuration parameters for common IPv4 and IPv6 unicast 3564 // AFI-SAFI options. 3565 Config Ipv6UnicastConfig `mapstructure:"config" json:"config,omitempty"` 3566 // original -> bgp-mp:ipv6-unicast-state 3567 // State information for common IPv4 and IPv6 unicast 3568 // parameters. 3569 State Ipv6UnicastState `mapstructure:"state" json:"state,omitempty"` 3570 } 3571 3572 func (lhs *Ipv6Unicast) Equal(rhs *Ipv6Unicast) bool { 3573 if lhs == nil || rhs == nil { 3574 return false 3575 } 3576 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3577 return false 3578 } 3579 if !lhs.Config.Equal(&(rhs.Config)) { 3580 return false 3581 } 3582 return true 3583 } 3584 3585 // struct for container bgp-mp:state. 3586 // State information for common IPv4 and IPv6 unicast 3587 // parameters. 3588 type Ipv4UnicastState struct { 3589 // original -> bgp-mp:send-default-route 3590 // bgp-mp:send-default-route's original type is boolean. 3591 // If set to true, send the default-route to the neighbour(s). 3592 SendDefaultRoute bool `mapstructure:"send-default-route" json:"send-default-route,omitempty"` 3593 } 3594 3595 // struct for container bgp-mp:config. 3596 // Configuration parameters for common IPv4 and IPv6 unicast 3597 // AFI-SAFI options. 3598 type Ipv4UnicastConfig struct { 3599 // original -> bgp-mp:send-default-route 3600 // bgp-mp:send-default-route's original type is boolean. 3601 // If set to true, send the default-route to the neighbour(s). 3602 SendDefaultRoute bool `mapstructure:"send-default-route" json:"send-default-route,omitempty"` 3603 } 3604 3605 func (lhs *Ipv4UnicastConfig) Equal(rhs *Ipv4UnicastConfig) bool { 3606 if lhs == nil || rhs == nil { 3607 return false 3608 } 3609 if lhs.SendDefaultRoute != rhs.SendDefaultRoute { 3610 return false 3611 } 3612 return true 3613 } 3614 3615 // struct for container bgp-mp:state. 3616 // State information relating to the prefix-limit for the 3617 // AFI-SAFI. 3618 type PrefixLimitState struct { 3619 // original -> bgp-mp:max-prefixes 3620 // Maximum number of prefixes that will be accepted 3621 // from the neighbour. 3622 MaxPrefixes uint32 `mapstructure:"max-prefixes" json:"max-prefixes,omitempty"` 3623 // original -> bgp-mp:shutdown-threshold-pct 3624 // Threshold on number of prefixes that can be received 3625 // from a neighbour before generation of warning messages 3626 // or log entries. Expressed as a percentage of 3627 // max-prefixes. 3628 ShutdownThresholdPct Percentage `mapstructure:"shutdown-threshold-pct" json:"shutdown-threshold-pct,omitempty"` 3629 // original -> bgp-mp:restart-timer 3630 // bgp-mp:restart-timer's original type is decimal64. 3631 // Time interval in seconds after which the BGP session 3632 // is re-established after being torn down due to exceeding 3633 // the max-prefix limit. 3634 RestartTimer float64 `mapstructure:"restart-timer" json:"restart-timer,omitempty"` 3635 } 3636 3637 // struct for container bgp-mp:config. 3638 // Configuration parameters relating to the prefix 3639 // limit for the AFI-SAFI. 3640 type PrefixLimitConfig struct { 3641 // original -> bgp-mp:max-prefixes 3642 // Maximum number of prefixes that will be accepted 3643 // from the neighbour. 3644 MaxPrefixes uint32 `mapstructure:"max-prefixes" json:"max-prefixes,omitempty"` 3645 // original -> bgp-mp:shutdown-threshold-pct 3646 // Threshold on number of prefixes that can be received 3647 // from a neighbour before generation of warning messages 3648 // or log entries. Expressed as a percentage of 3649 // max-prefixes. 3650 ShutdownThresholdPct Percentage `mapstructure:"shutdown-threshold-pct" json:"shutdown-threshold-pct,omitempty"` 3651 // original -> bgp-mp:restart-timer 3652 // bgp-mp:restart-timer's original type is decimal64. 3653 // Time interval in seconds after which the BGP session 3654 // is re-established after being torn down due to exceeding 3655 // the max-prefix limit. 3656 RestartTimer float64 `mapstructure:"restart-timer" json:"restart-timer,omitempty"` 3657 } 3658 3659 func (lhs *PrefixLimitConfig) Equal(rhs *PrefixLimitConfig) bool { 3660 if lhs == nil || rhs == nil { 3661 return false 3662 } 3663 if lhs.MaxPrefixes != rhs.MaxPrefixes { 3664 return false 3665 } 3666 if lhs.ShutdownThresholdPct != rhs.ShutdownThresholdPct { 3667 return false 3668 } 3669 if lhs.RestartTimer != rhs.RestartTimer { 3670 return false 3671 } 3672 return true 3673 } 3674 3675 // struct for container bgp-mp:prefix-limit. 3676 // Configure the maximum number of prefixes that will be 3677 // accepted from a peer. 3678 type PrefixLimit struct { 3679 // original -> bgp-mp:prefix-limit-config 3680 // Configuration parameters relating to the prefix 3681 // limit for the AFI-SAFI. 3682 Config PrefixLimitConfig `mapstructure:"config" json:"config,omitempty"` 3683 // original -> bgp-mp:prefix-limit-state 3684 // State information relating to the prefix-limit for the 3685 // AFI-SAFI. 3686 State PrefixLimitState `mapstructure:"state" json:"state,omitempty"` 3687 } 3688 3689 func (lhs *PrefixLimit) Equal(rhs *PrefixLimit) bool { 3690 if lhs == nil || rhs == nil { 3691 return false 3692 } 3693 if !lhs.Config.Equal(&(rhs.Config)) { 3694 return false 3695 } 3696 return true 3697 } 3698 3699 // struct for container bgp-mp:ipv4-unicast. 3700 // IPv4 unicast configuration options. 3701 type Ipv4Unicast struct { 3702 // original -> bgp-mp:prefix-limit 3703 // Configure the maximum number of prefixes that will be 3704 // accepted from a peer. 3705 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 3706 // original -> bgp-mp:ipv4-unicast-config 3707 // Configuration parameters for common IPv4 and IPv6 unicast 3708 // AFI-SAFI options. 3709 Config Ipv4UnicastConfig `mapstructure:"config" json:"config,omitempty"` 3710 // original -> bgp-mp:ipv4-unicast-state 3711 // State information for common IPv4 and IPv6 unicast 3712 // parameters. 3713 State Ipv4UnicastState `mapstructure:"state" json:"state,omitempty"` 3714 } 3715 3716 func (lhs *Ipv4Unicast) Equal(rhs *Ipv4Unicast) bool { 3717 if lhs == nil || rhs == nil { 3718 return false 3719 } 3720 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 3721 return false 3722 } 3723 if !lhs.Config.Equal(&(rhs.Config)) { 3724 return false 3725 } 3726 return true 3727 } 3728 3729 // struct for container rpol:state. 3730 // Operational state for routing policy. 3731 type ApplyPolicyState struct { 3732 // original -> rpol:import-policy 3733 // list of policy names in sequence to be applied on 3734 // receiving a routing update in the current context, e.g., 3735 // for the current peer group, neighbor, address family, 3736 // etc. 3737 ImportPolicyList []string `mapstructure:"import-policy-list" json:"import-policy-list,omitempty"` 3738 // original -> rpol:default-import-policy 3739 // explicitly set a default policy if no policy definition 3740 // in the import policy chain is satisfied. 3741 DefaultImportPolicy DefaultPolicyType `mapstructure:"default-import-policy" json:"default-import-policy,omitempty"` 3742 // original -> rpol:export-policy 3743 // list of policy names in sequence to be applied on 3744 // sending a routing update in the current context, e.g., 3745 // for the current peer group, neighbor, address family, 3746 // etc. 3747 ExportPolicyList []string `mapstructure:"export-policy-list" json:"export-policy-list,omitempty"` 3748 // original -> rpol:default-export-policy 3749 // explicitly set a default policy if no policy definition 3750 // in the export policy chain is satisfied. 3751 DefaultExportPolicy DefaultPolicyType `mapstructure:"default-export-policy" json:"default-export-policy,omitempty"` 3752 // original -> gobgp:in-policy 3753 // list of policy names in sequence to be applied on 3754 // sending a routing update in the current context, e.g., 3755 // for the current other route server clients. 3756 InPolicyList []string `mapstructure:"in-policy-list" json:"in-policy-list,omitempty"` 3757 // original -> gobgp:default-in-policy 3758 // explicitly set a default policy if no policy definition 3759 // in the in-policy chain is satisfied. 3760 DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy" json:"default-in-policy,omitempty"` 3761 } 3762 3763 // struct for container rpol:config. 3764 // Policy configuration data. 3765 type ApplyPolicyConfig struct { 3766 // original -> rpol:import-policy 3767 // list of policy names in sequence to be applied on 3768 // receiving a routing update in the current context, e.g., 3769 // for the current peer group, neighbor, address family, 3770 // etc. 3771 ImportPolicyList []string `mapstructure:"import-policy-list" json:"import-policy-list,omitempty"` 3772 // original -> rpol:default-import-policy 3773 // explicitly set a default policy if no policy definition 3774 // in the import policy chain is satisfied. 3775 DefaultImportPolicy DefaultPolicyType `mapstructure:"default-import-policy" json:"default-import-policy,omitempty"` 3776 // original -> rpol:export-policy 3777 // list of policy names in sequence to be applied on 3778 // sending a routing update in the current context, e.g., 3779 // for the current peer group, neighbor, address family, 3780 // etc. 3781 ExportPolicyList []string `mapstructure:"export-policy-list" json:"export-policy-list,omitempty"` 3782 // original -> rpol:default-export-policy 3783 // explicitly set a default policy if no policy definition 3784 // in the export policy chain is satisfied. 3785 DefaultExportPolicy DefaultPolicyType `mapstructure:"default-export-policy" json:"default-export-policy,omitempty"` 3786 // original -> gobgp:in-policy 3787 // list of policy names in sequence to be applied on 3788 // sending a routing update in the current context, e.g., 3789 // for the current other route server clients. 3790 InPolicyList []string `mapstructure:"in-policy-list" json:"in-policy-list,omitempty"` 3791 // original -> gobgp:default-in-policy 3792 // explicitly set a default policy if no policy definition 3793 // in the in-policy chain is satisfied. 3794 DefaultInPolicy DefaultPolicyType `mapstructure:"default-in-policy" json:"default-in-policy,omitempty"` 3795 } 3796 3797 func (lhs *ApplyPolicyConfig) Equal(rhs *ApplyPolicyConfig) bool { 3798 if lhs == nil || rhs == nil { 3799 return false 3800 } 3801 if len(lhs.ImportPolicyList) != len(rhs.ImportPolicyList) { 3802 return false 3803 } 3804 for idx, l := range lhs.ImportPolicyList { 3805 if l != rhs.ImportPolicyList[idx] { 3806 return false 3807 } 3808 } 3809 if lhs.DefaultImportPolicy != rhs.DefaultImportPolicy { 3810 return false 3811 } 3812 if len(lhs.ExportPolicyList) != len(rhs.ExportPolicyList) { 3813 return false 3814 } 3815 for idx, l := range lhs.ExportPolicyList { 3816 if l != rhs.ExportPolicyList[idx] { 3817 return false 3818 } 3819 } 3820 if lhs.DefaultExportPolicy != rhs.DefaultExportPolicy { 3821 return false 3822 } 3823 if len(lhs.InPolicyList) != len(rhs.InPolicyList) { 3824 return false 3825 } 3826 for idx, l := range lhs.InPolicyList { 3827 if l != rhs.InPolicyList[idx] { 3828 return false 3829 } 3830 } 3831 if lhs.DefaultInPolicy != rhs.DefaultInPolicy { 3832 return false 3833 } 3834 return true 3835 } 3836 3837 // struct for container rpol:apply-policy. 3838 // Anchor point for routing policies in the model. 3839 // Import and export policies are with respect to the local 3840 // routing table, i.e., export (send) and import (receive), 3841 // depending on the context. 3842 type ApplyPolicy struct { 3843 // original -> rpol:apply-policy-config 3844 // Policy configuration data. 3845 Config ApplyPolicyConfig `mapstructure:"config" json:"config,omitempty"` 3846 // original -> rpol:apply-policy-state 3847 // Operational state for routing policy. 3848 State ApplyPolicyState `mapstructure:"state" json:"state,omitempty"` 3849 } 3850 3851 func (lhs *ApplyPolicy) Equal(rhs *ApplyPolicy) bool { 3852 if lhs == nil || rhs == nil { 3853 return false 3854 } 3855 if !lhs.Config.Equal(&(rhs.Config)) { 3856 return false 3857 } 3858 return true 3859 } 3860 3861 // struct for container bgp-mp:state. 3862 // State information relating to the AFI-SAFI. 3863 type AfiSafiState struct { 3864 // original -> bgp-mp:afi-safi-name 3865 // AFI,SAFI. 3866 AfiSafiName AfiSafiType `mapstructure:"afi-safi-name" json:"afi-safi-name,omitempty"` 3867 // original -> bgp-mp:enabled 3868 // bgp-mp:enabled's original type is boolean. 3869 // This leaf indicates whether the IPv4 Unicast AFI,SAFI is 3870 // enabled for the neighbour or group. 3871 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3872 // original -> bgp-op:total-paths 3873 // Total number of BGP paths within the context. 3874 TotalPaths uint32 `mapstructure:"total-paths" json:"total-paths,omitempty"` 3875 // original -> bgp-op:total-prefixes 3876 // . 3877 TotalPrefixes uint32 `mapstructure:"total-prefixes" json:"total-prefixes,omitempty"` 3878 // original -> gobgp:family 3879 // gobgp:family's original type is route-family. 3880 // Address family value of AFI-SAFI pair translated from afi-safi-name. 3881 Family bgp.RouteFamily `mapstructure:"family" json:"family,omitempty"` 3882 } 3883 3884 // struct for container bgp-mp:config. 3885 // Configuration parameters for the AFI-SAFI. 3886 type AfiSafiConfig struct { 3887 // original -> bgp-mp:afi-safi-name 3888 // AFI,SAFI. 3889 AfiSafiName AfiSafiType `mapstructure:"afi-safi-name" json:"afi-safi-name,omitempty"` 3890 // original -> bgp-mp:enabled 3891 // bgp-mp:enabled's original type is boolean. 3892 // This leaf indicates whether the IPv4 Unicast AFI,SAFI is 3893 // enabled for the neighbour or group. 3894 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3895 } 3896 3897 func (lhs *AfiSafiConfig) Equal(rhs *AfiSafiConfig) bool { 3898 if lhs == nil || rhs == nil { 3899 return false 3900 } 3901 if lhs.AfiSafiName != rhs.AfiSafiName { 3902 return false 3903 } 3904 if lhs.Enabled != rhs.Enabled { 3905 return false 3906 } 3907 return true 3908 } 3909 3910 // struct for container bgp-mp:state. 3911 // State information for BGP graceful-restart. 3912 type MpGracefulRestartState struct { 3913 // original -> bgp-mp:enabled 3914 // bgp-mp:enabled's original type is boolean. 3915 // This leaf indicates whether graceful-restart is enabled for 3916 // this AFI-SAFI. 3917 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3918 // original -> bgp-op:received 3919 // bgp-op:received's original type is boolean. 3920 // This leaf indicates whether the neighbor advertised the 3921 // ability to support graceful-restart for this AFI-SAFI. 3922 Received bool `mapstructure:"received" json:"received,omitempty"` 3923 // original -> bgp-op:advertised 3924 // bgp-op:advertised's original type is boolean. 3925 // This leaf indicates whether the ability to support 3926 // graceful-restart has been advertised to the peer. 3927 Advertised bool `mapstructure:"advertised" json:"advertised,omitempty"` 3928 // original -> gobgp:end-of-rib-received 3929 // gobgp:end-of-rib-received's original type is boolean. 3930 EndOfRibReceived bool `mapstructure:"end-of-rib-received" json:"end-of-rib-received,omitempty"` 3931 // original -> gobgp:end-of-rib-sent 3932 // gobgp:end-of-rib-sent's original type is boolean. 3933 EndOfRibSent bool `mapstructure:"end-of-rib-sent" json:"end-of-rib-sent,omitempty"` 3934 } 3935 3936 // struct for container bgp-mp:config. 3937 // Configuration options for BGP graceful-restart. 3938 type MpGracefulRestartConfig struct { 3939 // original -> bgp-mp:enabled 3940 // bgp-mp:enabled's original type is boolean. 3941 // This leaf indicates whether graceful-restart is enabled for 3942 // this AFI-SAFI. 3943 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 3944 } 3945 3946 func (lhs *MpGracefulRestartConfig) Equal(rhs *MpGracefulRestartConfig) bool { 3947 if lhs == nil || rhs == nil { 3948 return false 3949 } 3950 if lhs.Enabled != rhs.Enabled { 3951 return false 3952 } 3953 return true 3954 } 3955 3956 // struct for container bgp-mp:graceful-restart. 3957 // Parameters relating to BGP graceful-restart. 3958 type MpGracefulRestart struct { 3959 // original -> bgp-mp:mp-graceful-restart-config 3960 // Configuration options for BGP graceful-restart. 3961 Config MpGracefulRestartConfig `mapstructure:"config" json:"config,omitempty"` 3962 // original -> bgp-mp:mp-graceful-restart-state 3963 // State information for BGP graceful-restart. 3964 State MpGracefulRestartState `mapstructure:"state" json:"state,omitempty"` 3965 } 3966 3967 func (lhs *MpGracefulRestart) Equal(rhs *MpGracefulRestart) bool { 3968 if lhs == nil || rhs == nil { 3969 return false 3970 } 3971 if !lhs.Config.Equal(&(rhs.Config)) { 3972 return false 3973 } 3974 return true 3975 } 3976 3977 // struct for container bgp-mp:afi-safi. 3978 // AFI,SAFI configuration available for the 3979 // neighbour or group. 3980 type AfiSafi struct { 3981 // original -> bgp-mp:afi-safi-name 3982 // original -> bgp-mp:mp-graceful-restart 3983 // Parameters relating to BGP graceful-restart. 3984 MpGracefulRestart MpGracefulRestart `mapstructure:"mp-graceful-restart" json:"mp-graceful-restart,omitempty"` 3985 // original -> bgp-mp:afi-safi-config 3986 // Configuration parameters for the AFI-SAFI. 3987 Config AfiSafiConfig `mapstructure:"config" json:"config,omitempty"` 3988 // original -> bgp-mp:afi-safi-state 3989 // State information relating to the AFI-SAFI. 3990 State AfiSafiState `mapstructure:"state" json:"state,omitempty"` 3991 // original -> rpol:apply-policy 3992 // Anchor point for routing policies in the model. 3993 // Import and export policies are with respect to the local 3994 // routing table, i.e., export (send) and import (receive), 3995 // depending on the context. 3996 ApplyPolicy ApplyPolicy `mapstructure:"apply-policy" json:"apply-policy,omitempty"` 3997 // original -> bgp-mp:ipv4-unicast 3998 // IPv4 unicast configuration options. 3999 Ipv4Unicast Ipv4Unicast `mapstructure:"ipv4-unicast" json:"ipv4-unicast,omitempty"` 4000 // original -> bgp-mp:ipv6-unicast 4001 // IPv6 unicast configuration options. 4002 Ipv6Unicast Ipv6Unicast `mapstructure:"ipv6-unicast" json:"ipv6-unicast,omitempty"` 4003 // original -> bgp-mp:ipv4-labelled-unicast 4004 // IPv4 Labelled Unicast configuration options. 4005 Ipv4LabelledUnicast Ipv4LabelledUnicast `mapstructure:"ipv4-labelled-unicast" json:"ipv4-labelled-unicast,omitempty"` 4006 // original -> bgp-mp:ipv6-labelled-unicast 4007 // IPv6 Labelled Unicast configuration options. 4008 Ipv6LabelledUnicast Ipv6LabelledUnicast `mapstructure:"ipv6-labelled-unicast" json:"ipv6-labelled-unicast,omitempty"` 4009 // original -> bgp-mp:l3vpn-ipv4-unicast 4010 // Unicast IPv4 L3VPN configuration options. 4011 L3vpnIpv4Unicast L3vpnIpv4Unicast `mapstructure:"l3vpn-ipv4-unicast" json:"l3vpn-ipv4-unicast,omitempty"` 4012 // original -> bgp-mp:l3vpn-ipv6-unicast 4013 // Unicast IPv6 L3VPN configuration options. 4014 L3vpnIpv6Unicast L3vpnIpv6Unicast `mapstructure:"l3vpn-ipv6-unicast" json:"l3vpn-ipv6-unicast,omitempty"` 4015 // original -> bgp-mp:l3vpn-ipv4-multicast 4016 // Multicast IPv4 L3VPN configuration options. 4017 L3vpnIpv4Multicast L3vpnIpv4Multicast `mapstructure:"l3vpn-ipv4-multicast" json:"l3vpn-ipv4-multicast,omitempty"` 4018 // original -> bgp-mp:l3vpn-ipv6-multicast 4019 // Multicast IPv6 L3VPN configuration options. 4020 L3vpnIpv6Multicast L3vpnIpv6Multicast `mapstructure:"l3vpn-ipv6-multicast" json:"l3vpn-ipv6-multicast,omitempty"` 4021 // original -> bgp-mp:l2vpn-vpls 4022 // BGP-signalled VPLS configuration options. 4023 L2vpnVpls L2vpnVpls `mapstructure:"l2vpn-vpls" json:"l2vpn-vpls,omitempty"` 4024 // original -> bgp-mp:l2vpn-evpn 4025 // BGP EVPN configuration options. 4026 L2vpnEvpn L2vpnEvpn `mapstructure:"l2vpn-evpn" json:"l2vpn-evpn,omitempty"` 4027 // original -> bgp-mp:route-selection-options 4028 // Parameters relating to options for route selection. 4029 RouteSelectionOptions RouteSelectionOptions `mapstructure:"route-selection-options" json:"route-selection-options,omitempty"` 4030 // original -> bgp-mp:use-multiple-paths 4031 // Parameters related to the use of multiple paths for the 4032 // same NLRI. 4033 UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths" json:"use-multiple-paths,omitempty"` 4034 // original -> bgp-mp:prefix-limit 4035 // Configure the maximum number of prefixes that will be 4036 // accepted from a peer. 4037 PrefixLimit PrefixLimit `mapstructure:"prefix-limit" json:"prefix-limit,omitempty"` 4038 // original -> gobgp:route-target-membership 4039 RouteTargetMembership RouteTargetMembership `mapstructure:"route-target-membership" json:"route-target-membership,omitempty"` 4040 // original -> gobgp:long-lived-graceful-restart 4041 LongLivedGracefulRestart LongLivedGracefulRestart `mapstructure:"long-lived-graceful-restart" json:"long-lived-graceful-restart,omitempty"` 4042 // original -> gobgp:add-paths 4043 // add-paths configuration options related to a particular AFI-SAFI. 4044 AddPaths AddPaths `mapstructure:"add-paths" json:"add-paths,omitempty"` 4045 } 4046 4047 func (lhs *AfiSafi) Equal(rhs *AfiSafi) bool { 4048 if lhs == nil || rhs == nil { 4049 return false 4050 } 4051 if !lhs.MpGracefulRestart.Equal(&(rhs.MpGracefulRestart)) { 4052 return false 4053 } 4054 if !lhs.Config.Equal(&(rhs.Config)) { 4055 return false 4056 } 4057 if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { 4058 return false 4059 } 4060 if !lhs.Ipv4Unicast.Equal(&(rhs.Ipv4Unicast)) { 4061 return false 4062 } 4063 if !lhs.Ipv6Unicast.Equal(&(rhs.Ipv6Unicast)) { 4064 return false 4065 } 4066 if !lhs.Ipv4LabelledUnicast.Equal(&(rhs.Ipv4LabelledUnicast)) { 4067 return false 4068 } 4069 if !lhs.Ipv6LabelledUnicast.Equal(&(rhs.Ipv6LabelledUnicast)) { 4070 return false 4071 } 4072 if !lhs.L3vpnIpv4Unicast.Equal(&(rhs.L3vpnIpv4Unicast)) { 4073 return false 4074 } 4075 if !lhs.L3vpnIpv6Unicast.Equal(&(rhs.L3vpnIpv6Unicast)) { 4076 return false 4077 } 4078 if !lhs.L3vpnIpv4Multicast.Equal(&(rhs.L3vpnIpv4Multicast)) { 4079 return false 4080 } 4081 if !lhs.L3vpnIpv6Multicast.Equal(&(rhs.L3vpnIpv6Multicast)) { 4082 return false 4083 } 4084 if !lhs.L2vpnVpls.Equal(&(rhs.L2vpnVpls)) { 4085 return false 4086 } 4087 if !lhs.L2vpnEvpn.Equal(&(rhs.L2vpnEvpn)) { 4088 return false 4089 } 4090 if !lhs.RouteSelectionOptions.Equal(&(rhs.RouteSelectionOptions)) { 4091 return false 4092 } 4093 if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { 4094 return false 4095 } 4096 if !lhs.PrefixLimit.Equal(&(rhs.PrefixLimit)) { 4097 return false 4098 } 4099 if !lhs.RouteTargetMembership.Equal(&(rhs.RouteTargetMembership)) { 4100 return false 4101 } 4102 if !lhs.LongLivedGracefulRestart.Equal(&(rhs.LongLivedGracefulRestart)) { 4103 return false 4104 } 4105 if !lhs.AddPaths.Equal(&(rhs.AddPaths)) { 4106 return false 4107 } 4108 return true 4109 } 4110 4111 // struct for container bgp:state. 4112 // State information associated with graceful-restart. 4113 type GracefulRestartState struct { 4114 // original -> bgp:enabled 4115 // bgp:enabled's original type is boolean. 4116 // Enable or disable the graceful-restart capability. 4117 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4118 // original -> bgp:restart-time 4119 // Estimated time (in seconds) for the local BGP speaker to 4120 // restart a session. This value is advertise in the graceful 4121 // restart BGP capability. This is a 12-bit value, referred to 4122 // as Restart Time in RFC4724. Per RFC4724, the suggested 4123 // default value is <= the hold-time value. 4124 RestartTime uint16 `mapstructure:"restart-time" json:"restart-time,omitempty"` 4125 // original -> bgp:stale-routes-time 4126 // bgp:stale-routes-time's original type is decimal64. 4127 // An upper-bound on the time thate stale routes will be 4128 // retained by a router after a session is restarted. If an 4129 // End-of-RIB (EOR) marker is received prior to this timer 4130 // expiring stale-routes will be flushed upon its receipt - if 4131 // no EOR is received, then when this timer expires stale paths 4132 // will be purged. This timer is referred to as the 4133 // Selection_Deferral_Timer in RFC4724. 4134 StaleRoutesTime float64 `mapstructure:"stale-routes-time" json:"stale-routes-time,omitempty"` 4135 // original -> bgp:helper-only 4136 // bgp:helper-only's original type is boolean. 4137 // Enable graceful-restart in helper mode only. When this 4138 // leaf is set, the local system does not retain forwarding 4139 // its own state during a restart, but supports procedures 4140 // for the receiving speaker, as defined in RFC4724. 4141 HelperOnly bool `mapstructure:"helper-only" json:"helper-only,omitempty"` 4142 // original -> bgp-op:peer-restart-time 4143 // The period of time (advertised by the peer) that 4144 // the peer expects a restart of a BGP session to 4145 // take. 4146 PeerRestartTime uint16 `mapstructure:"peer-restart-time" json:"peer-restart-time,omitempty"` 4147 // original -> bgp-op:peer-restarting 4148 // bgp-op:peer-restarting's original type is boolean. 4149 // This flag indicates whether the remote neighbor is currently 4150 // in the process of restarting, and hence received routes are 4151 // currently stale. 4152 PeerRestarting bool `mapstructure:"peer-restarting" json:"peer-restarting,omitempty"` 4153 // original -> bgp-op:local-restarting 4154 // bgp-op:local-restarting's original type is boolean. 4155 // This flag indicates whether the local neighbor is currently 4156 // restarting. The flag is unset after all NLRI have been 4157 // advertised to the peer, and the End-of-RIB (EOR) marker has 4158 // been unset. 4159 LocalRestarting bool `mapstructure:"local-restarting" json:"local-restarting,omitempty"` 4160 // original -> bgp-op:mode 4161 // Ths leaf indicates the mode of operation of BGP graceful 4162 // restart with the peer. 4163 Mode Mode `mapstructure:"mode" json:"mode,omitempty"` 4164 // original -> gobgp:deferral-time 4165 DeferralTime uint16 `mapstructure:"deferral-time" json:"deferral-time,omitempty"` 4166 // original -> gobgp:notification-enabled 4167 // gobgp:notification-enabled's original type is boolean. 4168 NotificationEnabled bool `mapstructure:"notification-enabled" json:"notification-enabled,omitempty"` 4169 // original -> gobgp:long-lived-enabled 4170 // gobgp:long-lived-enabled's original type is boolean. 4171 LongLivedEnabled bool `mapstructure:"long-lived-enabled" json:"long-lived-enabled,omitempty"` 4172 } 4173 4174 // struct for container bgp:config. 4175 // Configuration parameters relating to graceful-restart. 4176 type GracefulRestartConfig struct { 4177 // original -> bgp:enabled 4178 // bgp:enabled's original type is boolean. 4179 // Enable or disable the graceful-restart capability. 4180 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4181 // original -> bgp:restart-time 4182 // Estimated time (in seconds) for the local BGP speaker to 4183 // restart a session. This value is advertise in the graceful 4184 // restart BGP capability. This is a 12-bit value, referred to 4185 // as Restart Time in RFC4724. Per RFC4724, the suggested 4186 // default value is <= the hold-time value. 4187 RestartTime uint16 `mapstructure:"restart-time" json:"restart-time,omitempty"` 4188 // original -> bgp:stale-routes-time 4189 // bgp:stale-routes-time's original type is decimal64. 4190 // An upper-bound on the time thate stale routes will be 4191 // retained by a router after a session is restarted. If an 4192 // End-of-RIB (EOR) marker is received prior to this timer 4193 // expiring stale-routes will be flushed upon its receipt - if 4194 // no EOR is received, then when this timer expires stale paths 4195 // will be purged. This timer is referred to as the 4196 // Selection_Deferral_Timer in RFC4724. 4197 StaleRoutesTime float64 `mapstructure:"stale-routes-time" json:"stale-routes-time,omitempty"` 4198 // original -> bgp:helper-only 4199 // bgp:helper-only's original type is boolean. 4200 // Enable graceful-restart in helper mode only. When this 4201 // leaf is set, the local system does not retain forwarding 4202 // its own state during a restart, but supports procedures 4203 // for the receiving speaker, as defined in RFC4724. 4204 HelperOnly bool `mapstructure:"helper-only" json:"helper-only,omitempty"` 4205 // original -> gobgp:deferral-time 4206 DeferralTime uint16 `mapstructure:"deferral-time" json:"deferral-time,omitempty"` 4207 // original -> gobgp:notification-enabled 4208 // gobgp:notification-enabled's original type is boolean. 4209 NotificationEnabled bool `mapstructure:"notification-enabled" json:"notification-enabled,omitempty"` 4210 // original -> gobgp:long-lived-enabled 4211 // gobgp:long-lived-enabled's original type is boolean. 4212 LongLivedEnabled bool `mapstructure:"long-lived-enabled" json:"long-lived-enabled,omitempty"` 4213 } 4214 4215 func (lhs *GracefulRestartConfig) Equal(rhs *GracefulRestartConfig) bool { 4216 if lhs == nil || rhs == nil { 4217 return false 4218 } 4219 if lhs.Enabled != rhs.Enabled { 4220 return false 4221 } 4222 if lhs.RestartTime != rhs.RestartTime { 4223 return false 4224 } 4225 if lhs.StaleRoutesTime != rhs.StaleRoutesTime { 4226 return false 4227 } 4228 if lhs.HelperOnly != rhs.HelperOnly { 4229 return false 4230 } 4231 if lhs.DeferralTime != rhs.DeferralTime { 4232 return false 4233 } 4234 if lhs.NotificationEnabled != rhs.NotificationEnabled { 4235 return false 4236 } 4237 if lhs.LongLivedEnabled != rhs.LongLivedEnabled { 4238 return false 4239 } 4240 return true 4241 } 4242 4243 // struct for container bgp:graceful-restart. 4244 // Parameters relating the graceful restart mechanism for BGP. 4245 type GracefulRestart struct { 4246 // original -> bgp:graceful-restart-config 4247 // Configuration parameters relating to graceful-restart. 4248 Config GracefulRestartConfig `mapstructure:"config" json:"config,omitempty"` 4249 // original -> bgp:graceful-restart-state 4250 // State information associated with graceful-restart. 4251 State GracefulRestartState `mapstructure:"state" json:"state,omitempty"` 4252 } 4253 4254 func (lhs *GracefulRestart) Equal(rhs *GracefulRestart) bool { 4255 if lhs == nil || rhs == nil { 4256 return false 4257 } 4258 if !lhs.Config.Equal(&(rhs.Config)) { 4259 return false 4260 } 4261 return true 4262 } 4263 4264 // struct for container bgp-mp:state. 4265 // State information relating to iBGP multipath. 4266 type IbgpState struct { 4267 // original -> bgp-mp:maximum-paths 4268 // Maximum number of parallel paths to consider when using 4269 // iBGP multipath. The default is to use a single path. 4270 MaximumPaths uint32 `mapstructure:"maximum-paths" json:"maximum-paths,omitempty"` 4271 } 4272 4273 // struct for container bgp-mp:config. 4274 // Configuration parameters relating to iBGP multipath. 4275 type IbgpConfig struct { 4276 // original -> bgp-mp:maximum-paths 4277 // Maximum number of parallel paths to consider when using 4278 // iBGP multipath. The default is to use a single path. 4279 MaximumPaths uint32 `mapstructure:"maximum-paths" json:"maximum-paths,omitempty"` 4280 } 4281 4282 func (lhs *IbgpConfig) Equal(rhs *IbgpConfig) bool { 4283 if lhs == nil || rhs == nil { 4284 return false 4285 } 4286 if lhs.MaximumPaths != rhs.MaximumPaths { 4287 return false 4288 } 4289 return true 4290 } 4291 4292 // struct for container bgp-mp:ibgp. 4293 // Multipath parameters for iBGP. 4294 type Ibgp struct { 4295 // original -> bgp-mp:ibgp-config 4296 // Configuration parameters relating to iBGP multipath. 4297 Config IbgpConfig `mapstructure:"config" json:"config,omitempty"` 4298 // original -> bgp-mp:ibgp-state 4299 // State information relating to iBGP multipath. 4300 State IbgpState `mapstructure:"state" json:"state,omitempty"` 4301 } 4302 4303 func (lhs *Ibgp) Equal(rhs *Ibgp) bool { 4304 if lhs == nil || rhs == nil { 4305 return false 4306 } 4307 if !lhs.Config.Equal(&(rhs.Config)) { 4308 return false 4309 } 4310 return true 4311 } 4312 4313 // struct for container bgp-mp:state. 4314 // State information relating to eBGP multipath. 4315 type EbgpState struct { 4316 // original -> bgp-mp:allow-multiple-as 4317 // bgp-mp:allow-multiple-as's original type is boolean. 4318 // Allow multipath to use paths from different neighbouring 4319 // ASes. The default is to only consider multiple paths from 4320 // the same neighbouring AS. 4321 AllowMultipleAs bool `mapstructure:"allow-multiple-as" json:"allow-multiple-as,omitempty"` 4322 // original -> bgp-mp:maximum-paths 4323 // Maximum number of parallel paths to consider when using 4324 // BGP multipath. The default is use a single path. 4325 MaximumPaths uint32 `mapstructure:"maximum-paths" json:"maximum-paths,omitempty"` 4326 } 4327 4328 // struct for container bgp-mp:config. 4329 // Configuration parameters relating to eBGP multipath. 4330 type EbgpConfig struct { 4331 // original -> bgp-mp:allow-multiple-as 4332 // bgp-mp:allow-multiple-as's original type is boolean. 4333 // Allow multipath to use paths from different neighbouring 4334 // ASes. The default is to only consider multiple paths from 4335 // the same neighbouring AS. 4336 AllowMultipleAs bool `mapstructure:"allow-multiple-as" json:"allow-multiple-as,omitempty"` 4337 // original -> bgp-mp:maximum-paths 4338 // Maximum number of parallel paths to consider when using 4339 // BGP multipath. The default is use a single path. 4340 MaximumPaths uint32 `mapstructure:"maximum-paths" json:"maximum-paths,omitempty"` 4341 } 4342 4343 func (lhs *EbgpConfig) Equal(rhs *EbgpConfig) bool { 4344 if lhs == nil || rhs == nil { 4345 return false 4346 } 4347 if lhs.AllowMultipleAs != rhs.AllowMultipleAs { 4348 return false 4349 } 4350 if lhs.MaximumPaths != rhs.MaximumPaths { 4351 return false 4352 } 4353 return true 4354 } 4355 4356 // struct for container bgp-mp:ebgp. 4357 // Multipath parameters for eBGP. 4358 type Ebgp struct { 4359 // original -> bgp-mp:ebgp-config 4360 // Configuration parameters relating to eBGP multipath. 4361 Config EbgpConfig `mapstructure:"config" json:"config,omitempty"` 4362 // original -> bgp-mp:ebgp-state 4363 // State information relating to eBGP multipath. 4364 State EbgpState `mapstructure:"state" json:"state,omitempty"` 4365 } 4366 4367 func (lhs *Ebgp) Equal(rhs *Ebgp) bool { 4368 if lhs == nil || rhs == nil { 4369 return false 4370 } 4371 if !lhs.Config.Equal(&(rhs.Config)) { 4372 return false 4373 } 4374 return true 4375 } 4376 4377 // struct for container bgp-mp:state. 4378 // State parameters relating to multipath. 4379 type UseMultiplePathsState struct { 4380 // original -> bgp-mp:enabled 4381 // bgp-mp:enabled's original type is boolean. 4382 // Whether the use of multiple paths for the same NLRI is 4383 // enabled for the neighbor. This value is overridden by 4384 // any more specific configuration value. 4385 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4386 } 4387 4388 // struct for container bgp-mp:config. 4389 // Configuration parameters relating to multipath. 4390 type UseMultiplePathsConfig struct { 4391 // original -> bgp-mp:enabled 4392 // bgp-mp:enabled's original type is boolean. 4393 // Whether the use of multiple paths for the same NLRI is 4394 // enabled for the neighbor. This value is overridden by 4395 // any more specific configuration value. 4396 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4397 } 4398 4399 func (lhs *UseMultiplePathsConfig) Equal(rhs *UseMultiplePathsConfig) bool { 4400 if lhs == nil || rhs == nil { 4401 return false 4402 } 4403 if lhs.Enabled != rhs.Enabled { 4404 return false 4405 } 4406 return true 4407 } 4408 4409 // struct for container bgp-mp:use-multiple-paths. 4410 // Parameters related to the use of multiple paths for the 4411 // same NLRI. 4412 type UseMultiplePaths struct { 4413 // original -> bgp-mp:use-multiple-paths-config 4414 // Configuration parameters relating to multipath. 4415 Config UseMultiplePathsConfig `mapstructure:"config" json:"config,omitempty"` 4416 // original -> bgp-mp:use-multiple-paths-state 4417 // State parameters relating to multipath. 4418 State UseMultiplePathsState `mapstructure:"state" json:"state,omitempty"` 4419 // original -> bgp-mp:ebgp 4420 // Multipath parameters for eBGP. 4421 Ebgp Ebgp `mapstructure:"ebgp" json:"ebgp,omitempty"` 4422 // original -> bgp-mp:ibgp 4423 // Multipath parameters for iBGP. 4424 Ibgp Ibgp `mapstructure:"ibgp" json:"ibgp,omitempty"` 4425 } 4426 4427 func (lhs *UseMultiplePaths) Equal(rhs *UseMultiplePaths) bool { 4428 if lhs == nil || rhs == nil { 4429 return false 4430 } 4431 if !lhs.Config.Equal(&(rhs.Config)) { 4432 return false 4433 } 4434 if !lhs.Ebgp.Equal(&(rhs.Ebgp)) { 4435 return false 4436 } 4437 if !lhs.Ibgp.Equal(&(rhs.Ibgp)) { 4438 return false 4439 } 4440 return true 4441 } 4442 4443 // struct for container bgp:state. 4444 // State information relating to the BGP confederations. 4445 type ConfederationState struct { 4446 // original -> bgp:enabled 4447 // bgp:enabled's original type is boolean. 4448 // When this leaf is set to true it indicates that 4449 // the local-AS is part of a BGP confederation. 4450 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4451 // original -> bgp:identifier 4452 // bgp:identifier's original type is inet:as-number. 4453 // Confederation identifier for the autonomous system. 4454 Identifier uint32 `mapstructure:"identifier" json:"identifier,omitempty"` 4455 // original -> bgp:member-as 4456 // original type is list of inet:as-number 4457 // Remote autonomous systems that are to be treated 4458 // as part of the local confederation. 4459 MemberAsList []uint32 `mapstructure:"member-as-list" json:"member-as-list,omitempty"` 4460 } 4461 4462 // struct for container bgp:config. 4463 // Configuration parameters relating to BGP confederations. 4464 type ConfederationConfig struct { 4465 // original -> bgp:enabled 4466 // bgp:enabled's original type is boolean. 4467 // When this leaf is set to true it indicates that 4468 // the local-AS is part of a BGP confederation. 4469 Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"` 4470 // original -> bgp:identifier 4471 // bgp:identifier's original type is inet:as-number. 4472 // Confederation identifier for the autonomous system. 4473 Identifier uint32 `mapstructure:"identifier" json:"identifier,omitempty"` 4474 // original -> bgp:member-as 4475 // original type is list of inet:as-number 4476 // Remote autonomous systems that are to be treated 4477 // as part of the local confederation. 4478 MemberAsList []uint32 `mapstructure:"member-as-list" json:"member-as-list,omitempty"` 4479 } 4480 4481 func (lhs *ConfederationConfig) Equal(rhs *ConfederationConfig) bool { 4482 if lhs == nil || rhs == nil { 4483 return false 4484 } 4485 if lhs.Enabled != rhs.Enabled { 4486 return false 4487 } 4488 if lhs.Identifier != rhs.Identifier { 4489 return false 4490 } 4491 if len(lhs.MemberAsList) != len(rhs.MemberAsList) { 4492 return false 4493 } 4494 for idx, l := range lhs.MemberAsList { 4495 if l != rhs.MemberAsList[idx] { 4496 return false 4497 } 4498 } 4499 return true 4500 } 4501 4502 // struct for container bgp:confederation. 4503 // Parameters indicating whether the local system acts as part 4504 // of a BGP confederation. 4505 type Confederation struct { 4506 // original -> bgp:confederation-config 4507 // Configuration parameters relating to BGP confederations. 4508 Config ConfederationConfig `mapstructure:"config" json:"config,omitempty"` 4509 // original -> bgp:confederation-state 4510 // State information relating to the BGP confederations. 4511 State ConfederationState `mapstructure:"state" json:"state,omitempty"` 4512 } 4513 4514 func (lhs *Confederation) Equal(rhs *Confederation) bool { 4515 if lhs == nil || rhs == nil { 4516 return false 4517 } 4518 if !lhs.Config.Equal(&(rhs.Config)) { 4519 return false 4520 } 4521 return true 4522 } 4523 4524 // struct for container bgp:state. 4525 // State information relating to the default route distance. 4526 type DefaultRouteDistanceState struct { 4527 // original -> bgp:external-route-distance 4528 // Administrative distance for routes learned from external 4529 // BGP (eBGP). 4530 ExternalRouteDistance uint8 `mapstructure:"external-route-distance" json:"external-route-distance,omitempty"` 4531 // original -> bgp:internal-route-distance 4532 // Administrative distance for routes learned from internal 4533 // BGP (iBGP). 4534 InternalRouteDistance uint8 `mapstructure:"internal-route-distance" json:"internal-route-distance,omitempty"` 4535 } 4536 4537 // struct for container bgp:config. 4538 // Configuration parameters relating to the default route 4539 // distance. 4540 type DefaultRouteDistanceConfig struct { 4541 // original -> bgp:external-route-distance 4542 // Administrative distance for routes learned from external 4543 // BGP (eBGP). 4544 ExternalRouteDistance uint8 `mapstructure:"external-route-distance" json:"external-route-distance,omitempty"` 4545 // original -> bgp:internal-route-distance 4546 // Administrative distance for routes learned from internal 4547 // BGP (iBGP). 4548 InternalRouteDistance uint8 `mapstructure:"internal-route-distance" json:"internal-route-distance,omitempty"` 4549 } 4550 4551 func (lhs *DefaultRouteDistanceConfig) Equal(rhs *DefaultRouteDistanceConfig) bool { 4552 if lhs == nil || rhs == nil { 4553 return false 4554 } 4555 if lhs.ExternalRouteDistance != rhs.ExternalRouteDistance { 4556 return false 4557 } 4558 if lhs.InternalRouteDistance != rhs.InternalRouteDistance { 4559 return false 4560 } 4561 return true 4562 } 4563 4564 // struct for container bgp:default-route-distance. 4565 // Administrative distance (or preference) assigned to 4566 // routes received from different sources 4567 // (external, internal, and local). 4568 type DefaultRouteDistance struct { 4569 // original -> bgp:default-route-distance-config 4570 // Configuration parameters relating to the default route 4571 // distance. 4572 Config DefaultRouteDistanceConfig `mapstructure:"config" json:"config,omitempty"` 4573 // original -> bgp:default-route-distance-state 4574 // State information relating to the default route distance. 4575 State DefaultRouteDistanceState `mapstructure:"state" json:"state,omitempty"` 4576 } 4577 4578 func (lhs *DefaultRouteDistance) Equal(rhs *DefaultRouteDistance) bool { 4579 if lhs == nil || rhs == nil { 4580 return false 4581 } 4582 if !lhs.Config.Equal(&(rhs.Config)) { 4583 return false 4584 } 4585 return true 4586 } 4587 4588 // struct for container bgp-mp:state. 4589 // State information for the route selection options. 4590 type RouteSelectionOptionsState struct { 4591 // original -> bgp-mp:always-compare-med 4592 // bgp-mp:always-compare-med's original type is boolean. 4593 // Compare multi-exit discriminator (MED) value from 4594 // different ASes when selecting the best route. The 4595 // default behavior is to only compare MEDs for paths 4596 // received from the same AS. 4597 AlwaysCompareMed bool `mapstructure:"always-compare-med" json:"always-compare-med,omitempty"` 4598 // original -> bgp-mp:ignore-as-path-length 4599 // bgp-mp:ignore-as-path-length's original type is boolean. 4600 // Ignore the AS path length when selecting the best path. 4601 // The default is to use the AS path length and prefer paths 4602 // with shorter length. 4603 IgnoreAsPathLength bool `mapstructure:"ignore-as-path-length" json:"ignore-as-path-length,omitempty"` 4604 // original -> bgp-mp:external-compare-router-id 4605 // bgp-mp:external-compare-router-id's original type is boolean. 4606 // When comparing similar routes received from external 4607 // BGP peers, use the router-id as a criterion to select 4608 // the active path. 4609 ExternalCompareRouterId bool `mapstructure:"external-compare-router-id" json:"external-compare-router-id,omitempty"` 4610 // original -> bgp-mp:advertise-inactive-routes 4611 // bgp-mp:advertise-inactive-routes's original type is boolean. 4612 // Advertise inactive routes to external peers. The 4613 // default is to only advertise active routes. 4614 AdvertiseInactiveRoutes bool `mapstructure:"advertise-inactive-routes" json:"advertise-inactive-routes,omitempty"` 4615 // original -> bgp-mp:enable-aigp 4616 // bgp-mp:enable-aigp's original type is boolean. 4617 // Flag to enable sending / receiving accumulated IGP 4618 // attribute in routing updates. 4619 EnableAigp bool `mapstructure:"enable-aigp" json:"enable-aigp,omitempty"` 4620 // original -> bgp-mp:ignore-next-hop-igp-metric 4621 // bgp-mp:ignore-next-hop-igp-metric's original type is boolean. 4622 // Ignore the IGP metric to the next-hop when calculating 4623 // BGP best-path. The default is to select the route for 4624 // which the metric to the next-hop is lowest. 4625 IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric" json:"ignore-next-hop-igp-metric,omitempty"` 4626 // original -> gobgp:disable-best-path-selection 4627 // gobgp:disable-best-path-selection's original type is boolean. 4628 // Disables best path selection process. 4629 DisableBestPathSelection bool `mapstructure:"disable-best-path-selection" json:"disable-best-path-selection,omitempty"` 4630 } 4631 4632 // struct for container bgp-mp:config. 4633 // Configuration parameters relating to route selection 4634 // options. 4635 type RouteSelectionOptionsConfig struct { 4636 // original -> bgp-mp:always-compare-med 4637 // bgp-mp:always-compare-med's original type is boolean. 4638 // Compare multi-exit discriminator (MED) value from 4639 // different ASes when selecting the best route. The 4640 // default behavior is to only compare MEDs for paths 4641 // received from the same AS. 4642 AlwaysCompareMed bool `mapstructure:"always-compare-med" json:"always-compare-med,omitempty"` 4643 // original -> bgp-mp:ignore-as-path-length 4644 // bgp-mp:ignore-as-path-length's original type is boolean. 4645 // Ignore the AS path length when selecting the best path. 4646 // The default is to use the AS path length and prefer paths 4647 // with shorter length. 4648 IgnoreAsPathLength bool `mapstructure:"ignore-as-path-length" json:"ignore-as-path-length,omitempty"` 4649 // original -> bgp-mp:external-compare-router-id 4650 // bgp-mp:external-compare-router-id's original type is boolean. 4651 // When comparing similar routes received from external 4652 // BGP peers, use the router-id as a criterion to select 4653 // the active path. 4654 ExternalCompareRouterId bool `mapstructure:"external-compare-router-id" json:"external-compare-router-id,omitempty"` 4655 // original -> bgp-mp:advertise-inactive-routes 4656 // bgp-mp:advertise-inactive-routes's original type is boolean. 4657 // Advertise inactive routes to external peers. The 4658 // default is to only advertise active routes. 4659 AdvertiseInactiveRoutes bool `mapstructure:"advertise-inactive-routes" json:"advertise-inactive-routes,omitempty"` 4660 // original -> bgp-mp:enable-aigp 4661 // bgp-mp:enable-aigp's original type is boolean. 4662 // Flag to enable sending / receiving accumulated IGP 4663 // attribute in routing updates. 4664 EnableAigp bool `mapstructure:"enable-aigp" json:"enable-aigp,omitempty"` 4665 // original -> bgp-mp:ignore-next-hop-igp-metric 4666 // bgp-mp:ignore-next-hop-igp-metric's original type is boolean. 4667 // Ignore the IGP metric to the next-hop when calculating 4668 // BGP best-path. The default is to select the route for 4669 // which the metric to the next-hop is lowest. 4670 IgnoreNextHopIgpMetric bool `mapstructure:"ignore-next-hop-igp-metric" json:"ignore-next-hop-igp-metric,omitempty"` 4671 // original -> gobgp:disable-best-path-selection 4672 // gobgp:disable-best-path-selection's original type is boolean. 4673 // Disables best path selection process. 4674 DisableBestPathSelection bool `mapstructure:"disable-best-path-selection" json:"disable-best-path-selection,omitempty"` 4675 } 4676 4677 func (lhs *RouteSelectionOptionsConfig) Equal(rhs *RouteSelectionOptionsConfig) bool { 4678 if lhs == nil || rhs == nil { 4679 return false 4680 } 4681 if lhs.AlwaysCompareMed != rhs.AlwaysCompareMed { 4682 return false 4683 } 4684 if lhs.IgnoreAsPathLength != rhs.IgnoreAsPathLength { 4685 return false 4686 } 4687 if lhs.ExternalCompareRouterId != rhs.ExternalCompareRouterId { 4688 return false 4689 } 4690 if lhs.AdvertiseInactiveRoutes != rhs.AdvertiseInactiveRoutes { 4691 return false 4692 } 4693 if lhs.EnableAigp != rhs.EnableAigp { 4694 return false 4695 } 4696 if lhs.IgnoreNextHopIgpMetric != rhs.IgnoreNextHopIgpMetric { 4697 return false 4698 } 4699 if lhs.DisableBestPathSelection != rhs.DisableBestPathSelection { 4700 return false 4701 } 4702 return true 4703 } 4704 4705 // struct for container bgp-mp:route-selection-options. 4706 // Parameters relating to options for route selection. 4707 type RouteSelectionOptions struct { 4708 // original -> bgp-mp:route-selection-options-config 4709 // Configuration parameters relating to route selection 4710 // options. 4711 Config RouteSelectionOptionsConfig `mapstructure:"config" json:"config,omitempty"` 4712 // original -> bgp-mp:route-selection-options-state 4713 // State information for the route selection options. 4714 State RouteSelectionOptionsState `mapstructure:"state" json:"state,omitempty"` 4715 } 4716 4717 func (lhs *RouteSelectionOptions) Equal(rhs *RouteSelectionOptions) bool { 4718 if lhs == nil || rhs == nil { 4719 return false 4720 } 4721 if !lhs.Config.Equal(&(rhs.Config)) { 4722 return false 4723 } 4724 return true 4725 } 4726 4727 // struct for container bgp:state. 4728 // State information relating to the global BGP router. 4729 type GlobalState struct { 4730 // original -> bgp:as 4731 // bgp:as's original type is inet:as-number. 4732 // Local autonomous system number of the router. Uses 4733 // the 32-bit as-number type from the model in RFC 6991. 4734 As uint32 `mapstructure:"as" json:"as,omitempty"` 4735 // original -> bgp:router-id 4736 // bgp:router-id's original type is inet:ipv4-address. 4737 // Router id of the router, expressed as an 4738 // 32-bit value, IPv4 address. 4739 RouterId string `mapstructure:"router-id" json:"router-id,omitempty"` 4740 // original -> bgp-op:total-paths 4741 // Total number of BGP paths within the context. 4742 TotalPaths uint32 `mapstructure:"total-paths" json:"total-paths,omitempty"` 4743 // original -> bgp-op:total-prefixes 4744 // . 4745 TotalPrefixes uint32 `mapstructure:"total-prefixes" json:"total-prefixes,omitempty"` 4746 // original -> gobgp:port 4747 Port int32 `mapstructure:"port" json:"port,omitempty"` 4748 // original -> gobgp:local-address 4749 LocalAddressList []string `mapstructure:"local-address-list" json:"local-address-list,omitempty"` 4750 } 4751 4752 // struct for container bgp:config. 4753 // Configuration parameters relating to the global BGP router. 4754 type GlobalConfig struct { 4755 // original -> bgp:as 4756 // bgp:as's original type is inet:as-number. 4757 // Local autonomous system number of the router. Uses 4758 // the 32-bit as-number type from the model in RFC 6991. 4759 As uint32 `mapstructure:"as" json:"as,omitempty"` 4760 // original -> bgp:router-id 4761 // bgp:router-id's original type is inet:ipv4-address. 4762 // Router id of the router, expressed as an 4763 // 32-bit value, IPv4 address. 4764 RouterId string `mapstructure:"router-id" json:"router-id,omitempty"` 4765 // original -> gobgp:port 4766 Port int32 `mapstructure:"port" json:"port,omitempty"` 4767 // original -> gobgp:local-address 4768 LocalAddressList []string `mapstructure:"local-address-list" json:"local-address-list,omitempty"` 4769 } 4770 4771 func (lhs *GlobalConfig) Equal(rhs *GlobalConfig) bool { 4772 if lhs == nil || rhs == nil { 4773 return false 4774 } 4775 if lhs.As != rhs.As { 4776 return false 4777 } 4778 if lhs.RouterId != rhs.RouterId { 4779 return false 4780 } 4781 if lhs.Port != rhs.Port { 4782 return false 4783 } 4784 if len(lhs.LocalAddressList) != len(rhs.LocalAddressList) { 4785 return false 4786 } 4787 for idx, l := range lhs.LocalAddressList { 4788 if l != rhs.LocalAddressList[idx] { 4789 return false 4790 } 4791 } 4792 return true 4793 } 4794 4795 // struct for container bgp:global. 4796 // Global configuration for the BGP router. 4797 type Global struct { 4798 // original -> bgp:global-config 4799 // Configuration parameters relating to the global BGP router. 4800 Config GlobalConfig `mapstructure:"config" json:"config,omitempty"` 4801 // original -> bgp:global-state 4802 // State information relating to the global BGP router. 4803 State GlobalState `mapstructure:"state" json:"state,omitempty"` 4804 // original -> bgp-mp:route-selection-options 4805 // Parameters relating to options for route selection. 4806 RouteSelectionOptions RouteSelectionOptions `mapstructure:"route-selection-options" json:"route-selection-options,omitempty"` 4807 // original -> bgp:default-route-distance 4808 // Administrative distance (or preference) assigned to 4809 // routes received from different sources 4810 // (external, internal, and local). 4811 DefaultRouteDistance DefaultRouteDistance `mapstructure:"default-route-distance" json:"default-route-distance,omitempty"` 4812 // original -> bgp:confederation 4813 // Parameters indicating whether the local system acts as part 4814 // of a BGP confederation. 4815 Confederation Confederation `mapstructure:"confederation" json:"confederation,omitempty"` 4816 // original -> bgp-mp:use-multiple-paths 4817 // Parameters related to the use of multiple paths for the 4818 // same NLRI. 4819 UseMultiplePaths UseMultiplePaths `mapstructure:"use-multiple-paths" json:"use-multiple-paths,omitempty"` 4820 // original -> bgp:graceful-restart 4821 // Parameters relating the graceful restart mechanism for BGP. 4822 GracefulRestart GracefulRestart `mapstructure:"graceful-restart" json:"graceful-restart,omitempty"` 4823 // original -> bgp:afi-safis 4824 // Address family specific configuration. 4825 AfiSafis []AfiSafi `mapstructure:"afi-safis" json:"afi-safis,omitempty"` 4826 // original -> rpol:apply-policy 4827 // Anchor point for routing policies in the model. 4828 // Import and export policies are with respect to the local 4829 // routing table, i.e., export (send) and import (receive), 4830 // depending on the context. 4831 ApplyPolicy ApplyPolicy `mapstructure:"apply-policy" json:"apply-policy,omitempty"` 4832 } 4833 4834 func (lhs *Global) Equal(rhs *Global) bool { 4835 if lhs == nil || rhs == nil { 4836 return false 4837 } 4838 if !lhs.Config.Equal(&(rhs.Config)) { 4839 return false 4840 } 4841 if !lhs.RouteSelectionOptions.Equal(&(rhs.RouteSelectionOptions)) { 4842 return false 4843 } 4844 if !lhs.DefaultRouteDistance.Equal(&(rhs.DefaultRouteDistance)) { 4845 return false 4846 } 4847 if !lhs.Confederation.Equal(&(rhs.Confederation)) { 4848 return false 4849 } 4850 if !lhs.UseMultiplePaths.Equal(&(rhs.UseMultiplePaths)) { 4851 return false 4852 } 4853 if !lhs.GracefulRestart.Equal(&(rhs.GracefulRestart)) { 4854 return false 4855 } 4856 if len(lhs.AfiSafis) != len(rhs.AfiSafis) { 4857 return false 4858 } 4859 { 4860 lmap := make(map[string]*AfiSafi) 4861 for i, l := range lhs.AfiSafis { 4862 lmap[mapkey(i, string(l.Config.AfiSafiName))] = &lhs.AfiSafis[i] 4863 } 4864 for i, r := range rhs.AfiSafis { 4865 if l, y := lmap[mapkey(i, string(r.Config.AfiSafiName))]; !y { 4866 return false 4867 } else if !r.Equal(l) { 4868 return false 4869 } 4870 } 4871 } 4872 if !lhs.ApplyPolicy.Equal(&(rhs.ApplyPolicy)) { 4873 return false 4874 } 4875 return true 4876 } 4877 4878 // struct for container bgp:bgp. 4879 // Top-level configuration and state for the BGP router. 4880 type Bgp struct { 4881 // original -> bgp:global 4882 // Global configuration for the BGP router. 4883 Global Global `mapstructure:"global" json:"global,omitempty"` 4884 // original -> bgp:neighbors 4885 // Configuration for BGP neighbors. 4886 Neighbors []Neighbor `mapstructure:"neighbors" json:"neighbors,omitempty"` 4887 // original -> bgp:peer-groups 4888 // Configuration for BGP peer-groups. 4889 PeerGroups []PeerGroup `mapstructure:"peer-groups" json:"peer-groups,omitempty"` 4890 // original -> gobgp:rpki-servers 4891 RpkiServers []RpkiServer `mapstructure:"rpki-servers" json:"rpki-servers,omitempty"` 4892 // original -> gobgp:bmp-servers 4893 BmpServers []BmpServer `mapstructure:"bmp-servers" json:"bmp-servers,omitempty"` 4894 // original -> gobgp:vrfs 4895 Vrfs []Vrf `mapstructure:"vrfs" json:"vrfs,omitempty"` 4896 // original -> gobgp:mrt-dump 4897 MrtDump []Mrt `mapstructure:"mrt-dump" json:"mrt-dump,omitempty"` 4898 // original -> gobgp:zebra 4899 Zebra Zebra `mapstructure:"zebra" json:"zebra,omitempty"` 4900 // original -> gobgp:collector 4901 Collector Collector `mapstructure:"collector" json:"collector,omitempty"` 4902 // original -> gobgp:dynamic-neighbors 4903 DynamicNeighbors []DynamicNeighbor `mapstructure:"dynamic-neighbors" json:"dynamic-neighbors,omitempty"` 4904 } 4905 4906 func (lhs *Bgp) Equal(rhs *Bgp) bool { 4907 if lhs == nil || rhs == nil { 4908 return false 4909 } 4910 if !lhs.Global.Equal(&(rhs.Global)) { 4911 return false 4912 } 4913 if len(lhs.Neighbors) != len(rhs.Neighbors) { 4914 return false 4915 } 4916 { 4917 lmap := make(map[string]*Neighbor) 4918 for i, l := range lhs.Neighbors { 4919 lmap[mapkey(i, string(l.Config.NeighborAddress))] = &lhs.Neighbors[i] 4920 } 4921 for i, r := range rhs.Neighbors { 4922 if l, y := lmap[mapkey(i, string(r.Config.NeighborAddress))]; !y { 4923 return false 4924 } else if !r.Equal(l) { 4925 return false 4926 } 4927 } 4928 } 4929 if len(lhs.PeerGroups) != len(rhs.PeerGroups) { 4930 return false 4931 } 4932 { 4933 lmap := make(map[string]*PeerGroup) 4934 for i, l := range lhs.PeerGroups { 4935 lmap[mapkey(i, string(l.Config.PeerGroupName))] = &lhs.PeerGroups[i] 4936 } 4937 for i, r := range rhs.PeerGroups { 4938 if l, y := lmap[mapkey(i, string(r.Config.PeerGroupName))]; !y { 4939 return false 4940 } else if !r.Equal(l) { 4941 return false 4942 } 4943 } 4944 } 4945 if len(lhs.RpkiServers) != len(rhs.RpkiServers) { 4946 return false 4947 } 4948 { 4949 lmap := make(map[string]*RpkiServer) 4950 for i, l := range lhs.RpkiServers { 4951 lmap[mapkey(i, string(l.Config.Address))] = &lhs.RpkiServers[i] 4952 } 4953 for i, r := range rhs.RpkiServers { 4954 if l, y := lmap[mapkey(i, string(r.Config.Address))]; !y { 4955 return false 4956 } else if !r.Equal(l) { 4957 return false 4958 } 4959 } 4960 } 4961 if len(lhs.BmpServers) != len(rhs.BmpServers) { 4962 return false 4963 } 4964 { 4965 lmap := make(map[string]*BmpServer) 4966 for i, l := range lhs.BmpServers { 4967 lmap[mapkey(i, string(l.Config.Address))] = &lhs.BmpServers[i] 4968 } 4969 for i, r := range rhs.BmpServers { 4970 if l, y := lmap[mapkey(i, string(r.Config.Address))]; !y { 4971 return false 4972 } else if !r.Equal(l) { 4973 return false 4974 } 4975 } 4976 } 4977 if len(lhs.Vrfs) != len(rhs.Vrfs) { 4978 return false 4979 } 4980 { 4981 lmap := make(map[string]*Vrf) 4982 for i, l := range lhs.Vrfs { 4983 lmap[mapkey(i, string(l.Config.Name))] = &lhs.Vrfs[i] 4984 } 4985 for i, r := range rhs.Vrfs { 4986 if l, y := lmap[mapkey(i, string(r.Config.Name))]; !y { 4987 return false 4988 } else if !r.Equal(l) { 4989 return false 4990 } 4991 } 4992 } 4993 if len(lhs.MrtDump) != len(rhs.MrtDump) { 4994 return false 4995 } 4996 { 4997 lmap := make(map[string]*Mrt) 4998 for i, l := range lhs.MrtDump { 4999 lmap[mapkey(i, string(l.Config.FileName))] = &lhs.MrtDump[i] 5000 } 5001 for i, r := range rhs.MrtDump { 5002 if l, y := lmap[mapkey(i, string(r.Config.FileName))]; !y { 5003 return false 5004 } else if !r.Equal(l) { 5005 return false 5006 } 5007 } 5008 } 5009 if !lhs.Zebra.Equal(&(rhs.Zebra)) { 5010 return false 5011 } 5012 if !lhs.Collector.Equal(&(rhs.Collector)) { 5013 return false 5014 } 5015 if len(lhs.DynamicNeighbors) != len(rhs.DynamicNeighbors) { 5016 return false 5017 } 5018 { 5019 lmap := make(map[string]*DynamicNeighbor) 5020 for i, l := range lhs.DynamicNeighbors { 5021 lmap[mapkey(i, string(l.Config.Prefix))] = &lhs.DynamicNeighbors[i] 5022 } 5023 for i, r := range rhs.DynamicNeighbors { 5024 if l, y := lmap[mapkey(i, string(r.Config.Prefix))]; !y { 5025 return false 5026 } else if !r.Equal(l) { 5027 return false 5028 } 5029 } 5030 } 5031 return true 5032 } 5033 5034 // struct for container gobgp:set-large-community-method. 5035 type SetLargeCommunityMethod struct { 5036 // original -> gobgp:communities 5037 CommunitiesList []string `mapstructure:"communities-list" json:"communities-list,omitempty"` 5038 } 5039 5040 func (lhs *SetLargeCommunityMethod) Equal(rhs *SetLargeCommunityMethod) bool { 5041 if lhs == nil || rhs == nil { 5042 return false 5043 } 5044 if len(lhs.CommunitiesList) != len(rhs.CommunitiesList) { 5045 return false 5046 } 5047 for idx, l := range lhs.CommunitiesList { 5048 if l != rhs.CommunitiesList[idx] { 5049 return false 5050 } 5051 } 5052 return true 5053 } 5054 5055 // struct for container gobgp:set-large-community. 5056 type SetLargeCommunity struct { 5057 // original -> gobgp:set-large-community-method 5058 SetLargeCommunityMethod SetLargeCommunityMethod `mapstructure:"set-large-community-method" json:"set-large-community-method,omitempty"` 5059 // original -> gobgp:options 5060 Options BgpSetCommunityOptionType `mapstructure:"options" json:"options,omitempty"` 5061 } 5062 5063 func (lhs *SetLargeCommunity) Equal(rhs *SetLargeCommunity) bool { 5064 if lhs == nil || rhs == nil { 5065 return false 5066 } 5067 if !lhs.SetLargeCommunityMethod.Equal(&(rhs.SetLargeCommunityMethod)) { 5068 return false 5069 } 5070 if lhs.Options != rhs.Options { 5071 return false 5072 } 5073 return true 5074 } 5075 5076 // struct for container bgp-pol:set-ext-community-method. 5077 // Option to set communities using an inline list or 5078 // reference to an existing defined set. 5079 type SetExtCommunityMethod struct { 5080 // original -> bgp-pol:communities 5081 // original type is list of union 5082 // Set the community values for the update inline with 5083 // a list. 5084 CommunitiesList []string `mapstructure:"communities-list" json:"communities-list,omitempty"` 5085 // original -> bgp-pol:ext-community-set-ref 5086 // References a defined extended community set by 5087 // name. 5088 ExtCommunitySetRef string `mapstructure:"ext-community-set-ref" json:"ext-community-set-ref,omitempty"` 5089 } 5090 5091 func (lhs *SetExtCommunityMethod) Equal(rhs *SetExtCommunityMethod) bool { 5092 if lhs == nil || rhs == nil { 5093 return false 5094 } 5095 if len(lhs.CommunitiesList) != len(rhs.CommunitiesList) { 5096 return false 5097 } 5098 for idx, l := range lhs.CommunitiesList { 5099 if l != rhs.CommunitiesList[idx] { 5100 return false 5101 } 5102 } 5103 if lhs.ExtCommunitySetRef != rhs.ExtCommunitySetRef { 5104 return false 5105 } 5106 return true 5107 } 5108 5109 // struct for container bgp-pol:set-ext-community. 5110 // Action to set the extended community attributes of the 5111 // route, along with options to modify how the community is 5112 // modified. 5113 type SetExtCommunity struct { 5114 // original -> bgp-pol:set-ext-community-method 5115 // Option to set communities using an inline list or 5116 // reference to an existing defined set. 5117 SetExtCommunityMethod SetExtCommunityMethod `mapstructure:"set-ext-community-method" json:"set-ext-community-method,omitempty"` 5118 // original -> bgp-pol:options 5119 // bgp-pol:options's original type is bgp-set-community-option-type. 5120 // options for modifying the extended community 5121 // attribute with the specified values. These options 5122 // apply to both methods of setting the community 5123 // attribute. 5124 Options string `mapstructure:"options" json:"options,omitempty"` 5125 } 5126 5127 func (lhs *SetExtCommunity) Equal(rhs *SetExtCommunity) bool { 5128 if lhs == nil || rhs == nil { 5129 return false 5130 } 5131 if !lhs.SetExtCommunityMethod.Equal(&(rhs.SetExtCommunityMethod)) { 5132 return false 5133 } 5134 if lhs.Options != rhs.Options { 5135 return false 5136 } 5137 return true 5138 } 5139 5140 // struct for container bgp-pol:set-community-method. 5141 // Option to set communities using an inline list or 5142 // reference to an existing defined set. 5143 type SetCommunityMethod struct { 5144 // original -> bgp-pol:communities 5145 // original type is list of union 5146 // Set the community values for the update inline with 5147 // a list. 5148 CommunitiesList []string `mapstructure:"communities-list" json:"communities-list,omitempty"` 5149 // original -> bgp-pol:community-set-ref 5150 // References a defined community set by name. 5151 CommunitySetRef string `mapstructure:"community-set-ref" json:"community-set-ref,omitempty"` 5152 } 5153 5154 func (lhs *SetCommunityMethod) Equal(rhs *SetCommunityMethod) bool { 5155 if lhs == nil || rhs == nil { 5156 return false 5157 } 5158 if len(lhs.CommunitiesList) != len(rhs.CommunitiesList) { 5159 return false 5160 } 5161 for idx, l := range lhs.CommunitiesList { 5162 if l != rhs.CommunitiesList[idx] { 5163 return false 5164 } 5165 } 5166 if lhs.CommunitySetRef != rhs.CommunitySetRef { 5167 return false 5168 } 5169 return true 5170 } 5171 5172 // struct for container bgp-pol:set-community. 5173 // action to set the community attributes of the route, along 5174 // with options to modify how the community is modified. 5175 type SetCommunity struct { 5176 // original -> bgp-pol:set-community-method 5177 // Option to set communities using an inline list or 5178 // reference to an existing defined set. 5179 SetCommunityMethod SetCommunityMethod `mapstructure:"set-community-method" json:"set-community-method,omitempty"` 5180 // original -> bgp-pol:options 5181 // bgp-pol:options's original type is bgp-set-community-option-type. 5182 // Options for modifying the community attribute with 5183 // the specified values. These options apply to both 5184 // methods of setting the community attribute. 5185 Options string `mapstructure:"options" json:"options,omitempty"` 5186 } 5187 5188 func (lhs *SetCommunity) Equal(rhs *SetCommunity) bool { 5189 if lhs == nil || rhs == nil { 5190 return false 5191 } 5192 if !lhs.SetCommunityMethod.Equal(&(rhs.SetCommunityMethod)) { 5193 return false 5194 } 5195 if lhs.Options != rhs.Options { 5196 return false 5197 } 5198 return true 5199 } 5200 5201 // struct for container bgp-pol:set-as-path-prepend. 5202 // action to prepend local AS number to the AS-path a 5203 // specified number of times. 5204 type SetAsPathPrepend struct { 5205 // original -> bgp-pol:repeat-n 5206 // number of times to prepend the local AS 5207 // number. 5208 RepeatN uint8 `mapstructure:"repeat-n" json:"repeat-n,omitempty"` 5209 // original -> gobgp:as 5210 // gobgp:as's original type is union. 5211 // autonomous system number or 'last-as' which means 5212 // the leftmost as number in the AS-path to be prepended. 5213 As string `mapstructure:"as" json:"as,omitempty"` 5214 } 5215 5216 func (lhs *SetAsPathPrepend) Equal(rhs *SetAsPathPrepend) bool { 5217 if lhs == nil || rhs == nil { 5218 return false 5219 } 5220 if lhs.RepeatN != rhs.RepeatN { 5221 return false 5222 } 5223 if lhs.As != rhs.As { 5224 return false 5225 } 5226 return true 5227 } 5228 5229 // struct for container bgp-pol:bgp-actions. 5230 // Definitions for policy action statements that 5231 // change BGP-specific attributes of the route. 5232 type BgpActions struct { 5233 // original -> bgp-pol:set-as-path-prepend 5234 // action to prepend local AS number to the AS-path a 5235 // specified number of times. 5236 SetAsPathPrepend SetAsPathPrepend `mapstructure:"set-as-path-prepend" json:"set-as-path-prepend,omitempty"` 5237 // original -> bgp-pol:set-community 5238 // action to set the community attributes of the route, along 5239 // with options to modify how the community is modified. 5240 SetCommunity SetCommunity `mapstructure:"set-community" json:"set-community,omitempty"` 5241 // original -> bgp-pol:set-ext-community 5242 // Action to set the extended community attributes of the 5243 // route, along with options to modify how the community is 5244 // modified. 5245 SetExtCommunity SetExtCommunity `mapstructure:"set-ext-community" json:"set-ext-community,omitempty"` 5246 // original -> bgp-pol:set-route-origin 5247 // set the origin attribute to the specified 5248 // value. 5249 SetRouteOrigin BgpOriginAttrType `mapstructure:"set-route-origin" json:"set-route-origin,omitempty"` 5250 // original -> bgp-pol:set-local-pref 5251 // set the local pref attribute on the route 5252 // update. 5253 SetLocalPref uint32 `mapstructure:"set-local-pref" json:"set-local-pref,omitempty"` 5254 // original -> bgp-pol:set-next-hop 5255 // set the next-hop attribute in the route update. 5256 SetNextHop BgpNextHopType `mapstructure:"set-next-hop" json:"set-next-hop,omitempty"` 5257 // original -> bgp-pol:set-med 5258 // set the med metric attribute in the route 5259 // update. 5260 SetMed BgpSetMedType `mapstructure:"set-med" json:"set-med,omitempty"` 5261 // original -> gobgp:set-large-community 5262 SetLargeCommunity SetLargeCommunity `mapstructure:"set-large-community" json:"set-large-community,omitempty"` 5263 } 5264 5265 func (lhs *BgpActions) Equal(rhs *BgpActions) bool { 5266 if lhs == nil || rhs == nil { 5267 return false 5268 } 5269 if !lhs.SetAsPathPrepend.Equal(&(rhs.SetAsPathPrepend)) { 5270 return false 5271 } 5272 if !lhs.SetCommunity.Equal(&(rhs.SetCommunity)) { 5273 return false 5274 } 5275 if !lhs.SetExtCommunity.Equal(&(rhs.SetExtCommunity)) { 5276 return false 5277 } 5278 if lhs.SetRouteOrigin != rhs.SetRouteOrigin { 5279 return false 5280 } 5281 if lhs.SetLocalPref != rhs.SetLocalPref { 5282 return false 5283 } 5284 if lhs.SetNextHop != rhs.SetNextHop { 5285 return false 5286 } 5287 if lhs.SetMed != rhs.SetMed { 5288 return false 5289 } 5290 if !lhs.SetLargeCommunity.Equal(&(rhs.SetLargeCommunity)) { 5291 return false 5292 } 5293 return true 5294 } 5295 5296 // struct for container rpol:igp-actions. 5297 // Actions to set IGP route attributes; these actions 5298 // apply to multiple IGPs. 5299 type IgpActions struct { 5300 // original -> rpol:set-tag 5301 // Set the tag value for OSPF or IS-IS routes. 5302 SetTag TagType `mapstructure:"set-tag" json:"set-tag,omitempty"` 5303 } 5304 5305 func (lhs *IgpActions) Equal(rhs *IgpActions) bool { 5306 if lhs == nil || rhs == nil { 5307 return false 5308 } 5309 if lhs.SetTag != rhs.SetTag { 5310 return false 5311 } 5312 return true 5313 } 5314 5315 // struct for container rpol:actions. 5316 // Action statements for this policy 5317 // statement. 5318 type Actions struct { 5319 // original -> rpol:route-disposition 5320 // Select the final disposition for the route, either 5321 // accept or reject. 5322 RouteDisposition RouteDisposition `mapstructure:"route-disposition" json:"route-disposition,omitempty"` 5323 // original -> rpol:igp-actions 5324 // Actions to set IGP route attributes; these actions 5325 // apply to multiple IGPs. 5326 IgpActions IgpActions `mapstructure:"igp-actions" json:"igp-actions,omitempty"` 5327 // original -> bgp-pol:bgp-actions 5328 // Definitions for policy action statements that 5329 // change BGP-specific attributes of the route. 5330 BgpActions BgpActions `mapstructure:"bgp-actions" json:"bgp-actions,omitempty"` 5331 } 5332 5333 func (lhs *Actions) Equal(rhs *Actions) bool { 5334 if lhs == nil || rhs == nil { 5335 return false 5336 } 5337 if lhs.RouteDisposition != rhs.RouteDisposition { 5338 return false 5339 } 5340 if !lhs.IgpActions.Equal(&(rhs.IgpActions)) { 5341 return false 5342 } 5343 if !lhs.BgpActions.Equal(&(rhs.BgpActions)) { 5344 return false 5345 } 5346 return true 5347 } 5348 5349 // struct for container gobgp:match-large-community-set. 5350 type MatchLargeCommunitySet struct { 5351 // original -> gobgp:large-community-set 5352 LargeCommunitySet string `mapstructure:"large-community-set" json:"large-community-set,omitempty"` 5353 // original -> rpol:match-set-options 5354 // Optional parameter that governs the behaviour of the 5355 // match operation. 5356 MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5357 } 5358 5359 func (lhs *MatchLargeCommunitySet) Equal(rhs *MatchLargeCommunitySet) bool { 5360 if lhs == nil || rhs == nil { 5361 return false 5362 } 5363 if lhs.LargeCommunitySet != rhs.LargeCommunitySet { 5364 return false 5365 } 5366 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5367 return false 5368 } 5369 return true 5370 } 5371 5372 // struct for container bgp-pol:as-path-length. 5373 // Value and comparison operations for conditions based on the 5374 // length of the AS path in the route update. 5375 type AsPathLength struct { 5376 // original -> ptypes:operator 5377 // type of comparison to be performed. 5378 Operator AttributeComparison `mapstructure:"operator" json:"operator,omitempty"` 5379 // original -> ptypes:value 5380 // value to compare with the community count. 5381 Value uint32 `mapstructure:"value" json:"value,omitempty"` 5382 } 5383 5384 func (lhs *AsPathLength) Equal(rhs *AsPathLength) bool { 5385 if lhs == nil || rhs == nil { 5386 return false 5387 } 5388 if lhs.Operator != rhs.Operator { 5389 return false 5390 } 5391 if lhs.Value != rhs.Value { 5392 return false 5393 } 5394 return true 5395 } 5396 5397 // struct for container bgp-pol:community-count. 5398 // Value and comparison operations for conditions based on the 5399 // number of communities in the route update. 5400 type CommunityCount struct { 5401 // original -> ptypes:operator 5402 // type of comparison to be performed. 5403 Operator AttributeComparison `mapstructure:"operator" json:"operator,omitempty"` 5404 // original -> ptypes:value 5405 // value to compare with the community count. 5406 Value uint32 `mapstructure:"value" json:"value,omitempty"` 5407 } 5408 5409 func (lhs *CommunityCount) Equal(rhs *CommunityCount) bool { 5410 if lhs == nil || rhs == nil { 5411 return false 5412 } 5413 if lhs.Operator != rhs.Operator { 5414 return false 5415 } 5416 if lhs.Value != rhs.Value { 5417 return false 5418 } 5419 return true 5420 } 5421 5422 // struct for container bgp-pol:match-as-path-set. 5423 // Match a referenced as-path set according to the logic 5424 // defined in the match-set-options leaf. 5425 type MatchAsPathSet struct { 5426 // original -> bgp-pol:as-path-set 5427 // References a defined AS path set. 5428 AsPathSet string `mapstructure:"as-path-set" json:"as-path-set,omitempty"` 5429 // original -> rpol:match-set-options 5430 // Optional parameter that governs the behaviour of the 5431 // match operation. 5432 MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5433 } 5434 5435 func (lhs *MatchAsPathSet) Equal(rhs *MatchAsPathSet) bool { 5436 if lhs == nil || rhs == nil { 5437 return false 5438 } 5439 if lhs.AsPathSet != rhs.AsPathSet { 5440 return false 5441 } 5442 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5443 return false 5444 } 5445 return true 5446 } 5447 5448 // struct for container bgp-pol:match-ext-community-set. 5449 // Match a referenced extended community-set according to the 5450 // logic defined in the match-set-options leaf. 5451 type MatchExtCommunitySet struct { 5452 // original -> bgp-pol:ext-community-set 5453 // References a defined extended community set. 5454 ExtCommunitySet string `mapstructure:"ext-community-set" json:"ext-community-set,omitempty"` 5455 // original -> rpol:match-set-options 5456 // Optional parameter that governs the behaviour of the 5457 // match operation. 5458 MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5459 } 5460 5461 func (lhs *MatchExtCommunitySet) Equal(rhs *MatchExtCommunitySet) bool { 5462 if lhs == nil || rhs == nil { 5463 return false 5464 } 5465 if lhs.ExtCommunitySet != rhs.ExtCommunitySet { 5466 return false 5467 } 5468 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5469 return false 5470 } 5471 return true 5472 } 5473 5474 // struct for container bgp-pol:match-community-set. 5475 // Match a referenced community-set according to the logic 5476 // defined in the match-set-options leaf. 5477 type MatchCommunitySet struct { 5478 // original -> bgp-pol:community-set 5479 // References a defined community set. 5480 CommunitySet string `mapstructure:"community-set" json:"community-set,omitempty"` 5481 // original -> rpol:match-set-options 5482 // Optional parameter that governs the behaviour of the 5483 // match operation. 5484 MatchSetOptions MatchSetOptionsType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5485 } 5486 5487 func (lhs *MatchCommunitySet) Equal(rhs *MatchCommunitySet) bool { 5488 if lhs == nil || rhs == nil { 5489 return false 5490 } 5491 if lhs.CommunitySet != rhs.CommunitySet { 5492 return false 5493 } 5494 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5495 return false 5496 } 5497 return true 5498 } 5499 5500 // struct for container bgp-pol:bgp-conditions. 5501 // Policy conditions for matching 5502 // BGP-specific defined sets or comparing BGP-specific 5503 // attributes. 5504 type BgpConditions struct { 5505 // original -> bgp-pol:match-community-set 5506 // Match a referenced community-set according to the logic 5507 // defined in the match-set-options leaf. 5508 MatchCommunitySet MatchCommunitySet `mapstructure:"match-community-set" json:"match-community-set,omitempty"` 5509 // original -> bgp-pol:match-ext-community-set 5510 // Match a referenced extended community-set according to the 5511 // logic defined in the match-set-options leaf. 5512 MatchExtCommunitySet MatchExtCommunitySet `mapstructure:"match-ext-community-set" json:"match-ext-community-set,omitempty"` 5513 // original -> bgp-pol:match-as-path-set 5514 // Match a referenced as-path set according to the logic 5515 // defined in the match-set-options leaf. 5516 MatchAsPathSet MatchAsPathSet `mapstructure:"match-as-path-set" json:"match-as-path-set,omitempty"` 5517 // original -> bgp-pol:med-eq 5518 // Condition to check if the received MED value is equal to 5519 // the specified value. 5520 MedEq uint32 `mapstructure:"med-eq" json:"med-eq,omitempty"` 5521 // original -> bgp-pol:origin-eq 5522 // Condition to check if the route origin is equal to the 5523 // specified value. 5524 OriginEq BgpOriginAttrType `mapstructure:"origin-eq" json:"origin-eq,omitempty"` 5525 // original -> bgp-pol:next-hop-in 5526 // original type is list of inet:ip-address 5527 // List of next hop addresses to check for in the route 5528 // update. 5529 NextHopInList []string `mapstructure:"next-hop-in-list" json:"next-hop-in-list,omitempty"` 5530 // original -> bgp-pol:afi-safi-in 5531 // List of address families which the NLRI may be 5532 // within. 5533 AfiSafiInList []AfiSafiType `mapstructure:"afi-safi-in-list" json:"afi-safi-in-list,omitempty"` 5534 // original -> bgp-pol:local-pref-eq 5535 // Condition to check if the local pref attribute is equal to 5536 // the specified value. 5537 LocalPrefEq uint32 `mapstructure:"local-pref-eq" json:"local-pref-eq,omitempty"` 5538 // original -> bgp-pol:community-count 5539 // Value and comparison operations for conditions based on the 5540 // number of communities in the route update. 5541 CommunityCount CommunityCount `mapstructure:"community-count" json:"community-count,omitempty"` 5542 // original -> bgp-pol:as-path-length 5543 // Value and comparison operations for conditions based on the 5544 // length of the AS path in the route update. 5545 AsPathLength AsPathLength `mapstructure:"as-path-length" json:"as-path-length,omitempty"` 5546 // original -> bgp-pol:route-type 5547 // Condition to check the route type in the route update. 5548 RouteType RouteType `mapstructure:"route-type" json:"route-type,omitempty"` 5549 // original -> gobgp:rpki-validation-result 5550 // specify the validation result of RPKI based on ROA as conditions. 5551 RpkiValidationResult RpkiValidationResultType `mapstructure:"rpki-validation-result" json:"rpki-validation-result,omitempty"` 5552 // original -> gobgp:match-large-community-set 5553 MatchLargeCommunitySet MatchLargeCommunitySet `mapstructure:"match-large-community-set" json:"match-large-community-set,omitempty"` 5554 } 5555 5556 func (lhs *BgpConditions) Equal(rhs *BgpConditions) bool { 5557 if lhs == nil || rhs == nil { 5558 return false 5559 } 5560 if !lhs.MatchCommunitySet.Equal(&(rhs.MatchCommunitySet)) { 5561 return false 5562 } 5563 if !lhs.MatchExtCommunitySet.Equal(&(rhs.MatchExtCommunitySet)) { 5564 return false 5565 } 5566 if !lhs.MatchAsPathSet.Equal(&(rhs.MatchAsPathSet)) { 5567 return false 5568 } 5569 if lhs.MedEq != rhs.MedEq { 5570 return false 5571 } 5572 if lhs.OriginEq != rhs.OriginEq { 5573 return false 5574 } 5575 if len(lhs.NextHopInList) != len(rhs.NextHopInList) { 5576 return false 5577 } 5578 for idx, l := range lhs.NextHopInList { 5579 if l != rhs.NextHopInList[idx] { 5580 return false 5581 } 5582 } 5583 if len(lhs.AfiSafiInList) != len(rhs.AfiSafiInList) { 5584 return false 5585 } 5586 for idx, l := range lhs.AfiSafiInList { 5587 if l != rhs.AfiSafiInList[idx] { 5588 return false 5589 } 5590 } 5591 if lhs.LocalPrefEq != rhs.LocalPrefEq { 5592 return false 5593 } 5594 if !lhs.CommunityCount.Equal(&(rhs.CommunityCount)) { 5595 return false 5596 } 5597 if !lhs.AsPathLength.Equal(&(rhs.AsPathLength)) { 5598 return false 5599 } 5600 if lhs.RouteType != rhs.RouteType { 5601 return false 5602 } 5603 if lhs.RpkiValidationResult != rhs.RpkiValidationResult { 5604 return false 5605 } 5606 if !lhs.MatchLargeCommunitySet.Equal(&(rhs.MatchLargeCommunitySet)) { 5607 return false 5608 } 5609 return true 5610 } 5611 5612 // struct for container rpol:igp-conditions. 5613 // Policy conditions for IGP attributes. 5614 type IgpConditions struct { 5615 } 5616 5617 func (lhs *IgpConditions) Equal(rhs *IgpConditions) bool { 5618 if lhs == nil || rhs == nil { 5619 return false 5620 } 5621 return true 5622 } 5623 5624 // struct for container rpol:match-tag-set. 5625 // Match a referenced tag set according to the logic defined 5626 // in the match-options-set leaf. 5627 type MatchTagSet struct { 5628 // original -> rpol:tag-set 5629 // References a defined tag set. 5630 TagSet string `mapstructure:"tag-set" json:"tag-set,omitempty"` 5631 // original -> rpol:match-set-options 5632 // Optional parameter that governs the behaviour of the 5633 // match operation. This leaf only supports matching on ANY 5634 // member of the set or inverting the match. Matching on ALL is 5635 // not supported). 5636 MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5637 } 5638 5639 func (lhs *MatchTagSet) Equal(rhs *MatchTagSet) bool { 5640 if lhs == nil || rhs == nil { 5641 return false 5642 } 5643 if lhs.TagSet != rhs.TagSet { 5644 return false 5645 } 5646 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5647 return false 5648 } 5649 return true 5650 } 5651 5652 // struct for container rpol:match-neighbor-set. 5653 // Match a referenced neighbor set according to the logic 5654 // defined in the match-set-options-leaf. 5655 type MatchNeighborSet struct { 5656 // original -> rpol:neighbor-set 5657 // References a defined neighbor set. 5658 NeighborSet string `mapstructure:"neighbor-set" json:"neighbor-set,omitempty"` 5659 // original -> rpol:match-set-options 5660 // Optional parameter that governs the behaviour of the 5661 // match operation. This leaf only supports matching on ANY 5662 // member of the set or inverting the match. Matching on ALL is 5663 // not supported). 5664 MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5665 } 5666 5667 func (lhs *MatchNeighborSet) Equal(rhs *MatchNeighborSet) bool { 5668 if lhs == nil || rhs == nil { 5669 return false 5670 } 5671 if lhs.NeighborSet != rhs.NeighborSet { 5672 return false 5673 } 5674 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5675 return false 5676 } 5677 return true 5678 } 5679 5680 // struct for container rpol:match-prefix-set. 5681 // Match a referenced prefix-set according to the logic 5682 // defined in the match-set-options leaf. 5683 type MatchPrefixSet struct { 5684 // original -> rpol:prefix-set 5685 // References a defined prefix set. 5686 PrefixSet string `mapstructure:"prefix-set" json:"prefix-set,omitempty"` 5687 // original -> rpol:match-set-options 5688 // Optional parameter that governs the behaviour of the 5689 // match operation. This leaf only supports matching on ANY 5690 // member of the set or inverting the match. Matching on ALL is 5691 // not supported). 5692 MatchSetOptions MatchSetOptionsRestrictedType `mapstructure:"match-set-options" json:"match-set-options,omitempty"` 5693 } 5694 5695 func (lhs *MatchPrefixSet) Equal(rhs *MatchPrefixSet) bool { 5696 if lhs == nil || rhs == nil { 5697 return false 5698 } 5699 if lhs.PrefixSet != rhs.PrefixSet { 5700 return false 5701 } 5702 if lhs.MatchSetOptions != rhs.MatchSetOptions { 5703 return false 5704 } 5705 return true 5706 } 5707 5708 // struct for container rpol:conditions. 5709 // Condition statements for this 5710 // policy statement. 5711 type Conditions struct { 5712 // original -> rpol:call-policy 5713 // Applies the statements from the specified policy 5714 // definition and then returns control the current 5715 // policy statement. Note that the called policy may 5716 // itself call other policies (subject to 5717 // implementation limitations). This is intended to 5718 // provide a policy 'subroutine' capability. The 5719 // called policy should contain an explicit or a 5720 // default route disposition that returns an 5721 // effective true (accept-route) or false 5722 // (reject-route), otherwise the behavior may be 5723 // ambiguous and implementation dependent. 5724 CallPolicy string `mapstructure:"call-policy" json:"call-policy,omitempty"` 5725 // original -> rpol:match-prefix-set 5726 // Match a referenced prefix-set according to the logic 5727 // defined in the match-set-options leaf. 5728 MatchPrefixSet MatchPrefixSet `mapstructure:"match-prefix-set" json:"match-prefix-set,omitempty"` 5729 // original -> rpol:match-neighbor-set 5730 // Match a referenced neighbor set according to the logic 5731 // defined in the match-set-options-leaf. 5732 MatchNeighborSet MatchNeighborSet `mapstructure:"match-neighbor-set" json:"match-neighbor-set,omitempty"` 5733 // original -> rpol:match-tag-set 5734 // Match a referenced tag set according to the logic defined 5735 // in the match-options-set leaf. 5736 MatchTagSet MatchTagSet `mapstructure:"match-tag-set" json:"match-tag-set,omitempty"` 5737 // original -> rpol:install-protocol-eq 5738 // Condition to check the protocol / method used to install 5739 // which installed the route into the local routing table. 5740 InstallProtocolEq InstallProtocolType `mapstructure:"install-protocol-eq" json:"install-protocol-eq,omitempty"` 5741 // original -> rpol:igp-conditions 5742 // Policy conditions for IGP attributes. 5743 IgpConditions IgpConditions `mapstructure:"igp-conditions" json:"igp-conditions,omitempty"` 5744 // original -> bgp-pol:bgp-conditions 5745 // Policy conditions for matching 5746 // BGP-specific defined sets or comparing BGP-specific 5747 // attributes. 5748 BgpConditions BgpConditions `mapstructure:"bgp-conditions" json:"bgp-conditions,omitempty"` 5749 } 5750 5751 func (lhs *Conditions) Equal(rhs *Conditions) bool { 5752 if lhs == nil || rhs == nil { 5753 return false 5754 } 5755 if lhs.CallPolicy != rhs.CallPolicy { 5756 return false 5757 } 5758 if !lhs.MatchPrefixSet.Equal(&(rhs.MatchPrefixSet)) { 5759 return false 5760 } 5761 if !lhs.MatchNeighborSet.Equal(&(rhs.MatchNeighborSet)) { 5762 return false 5763 } 5764 if !lhs.MatchTagSet.Equal(&(rhs.MatchTagSet)) { 5765 return false 5766 } 5767 if lhs.InstallProtocolEq != rhs.InstallProtocolEq { 5768 return false 5769 } 5770 if !lhs.IgpConditions.Equal(&(rhs.IgpConditions)) { 5771 return false 5772 } 5773 if !lhs.BgpConditions.Equal(&(rhs.BgpConditions)) { 5774 return false 5775 } 5776 return true 5777 } 5778 5779 // struct for container rpol:statement. 5780 // Policy statements group conditions and actions 5781 // within a policy definition. They are evaluated in 5782 // the order specified (see the description of policy 5783 // evaluation at the top of this module. 5784 type Statement struct { 5785 // original -> rpol:name 5786 // name of the policy statement. 5787 Name string `mapstructure:"name" json:"name,omitempty"` 5788 // original -> rpol:conditions 5789 // Condition statements for this 5790 // policy statement. 5791 Conditions Conditions `mapstructure:"conditions" json:"conditions,omitempty"` 5792 // original -> rpol:actions 5793 // Action statements for this policy 5794 // statement. 5795 Actions Actions `mapstructure:"actions" json:"actions,omitempty"` 5796 } 5797 5798 func (lhs *Statement) Equal(rhs *Statement) bool { 5799 if lhs == nil || rhs == nil { 5800 return false 5801 } 5802 if lhs.Name != rhs.Name { 5803 return false 5804 } 5805 if !lhs.Conditions.Equal(&(rhs.Conditions)) { 5806 return false 5807 } 5808 if !lhs.Actions.Equal(&(rhs.Actions)) { 5809 return false 5810 } 5811 return true 5812 } 5813 5814 // struct for container rpol:policy-definition. 5815 // List of top-level policy definitions, keyed by unique 5816 // name. These policy definitions are expected to be 5817 // referenced (by name) in policy chains specified in import 5818 // or export configuration statements. 5819 type PolicyDefinition struct { 5820 // original -> rpol:name 5821 // Name of the top-level policy definition -- this name 5822 // is used in references to the current policy. 5823 Name string `mapstructure:"name" json:"name,omitempty"` 5824 // original -> rpol:statements 5825 // Enclosing container for policy statements. 5826 Statements []Statement `mapstructure:"statements" json:"statements,omitempty"` 5827 } 5828 5829 func (lhs *PolicyDefinition) Equal(rhs *PolicyDefinition) bool { 5830 if lhs == nil || rhs == nil { 5831 return false 5832 } 5833 if lhs.Name != rhs.Name { 5834 return false 5835 } 5836 if len(lhs.Statements) != len(rhs.Statements) { 5837 return false 5838 } 5839 { 5840 lmap := make(map[string]*Statement) 5841 for i, l := range lhs.Statements { 5842 lmap[mapkey(i, string(l.Name))] = &lhs.Statements[i] 5843 } 5844 for i, r := range rhs.Statements { 5845 if l, y := lmap[mapkey(i, string(r.Name))]; !y { 5846 return false 5847 } else if !r.Equal(l) { 5848 return false 5849 } 5850 } 5851 } 5852 return true 5853 } 5854 5855 // struct for container gobgp:large-community-set. 5856 type LargeCommunitySet struct { 5857 // original -> gobgp:large-community-set-name 5858 LargeCommunitySetName string `mapstructure:"large-community-set-name" json:"large-community-set-name,omitempty"` 5859 // original -> gobgp:large-community 5860 // extended community set member. 5861 LargeCommunityList []string `mapstructure:"large-community-list" json:"large-community-list,omitempty"` 5862 } 5863 5864 func (lhs *LargeCommunitySet) Equal(rhs *LargeCommunitySet) bool { 5865 if lhs == nil || rhs == nil { 5866 return false 5867 } 5868 if lhs.LargeCommunitySetName != rhs.LargeCommunitySetName { 5869 return false 5870 } 5871 if len(lhs.LargeCommunityList) != len(rhs.LargeCommunityList) { 5872 return false 5873 } 5874 for idx, l := range lhs.LargeCommunityList { 5875 if l != rhs.LargeCommunityList[idx] { 5876 return false 5877 } 5878 } 5879 return true 5880 } 5881 5882 // struct for container bgp-pol:as-path-set. 5883 // Definitions for AS path sets. 5884 type AsPathSet struct { 5885 // original -> bgp-pol:as-path-set-name 5886 // name of the AS path set -- this is used to reference 5887 // the set in match conditions. 5888 AsPathSetName string `mapstructure:"as-path-set-name" json:"as-path-set-name,omitempty"` 5889 // original -> gobgp:as-path 5890 // AS path expression. 5891 AsPathList []string `mapstructure:"as-path-list" json:"as-path-list,omitempty"` 5892 } 5893 5894 func (lhs *AsPathSet) Equal(rhs *AsPathSet) bool { 5895 if lhs == nil || rhs == nil { 5896 return false 5897 } 5898 if lhs.AsPathSetName != rhs.AsPathSetName { 5899 return false 5900 } 5901 if len(lhs.AsPathList) != len(rhs.AsPathList) { 5902 return false 5903 } 5904 for idx, l := range lhs.AsPathList { 5905 if l != rhs.AsPathList[idx] { 5906 return false 5907 } 5908 } 5909 return true 5910 } 5911 5912 // struct for container bgp-pol:ext-community-set. 5913 // Definitions for extended community sets. 5914 type ExtCommunitySet struct { 5915 // original -> bgp-pol:ext-community-set-name 5916 // name / label of the extended community set -- this is 5917 // used to reference the set in match conditions. 5918 ExtCommunitySetName string `mapstructure:"ext-community-set-name" json:"ext-community-set-name,omitempty"` 5919 // original -> gobgp:ext-community 5920 // extended community set member. 5921 ExtCommunityList []string `mapstructure:"ext-community-list" json:"ext-community-list,omitempty"` 5922 } 5923 5924 func (lhs *ExtCommunitySet) Equal(rhs *ExtCommunitySet) bool { 5925 if lhs == nil || rhs == nil { 5926 return false 5927 } 5928 if lhs.ExtCommunitySetName != rhs.ExtCommunitySetName { 5929 return false 5930 } 5931 if len(lhs.ExtCommunityList) != len(rhs.ExtCommunityList) { 5932 return false 5933 } 5934 for idx, l := range lhs.ExtCommunityList { 5935 if l != rhs.ExtCommunityList[idx] { 5936 return false 5937 } 5938 } 5939 return true 5940 } 5941 5942 // struct for container bgp-pol:community-set. 5943 // Definitions for community sets. 5944 type CommunitySet struct { 5945 // original -> bgp-pol:community-set-name 5946 // name / label of the community set -- this is used to 5947 // reference the set in match conditions. 5948 CommunitySetName string `mapstructure:"community-set-name" json:"community-set-name,omitempty"` 5949 // original -> gobgp:community 5950 // community set member. 5951 CommunityList []string `mapstructure:"community-list" json:"community-list,omitempty"` 5952 } 5953 5954 func (lhs *CommunitySet) Equal(rhs *CommunitySet) bool { 5955 if lhs == nil || rhs == nil { 5956 return false 5957 } 5958 if lhs.CommunitySetName != rhs.CommunitySetName { 5959 return false 5960 } 5961 if len(lhs.CommunityList) != len(rhs.CommunityList) { 5962 return false 5963 } 5964 for idx, l := range lhs.CommunityList { 5965 if l != rhs.CommunityList[idx] { 5966 return false 5967 } 5968 } 5969 return true 5970 } 5971 5972 // struct for container bgp-pol:bgp-defined-sets. 5973 // BGP-related set definitions for policy match conditions. 5974 type BgpDefinedSets struct { 5975 // original -> bgp-pol:community-sets 5976 // Enclosing container for community sets. 5977 CommunitySets []CommunitySet `mapstructure:"community-sets" json:"community-sets,omitempty"` 5978 // original -> bgp-pol:ext-community-sets 5979 // Enclosing container for extended community sets. 5980 ExtCommunitySets []ExtCommunitySet `mapstructure:"ext-community-sets" json:"ext-community-sets,omitempty"` 5981 // original -> bgp-pol:as-path-sets 5982 // Enclosing container for AS path sets. 5983 AsPathSets []AsPathSet `mapstructure:"as-path-sets" json:"as-path-sets,omitempty"` 5984 // original -> gobgp:large-community-sets 5985 LargeCommunitySets []LargeCommunitySet `mapstructure:"large-community-sets" json:"large-community-sets,omitempty"` 5986 } 5987 5988 func (lhs *BgpDefinedSets) Equal(rhs *BgpDefinedSets) bool { 5989 if lhs == nil || rhs == nil { 5990 return false 5991 } 5992 if len(lhs.CommunitySets) != len(rhs.CommunitySets) { 5993 return false 5994 } 5995 { 5996 lmap := make(map[string]*CommunitySet) 5997 for i, l := range lhs.CommunitySets { 5998 lmap[mapkey(i, string(l.CommunitySetName))] = &lhs.CommunitySets[i] 5999 } 6000 for i, r := range rhs.CommunitySets { 6001 if l, y := lmap[mapkey(i, string(r.CommunitySetName))]; !y { 6002 return false 6003 } else if !r.Equal(l) { 6004 return false 6005 } 6006 } 6007 } 6008 if len(lhs.ExtCommunitySets) != len(rhs.ExtCommunitySets) { 6009 return false 6010 } 6011 { 6012 lmap := make(map[string]*ExtCommunitySet) 6013 for i, l := range lhs.ExtCommunitySets { 6014 lmap[mapkey(i, string(l.ExtCommunitySetName))] = &lhs.ExtCommunitySets[i] 6015 } 6016 for i, r := range rhs.ExtCommunitySets { 6017 if l, y := lmap[mapkey(i, string(r.ExtCommunitySetName))]; !y { 6018 return false 6019 } else if !r.Equal(l) { 6020 return false 6021 } 6022 } 6023 } 6024 if len(lhs.AsPathSets) != len(rhs.AsPathSets) { 6025 return false 6026 } 6027 { 6028 lmap := make(map[string]*AsPathSet) 6029 for i, l := range lhs.AsPathSets { 6030 lmap[mapkey(i, string(l.AsPathSetName))] = &lhs.AsPathSets[i] 6031 } 6032 for i, r := range rhs.AsPathSets { 6033 if l, y := lmap[mapkey(i, string(r.AsPathSetName))]; !y { 6034 return false 6035 } else if !r.Equal(l) { 6036 return false 6037 } 6038 } 6039 } 6040 if len(lhs.LargeCommunitySets) != len(rhs.LargeCommunitySets) { 6041 return false 6042 } 6043 { 6044 lmap := make(map[string]*LargeCommunitySet) 6045 for i, l := range lhs.LargeCommunitySets { 6046 lmap[mapkey(i, string(l.LargeCommunitySetName))] = &lhs.LargeCommunitySets[i] 6047 } 6048 for i, r := range rhs.LargeCommunitySets { 6049 if l, y := lmap[mapkey(i, string(r.LargeCommunitySetName))]; !y { 6050 return false 6051 } else if !r.Equal(l) { 6052 return false 6053 } 6054 } 6055 } 6056 return true 6057 } 6058 6059 // struct for container rpol:tag. 6060 // list of tags that are part of the tag set. 6061 type Tag struct { 6062 // original -> rpol:value 6063 // Value of the tag set member. 6064 Value TagType `mapstructure:"value" json:"value,omitempty"` 6065 } 6066 6067 func (lhs *Tag) Equal(rhs *Tag) bool { 6068 if lhs == nil || rhs == nil { 6069 return false 6070 } 6071 if lhs.Value != rhs.Value { 6072 return false 6073 } 6074 return true 6075 } 6076 6077 // struct for container rpol:tag-set. 6078 // Definitions for tag sets. 6079 type TagSet struct { 6080 // original -> rpol:tag-set-name 6081 // name / label of the tag set -- this is used to reference 6082 // the set in match conditions. 6083 TagSetName string `mapstructure:"tag-set-name" json:"tag-set-name,omitempty"` 6084 // original -> rpol:tag 6085 // list of tags that are part of the tag set. 6086 TagList []Tag `mapstructure:"tag-list" json:"tag-list,omitempty"` 6087 } 6088 6089 func (lhs *TagSet) Equal(rhs *TagSet) bool { 6090 if lhs == nil || rhs == nil { 6091 return false 6092 } 6093 if lhs.TagSetName != rhs.TagSetName { 6094 return false 6095 } 6096 if len(lhs.TagList) != len(rhs.TagList) { 6097 return false 6098 } 6099 { 6100 lmap := make(map[string]*Tag) 6101 for i, l := range lhs.TagList { 6102 lmap[mapkey(i, string(l.Value))] = &lhs.TagList[i] 6103 } 6104 for i, r := range rhs.TagList { 6105 if l, y := lmap[mapkey(i, string(r.Value))]; !y { 6106 return false 6107 } else if !r.Equal(l) { 6108 return false 6109 } 6110 } 6111 } 6112 return true 6113 } 6114 6115 // struct for container rpol:neighbor-set. 6116 // Definitions for neighbor sets. 6117 type NeighborSet struct { 6118 // original -> rpol:neighbor-set-name 6119 // name / label of the neighbor set -- this is used to 6120 // reference the set in match conditions. 6121 NeighborSetName string `mapstructure:"neighbor-set-name" json:"neighbor-set-name,omitempty"` 6122 // original -> gobgp:neighbor-info 6123 // original type is list of inet:ip-address 6124 // neighbor ip address or prefix. 6125 NeighborInfoList []string `mapstructure:"neighbor-info-list" json:"neighbor-info-list,omitempty"` 6126 } 6127 6128 func (lhs *NeighborSet) Equal(rhs *NeighborSet) bool { 6129 if lhs == nil || rhs == nil { 6130 return false 6131 } 6132 if lhs.NeighborSetName != rhs.NeighborSetName { 6133 return false 6134 } 6135 if len(lhs.NeighborInfoList) != len(rhs.NeighborInfoList) { 6136 return false 6137 } 6138 for idx, l := range lhs.NeighborInfoList { 6139 if l != rhs.NeighborInfoList[idx] { 6140 return false 6141 } 6142 } 6143 return true 6144 } 6145 6146 // struct for container rpol:prefix. 6147 // List of prefix expressions that are part of the set. 6148 type Prefix struct { 6149 // original -> rpol:ip-prefix 6150 // rpol:ip-prefix's original type is inet:ip-prefix. 6151 // The prefix member in CIDR notation -- while the 6152 // prefix may be either IPv4 or IPv6, most 6153 // implementations require all members of the prefix set 6154 // to be the same address family. Mixing address types in 6155 // the same prefix set is likely to cause an error. 6156 IpPrefix string `mapstructure:"ip-prefix" json:"ip-prefix,omitempty"` 6157 // original -> rpol:masklength-range 6158 // Defines a range for the masklength, or 'exact' if 6159 // the prefix has an exact length. 6160 // 6161 // Example: 10.3.192.0/21 through 10.3.192.0/24 would be 6162 // expressed as prefix: 10.3.192.0/21, 6163 // masklength-range: 21..24. 6164 // 6165 // Example: 10.3.192.0/21 would be expressed as 6166 // prefix: 10.3.192.0/21, 6167 // masklength-range: exact. 6168 MasklengthRange string `mapstructure:"masklength-range" json:"masklength-range,omitempty"` 6169 } 6170 6171 func (lhs *Prefix) Equal(rhs *Prefix) bool { 6172 if lhs == nil || rhs == nil { 6173 return false 6174 } 6175 if lhs.IpPrefix != rhs.IpPrefix { 6176 return false 6177 } 6178 if lhs.MasklengthRange != rhs.MasklengthRange { 6179 return false 6180 } 6181 return true 6182 } 6183 6184 // struct for container rpol:prefix-set. 6185 // List of the defined prefix sets. 6186 type PrefixSet struct { 6187 // original -> rpol:prefix-set-name 6188 // name / label of the prefix set -- this is used to 6189 // reference the set in match conditions. 6190 PrefixSetName string `mapstructure:"prefix-set-name" json:"prefix-set-name,omitempty"` 6191 // original -> rpol:prefix 6192 // List of prefix expressions that are part of the set. 6193 PrefixList []Prefix `mapstructure:"prefix-list" json:"prefix-list,omitempty"` 6194 } 6195 6196 func (lhs *PrefixSet) Equal(rhs *PrefixSet) bool { 6197 if lhs == nil || rhs == nil { 6198 return false 6199 } 6200 if lhs.PrefixSetName != rhs.PrefixSetName { 6201 return false 6202 } 6203 if len(lhs.PrefixList) != len(rhs.PrefixList) { 6204 return false 6205 } 6206 { 6207 lmap := make(map[string]*Prefix) 6208 for i, l := range lhs.PrefixList { 6209 lmap[mapkey(i, string(l.IpPrefix+l.MasklengthRange))] = &lhs.PrefixList[i] 6210 } 6211 for i, r := range rhs.PrefixList { 6212 if l, y := lmap[mapkey(i, string(r.IpPrefix+r.MasklengthRange))]; !y { 6213 return false 6214 } else if !r.Equal(l) { 6215 return false 6216 } 6217 } 6218 } 6219 return true 6220 } 6221 6222 // struct for container rpol:defined-sets. 6223 // Predefined sets of attributes used in policy match 6224 // statements. 6225 type DefinedSets struct { 6226 // original -> rpol:prefix-sets 6227 // Enclosing container for defined prefix sets for matching. 6228 PrefixSets []PrefixSet `mapstructure:"prefix-sets" json:"prefix-sets,omitempty"` 6229 // original -> rpol:neighbor-sets 6230 // Enclosing container for defined neighbor sets for matching. 6231 NeighborSets []NeighborSet `mapstructure:"neighbor-sets" json:"neighbor-sets,omitempty"` 6232 // original -> rpol:tag-sets 6233 // Enclosing container for defined tag sets for matching. 6234 TagSets []TagSet `mapstructure:"tag-sets" json:"tag-sets,omitempty"` 6235 // original -> bgp-pol:bgp-defined-sets 6236 // BGP-related set definitions for policy match conditions. 6237 BgpDefinedSets BgpDefinedSets `mapstructure:"bgp-defined-sets" json:"bgp-defined-sets,omitempty"` 6238 } 6239 6240 func (lhs *DefinedSets) Equal(rhs *DefinedSets) bool { 6241 if lhs == nil || rhs == nil { 6242 return false 6243 } 6244 if len(lhs.PrefixSets) != len(rhs.PrefixSets) { 6245 return false 6246 } 6247 { 6248 lmap := make(map[string]*PrefixSet) 6249 for i, l := range lhs.PrefixSets { 6250 lmap[mapkey(i, string(l.PrefixSetName))] = &lhs.PrefixSets[i] 6251 } 6252 for i, r := range rhs.PrefixSets { 6253 if l, y := lmap[mapkey(i, string(r.PrefixSetName))]; !y { 6254 return false 6255 } else if !r.Equal(l) { 6256 return false 6257 } 6258 } 6259 } 6260 if len(lhs.NeighborSets) != len(rhs.NeighborSets) { 6261 return false 6262 } 6263 { 6264 lmap := make(map[string]*NeighborSet) 6265 for i, l := range lhs.NeighborSets { 6266 lmap[mapkey(i, string(l.NeighborSetName))] = &lhs.NeighborSets[i] 6267 } 6268 for i, r := range rhs.NeighborSets { 6269 if l, y := lmap[mapkey(i, string(r.NeighborSetName))]; !y { 6270 return false 6271 } else if !r.Equal(l) { 6272 return false 6273 } 6274 } 6275 } 6276 if len(lhs.TagSets) != len(rhs.TagSets) { 6277 return false 6278 } 6279 { 6280 lmap := make(map[string]*TagSet) 6281 for i, l := range lhs.TagSets { 6282 lmap[mapkey(i, string(l.TagSetName))] = &lhs.TagSets[i] 6283 } 6284 for i, r := range rhs.TagSets { 6285 if l, y := lmap[mapkey(i, string(r.TagSetName))]; !y { 6286 return false 6287 } else if !r.Equal(l) { 6288 return false 6289 } 6290 } 6291 } 6292 if !lhs.BgpDefinedSets.Equal(&(rhs.BgpDefinedSets)) { 6293 return false 6294 } 6295 return true 6296 } 6297 6298 // struct for container rpol:routing-policy. 6299 // top-level container for all routing policy configuration. 6300 type RoutingPolicy struct { 6301 // original -> rpol:defined-sets 6302 // Predefined sets of attributes used in policy match 6303 // statements. 6304 DefinedSets DefinedSets `mapstructure:"defined-sets" json:"defined-sets,omitempty"` 6305 // original -> rpol:policy-definitions 6306 // Enclosing container for the list of top-level policy 6307 // definitions. 6308 PolicyDefinitions []PolicyDefinition `mapstructure:"policy-definitions" json:"policy-definitions,omitempty"` 6309 } 6310 6311 func (lhs *RoutingPolicy) Equal(rhs *RoutingPolicy) bool { 6312 if lhs == nil || rhs == nil { 6313 return false 6314 } 6315 if !lhs.DefinedSets.Equal(&(rhs.DefinedSets)) { 6316 return false 6317 } 6318 if len(lhs.PolicyDefinitions) != len(rhs.PolicyDefinitions) { 6319 return false 6320 } 6321 { 6322 lmap := make(map[string]*PolicyDefinition) 6323 for i, l := range lhs.PolicyDefinitions { 6324 lmap[mapkey(i, string(l.Name))] = &lhs.PolicyDefinitions[i] 6325 } 6326 for i, r := range rhs.PolicyDefinitions { 6327 if l, y := lmap[mapkey(i, string(r.Name))]; !y { 6328 return false 6329 } else if !r.Equal(l) { 6330 return false 6331 } 6332 } 6333 } 6334 return true 6335 }