Zero-touch provisioning of access switch

First, make sure distribution switches are added as devices. If they are not, add them. Can be done using the API:

curl https://localhost/api/v1.0/device -X POST -H "Content-Type: application/json" -d '{"hostname": "dist0", "management_ip": "", "platform": "junos", "state": "UNKNOWN", "device_type": "DIST"}'

Once the distribution switches are added, we can create a management domain and assign the distribution switches to it. Of course the IPv4 range, device IDs and VLAN should be replaced with whatever values you want.

curl https://localhost/api/v1.0/mgmtdomains -X POST -H "Content-Type: application/json" -d '{"ipv4_gw": "", "device_a": "cn-dist-juniper1", "device_b": "cn-dist-juniper2", "vlan": 100}'

Then we can power on the access switch, wait for it to boot using DHCP. List new devices that has booted using CNaaS startup config:

curl https://localhost/api/v1.0/devices?filter[state]=DISCOVERED

If the device serial/MAC matches with a device you want to provision, call the API to initialize the device with a specified hostname and device type:

curl https://localhost/api/v1.0/device_init/20 -X POST -H "Content-Type: application/json" -d '{"hostname": "ex2300-top", "device_type": "ACCESS"}'

Check job status to see progress, there should be two jobs running after each other, step1 and step2.

curl https://localhost/api/v1.0/jobs?limit=2
  • No labels