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