| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright (c) 2021, Cisco Systems |
| 5 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
module: networks_switch_stacks_routing_interfaces |
| 9 |
short_description: Resource module for networks _switch _stacks _routing _interfaces |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource networks _switch _stacks |
| 12 |
_routing _interfaces. |
| 13 |
- Create a layer 3 interface for a switch stack. |
| 14 |
- Delete a layer 3 interface from a switch stack. |
| 15 |
- Update a layer 3 interface for a switch stack. |
| 16 |
version_added: '1.0.0' |
| 17 |
extends_documentation_fragment: |
| 18 |
- cisco.meraki.module |
| 19 |
author: Francisco Munoz (@fmunoz) |
| 20 |
options: |
| 21 |
defaultGateway: |
| 22 |
description: The next hop for any traffic that isn't going to a directly connected |
| 23 |
subnet or over a static route. This IP address must exist in a subnet with a |
| 24 |
L3 interface. Required if this is the first IPv4 interface. |
| 25 |
type: str |
| 26 |
interfaceId: |
| 27 |
description: InterfaceId path parameter. Interface ID. |
| 28 |
type: str |
| 29 |
interfaceIp: |
| 30 |
description: The IP address that will be used for Layer 3 routing on this VLAN |
| 31 |
or subnet. This cannot be the same as the device management IP. |
| 32 |
type: str |
| 33 |
ipv6: |
| 34 |
description: The IPv6 settings of the interface. |
| 35 |
suboptions: |
| 36 |
address: |
| 37 |
description: The IPv6 address of the interface. Required if assignmentMode |
| 38 |
is 'static'. Must not be included if assignmentMode is 'eui-64'. |
| 39 |
type: str |
| 40 |
assignmentMode: |
| 41 |
description: The IPv6 assignment mode for the interface. Can be either 'eui-64' |
| 42 |
or 'static'. |
| 43 |
type: str |
| 44 |
gateway: |
| 45 |
description: The IPv6 default gateway of the interface. Required if prefix |
| 46 |
is defined and this is the first interface with IPv6 configured. |
| 47 |
type: str |
| 48 |
prefix: |
| 49 |
description: The IPv6 prefix of the interface. Required if IPv6 object is |
| 50 |
included. |
| 51 |
type: str |
| 52 |
type: dict |
| 53 |
loopback: |
| 54 |
description: The loopback settings of the interface. |
| 55 |
type: dict |
| 56 |
mode: |
| 57 |
description: L3 Interface mode, can be one of 'vlan', 'routed', 'loopback'. Default |
| 58 |
is 'vlan'. CS 17.18 or higher is required for 'routed' mode. |
| 59 |
type: str |
| 60 |
multicastRouting: |
| 61 |
description: Enable multicast support if, multicast routing between VLANs is required. |
| 62 |
Options are 'disabled', 'enabled' or 'IGMP snooping querier'. Default is 'disabled'. |
| 63 |
type: str |
| 64 |
name: |
| 65 |
description: A friendly name or description for the interface or VLAN (max length |
| 66 |
128 characters). |
| 67 |
type: str |
| 68 |
networkId: |
| 69 |
description: NetworkId path parameter. Network ID. |
| 70 |
type: str |
| 71 |
ospfSettings: |
| 72 |
description: The OSPF routing settings of the interface. |
| 73 |
suboptions: |
| 74 |
area: |
| 75 |
description: The OSPF area to which this interface should belong. Can be either |
| 76 |
'disabled' or the identifier of an existing OSPF area. Defaults to 'disabled'. |
| 77 |
type: str |
| 78 |
cost: |
| 79 |
description: The path cost for this interface. Defaults to 1, but can be increased |
| 80 |
up to 65535 to give lower priority. |
| 81 |
type: int |
| 82 |
isPassiveEnabled: |
| 83 |
description: When enabled, OSPF will not run on the interface, but the subnet |
| 84 |
will still be advertised. |
| 85 |
type: bool |
| 86 |
networkType: |
| 87 |
description: OSPF network type. |
| 88 |
type: str |
| 89 |
type: dict |
| 90 |
subnet: |
| 91 |
description: The network that this L3 interface is on, in CIDR notation (ex. 10.1.1.0/24). |
| 92 |
type: str |
| 93 |
switchPortId: |
| 94 |
description: Switch Port ID when in Routed mode (CS 17.18 or higher required). |
| 95 |
type: str |
| 96 |
switchStackId: |
| 97 |
description: SwitchStackId path parameter. Switch stack ID. |
| 98 |
type: str |
| 99 |
vlanId: |
| 100 |
description: The VLAN this L3 interface is on. VLAN must be between 1 and 4094. |
| 101 |
type: int |
| 102 |
vrf: |
| 103 |
description: The VRF settings of the interface. Requires IOS XE 17.18 or higher. |
| 104 |
suboptions: |
| 105 |
name: |
| 106 |
description: The name of the VRF this interface belongs to. |
| 107 |
type: str |
| 108 |
type: dict |
| 109 |
requirements: |
| 110 |
- meraki >= 2.4.9 |
| 111 |
- python >= 3.5 |
| 112 |
seealso: |
| 113 |
- name: Cisco Meraki documentation for switch createNetworkSwitchStackRoutingInterface |
| 114 |
description: Complete reference of the createNetworkSwitchStackRoutingInterface |
| 115 |
API. |
| 116 |
link: https://developer.cisco.com/meraki/api-v1/#!create-network-switch-stack-routing-interface |
| 117 |
- name: Cisco Meraki documentation for switch deleteNetworkSwitchStackRoutingInterface |
| 118 |
description: Complete reference of the deleteNetworkSwitchStackRoutingInterface |
| 119 |
API. |
| 120 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-network-switch-stack-routing-interface |
| 121 |
- name: Cisco Meraki documentation for switch updateNetworkSwitchStackRoutingInterface |
| 122 |
description: Complete reference of the updateNetworkSwitchStackRoutingInterface |
| 123 |
API. |
| 124 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-switch-stack-routing-interface |
| 125 |
notes: |
| 126 |
- SDK Method used are |
| 127 |
switch.Switch.create_network_switch_stack_routing_interface, |
| 128 |
switch.Switch.delete_network_switch_stack_routing_interface, |
| 129 |
switch.Switch.update_network_switch_stack_routing_interface, |
| 130 |
- Paths used are |
| 131 |
post /networks/{networkId}/switch/stacks/{switchStackId}/routing/interfaces, |
| 132 |
delete /networks/{networkId}/switch/stacks/{switchStackId}/routing/interfaces/{interfaceId}, |
| 133 |
put /networks/{networkId}/switch/stacks/{switchStackId}/routing/interfaces/{interfaceId}, |
| 134 |
""" |
| 135 |
|
| 136 |
EXAMPLES = r""" |
| 137 |
- name: Create |
| 138 |
cisco.meraki.networks_switch_stacks_routing_interfaces: |
| 139 |
meraki_api_key: "{{ meraki_api_key }}" |
| 140 |
meraki_base_url: "{{ meraki_base_url }}" |
| 141 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 142 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 143 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 144 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 145 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 146 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 147 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 148 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 149 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 150 |
meraki_output_log: "{{ meraki_output_log }}" |
| 151 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 152 |
meraki_log_path: "{{ meraki_log_path }}" |
| 153 |
meraki_print_console: "{{ meraki_print_console }}" |
| 154 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 155 |
meraki_simulate: "{{ meraki_simulate }}" |
| 156 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 157 |
meraki_caller: "{{ meraki_caller }}" |
| 158 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 159 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 160 |
state: present |
| 161 |
defaultGateway: 192.168.1.1 |
| 162 |
interfaceIp: 192.168.1.2 |
| 163 |
ipv6: |
| 164 |
address: 2001:db8::1 |
| 165 |
assignmentMode: static |
| 166 |
gateway: 2001:db8::2 |
| 167 |
prefix: 2001:db8::/32 |
| 168 |
mode: vlan |
| 169 |
multicastRouting: disabled |
| 170 |
name: L3 interface |
| 171 |
networkId: string |
| 172 |
ospfSettings: |
| 173 |
area: '0' |
| 174 |
cost: 1 |
| 175 |
isPassiveEnabled: true |
| 176 |
networkType: broadcast |
| 177 |
subnet: 192.168.1.0/24 |
| 178 |
switchPortId: '1' |
| 179 |
switchStackId: string |
| 180 |
vlanId: 100 |
| 181 |
vrf: |
| 182 |
name: Blue |
| 183 |
- name: Update by id |
| 184 |
cisco.meraki.networks_switch_stacks_routing_interfaces: |
| 185 |
meraki_api_key: "{{ meraki_api_key }}" |
| 186 |
meraki_base_url: "{{ meraki_base_url }}" |
| 187 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 188 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 189 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 190 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 191 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 192 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 193 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 194 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 195 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 196 |
meraki_output_log: "{{ meraki_output_log }}" |
| 197 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 198 |
meraki_log_path: "{{ meraki_log_path }}" |
| 199 |
meraki_print_console: "{{ meraki_print_console }}" |
| 200 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 201 |
meraki_simulate: "{{ meraki_simulate }}" |
| 202 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 203 |
meraki_caller: "{{ meraki_caller }}" |
| 204 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 205 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 206 |
state: present |
| 207 |
defaultGateway: 192.168.1.1 |
| 208 |
interfaceId: string |
| 209 |
interfaceIp: 192.168.1.2 |
| 210 |
ipv6: |
| 211 |
address: 2001:db8::1 |
| 212 |
assignmentMode: static |
| 213 |
gateway: 2001:db8::2 |
| 214 |
prefix: 2001:db8::/32 |
| 215 |
multicastRouting: disabled |
| 216 |
name: L3 interface |
| 217 |
networkId: string |
| 218 |
ospfSettings: |
| 219 |
area: '0' |
| 220 |
cost: 1 |
| 221 |
isPassiveEnabled: true |
| 222 |
networkType: broadcast |
| 223 |
subnet: 192.168.1.0/24 |
| 224 |
switchPortId: '1' |
| 225 |
switchStackId: string |
| 226 |
vlanId: 100 |
| 227 |
vrf: |
| 228 |
name: Blue |
| 229 |
- name: Delete by id |
| 230 |
cisco.meraki.networks_switch_stacks_routing_interfaces: |
| 231 |
meraki_api_key: "{{ meraki_api_key }}" |
| 232 |
meraki_base_url: "{{ meraki_base_url }}" |
| 233 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 234 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 235 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 236 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 237 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 238 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 239 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 240 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 241 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 242 |
meraki_output_log: "{{ meraki_output_log }}" |
| 243 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 244 |
meraki_log_path: "{{ meraki_log_path }}" |
| 245 |
meraki_print_console: "{{ meraki_print_console }}" |
| 246 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 247 |
meraki_simulate: "{{ meraki_simulate }}" |
| 248 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 249 |
meraki_caller: "{{ meraki_caller }}" |
| 250 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 251 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 252 |
state: absent |
| 253 |
interfaceId: string |
| 254 |
networkId: string |
| 255 |
switchStackId: string |
| 256 |
""" |
| 257 |
RETURN = r""" |
| 258 |
meraki_response: |
| 259 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 260 |
returned: always |
| 261 |
type: dict |
| 262 |
sample: > |
| 263 |
{ |
| 264 |
"interfaceId": "string", |
| 265 |
"name": "string", |
| 266 |
"mode": "string", |
| 267 |
"subnet": "string", |
| 268 |
"interfaceIp": "string", |
| 269 |
"serial": "string", |
| 270 |
"switchPortId": "string", |
| 271 |
"multicastRouting": "string", |
| 272 |
"vlanId": 0, |
| 273 |
"uplinkV4": true, |
| 274 |
"uplinkV6": true, |
| 275 |
"ospfSettings": { |
| 276 |
"area": "string", |
| 277 |
"cost": 0, |
| 278 |
"isPassiveEnabled": true, |
| 279 |
"networkType": "string" |
| 280 |
}, |
| 281 |
"ospfV3": { |
| 282 |
"area": "string", |
| 283 |
"cost": 0, |
| 284 |
"isPassiveEnabled": true, |
| 285 |
"networkType": "string" |
| 286 |
}, |
| 287 |
"ipv6": { |
| 288 |
"assignmentMode": "string", |
| 289 |
"address": "string", |
| 290 |
"prefix": "string", |
| 291 |
"gateway": "string" |
| 292 |
}, |
| 293 |
"vrf": { |
| 294 |
"name": "string" |
| 295 |
}, |
| 296 |
"loopback": {}, |
| 297 |
"defaultGateway": "string" |
| 298 |
} |
| 299 |
""" |