Class: MistApi::DeviceSwitch

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

Overview

You can configure ‘port_usages` and `networks` settings at the device level, but most of the time it’s better use the Site Setting to achieve better consistency and be able to re-use the same settings across switches entries defined here will “replace” those defined in Site Setting/Network Template In addition it is possible to use the ‘port_config_overwrite` to overwrite some attributes of the port_usage without having to create a new port_usage.

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(acl_policies = SKIP, acl_tags = SKIP, additional_config_cmds = SKIP, aggregate_routes = SKIP, aggregate_routes6 = SKIP, bgp_config = SKIP, created_time = SKIP, default_port_usage = 'default', deviceprofile_id = SKIP, dhcp_snooping = SKIP, dhcpd_config = SKIP, disable_auto_config = false, dns_servers = SKIP, dns_suffix = SKIP, evpn_config = SKIP, extra_routes = SKIP, extra_routes6 = SKIP, id = SKIP, image1_url = SKIP, image2_url = SKIP, image3_url = SKIP, iot_config = SKIP, ip_config = SKIP, local_port_config = SKIP, mac = SKIP, managed = false, map_id = SKIP, mist_configured = SKIP, mist_nac = SKIP, model = SKIP, modified_time = SKIP, name = SKIP, networks = SKIP, notes = SKIP, ntp_servers = SKIP, oob_ip_config = SKIP, org_id = SKIP, ospf_areas = SKIP, ospf_config = SKIP, other_ip_configs = SKIP, port_config = SKIP, port_config_overwrite = SKIP, port_mirroring = SKIP, port_usages = SKIP, radius_config = SKIP, remote_syslog = SKIP, role = SKIP, router_id = SKIP, routing_policies = SKIP, serial = SKIP, site_id = SKIP, snmp_config = SKIP, stp_config = SKIP, switch_mgmt = SKIP, use_router_id_as_source_ip = false, vars = SKIP, virtual_chassis = SKIP, vrf_config = SKIP, vrf_instances = SKIP, vrrp_config = SKIP, x = SKIP, y = SKIP, additional_properties = nil) ⇒ DeviceSwitch

Returns a new instance of DeviceSwitch.



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
# File 'lib/mist_api/models/device_switch.rb', line 455

def initialize(acl_policies = SKIP, acl_tags = SKIP,
               additional_config_cmds = SKIP, aggregate_routes = SKIP,
               aggregate_routes6 = SKIP, bgp_config = SKIP,
               created_time = SKIP, default_port_usage = 'default',
               deviceprofile_id = SKIP, dhcp_snooping = SKIP,
               dhcpd_config = SKIP, disable_auto_config = false,
               dns_servers = SKIP, dns_suffix = SKIP, evpn_config = SKIP,
               extra_routes = SKIP, extra_routes6 = SKIP, id = SKIP,
               image1_url = SKIP, image2_url = SKIP, image3_url = SKIP,
               iot_config = SKIP, ip_config = SKIP,
               local_port_config = SKIP, mac = SKIP, managed = false,
               map_id = SKIP, mist_configured = SKIP, mist_nac = SKIP,
               model = SKIP, modified_time = SKIP, name = SKIP,
               networks = SKIP, notes = SKIP, ntp_servers = SKIP,
               oob_ip_config = SKIP, org_id = SKIP, ospf_areas = SKIP,
               ospf_config = SKIP, other_ip_configs = SKIP,
               port_config = SKIP, port_config_overwrite = SKIP,
               port_mirroring = SKIP, port_usages = SKIP,
               radius_config = SKIP, remote_syslog = SKIP, role = SKIP,
               router_id = SKIP, routing_policies = SKIP, serial = SKIP,
               site_id = SKIP, snmp_config = SKIP, stp_config = SKIP,
               switch_mgmt = SKIP, use_router_id_as_source_ip = false,
               vars = SKIP, virtual_chassis = SKIP, vrf_config = SKIP,
               vrf_instances = SKIP, vrrp_config = SKIP, x = SKIP, y = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @acl_policies = acl_policies unless acl_policies == SKIP
  @acl_tags = acl_tags unless acl_tags == SKIP
  @additional_config_cmds = additional_config_cmds unless additional_config_cmds == SKIP
  @aggregate_routes = aggregate_routes unless aggregate_routes == SKIP
  @aggregate_routes6 = aggregate_routes6 unless aggregate_routes6 == SKIP
  @bgp_config = bgp_config unless bgp_config == SKIP
  @created_time = created_time unless created_time == SKIP
  @default_port_usage = default_port_usage unless default_port_usage == SKIP
  @deviceprofile_id = deviceprofile_id unless deviceprofile_id == SKIP
  @dhcp_snooping = dhcp_snooping unless dhcp_snooping == SKIP
  @dhcpd_config = dhcpd_config unless dhcpd_config == SKIP
  @disable_auto_config = disable_auto_config unless disable_auto_config == SKIP
  @dns_servers = dns_servers unless dns_servers == SKIP
  @dns_suffix = dns_suffix unless dns_suffix == SKIP
  @evpn_config = evpn_config unless evpn_config == SKIP
  @extra_routes = extra_routes unless extra_routes == SKIP
  @extra_routes6 = extra_routes6 unless extra_routes6 == SKIP
  @id = id unless id == SKIP
  @image1_url = image1_url unless image1_url == SKIP
  @image2_url = image2_url unless image2_url == SKIP
  @image3_url = image3_url unless image3_url == SKIP
  @iot_config = iot_config unless iot_config == SKIP
  @ip_config = ip_config unless ip_config == SKIP
  @local_port_config = local_port_config unless local_port_config == SKIP
  @mac = mac unless mac == SKIP
  @managed = managed unless managed == SKIP
  @map_id = map_id unless map_id == SKIP
  @mist_configured = mist_configured unless mist_configured == SKIP
  @mist_nac = mist_nac unless mist_nac == SKIP
  @model = model unless model == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name unless name == SKIP
  @networks = networks unless networks == SKIP
  @notes = notes unless notes == SKIP
  @ntp_servers = ntp_servers unless ntp_servers == SKIP
  @oob_ip_config = oob_ip_config unless oob_ip_config == SKIP
  @org_id = org_id unless org_id == SKIP
  @ospf_areas = ospf_areas unless ospf_areas == SKIP
  @ospf_config = ospf_config unless ospf_config == SKIP
  @other_ip_configs = other_ip_configs unless other_ip_configs == SKIP
  @port_config = port_config unless port_config == SKIP
  @port_config_overwrite = port_config_overwrite unless port_config_overwrite == SKIP
  @port_mirroring = port_mirroring unless port_mirroring == SKIP
  @port_usages = port_usages unless port_usages == SKIP
  @radius_config = radius_config unless radius_config == SKIP
  @remote_syslog = remote_syslog unless remote_syslog == SKIP
  @role = role unless role == SKIP
  @router_id = router_id unless router_id == SKIP
  @routing_policies = routing_policies unless routing_policies == SKIP
  @serial = serial unless serial == SKIP
  @site_id = site_id unless site_id == SKIP
  @snmp_config = snmp_config unless snmp_config == SKIP
  @stp_config = stp_config unless stp_config == SKIP
  @switch_mgmt = switch_mgmt unless switch_mgmt == SKIP
  @type = 'switch'
  unless use_router_id_as_source_ip == SKIP
    @use_router_id_as_source_ip =
      use_router_id_as_source_ip
  end
  @vars = vars unless vars == SKIP
  @virtual_chassis = virtual_chassis unless virtual_chassis == SKIP
  @vrf_config = vrf_config unless vrf_config == SKIP
  @vrf_instances = vrf_instances unless vrf_instances == SKIP
  @vrrp_config = vrrp_config unless vrrp_config == SKIP
  @x = x unless x == SKIP
  @y = y unless y == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#acl_policiesArray[AclPolicy]

TODO: Write general description for this method

Returns:



19
20
21
# File 'lib/mist_api/models/device_switch.rb', line 19

def acl_policies
  @acl_policies
end

#acl_tagsHash[String, AclTag]

ACL Tags to identify traffic source or destination. Key name is the tag name

Returns:

  • (Hash[String, AclTag])


24
25
26
# File 'lib/mist_api/models/device_switch.rb', line 24

def acl_tags
  @acl_tags
end

#additional_config_cmdsArray[String]

additional CLI commands to append to the generated Junos config. Note: no check is done

Returns:

  • (Array[String])


29
30
31
# File 'lib/mist_api/models/device_switch.rb', line 29

def additional_config_cmds
  @additional_config_cmds
end

#aggregate_routesHash[String, AggregateRoute]

Property key is the destination subnet (e.g. “172.16.3.0/24”)

Returns:



33
34
35
# File 'lib/mist_api/models/device_switch.rb', line 33

def aggregate_routes
  @aggregate_routes
end

#aggregate_routes6Hash[String, AggregateRoute]

Property key is the destination subnet (e.g. “2a02:1234:420a:10c9::/64”)

Returns:



37
38
39
# File 'lib/mist_api/models/device_switch.rb', line 37

def aggregate_routes6
  @aggregate_routes6
end

#bgp_configHash[String, SwitchBgpConfig]

Property key is the destination subnet (e.g. “2a02:1234:420a:10c9::/64”)

Returns:



41
42
43
# File 'lib/mist_api/models/device_switch.rb', line 41

def bgp_config
  @bgp_config
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


45
46
47
# File 'lib/mist_api/models/device_switch.rb', line 45

def created_time
  @created_time
end

#default_port_usageString

Port usage to assign to switch ports without any port usage assigned. Default: ‘default` to preserve default behavior

Returns:

  • (String)


50
51
52
# File 'lib/mist_api/models/device_switch.rb', line 50

def default_port_usage
  @default_port_usage
end

#deviceprofile_idUUID | String

Port usage to assign to switch ports without any port usage assigned. Default: ‘default` to preserve default behavior

Returns:

  • (UUID | String)


55
56
57
# File 'lib/mist_api/models/device_switch.rb', line 55

def deviceprofile_id
  @deviceprofile_id
end

#dhcp_snoopingDhcpSnooping

Port usage to assign to switch ports without any port usage assigned. Default: ‘default` to preserve default behavior

Returns:



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

def dhcp_snooping
  @dhcp_snooping
end

#dhcpd_configSwitchDhcpdConfig

Port usage to assign to switch ports without any port usage assigned. Default: ‘default` to preserve default behavior

Returns:



65
66
67
# File 'lib/mist_api/models/device_switch.rb', line 65

def dhcpd_config
  @dhcpd_config
end

#disable_auto_configTrueClass | FalseClass

This disables the default behavior of a cloud-ready switch/gateway being managed/configured by Mist. Setting this to ‘true` means you want to disable the default behavior and do not want the device to be Mist-managed.

Returns:

  • (TrueClass | FalseClass)


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

def disable_auto_config
  @disable_auto_config
end

#dns_serversArray[String]

Global dns settings. To keep compatibility, dns settings in ‘ip_config` and `oob_ip_config` will overwrite this setting

Returns:

  • (Array[String])


77
78
79
# File 'lib/mist_api/models/device_switch.rb', line 77

def dns_servers
  @dns_servers
end

#dns_suffixArray[String]

Global dns settings. To keep compatibility, dns settings in ‘ip_config` and `oob_ip_config` will overwrite this setting

Returns:

  • (Array[String])


82
83
84
# File 'lib/mist_api/models/device_switch.rb', line 82

def dns_suffix
  @dns_suffix
end

#evpn_configEvpnConfig

EVPN Junos settings

Returns:



86
87
88
# File 'lib/mist_api/models/device_switch.rb', line 86

def evpn_config
  @evpn_config
end

#extra_routesHash[String, ExtraRoute]

Property key is the destination CIDR (e.g. “10.0.0.0/8”)

Returns:



90
91
92
# File 'lib/mist_api/models/device_switch.rb', line 90

def extra_routes
  @extra_routes
end

#extra_routes6Hash[String, ExtraRoute6]

Property key is the destination CIDR (e.g. “2a02:1234:420a:10c9::/64”)

Returns:



94
95
96
# File 'lib/mist_api/models/device_switch.rb', line 94

def extra_routes6
  @extra_routes6
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


98
99
100
# File 'lib/mist_api/models/device_switch.rb', line 98

def id
  @id
end

#image1_urlString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


102
103
104
# File 'lib/mist_api/models/device_switch.rb', line 102

def image1_url
  @image1_url
end

#image2_urlString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


106
107
108
# File 'lib/mist_api/models/device_switch.rb', line 106

def image2_url
  @image2_url
end

#image3_urlString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


110
111
112
# File 'lib/mist_api/models/device_switch.rb', line 110

def image3_url
  @image3_url
end

#iot_configHash[String, SwitchIotPort]

Property Key is the IOT port name, e.g.:

* `IN0` or `IN1` for the FPC0 input port with 5V triggered inputs
* `OUT1` for the FPC0 output port (can only be triggered by either IN0

or IN1)

* "X/IN0`, `X/IN1` and `X/OUT` are used to define IOT ports on VC

members

Returns:



119
120
121
# File 'lib/mist_api/models/device_switch.rb', line 119

def iot_config
  @iot_config
end

#ip_configJunosIpConfig

Junos IP Config

Returns:



123
124
125
# File 'lib/mist_api/models/device_switch.rb', line 123

def ip_config
  @ip_config
end

#local_port_configHash[String, JunosLocalPortConfig]

Local port override, overriding the port configuration from ‘port_config`. Property key is the port name or range (e.g. “ge-0/0/0-10”)

Returns:



128
129
130
# File 'lib/mist_api/models/device_switch.rb', line 128

def local_port_config
  @local_port_config
end

#macString

Device MAC address

Returns:

  • (String)


132
133
134
# File 'lib/mist_api/models/device_switch.rb', line 132

def mac
  @mac
end

#managedTrueClass | FalseClass

An adopted switch/gateway will not be managed/configured by Mist by default. Setting this parameter to ‘true` enables the adopted switch/gateway to be managed/configured by Mist. Deprecated in favour of mist_configured, which is more intuitive and can be used for both adopted and claimed devices.

Returns:

  • (TrueClass | FalseClass)


140
141
142
# File 'lib/mist_api/models/device_switch.rb', line 140

def managed
  @managed
end

#map_idUUID | String

Map where the device belongs to

Returns:

  • (UUID | String)


144
145
146
# File 'lib/mist_api/models/device_switch.rb', line 144

def map_id
  @map_id
end

#mist_configuredTrueClass | FalseClass

whether the device can be configured by Mist or not. This deprecates ‘managed` (for adopted device) and `disable_auto_config` for claimed device)

Returns:

  • (TrueClass | FalseClass)


150
151
152
# File 'lib/mist_api/models/device_switch.rb', line 150

def mist_configured
  @mist_configured
end

#mist_nacSwitchMistNac

Enable mist_nac to use RadSec

Returns:



154
155
156
# File 'lib/mist_api/models/device_switch.rb', line 154

def mist_nac
  @mist_nac
end

#modelString

Device Model

Returns:

  • (String)


158
159
160
# File 'lib/mist_api/models/device_switch.rb', line 158

def model
  @model
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


162
163
164
# File 'lib/mist_api/models/device_switch.rb', line 162

def modified_time
  @modified_time
end

#nameString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


166
167
168
# File 'lib/mist_api/models/device_switch.rb', line 166

def name
  @name
end

#networksHash[String, SwitchNetwork]

Property key is network name

Returns:



170
171
172
# File 'lib/mist_api/models/device_switch.rb', line 170

def networks
  @networks
end

#notesString

Property key is network name

Returns:

  • (String)


174
175
176
# File 'lib/mist_api/models/device_switch.rb', line 174

def notes
  @notes
end

#ntp_serversArray[String]

List of NTP servers specific to this device. By default, those in Site Settings will be used

Returns:

  • (Array[String])


179
180
181
# File 'lib/mist_api/models/device_switch.rb', line 179

def ntp_servers
  @ntp_servers
end

#oob_ip_configSwitchOobIpConfig

Switch OOB IP Config:

- If HA configuration: key parameter will be nodeX (eg: node1)
- If there are 2 routing engines, re1 mgmt IP has to be set separately

(if desired): key parameter = ‘re1`

Returns:



186
187
188
# File 'lib/mist_api/models/device_switch.rb', line 186

def oob_ip_config
  @oob_ip_config
end

#org_idUUID | String

Switch OOB IP Config:

- If HA configuration: key parameter will be nodeX (eg: node1)
- If there are 2 routing engines, re1 mgmt IP has to be set separately

(if desired): key parameter = ‘re1`

Returns:

  • (UUID | String)


193
194
195
# File 'lib/mist_api/models/device_switch.rb', line 193

def org_id
  @org_id
end

#ospf_areasHash[String, OspfArea]

Junos OSPF areas. Property key is the OSPF Area (Area should be a number (0-255) / IP address)

Returns:



198
199
200
# File 'lib/mist_api/models/device_switch.rb', line 198

def ospf_areas
  @ospf_areas
end

#ospf_configSwitchOspfConfig

Junos OSPF areas. Property key is the OSPF Area (Area should be a number (0-255) / IP address)

Returns:



203
204
205
# File 'lib/mist_api/models/device_switch.rb', line 203

def ospf_config
  @ospf_config
end

#other_ip_configsHash[String, JunosOtherIpConfig]

Property key is the network name. Defines the additional IP Addresses configured on the device.

Returns:



208
209
210
# File 'lib/mist_api/models/device_switch.rb', line 208

def other_ip_configs
  @other_ip_configs
end

#port_configHash[String, JunosPortConfig]

Property key is the port name or range (e.g. “ge-0/0/0-10”)

Returns:



212
213
214
# File 'lib/mist_api/models/device_switch.rb', line 212

def port_config
  @port_config
end

#port_config_overwriteHash[String, SwitchPortConfigOverwrite]

Property key is the port name or range (e.g. “ge-0/0/0-10”). This can be used to override some attributes of the port_usage without having to create a new port_usage.

Returns:



218
219
220
# File 'lib/mist_api/models/device_switch.rb', line 218

def port_config_overwrite
  @port_config_overwrite
end

#port_mirroringHash[String, SwitchPortMirroringProperty]

Property key is the port mirroring instance name. ‘port_mirroring` can be added under device/site settings. It takes interface and ports as input for ingress, interface as input for egress and can take interface and port as output. A maximum 4 mirroring ports is allowed

Returns:



225
226
227
# File 'lib/mist_api/models/device_switch.rb', line 225

def port_mirroring
  @port_mirroring
end

#port_usagesHash[String, SwitchPortUsage]

Property key is the port usage name. Defines the profiles of port configuration configured on the switch

Returns:



230
231
232
# File 'lib/mist_api/models/device_switch.rb', line 230

def port_usages
  @port_usages
end

#radius_configSwitchRadiusConfig

Junos Radius config

Returns:



234
235
236
# File 'lib/mist_api/models/device_switch.rb', line 234

def radius_config
  @radius_config
end

#remote_syslogRemoteSyslog

Junos Radius config

Returns:



238
239
240
# File 'lib/mist_api/models/device_switch.rb', line 238

def remote_syslog
  @remote_syslog
end

#roleString

Junos Radius config

Returns:

  • (String)


242
243
244
# File 'lib/mist_api/models/device_switch.rb', line 242

def role
  @role
end

#router_idString

Used for OSPF / BGP / EVPN

Returns:

  • (String)


246
247
248
# File 'lib/mist_api/models/device_switch.rb', line 246

def router_id
  @router_id
end

#routing_policiesHash[String, SwRoutingPolicy]

Property key is the routing policy name

Returns:



250
251
252
# File 'lib/mist_api/models/device_switch.rb', line 250

def routing_policies
  @routing_policies
end

#serialString

Device Serial

Returns:

  • (String)


254
255
256
# File 'lib/mist_api/models/device_switch.rb', line 254

def serial
  @serial
end

#site_idUUID | String

Device Serial

Returns:

  • (UUID | String)


258
259
260
# File 'lib/mist_api/models/device_switch.rb', line 258

def site_id
  @site_id
end

#snmp_configSnmpConfig

Device Serial

Returns:



262
263
264
# File 'lib/mist_api/models/device_switch.rb', line 262

def snmp_config
  @snmp_config
end

#stp_configSwitchStpConfig

Device Serial

Returns:



266
267
268
# File 'lib/mist_api/models/device_switch.rb', line 266

def stp_config
  @stp_config
end

#switch_mgmtSwitchMgmt

Switch Management settings

Returns:



270
271
272
# File 'lib/mist_api/models/device_switch.rb', line 270

def switch_mgmt
  @switch_mgmt
end

#typeString (readonly)

Device Type. enum: ‘switch`

Returns:

  • (String)


274
275
276
# File 'lib/mist_api/models/device_switch.rb', line 274

def type
  @type
end

#use_router_id_as_source_ipTrueClass | FalseClass

Whether to use it for snmp / syslog / tacplus / radius

Returns:

  • (TrueClass | FalseClass)


278
279
280
# File 'lib/mist_api/models/device_switch.rb', line 278

def use_router_id_as_source_ip
  @use_router_id_as_source_ip
end

#varsHash[String, String]

Dictionary of name->value, the vars can then be used in Wlans. This can overwrite those from Site Vars

Returns:

  • (Hash[String, String])


283
284
285
# File 'lib/mist_api/models/device_switch.rb', line 283

def vars
  @vars
end

#virtual_chassisSwitchVirtualChassis

Required for preprovisioned Virtual Chassis



287
288
289
# File 'lib/mist_api/models/device_switch.rb', line 287

def virtual_chassis
  @virtual_chassis
end

#vrf_configVrfConfig

Required for preprovisioned Virtual Chassis

Returns:



291
292
293
# File 'lib/mist_api/models/device_switch.rb', line 291

def vrf_config
  @vrf_config
end

#vrf_instancesHash[String, SwitchVrfInstance]

Property key is the network name

Returns:



295
296
297
# File 'lib/mist_api/models/device_switch.rb', line 295

def vrf_instances
  @vrf_instances
end

#vrrp_configVrrpConfig

Junos VRRP config

Returns:



299
300
301
# File 'lib/mist_api/models/device_switch.rb', line 299

def vrrp_config
  @vrrp_config
end

#xFloat

X in pixel

Returns:

  • (Float)


303
304
305
# File 'lib/mist_api/models/device_switch.rb', line 303

def x
  @x
end

#yFloat

Y in pixel

Returns:

  • (Float)


307
308
309
# File 'lib/mist_api/models/device_switch.rb', line 307

def y
  @y
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/mist_api/models/device_switch.rb', line 553

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  acl_policies = nil
  unless hash['acl_policies'].nil?
    acl_policies = []
    hash['acl_policies'].each do |structure|
      acl_policies << (AclPolicy.from_hash(structure) if structure)
    end
  end

  acl_policies = SKIP unless hash.key?('acl_policies')
  acl_tags = AclTag.from_hash(hash['acl_tags']) if hash['acl_tags']

  acl_tags = SKIP unless hash.key?('acl_tags')
  additional_config_cmds =
    hash.key?('additional_config_cmds') ? hash['additional_config_cmds'] : SKIP
  aggregate_routes = AggregateRoute.from_hash(hash['aggregate_routes']) if
    hash['aggregate_routes']

  aggregate_routes = SKIP unless hash.key?('aggregate_routes')
  aggregate_routes6 = AggregateRoute.from_hash(hash['aggregate_routes6']) if
    hash['aggregate_routes6']

  aggregate_routes6 = SKIP unless hash.key?('aggregate_routes6')
  bgp_config = SwitchBgpConfig.from_hash(hash['bgp_config']) if hash['bgp_config']

  bgp_config = SKIP unless hash.key?('bgp_config')
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  default_port_usage = hash['default_port_usage'] ||= 'default'
  deviceprofile_id =
    hash.key?('deviceprofile_id') ? hash['deviceprofile_id'] : SKIP
  dhcp_snooping = DhcpSnooping.from_hash(hash['dhcp_snooping']) if hash['dhcp_snooping']
  dhcpd_config = SwitchDhcpdConfig.from_hash(hash['dhcpd_config']) if hash['dhcpd_config']
  disable_auto_config = hash['disable_auto_config'] ||= false
  dns_servers = hash.key?('dns_servers') ? hash['dns_servers'] : SKIP
  dns_suffix = hash.key?('dns_suffix') ? hash['dns_suffix'] : SKIP
  evpn_config = EvpnConfig.from_hash(hash['evpn_config']) if hash['evpn_config']
  extra_routes = ExtraRoute.from_hash(hash['extra_routes']) if hash['extra_routes']

  extra_routes = SKIP unless hash.key?('extra_routes')
  extra_routes6 = ExtraRoute6.from_hash(hash['extra_routes6']) if hash['extra_routes6']

  extra_routes6 = SKIP unless hash.key?('extra_routes6')
  id = hash.key?('id') ? hash['id'] : SKIP
  image1_url = hash.key?('image1_url') ? hash['image1_url'] : SKIP
  image2_url = hash.key?('image2_url') ? hash['image2_url'] : SKIP
  image3_url = hash.key?('image3_url') ? hash['image3_url'] : SKIP
  iot_config = SwitchIotPort.from_hash(hash['iot_config']) if hash['iot_config']

  iot_config = SKIP unless hash.key?('iot_config')
  ip_config = JunosIpConfig.from_hash(hash['ip_config']) if hash['ip_config']
  local_port_config = JunosLocalPortConfig.from_hash(hash['local_port_config']) if
    hash['local_port_config']

  local_port_config = SKIP unless hash.key?('local_port_config')
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  managed = hash['managed'] ||= false
  map_id = hash.key?('map_id') ? hash['map_id'] : SKIP
  mist_configured =
    hash.key?('mist_configured') ? hash['mist_configured'] : SKIP
  mist_nac = SwitchMistNac.from_hash(hash['mist_nac']) if hash['mist_nac']
  model = hash.key?('model') ? hash['model'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  networks = SwitchNetwork.from_hash(hash['networks']) if hash['networks']

  networks = SKIP unless hash.key?('networks')
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  ntp_servers = hash.key?('ntp_servers') ? hash['ntp_servers'] : SKIP
  oob_ip_config = SwitchOobIpConfig.from_hash(hash['oob_ip_config']) if hash['oob_ip_config']
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  ospf_areas = OspfArea.from_hash(hash['ospf_areas']) if hash['ospf_areas']

  ospf_areas = SKIP unless hash.key?('ospf_areas')
  ospf_config = SwitchOspfConfig.from_hash(hash['ospf_config']) if hash['ospf_config']
  other_ip_configs = JunosOtherIpConfig.from_hash(hash['other_ip_configs']) if
    hash['other_ip_configs']

  other_ip_configs = SKIP unless hash.key?('other_ip_configs')
  port_config = JunosPortConfig.from_hash(hash['port_config']) if hash['port_config']

  port_config = SKIP unless hash.key?('port_config')
  port_config_overwrite = SwitchPortConfigOverwrite.from_hash(hash['port_config_overwrite']) if
    hash['port_config_overwrite']

  port_config_overwrite = SKIP unless hash.key?('port_config_overwrite')
  port_mirroring = SwitchPortMirroringProperty.from_hash(hash['port_mirroring']) if
    hash['port_mirroring']

  port_mirroring = SKIP unless hash.key?('port_mirroring')
  port_usages = SwitchPortUsage.from_hash(hash['port_usages']) if hash['port_usages']

  port_usages = SKIP unless hash.key?('port_usages')
  radius_config = SwitchRadiusConfig.from_hash(hash['radius_config']) if hash['radius_config']
  remote_syslog = RemoteSyslog.from_hash(hash['remote_syslog']) if hash['remote_syslog']
  role = hash.key?('role') ? hash['role'] : SKIP
  router_id = hash.key?('router_id') ? hash['router_id'] : SKIP
  routing_policies = SwRoutingPolicy.from_hash(hash['routing_policies']) if
    hash['routing_policies']

  routing_policies = SKIP unless hash.key?('routing_policies')
  serial = hash.key?('serial') ? hash['serial'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  snmp_config = SnmpConfig.from_hash(hash['snmp_config']) if hash['snmp_config']
  stp_config = SwitchStpConfig.from_hash(hash['stp_config']) if hash['stp_config']
  switch_mgmt = SwitchMgmt.from_hash(hash['switch_mgmt']) if hash['switch_mgmt']
  use_router_id_as_source_ip = hash['use_router_id_as_source_ip'] ||= false
  vars = hash.key?('vars') ? hash['vars'] : SKIP
  virtual_chassis = SwitchVirtualChassis.from_hash(hash['virtual_chassis']) if
    hash['virtual_chassis']
  vrf_config = VrfConfig.from_hash(hash['vrf_config']) if hash['vrf_config']
  vrf_instances = SwitchVrfInstance.from_hash(hash['vrf_instances']) if hash['vrf_instances']

  vrf_instances = SKIP unless hash.key?('vrf_instances')
  vrrp_config = VrrpConfig.from_hash(hash['vrrp_config']) if hash['vrrp_config']
  x = hash.key?('x') ? hash['x'] : SKIP
  y = hash.key?('y') ? hash['y'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DeviceSwitch.new(acl_policies,
                   acl_tags,
                   additional_config_cmds,
                   aggregate_routes,
                   aggregate_routes6,
                   bgp_config,
                   created_time,
                   default_port_usage,
                   deviceprofile_id,
                   dhcp_snooping,
                   dhcpd_config,
                   disable_auto_config,
                   dns_servers,
                   dns_suffix,
                   evpn_config,
                   extra_routes,
                   extra_routes6,
                   id,
                   image1_url,
                   image2_url,
                   image3_url,
                   iot_config,
                   ip_config,
                   local_port_config,
                   mac,
                   managed,
                   map_id,
                   mist_configured,
                   mist_nac,
                   model,
                   modified_time,
                   name,
                   networks,
                   notes,
                   ntp_servers,
                   oob_ip_config,
                   org_id,
                   ospf_areas,
                   ospf_config,
                   other_ip_configs,
                   port_config,
                   port_config_overwrite,
                   port_mirroring,
                   port_usages,
                   radius_config,
                   remote_syslog,
                   role,
                   router_id,
                   routing_policies,
                   serial,
                   site_id,
                   snmp_config,
                   stp_config,
                   switch_mgmt,
                   use_router_id_as_source_ip,
                   vars,
                   virtual_chassis,
                   vrf_config,
                   vrf_instances,
                   vrrp_config,
                   x,
                   y,
                   additional_properties)
end

.namesObject

A mapping from model property names to API property names.



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/mist_api/models/device_switch.rb', line 310

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['acl_policies'] = 'acl_policies'
  @_hash['acl_tags'] = 'acl_tags'
  @_hash['additional_config_cmds'] = 'additional_config_cmds'
  @_hash['aggregate_routes'] = 'aggregate_routes'
  @_hash['aggregate_routes6'] = 'aggregate_routes6'
  @_hash['bgp_config'] = 'bgp_config'
  @_hash['created_time'] = 'created_time'
  @_hash['default_port_usage'] = 'default_port_usage'
  @_hash['deviceprofile_id'] = 'deviceprofile_id'
  @_hash['dhcp_snooping'] = 'dhcp_snooping'
  @_hash['dhcpd_config'] = 'dhcpd_config'
  @_hash['disable_auto_config'] = 'disable_auto_config'
  @_hash['dns_servers'] = 'dns_servers'
  @_hash['dns_suffix'] = 'dns_suffix'
  @_hash['evpn_config'] = 'evpn_config'
  @_hash['extra_routes'] = 'extra_routes'
  @_hash['extra_routes6'] = 'extra_routes6'
  @_hash['id'] = 'id'
  @_hash['image1_url'] = 'image1_url'
  @_hash['image2_url'] = 'image2_url'
  @_hash['image3_url'] = 'image3_url'
  @_hash['iot_config'] = 'iot_config'
  @_hash['ip_config'] = 'ip_config'
  @_hash['local_port_config'] = 'local_port_config'
  @_hash['mac'] = 'mac'
  @_hash['managed'] = 'managed'
  @_hash['map_id'] = 'map_id'
  @_hash['mist_configured'] = 'mist_configured'
  @_hash['mist_nac'] = 'mist_nac'
  @_hash['model'] = 'model'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['networks'] = 'networks'
  @_hash['notes'] = 'notes'
  @_hash['ntp_servers'] = 'ntp_servers'
  @_hash['oob_ip_config'] = 'oob_ip_config'
  @_hash['org_id'] = 'org_id'
  @_hash['ospf_areas'] = 'ospf_areas'
  @_hash['ospf_config'] = 'ospf_config'
  @_hash['other_ip_configs'] = 'other_ip_configs'
  @_hash['port_config'] = 'port_config'
  @_hash['port_config_overwrite'] = 'port_config_overwrite'
  @_hash['port_mirroring'] = 'port_mirroring'
  @_hash['port_usages'] = 'port_usages'
  @_hash['radius_config'] = 'radius_config'
  @_hash['remote_syslog'] = 'remote_syslog'
  @_hash['role'] = 'role'
  @_hash['router_id'] = 'router_id'
  @_hash['routing_policies'] = 'routing_policies'
  @_hash['serial'] = 'serial'
  @_hash['site_id'] = 'site_id'
  @_hash['snmp_config'] = 'snmp_config'
  @_hash['stp_config'] = 'stp_config'
  @_hash['switch_mgmt'] = 'switch_mgmt'
  @_hash['type'] = 'type'
  @_hash['use_router_id_as_source_ip'] = 'use_router_id_as_source_ip'
  @_hash['vars'] = 'vars'
  @_hash['virtual_chassis'] = 'virtual_chassis'
  @_hash['vrf_config'] = 'vrf_config'
  @_hash['vrf_instances'] = 'vrf_instances'
  @_hash['vrrp_config'] = 'vrrp_config'
  @_hash['x'] = 'x'
  @_hash['y'] = 'y'
  @_hash
end

.nullablesObject

An array for nullable fields



447
448
449
450
451
452
453
# File 'lib/mist_api/models/device_switch.rb', line 447

def self.nullables
  %w[
    image1_url
    image2_url
    image3_url
  ]
end

.optionalsObject

An array for optional fields



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/mist_api/models/device_switch.rb', line 379

def self.optionals
  %w[
    acl_policies
    acl_tags
    additional_config_cmds
    aggregate_routes
    aggregate_routes6
    bgp_config
    created_time
    default_port_usage
    deviceprofile_id
    dhcp_snooping
    dhcpd_config
    disable_auto_config
    dns_servers
    dns_suffix
    evpn_config
    extra_routes
    extra_routes6
    id
    image1_url
    image2_url
    image3_url
    iot_config
    ip_config
    local_port_config
    mac
    managed
    map_id
    mist_configured
    mist_nac
    model
    modified_time
    name
    networks
    notes
    ntp_servers
    oob_ip_config
    org_id
    ospf_areas
    ospf_config
    other_ip_configs
    port_config
    port_config_overwrite
    port_mirroring
    port_usages
    radius_config
    remote_syslog
    role
    router_id
    routing_policies
    serial
    site_id
    snmp_config
    stp_config
    switch_mgmt
    use_router_id_as_source_ip
    vars
    virtual_chassis
    vrf_config
    vrf_instances
    vrrp_config
    x
    y
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/mist_api/models/device_switch.rb', line 777

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} acl_policies: #{@acl_policies.inspect}, acl_tags: #{@acl_tags.inspect},"\
  " additional_config_cmds: #{@additional_config_cmds.inspect}, aggregate_routes:"\
  " #{@aggregate_routes.inspect}, aggregate_routes6: #{@aggregate_routes6.inspect},"\
  " bgp_config: #{@bgp_config.inspect}, created_time: #{@created_time.inspect},"\
  " default_port_usage: #{@default_port_usage.inspect}, deviceprofile_id:"\
  " #{@deviceprofile_id.inspect}, dhcp_snooping: #{@dhcp_snooping.inspect}, dhcpd_config:"\
  " #{@dhcpd_config.inspect}, disable_auto_config: #{@disable_auto_config.inspect},"\
  " dns_servers: #{@dns_servers.inspect}, dns_suffix: #{@dns_suffix.inspect}, evpn_config:"\
  " #{@evpn_config.inspect}, extra_routes: #{@extra_routes.inspect}, extra_routes6:"\
  " #{@extra_routes6.inspect}, id: #{@id.inspect}, image1_url: #{@image1_url.inspect},"\
  " image2_url: #{@image2_url.inspect}, image3_url: #{@image3_url.inspect}, iot_config:"\
  " #{@iot_config.inspect}, ip_config: #{@ip_config.inspect}, local_port_config:"\
  " #{@local_port_config.inspect}, mac: #{@mac.inspect}, managed: #{@managed.inspect}, map_id:"\
  " #{@map_id.inspect}, mist_configured: #{@mist_configured.inspect}, mist_nac:"\
  " #{@mist_nac.inspect}, model: #{@model.inspect}, modified_time: #{@modified_time.inspect},"\
  " name: #{@name.inspect}, networks: #{@networks.inspect}, notes: #{@notes.inspect},"\
  " ntp_servers: #{@ntp_servers.inspect}, oob_ip_config: #{@oob_ip_config.inspect}, org_id:"\
  " #{@org_id.inspect}, ospf_areas: #{@ospf_areas.inspect}, ospf_config:"\
  " #{@ospf_config.inspect}, other_ip_configs: #{@other_ip_configs.inspect}, port_config:"\
  " #{@port_config.inspect}, port_config_overwrite: #{@port_config_overwrite.inspect},"\
  " port_mirroring: #{@port_mirroring.inspect}, port_usages: #{@port_usages.inspect},"\
  " radius_config: #{@radius_config.inspect}, remote_syslog: #{@remote_syslog.inspect}, role:"\
  " #{@role.inspect}, router_id: #{@router_id.inspect}, routing_policies:"\
  " #{@routing_policies.inspect}, serial: #{@serial.inspect}, site_id: #{@site_id.inspect},"\
  " snmp_config: #{@snmp_config.inspect}, stp_config: #{@stp_config.inspect}, switch_mgmt:"\
  " #{@switch_mgmt.inspect}, type: #{@type.inspect}, use_router_id_as_source_ip:"\
  " #{@use_router_id_as_source_ip.inspect}, vars: #{@vars.inspect}, virtual_chassis:"\
  " #{@virtual_chassis.inspect}, vrf_config: #{@vrf_config.inspect}, vrf_instances:"\
  " #{@vrf_instances.inspect}, vrrp_config: #{@vrrp_config.inspect}, x: #{@x.inspect}, y:"\
  " #{@y.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
# File 'lib/mist_api/models/device_switch.rb', line 748

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} acl_policies: #{@acl_policies}, acl_tags: #{@acl_tags},"\
  " additional_config_cmds: #{@additional_config_cmds}, aggregate_routes:"\
  " #{@aggregate_routes}, aggregate_routes6: #{@aggregate_routes6}, bgp_config:"\
  " #{@bgp_config}, created_time: #{@created_time}, default_port_usage:"\
  " #{@default_port_usage}, deviceprofile_id: #{@deviceprofile_id}, dhcp_snooping:"\
  " #{@dhcp_snooping}, dhcpd_config: #{@dhcpd_config}, disable_auto_config:"\
  " #{@disable_auto_config}, dns_servers: #{@dns_servers}, dns_suffix: #{@dns_suffix},"\
  " evpn_config: #{@evpn_config}, extra_routes: #{@extra_routes}, extra_routes6:"\
  " #{@extra_routes6}, id: #{@id}, image1_url: #{@image1_url}, image2_url: #{@image2_url},"\
  " image3_url: #{@image3_url}, iot_config: #{@iot_config}, ip_config: #{@ip_config},"\
  " local_port_config: #{@local_port_config}, mac: #{@mac}, managed: #{@managed}, map_id:"\
  " #{@map_id}, mist_configured: #{@mist_configured}, mist_nac: #{@mist_nac}, model:"\
  " #{@model}, modified_time: #{@modified_time}, name: #{@name}, networks: #{@networks},"\
  " notes: #{@notes}, ntp_servers: #{@ntp_servers}, oob_ip_config: #{@oob_ip_config}, org_id:"\
  " #{@org_id}, ospf_areas: #{@ospf_areas}, ospf_config: #{@ospf_config}, other_ip_configs:"\
  " #{@other_ip_configs}, port_config: #{@port_config}, port_config_overwrite:"\
  " #{@port_config_overwrite}, port_mirroring: #{@port_mirroring}, port_usages:"\
  " #{@port_usages}, radius_config: #{@radius_config}, remote_syslog: #{@remote_syslog}, role:"\
  " #{@role}, router_id: #{@router_id}, routing_policies: #{@routing_policies}, serial:"\
  " #{@serial}, site_id: #{@site_id}, snmp_config: #{@snmp_config}, stp_config:"\
  " #{@stp_config}, switch_mgmt: #{@switch_mgmt}, type: #{@type}, use_router_id_as_source_ip:"\
  " #{@use_router_id_as_source_ip}, vars: #{@vars}, virtual_chassis: #{@virtual_chassis},"\
  " vrf_config: #{@vrf_config}, vrf_instances: #{@vrf_instances}, vrrp_config:"\
  " #{@vrrp_config}, x: #{@x}, y: #{@y}, additional_properties: #{@additional_properties}>"
end