Class: MistApi::BgpConfigNeighbors

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/bgp_config_neighbors.rb

Overview

BgpConfigNeighbors Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(neighbor_as = nil, disabled = false, export_policy = SKIP, hold_time = 90, import_policy = SKIP, multihop_ttl = SKIP, tunnel_via = TunnelViaEnum::PRIMARY) ⇒ BgpConfigNeighbors

Returns a new instance of BgpConfigNeighbors.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 76

def initialize(neighbor_as = nil, disabled = false, export_policy = SKIP,
               hold_time = 90, import_policy = SKIP, multihop_ttl = SKIP,
               tunnel_via = TunnelViaEnum::PRIMARY)
  @disabled = disabled unless disabled == 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
  @multihop_ttl = multihop_ttl unless multihop_ttl == SKIP
  @neighbor_as = neighbor_as
  @tunnel_via = tunnel_via unless tunnel_via == SKIP
end

Instance Attribute Details

#disabledTrueClass | FalseClass

If true, the BGP session to this neighbor will be administratively disabled/shutdown

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 15

def disabled
  @disabled
end

#export_policyString

If true, the BGP session to this neighbor will be administratively disabled/shutdown

Returns:

  • (String)


20
21
22
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 20

def export_policy
  @export_policy
end

#hold_timeInteger

If true, the BGP session to this neighbor will be administratively disabled/shutdown

Returns:

  • (Integer)


25
26
27
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 25

def hold_time
  @hold_time
end

#import_policyString

If true, the BGP session to this neighbor will be administratively disabled/shutdown

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 30

def import_policy
  @import_policy
end

#multihop_ttlInteger

Assuming BGP neighbor is directly connected

Returns:

  • (Integer)


34
35
36
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 34

def multihop_ttl
  @multihop_ttl
end

#neighbor_asObject

BGP AS, value in range 1-4294967294. Can be a Variable (e.g. ‘{bgp_as}` )

Returns:

  • (Object)


39
40
41
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 39

def neighbor_as
  @neighbor_as
end

#tunnel_viaTunnelViaEnum

If ‘via`==`tunnel`, specifies which tunnel (primary/secondary) this neighbor is associated with. enum: `primary`, `secondary`

Returns:



44
45
46
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 44

def tunnel_via
  @tunnel_via
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  neighbor_as = hash.key?('neighbor_as') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:BgpAs2), hash['neighbor_as']
  ) : nil
  disabled = hash['disabled'] ||= false
  export_policy = hash.key?('export_policy') ? hash['export_policy'] : SKIP
  hold_time = hash['hold_time'] ||= 90
  import_policy = hash.key?('import_policy') ? hash['import_policy'] : SKIP
  multihop_ttl = hash.key?('multihop_ttl') ? hash['multihop_ttl'] : SKIP
  tunnel_via = hash['tunnel_via'] ||= TunnelViaEnum::PRIMARY

  # Create object from extracted values.
  BgpConfigNeighbors.new(neighbor_as,
                         disabled,
                         export_policy,
                         hold_time,
                         import_policy,
                         multihop_ttl,
                         tunnel_via)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['disabled'] = 'disabled'
  @_hash['export_policy'] = 'export_policy'
  @_hash['hold_time'] = 'hold_time'
  @_hash['import_policy'] = 'import_policy'
  @_hash['multihop_ttl'] = 'multihop_ttl'
  @_hash['neighbor_as'] = 'neighbor_as'
  @_hash['tunnel_via'] = 'tunnel_via'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 60

def self.optionals
  %w[
    disabled
    export_policy
    hold_time
    import_policy
    multihop_ttl
    tunnel_via
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 115

def self.validate(value)
  if value.instance_of? self
    return UnionTypeLookUp.get(:BgpAs2)
                          .validate(value.neighbor_as)
  end

  return false unless value.instance_of? Hash

  UnionTypeLookUp.get(:BgpAs2)
                 .validate(value['neighbor_as'])
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} disabled: #{@disabled.inspect}, export_policy: #{@export_policy.inspect},"\
  " hold_time: #{@hold_time.inspect}, import_policy: #{@import_policy.inspect}, multihop_ttl:"\
  " #{@multihop_ttl.inspect}, neighbor_as: #{@neighbor_as.inspect}, tunnel_via:"\
  " #{@tunnel_via.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
# File 'lib/mist_api/models/bgp_config_neighbors.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} disabled: #{@disabled}, export_policy: #{@export_policy}, hold_time:"\
  " #{@hold_time}, import_policy: #{@import_policy}, multihop_ttl: #{@multihop_ttl},"\
  " neighbor_as: #{@neighbor_as}, tunnel_via: #{@tunnel_via}>"
end