QuestionQ53

Device-Level Network Automation

An engineer needs to enable VLANs and create a management VLAN on an MX appliance. The engineer must first update the VLAN settings and then configure a VLAN by using the appropriate appliance endpoints. Drag the code snippets into the boxes to construct the artifact. Not every option is used, and options can be used more than once.

Drag & Drop
import requests

base = "https://api.meraki.com/api/v1"
network_id = "N_1234567890"
api_key = "abcd1234"
headers = {
    "": api_key,
    "Accept": "application/json",
    "Content-Type": "application/json"
}

# Enable VLANs
requests.put(
    f"{base}//{network_id}/",
    headers=headers,
    json={"vlansEnabled": True}
).raise_for_status()

# Configure VLAN 20
payload = {"name": "Mgmt", "id": "20", "subnet": "10.20.0.0/24", "applianceIp": "10.20.0.1"}
resp = requests.post(
    f"{base}//{network_id}//20",
    headers=headers,
    json=payload
)
resp.raise_for_status()
print("VLANs configured.")

$$$routing/vlans###
Explanation

Cisco Meraki Dashboard API authentication uses the x-cisco-meraki-api-key request header. The MX VLAN settings resource is /networks/{networkId}/appliance/vlans/settings; VLAN resources use /networks/{networkId}/appliance/vlans.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!