QuestionQ82

VerifiedController-Based Network Automation

An engineer needs to schedule code-driven firmware upgrades for Cisco Meraki switches across a specific network to remediate vulnerabilities. The engineer must use the Meraki Dashboard API to schedule the next upgrade for the switch product and specify the target version. Drag the code snippets into the boxes to build the artifact. Not all options are used.

Drag & Drop
import meraki, datetime

API_KEY = "MERAKI_API_KEY"
dashboard = meraki.DashboardAPI(API_KEY, output_log=False, suppress_logging=True)

network_id = "N_1234567890"
schedule_time = (datetime.datetime.utcnow() + datetime.timedelta(days=2)).replace(microsecond=0).isoformat() + "Z"

payload = {
    "": {
        "": {
            "nextUpgrade": {
                "time": schedule_time,
                "": "switch-15-20"
            }
        }
    }
}

resp = dashboard.networks.(network_id, **payload)
print("Scheduled:", resp.get("id", "ok"))
Explanation

updateNetworkFirmwareUpgrades updates a network’s firmware-upgrade configuration. The payload’s products object selects the switch product, and nextUpgrade.toVersion specifies the firmware version to schedule at the supplied UTC time.

Learn more

Community Discussion

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