Class: MistApi::SwitchBgpConfig
- Defined in:
- lib/mist_api/models/switch_bgp_config.rb
Overview
SwitchBgpConfig Model.
Instance Attribute Summary collapse
-
#auth_key ⇒ String
TODO: Write general description for this method.
-
#bfd_minimum_interval ⇒ Integer
Minimum interval in milliseconds for BFD hello packets.
-
#export_policy ⇒ String
Export policy must match one of the policy names defined in the ‘routing_policies` property.
-
#hold_time ⇒ Integer
Hold time is three times the interval at which keepalive messages are sent.
-
#import_policy ⇒ String
Import policy must match one of the policy names defined in the ‘routing_policies` property.
-
#local_as ⇒ Object
BGP AS, value in range 1-4294967294.
-
#neighbors ⇒ Hash[String, SwitchBgpConfigNeighbor]
Property key is the BGP Neighbor IP Address.
-
#networks ⇒ Array[String]
List of network names for BGP configuration.
-
#type ⇒ SwitchBgpConfigTypeEnum
enum: ‘external`, `internal`.
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(local_as = nil, type = nil, auth_key = SKIP, bfd_minimum_interval = SKIP, export_policy = SKIP, hold_time = SKIP, import_policy = SKIP, neighbors = SKIP, networks = SKIP) ⇒ SwitchBgpConfig
constructor
A new instance of SwitchBgpConfig.
-
#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(local_as = nil, type = nil, auth_key = SKIP, bfd_minimum_interval = SKIP, export_policy = SKIP, hold_time = SKIP, import_policy = SKIP, neighbors = SKIP, networks = SKIP) ⇒ SwitchBgpConfig
Returns a new instance of SwitchBgpConfig.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 89 def initialize(local_as = nil, type = nil, auth_key = SKIP, bfd_minimum_interval = SKIP, export_policy = SKIP, hold_time = SKIP, import_policy = SKIP, neighbors = SKIP, networks = SKIP) @auth_key = auth_key unless auth_key == SKIP @bfd_minimum_interval = bfd_minimum_interval unless bfd_minimum_interval == SKIP @export_policy = export_policy unless export_policy == SKIP @hold_time = hold_time unless hold_time == SKIP @import_policy = import_policy unless import_policy == SKIP @local_as = local_as @neighbors = neighbors unless neighbors == SKIP @networks = networks unless networks == SKIP @type = type end |
Instance Attribute Details
#auth_key ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 14 def auth_key @auth_key end |
#bfd_minimum_interval ⇒ Integer
Minimum interval in milliseconds for BFD hello packets. A neighbor is considered failed when the device stops receiving replies after the specified interval. Value must be between 1 and 255000.
20 21 22 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 20 def bfd_minimum_interval @bfd_minimum_interval end |
#export_policy ⇒ String
Export policy must match one of the policy names defined in the ‘routing_policies` property.
25 26 27 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 25 def export_policy @export_policy end |
#hold_time ⇒ Integer
Hold time is three times the interval at which keepalive messages are sent. It indicates to the peer the length of time that it should consider the sender valid. Must be 0 or a number in the range 3-65535.
31 32 33 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 31 def hold_time @hold_time end |
#import_policy ⇒ String
Import policy must match one of the policy names defined in the ‘routing_policies` property.
36 37 38 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 36 def import_policy @import_policy end |
#local_as ⇒ Object
BGP AS, value in range 1-4294967294. Can be a Variable (e.g. ‘{bgp_as}` )
41 42 43 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 41 def local_as @local_as end |
#neighbors ⇒ Hash[String, SwitchBgpConfigNeighbor]
Property key is the BGP Neighbor IP Address.
45 46 47 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 45 def neighbors @neighbors end |
#networks ⇒ Array[String]
List of network names for BGP configuration. When a network is specified, a BGP group will be added to the VRF that network is part of.
50 51 52 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 50 def networks @networks end |
#type ⇒ SwitchBgpConfigTypeEnum
enum: ‘external`, `internal`
54 55 56 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 54 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. local_as = hash.key?('local_as') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:BgpAs5), hash['local_as'] ) : nil type = hash.key?('type') ? hash['type'] : nil auth_key = hash.key?('auth_key') ? hash['auth_key'] : SKIP bfd_minimum_interval = hash.key?('bfd_minimum_interval') ? hash['bfd_minimum_interval'] : SKIP export_policy = hash.key?('export_policy') ? hash['export_policy'] : SKIP hold_time = hash.key?('hold_time') ? hash['hold_time'] : SKIP import_policy = hash.key?('import_policy') ? hash['import_policy'] : SKIP neighbors = SwitchBgpConfigNeighbor.from_hash(hash['neighbors']) if hash['neighbors'] neighbors = SKIP unless hash.key?('neighbors') networks = hash.key?('networks') ? hash['networks'] : SKIP # Create object from extracted values. SwitchBgpConfig.new(local_as, type, auth_key, bfd_minimum_interval, export_policy, hold_time, import_policy, neighbors, networks) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['auth_key'] = 'auth_key' @_hash['bfd_minimum_interval'] = 'bfd_minimum_interval' @_hash['export_policy'] = 'export_policy' @_hash['hold_time'] = 'hold_time' @_hash['import_policy'] = 'import_policy' @_hash['local_as'] = 'local_as' @_hash['neighbors'] = 'neighbors' @_hash['networks'] = 'networks' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 85 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 72 def self.optionals %w[ auth_key bfd_minimum_interval export_policy hold_time import_policy neighbors networks ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 138 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:BgpAs5) .validate(value.local_as) and APIHelper.valid_type?(value.type, ->(val) { SwitchBgpConfigTypeEnum.validate(val) }) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:BgpAs5) .validate(value['local_as']) and APIHelper.valid_type?(value['type'], ->(val) { SwitchBgpConfigTypeEnum.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
168 169 170 171 172 173 174 175 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 168 def inspect class_name = self.class.name.split('::').last "<#{class_name} auth_key: #{@auth_key.inspect}, bfd_minimum_interval:"\ " #{@bfd_minimum_interval.inspect}, export_policy: #{@export_policy.inspect}, hold_time:"\ " #{@hold_time.inspect}, import_policy: #{@import_policy.inspect}, local_as:"\ " #{@local_as.inspect}, neighbors: #{@neighbors.inspect}, networks: #{@networks.inspect},"\ " type: #{@type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
159 160 161 162 163 164 165 |
# File 'lib/mist_api/models/switch_bgp_config.rb', line 159 def to_s class_name = self.class.name.split('::').last "<#{class_name} auth_key: #{@auth_key}, bfd_minimum_interval: #{@bfd_minimum_interval},"\ " export_policy: #{@export_policy}, hold_time: #{@hold_time}, import_policy:"\ " #{@import_policy}, local_as: #{@local_as}, neighbors: #{@neighbors}, networks:"\ " #{@networks}, type: #{@type}>" end |