Class: MistApi::BgpConfig
- Defined in:
- lib/mist_api/models/bgp_config.rb
Overview
BFD is enabled when either bfd_minimum_interval or bfd_multiplier is configured
Instance Attribute Summary collapse
-
#auth_key ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#bfd_minimum_interval ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`, when bfd_multiplier is configured alone.
-
#bfd_multiplier ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`, when bfd_minimum_interval_is_configured alone.
-
#disable_bfd ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#export ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#export_policy ⇒ String
Default export policies if no per-neighbor policies defined.
-
#extended_v4_nexthop ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#graceful_restart_time ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#hold_time ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#import ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#import_policy ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#local_as ⇒ Object
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#neighbor_as ⇒ Object
BGP AS, value in range 1-4294967294.
-
#neighbors ⇒ Hash[String, BgpConfigNeighbors]
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#networks ⇒ Array[String]
Optional if ‘via`==`lan`.
-
#no_private_as ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#no_readvertise_to_overlay ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#tunnel_name ⇒ String
Optional if ‘via`==`tunnel`.
-
#type ⇒ BgpConfigTypeEnum
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`.
-
#via ⇒ BgpConfigViaEnum
enum: ‘lan`, `tunnel`, `vpn`, `wan`.
-
#vpn_name ⇒ String
Optional if ‘via`==`vpn`.
-
#wan_name ⇒ String
Optional if ‘via`==`wan`.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(via = BgpConfigViaEnum::LAN, auth_key = SKIP, bfd_minimum_interval = 350, bfd_multiplier = 3, disable_bfd = false, export = SKIP, export_policy = SKIP, extended_v4_nexthop = SKIP, graceful_restart_time = 0, hold_time = 90, import = SKIP, import_policy = SKIP, local_as = SKIP, neighbor_as = SKIP, neighbors = SKIP, networks = SKIP, no_private_as = false, no_readvertise_to_overlay = false, tunnel_name = SKIP, type = SKIP, vpn_name = SKIP, wan_name = SKIP) ⇒ BgpConfig
constructor
A new instance of BgpConfig.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(via = BgpConfigViaEnum::LAN, auth_key = SKIP, bfd_minimum_interval = 350, bfd_multiplier = 3, disable_bfd = false, export = SKIP, export_policy = SKIP, extended_v4_nexthop = SKIP, graceful_restart_time = 0, hold_time = 90, import = SKIP, import_policy = SKIP, local_as = SKIP, neighbor_as = SKIP, neighbors = SKIP, networks = SKIP, no_private_as = false, no_readvertise_to_overlay = false, tunnel_name = SKIP, type = SKIP, vpn_name = SKIP, wan_name = SKIP) ⇒ BgpConfig
Returns a new instance of BgpConfig.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/mist_api/models/bgp_config.rb', line 182 def initialize(via = BgpConfigViaEnum::LAN, auth_key = SKIP, bfd_minimum_interval = 350, bfd_multiplier = 3, disable_bfd = false, export = SKIP, export_policy = SKIP, extended_v4_nexthop = SKIP, graceful_restart_time = 0, hold_time = 90, import = SKIP, import_policy = SKIP, local_as = SKIP, neighbor_as = SKIP, neighbors = SKIP, networks = SKIP, no_private_as = false, = false, tunnel_name = SKIP, type = SKIP, vpn_name = SKIP, wan_name = SKIP) @auth_key = auth_key unless auth_key == SKIP @bfd_minimum_interval = bfd_minimum_interval unless bfd_minimum_interval == SKIP @bfd_multiplier = bfd_multiplier unless bfd_multiplier == SKIP @disable_bfd = disable_bfd unless disable_bfd == SKIP @export = export unless export == SKIP @export_policy = export_policy unless export_policy == SKIP @extended_v4_nexthop = extended_v4_nexthop unless extended_v4_nexthop == SKIP @graceful_restart_time = graceful_restart_time unless graceful_restart_time == SKIP @hold_time = hold_time unless hold_time == SKIP @import = import unless import == SKIP @import_policy = import_policy unless import_policy == SKIP @local_as = local_as unless local_as == SKIP @neighbor_as = neighbor_as unless neighbor_as == SKIP @neighbors = neighbors unless neighbors == SKIP @networks = networks unless networks == SKIP @no_private_as = no_private_as unless no_private_as == SKIP unless == SKIP @no_readvertise_to_overlay = end @tunnel_name = tunnel_name unless tunnel_name == SKIP @type = type unless type == SKIP @via = via @vpn_name = vpn_name unless vpn_name == SKIP @wan_name = wan_name unless wan_name == SKIP end |
Instance Attribute Details
#auth_key ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`
15 16 17 |
# File 'lib/mist_api/models/bgp_config.rb', line 15 def auth_key @auth_key end |
#bfd_minimum_interval ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`, when bfd_multiplier is configured alone. Default:
* 1000 if `type`==`external`
* 350 `type`==`internal`
22 23 24 |
# File 'lib/mist_api/models/bgp_config.rb', line 22 def bfd_minimum_interval @bfd_minimum_interval end |
#bfd_multiplier ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`, when bfd_minimum_interval_is_configured alone
27 28 29 |
# File 'lib/mist_api/models/bgp_config.rb', line 27 def bfd_multiplier @bfd_multiplier end |
#disable_bfd ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. BFD provides faster path failure detection and is enabled by default
32 33 34 |
# File 'lib/mist_api/models/bgp_config.rb', line 32 def disable_bfd @disable_bfd end |
#export ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. BFD provides faster path failure detection and is enabled by default
37 38 39 |
# File 'lib/mist_api/models/bgp_config.rb', line 37 def export @export end |
#export_policy ⇒ String
Default export policies if no per-neighbor policies defined
41 42 43 |
# File 'lib/mist_api/models/bgp_config.rb', line 41 def export_policy @export_policy end |
#extended_v4_nexthop ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. By default, either inet/net6 unicast depending on neighbor IP family (v4 or v6). For v6 neighbors, to exchange v4 nexthop, which allows dual-stack support, enable this
48 49 50 |
# File 'lib/mist_api/models/bgp_config.rb', line 48 def extended_v4_nexthop @extended_v4_nexthop end |
#graceful_restart_time ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. `0` means disable
53 54 55 |
# File 'lib/mist_api/models/bgp_config.rb', line 53 def graceful_restart_time @graceful_restart_time end |
#hold_time ⇒ Integer
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. Default is 90.
57 58 59 |
# File 'lib/mist_api/models/bgp_config.rb', line 57 def hold_time @hold_time end |
#import ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. Default is 90.
61 62 63 |
# File 'lib/mist_api/models/bgp_config.rb', line 61 def import @import end |
#import_policy ⇒ String
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. Default import policies if no per-neighbor policies defined
66 67 68 |
# File 'lib/mist_api/models/bgp_config.rb', line 66 def import_policy @import_policy end |
#local_as ⇒ Object
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. BGP AS, value in range 1-4294967295
71 72 73 |
# File 'lib/mist_api/models/bgp_config.rb', line 71 def local_as @local_as end |
#neighbor_as ⇒ Object
BGP AS, value in range 1-4294967294. Can be a Variable (e.g. ‘{bgp_as}` )
76 77 78 |
# File 'lib/mist_api/models/bgp_config.rb', line 76 def neighbor_as @neighbor_as end |
#neighbors ⇒ Hash[String, BgpConfigNeighbors]
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. If per-neighbor as is desired. Property key is the neighbor address
81 82 83 |
# File 'lib/mist_api/models/bgp_config.rb', line 81 def neighbors @neighbors end |
#networks ⇒ Array[String]
Optional if ‘via`==`lan`. List of networks where we expect BGP neighbor to connect to/from
86 87 88 |
# File 'lib/mist_api/models/bgp_config.rb', line 86 def networks @networks end |
#no_private_as ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. If true, we will not advertise private ASNs (AS 64512-65534) to this neighbor
91 92 93 |
# File 'lib/mist_api/models/bgp_config.rb', line 91 def no_private_as @no_private_as end |
#no_readvertise_to_overlay ⇒ TrueClass | FalseClass
Optional if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. By default, we’ll re-advertise all learned BGP routers toward overlay
96 97 98 |
# File 'lib/mist_api/models/bgp_config.rb', line 96 def @no_readvertise_to_overlay end |
#tunnel_name ⇒ String
Optional if ‘via`==`tunnel`
100 101 102 |
# File 'lib/mist_api/models/bgp_config.rb', line 100 def tunnel_name @tunnel_name end |
#type ⇒ BgpConfigTypeEnum
Required if ‘via`==`lan`, `via`==`tunnel` or `via`==`wan`. enum: `external`, `internal`
105 106 107 |
# File 'lib/mist_api/models/bgp_config.rb', line 105 def type @type end |
#via ⇒ BgpConfigViaEnum
enum: ‘lan`, `tunnel`, `vpn`, `wan`
109 110 111 |
# File 'lib/mist_api/models/bgp_config.rb', line 109 def via @via end |
#vpn_name ⇒ String
Optional if ‘via`==`vpn`
113 114 115 |
# File 'lib/mist_api/models/bgp_config.rb', line 113 def vpn_name @vpn_name end |
#wan_name ⇒ String
Optional if ‘via`==`wan`
117 118 119 |
# File 'lib/mist_api/models/bgp_config.rb', line 117 def wan_name @wan_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/mist_api/models/bgp_config.rb', line 219 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. via = hash['via'] ||= BgpConfigViaEnum::LAN auth_key = hash.key?('auth_key') ? hash['auth_key'] : SKIP bfd_minimum_interval = hash['bfd_minimum_interval'] ||= 350 bfd_multiplier = hash['bfd_multiplier'] ||= 3 disable_bfd = hash['disable_bfd'] ||= false export = hash.key?('export') ? hash['export'] : SKIP export_policy = hash.key?('export_policy') ? hash['export_policy'] : SKIP extended_v4_nexthop = hash.key?('extended_v4_nexthop') ? hash['extended_v4_nexthop'] : SKIP graceful_restart_time = hash['graceful_restart_time'] ||= 0 hold_time = hash['hold_time'] ||= 90 import = hash.key?('import') ? hash['import'] : SKIP import_policy = hash.key?('import_policy') ? hash['import_policy'] : SKIP local_as = hash.key?('local_as') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:BgpLocalAs), hash['local_as'] ) : SKIP neighbor_as = hash.key?('neighbor_as') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:BgpAs), hash['neighbor_as'] ) : SKIP neighbors = BgpConfigNeighbors.from_hash(hash['neighbors']) if hash['neighbors'] neighbors = SKIP unless hash.key?('neighbors') networks = hash.key?('networks') ? hash['networks'] : SKIP no_private_as = hash['no_private_as'] ||= false = hash['no_readvertise_to_overlay'] ||= false tunnel_name = hash.key?('tunnel_name') ? hash['tunnel_name'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP vpn_name = hash.key?('vpn_name') ? hash['vpn_name'] : SKIP wan_name = hash.key?('wan_name') ? hash['wan_name'] : SKIP # Create object from extracted values. BgpConfig.new(via, auth_key, bfd_minimum_interval, bfd_multiplier, disable_bfd, export, export_policy, extended_v4_nexthop, graceful_restart_time, hold_time, import, import_policy, local_as, neighbor_as, neighbors, networks, no_private_as, , tunnel_name, type, vpn_name, wan_name) end |
.names ⇒ Object
A mapping from model property names to API property names.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/mist_api/models/bgp_config.rb', line 120 def self.names @_hash = {} if @_hash.nil? @_hash['auth_key'] = 'auth_key' @_hash['bfd_minimum_interval'] = 'bfd_minimum_interval' @_hash['bfd_multiplier'] = 'bfd_multiplier' @_hash['disable_bfd'] = 'disable_bfd' @_hash['export'] = 'export' @_hash['export_policy'] = 'export_policy' @_hash['extended_v4_nexthop'] = 'extended_v4_nexthop' @_hash['graceful_restart_time'] = 'graceful_restart_time' @_hash['hold_time'] = 'hold_time' @_hash['import'] = 'import' @_hash['import_policy'] = 'import_policy' @_hash['local_as'] = 'local_as' @_hash['neighbor_as'] = 'neighbor_as' @_hash['neighbors'] = 'neighbors' @_hash['networks'] = 'networks' @_hash['no_private_as'] = 'no_private_as' @_hash['no_readvertise_to_overlay'] = 'no_readvertise_to_overlay' @_hash['tunnel_name'] = 'tunnel_name' @_hash['type'] = 'type' @_hash['via'] = 'via' @_hash['vpn_name'] = 'vpn_name' @_hash['wan_name'] = 'wan_name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
175 176 177 178 179 180 |
# File 'lib/mist_api/models/bgp_config.rb', line 175 def self.nullables %w[ bfd_minimum_interval bfd_multiplier ] end |
.optionals ⇒ Object
An array for optional fields
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/mist_api/models/bgp_config.rb', line 148 def self.optionals %w[ auth_key bfd_minimum_interval bfd_multiplier disable_bfd export export_policy extended_v4_nexthop graceful_restart_time hold_time import import_policy local_as neighbor_as neighbors networks no_private_as no_readvertise_to_overlay tunnel_name type vpn_name wan_name ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/mist_api/models/bgp_config.rb', line 280 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.via, ->(val) { BgpConfigViaEnum.validate(val) }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['via'], ->(val) { BgpConfigViaEnum.validate(val) }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/mist_api/models/bgp_config.rb', line 307 def inspect class_name = self.class.name.split('::').last "<#{class_name} auth_key: #{@auth_key.inspect}, bfd_minimum_interval:"\ " #{@bfd_minimum_interval.inspect}, bfd_multiplier: #{@bfd_multiplier.inspect}, disable_bfd:"\ " #{@disable_bfd.inspect}, export: #{@export.inspect}, export_policy:"\ " #{@export_policy.inspect}, extended_v4_nexthop: #{@extended_v4_nexthop.inspect},"\ " graceful_restart_time: #{@graceful_restart_time.inspect}, hold_time:"\ " #{@hold_time.inspect}, import: #{@import.inspect}, import_policy:"\ " #{@import_policy.inspect}, local_as: #{@local_as.inspect}, neighbor_as:"\ " #{@neighbor_as.inspect}, neighbors: #{@neighbors.inspect}, networks: #{@networks.inspect},"\ " no_private_as: #{@no_private_as.inspect}, no_readvertise_to_overlay:"\ " #{@no_readvertise_to_overlay.inspect}, tunnel_name: #{@tunnel_name.inspect}, type:"\ " #{@type.inspect}, via: #{@via.inspect}, vpn_name: #{@vpn_name.inspect}, wan_name:"\ " #{@wan_name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/mist_api/models/bgp_config.rb', line 293 def to_s class_name = self.class.name.split('::').last "<#{class_name} auth_key: #{@auth_key}, bfd_minimum_interval: #{@bfd_minimum_interval},"\ " bfd_multiplier: #{@bfd_multiplier}, disable_bfd: #{@disable_bfd}, export: #{@export},"\ " export_policy: #{@export_policy}, extended_v4_nexthop: #{@extended_v4_nexthop},"\ " graceful_restart_time: #{@graceful_restart_time}, hold_time: #{@hold_time}, import:"\ " #{@import}, import_policy: #{@import_policy}, local_as: #{@local_as}, neighbor_as:"\ " #{@neighbor_as}, neighbors: #{@neighbors}, networks: #{@networks}, no_private_as:"\ " #{@no_private_as}, no_readvertise_to_overlay: #{@no_readvertise_to_overlay}, tunnel_name:"\ " #{@tunnel_name}, type: #{@type}, via: #{@via}, vpn_name: #{@vpn_name}, wan_name:"\ " #{@wan_name}>" end |