Class: MistApi::SwitchBgpConfigNeighbor

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

Overview

SwitchBgpConfigNeighbor 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, export_policy = SKIP, hold_time = SKIP, import_policy = SKIP, multihop_ttl = SKIP) ⇒ SwitchBgpConfigNeighbor

Returns a new instance of SwitchBgpConfigNeighbor.



64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 64

def initialize(neighbor_as = nil, export_policy = SKIP, hold_time = SKIP,
               import_policy = SKIP, multihop_ttl = 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
end

Instance Attribute Details

#export_policyString

Export policy must match one of the policy names defined in the ‘routing_policies` property.

Returns:

  • (String)


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

def export_policy
  @export_policy
end

#hold_timeInteger

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.

Returns:

  • (Integer)


21
22
23
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 21

def hold_time
  @hold_time
end

#import_policyString

Import policy must match one of the policy names defined in the ‘routing_policies` property.

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 26

def import_policy
  @import_policy
end

#multihop_ttlInteger

Import policy must match one of the policy names defined in the ‘routing_policies` property.

Returns:

  • (Integer)


31
32
33
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 31

def multihop_ttl
  @multihop_ttl
end

#neighbor_asObject

Autonomous System (AS) number of the BGP neighbor. For internal BGP, this must match ‘local_as`. For external BGP, this must differ from `local_as`.

Returns:

  • (Object)


36
37
38
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 36

def neighbor_as
  @neighbor_as
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 74

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(:SwitchBgpConfigNeighborNeighborAs), hash['neighbor_as']
  ) : nil
  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
  multihop_ttl = hash.key?('multihop_ttl') ? hash['multihop_ttl'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_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
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 50

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

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 96

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

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} 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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/mist_api/models/switch_bgp_config_neighbor.rb', line 109

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