B `2I@sGdddeZdS)csNeZdZfddZedddZedddZeddd Zedd d Zedd d Z ee dddZ edddZ edddZ edddZedddZedddZeedddZedddZee d d!d"Zeed#d$d%Zeed#d&d'Zeed#d(d)Zedd*d+Zedd,d-Zedd.d/Zedd0d1ZZS)2SwitchSettingscstt|||_dS)N)superr__init___session)selfsession) __class__x/private/var/folders/7j/8686xlfs15q3tgljmghtvg0r0000gn/T/pip-target-isidps9b/lib/python/meraki_v0/api/switch_settings.pyrszSwitchSettings.__init__) networkIdcCs&dgdd}d|d}|j||S)z **Returns the switch network settings** https://developer.cisco.com/meraki/api/#!get-network-switch-settings - networkId (string) zSwitch settingsgetNetworkSwitchSettings)tags operationz /networks/z/switch/settings)rget)rr metadataresourcerrr r s  z'SwitchSettings.getNetworkSwitchSettingsc sT|tdgdd}d|d}dddgfd d |D}|j|||S) a **Update switch network settings** https://developer.cisco.com/meraki/api/#!update-network-switch-settings - networkId (string) - vlan (integer): Management VLAN - useCombinedPower (boolean): The use Combined Power as the default behavior of secondary power supplies on supported devices. - powerExceptions (array): Exceptions on a per switch basis to "useCombinedPower" zSwitch settingsupdateNetworkSwitchSettings)r r z /networks/z/switch/settingsvlanZuseCombinedPowerZpowerExceptionscs&i|]\}}|kr||qSr)strip).0kv) body_paramsrr *sz>SwitchSettings.updateNetworkSwitchSettings..)updatelocalsitemsrput)rr kwargsrrpayloadr)rr rs   z*SwitchSettings.updateNetworkSwitchSettingscCs&dgdd}d|d}|j||S)z **Return the DHCP server policy** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-dhcp-server-policy - networkId (string) zSwitch settings(getNetworkSwitchSettingsDhcpServerPolicy)r r z /networks/z!/switch/settings/dhcpServerPolicy)rr)rr rrrrr r.s  z7SwitchSettings.getNetworkSwitchSettingsDhcpServerPolicyc s|td|kr@ddg}|d|ks@td|dd|dgdd}d |d }dd d gfd d|D}|j|||S)a **Update the DHCP server policy** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-dhcp-server-policy - networkId (string) - defaultPolicy (string): 'allow' or 'block' new DHCP servers. Default value is 'allow'. - allowedServers (array): List the MAC addresses of DHCP servers to permit on the network. Applicable only if defaultPolicy is set to block. An empty array will clear the entries. - blockedServers (array): List the MAC addresses of DHCP servers to block on the network. Applicable only if defaultPolicy is set to allow. An empty array will clear the entries. Z defaultPolicyZallowblockz"defaultPolicy" cannot be "z", & must be set to one of: zSwitch settings+updateNetworkSwitchSettingsDhcpServerPolicy)r r z /networks/z!/switch/settings/dhcpServerPolicyZallowedServersZblockedServerscs&i|]\}}|kr||qSr)r)rrr)rrr rVszNSwitchSettings.updateNetworkSwitchSettingsDhcpServerPolicy..)rrAssertionErrorrrr)rr roptionsrrrr)rr r!>s $  z:SwitchSettings.updateNetworkSwitchSettingsDhcpServerPolicycCs&dgdd}d|d}|j||S)z **Return the DSCP to CoS mappings** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-dscp-to-cos-mappings - networkId (string) zSwitch settings)getNetworkSwitchSettingsDscpToCosMappings)r r z /networks/z"/switch/settings/dscpToCosMappings)rr)rr rrrrr r$Zs  z8SwitchSettings.getNetworkSwitchSettingsDscpToCosMappings)r mappingscsJt}dgdd}d|d}dgfdd|D}|j|||S) a1 **Update the DSCP to CoS mappings** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-dscp-to-cos-mappings - networkId (string) - mappings (array): An array of DSCP to CoS mappings. An empty array will reset the mappings to default. zSwitch settings,updateNetworkSwitchSettingsDscpToCosMappings)r r z /networks/z"/switch/settings/dscpToCosMappingsr%cs&i|]\}}|kr||qSr)r)rrr)rrr r|szOSwitchSettings.updateNetworkSwitchSettingsDscpToCosMappings..)rrrr)rr r%rrrrr)rr r&js  z;SwitchSettings.updateNetworkSwitchSettingsDscpToCosMappingscCs&dgdd}d|d}|j||S)z **Return the MTU configuration** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-mtu - networkId (string) zSwitch settingsgetNetworkSwitchSettingsMtu)r r z /networks/z/switch/settings/mtu)rr)rr rrrrr r's  z*SwitchSettings.getNetworkSwitchSettingsMtuc sR|tdgdd}d|d}ddgfdd |D}|j|||S) a **Update the MTU configuration** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-mtu - networkId (string) - defaultMtuSize (integer): MTU size for the entire network. Default value is 9578. - overrides (array): Override MTU size for individual switches or switch profiles. An empty array will clear overrides. zSwitch settingsupdateNetworkSwitchSettingsMtu)r r z /networks/z/switch/settings/mtuZdefaultMtuSize overridescs&i|]\}}|kr||qSr)r)rrr)rrr rszASwitchSettings.updateNetworkSwitchSettingsMtu..)rrrrr)rr rrrrr)rr r(s  z-SwitchSettings.updateNetworkSwitchSettingsMtucCs&dgdd}d|d}|j||S)z **Return multicast settings for a network** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-multicast - networkId (string) zSwitch settings!getNetworkSwitchSettingsMulticast)r r z /networks/z/switch/settings/multicast)rr)rr rrrrr r*s  z0SwitchSettings.getNetworkSwitchSettingsMulticastc sR|tdgdd}d|d}ddgfdd |D}|j|||S) a **Update multicast settings for a network** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-multicast - networkId (string) - defaultSettings (object): Default multicast setting for entire network. IGMP snooping and Flood unknown multicast traffic settings are enabled by default. - overrides (array): Array of paired switches/stacks/profiles and corresponding multicast settings. An empty array will clear the multicast settings. zSwitch settings$updateNetworkSwitchSettingsMulticast)r r z /networks/z/switch/settings/multicastZdefaultSettingsr)cs&i|]\}}|kr||qSr)r)rrr)rrr rszGSwitchSettings.updateNetworkSwitchSettingsMulticast..)rrrrr)rr rrrrr)rr r+s  z3SwitchSettings.updateNetworkSwitchSettingsMulticastcCs&dgdd}d|d}|j||S)z **List quality of service rules** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-qos-rules - networkId (string) zSwitch settings getNetworkSwitchSettingsQosRules)r r z /networks/z/switch/settings/qosRules)rr)rr rrrrr r,s  z/SwitchSettings.getNetworkSwitchSettingsQosRules)r rc s|td|krBdddg}|d|ksBtd|dd|dgdd }d |d }d dd ddddgfdd|D}|j|||S)a **Add a quality of service rule** https://developer.cisco.com/meraki/api/#!create-network-switch-settings-qos-rule - networkId (string) - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - dscp (integer): DSCP tag. Set this to -1 to trust incoming DSCP. Default value is 0 protocolANYTCPUDPz"protocol" cannot be "z", & must be set to one of: zSwitch settings"createNetworkSwitchSettingsQosRule)r r z /networks/z/switch/settings/qosRulesrsrcPort srcPortRangedstPort dstPortRangedscpcs&i|]\}}|kr||qSr)r)rrr)rrr rszESwitchSettings.createNetworkSwitchSettingsQosRule..)rrr"rrpost)rr rrr#rrrr)rr r1s  $ z1SwitchSettings.createNetworkSwitchSettingsQosRulecCs&dgdd}d|d}|j||S)z **Return the quality of service rule IDs by order in which they will be processed by the switch** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-qos-rules-order - networkId (string) zSwitch settings%getNetworkSwitchSettingsQosRulesOrder)r r z /networks/z/switch/settings/qosRules/order)rr)rr rrrrr r8s  z4SwitchSettings.getNetworkSwitchSettingsQosRulesOrder)r ruleIdscsJt}dgdd}d|d}dgfdd|D}|j|||S) ae **Update the order in which the rules should be processed by the switch** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-qos-rules-order - networkId (string) - ruleIds (array): A list of quality of service rule IDs arranged in order in which they should be processed by the switch. zSwitch settings(updateNetworkSwitchSettingsQosRulesOrder)r r z /networks/z/switch/settings/qosRules/orderr9cs&i|]\}}|kr||qSr)r)rrr)rrr r szKSwitchSettings.updateNetworkSwitchSettingsQosRulesOrder..)rrrr)rr r9rrrrr)rr r:s  z7SwitchSettings.updateNetworkSwitchSettingsQosRulesOrder)r qosRuleIdcCs*dgdd}d|d|}|j||S)z **Return a quality of service rule** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-qos-rule - networkId (string) - qosRuleId (string) zSwitch settingsgetNetworkSwitchSettingsQosRule)r r z /networks/z/switch/settings/qosRules/)rr)rr r;rrrrr r<$s z.SwitchSettings.getNetworkSwitchSettingsQosRulecCs*dgdd}d|d|}|j||S)z **Delete a quality of service rule** https://developer.cisco.com/meraki/api/#!delete-network-switch-settings-qos-rule - networkId (string) - qosRuleId (string) zSwitch settings"deleteNetworkSwitchSettingsQosRule)r r z /networks/z/switch/settings/qosRules/)rdelete)rr r;rrrrr r=5s z1SwitchSettings.deleteNetworkSwitchSettingsQosRulec s|td|krBdddg}|d|ksBtd|dd|dgdd }d |d |}d dd ddddgfdd|D}|j|||S)aB **Update a quality of service rule** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-qos-rule - networkId (string) - qosRuleId (string) - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY". - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0. r-r.r/r0z"protocol" cannot be "z", & must be set to one of: zSwitch settings"updateNetworkSwitchSettingsQosRule)r r z /networks/z/switch/settings/qosRules/rr2r3r4r5r6cs&i|]\}}|kr||qSr)r)rrr)rrr rcszESwitchSettings.updateNetworkSwitchSettingsQosRule..)rrr"rrr)rr r;rr#rrrr)rr r?Fs  $z1SwitchSettings.updateNetworkSwitchSettingsQosRulecCs&dgdd}d|d}|j||S)z **Return the storm control configuration for a switch network** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-storm-control - networkId (string) zSwitch settings$getNetworkSwitchSettingsStormControl)r r z /networks/z/switch/settings/stormControl)rr)rr rrrrr r@gs  z3SwitchSettings.getNetworkSwitchSettingsStormControlc sT|tdgdd}d|d}dddgfd d |D}|j|||S) a, **Update the storm control configuration for a switch network** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-storm-control - networkId (string) - broadcastThreshold (integer): Percentage (1 to 99) of total available port bandwidth for broadcast traffic type. Default value 100 percent rate is to clear the configuration. - multicastThreshold (integer): Percentage (1 to 99) of total available port bandwidth for multicast traffic type. Default value 100 percent rate is to clear the configuration. - unknownUnicastThreshold (integer): Percentage (1 to 99) of total available port bandwidth for unknown unicast (dlf-destination lookup failure) traffic type. Default value 100 percent rate is to clear the configuration. zSwitch settings'updateNetworkSwitchSettingsStormControl)r r z /networks/z/switch/settings/stormControlZbroadcastThresholdZmulticastThresholdZunknownUnicastThresholdcs&i|]\}}|kr||qSr)r)rrr)rrr rszJSwitchSettings.updateNetworkSwitchSettingsStormControl..)rrrrr)rr rrrrr)rr rAws   z6SwitchSettings.updateNetworkSwitchSettingsStormControlcCs&dgdd}d|d}|j||S)z **Returns STP settings** https://developer.cisco.com/meraki/api/#!get-network-switch-settings-stp - networkId (string) zSwitch settingsgetNetworkSwitchSettingsStp)r r z /networks/z/switch/settings/stp)rr)rr rrrrr rBs  z*SwitchSettings.getNetworkSwitchSettingsStpc sR|tdgdd}d|d}ddgfdd |D}|j|||S) a **Updates STP settings** https://developer.cisco.com/meraki/api/#!update-network-switch-settings-stp - networkId (string) - rstpEnabled (boolean): The spanning tree protocol status in network - stpBridgePriority (array): STP bridge priority for switches/stacks or switch profiles. An empty array will clear the STP bridge priority settings. zSwitch settingsupdateNetworkSwitchSettingsStp)r r z /networks/z/switch/settings/stpZ rstpEnabledZstpBridgePrioritycs&i|]\}}|kr||qSr)r)rrr)rrr rszASwitchSettings.updateNetworkSwitchSettingsStp..)rrrrr)rr rrrrr)rr rCs  z-SwitchSettings.updateNetworkSwitchSettingsStp)__name__ __module__ __qualname__rstrr rrr!r$listr&r'r(r*r+r,intr1r8r:r<r=r?r@rArBrC __classcell__rr)rr rs,  !rN)objectrrrrr