Dear
I'd like to change the street address for a bulk number of access points and switches / entire network
and not having to go one by one.
Is there an elegant way of achieving it?
Best regards.
Solved! Go to solution.
Hi there !
# Save changes
postnewaddr = meraki.updatedevice(apikey,deviceinfo['networkId'],deviceinfo['serial'],deviceinfo['address'])
I would do :
postnewaddr = meraki.updatedevice(apikeu,deviceinfo['networkId'],deviceinfo['serial'], address = deviceinfo['address'])
The reference in Meraki.py is :
def updatedevice(apikey, networkid, serial, name=None, tags=None, lat=None,
lng=None, address=None, move=None, suppressprint=False):
So the first variable is name, that is the reason why It changed the name instead of address. ( had the same issue yesterday haha )
It should be working now. Try it 🙂
Maybe this helps:
https://community.meraki.com/t5/Dashboard-Administration/Bulk-change-street-address/td-p/5921
Using API, but I´m not familiar with API...
That would be super easy with API ! I recommend to use the meraki.py library ( https://github.com/meraki/dashboard-api-python/ )
Python 3.6 -> pip install meraki
Then you could use something like that :
apikey = "your api key"
orgid = "your org id"
newaddr = " your new addr "
inventory = meraki.getorginventory(apikey,orgid) # Return your inventory
for mr in inventory:
if "MR" in mr['model']: # if the model contains MR ( AP ) could be MS , MX , MV
mrinfo = meraki.getdevicedetail(apikey,mr['networkId'],mr['serial']) # To get the device info that contains the adress
if "OldAdress" in mrinfo['address']: # To check if the device matches your old adress
postnewaddr = meraki.updatedevice(apikey,mr['networkId'],newaddr) #Push the new addr
This is mostly complete. I didnt run it , so double check it before doing so. And I'm not responsible if something bad happens. Always try your calls before running them in a production environnement.
Hope it helps !
Hello RaphaelL,
Thanks for your reply showing towards the correct way.
I am able to read all devices from the organization->network-> inventory list.
Then iterate over device list and find the device with the location address that need to be changed.
In this case I am looking for any device that it's address is = "old Address"
For a reason I can't understand it is updating the new location address in the device['name'] attribute instead in the device['address'] attribute.
In the printout below you can see the device['name'] before posting is 'P1234'
and after posting it changes to "new Address" when actually expected that the device
name remains 'AP1234'
and the device address is changed from 'old Address' to 'new Address'
Not sure why it is updating the wrong attribute. Can you tell?
from meraki import meraki apikey = "3***5" orgid = "6***4" newaddr = "new Address" # Return your inventory deviceList = meraki.getorginventory(apikey,orgid) #Iterate over all devices in network for device in deviceList: # Check if the device['model'] contains string "MR"
# If it does then it is an access point. (it could be MS/MX/MV...)
if "MR" in device['model']: # Get the device info that contains the address deviceinfo = meraki.getdevicedetail(apikey,device['networkId'],device['serial']) # Print per each item the name, mac and current addresss print("Device name: " + str(deviceinfo['name'])) print("\tMAC: " + str(deviceinfo['mac'])) print("\tAddress: " + str(deviceinfo['address'])) # Check if the device matches your old address if "old Address" in deviceinfo['address']: # Print address value as stored in deviceinfo['address'] print("Address as stored in 'address' attribute before assigning new value to it:" + str(deviceinfo['address'])) # Assign new address to deviceinfo['address'] deviceinfo['address'] = newaddr print("Address as stored in 'address' attribute after assigning new value to it:" + str(deviceinfo['address'])) # Save changes postnewaddr = meraki.updatedevice(apikey,deviceinfo['networkId'],deviceinfo['serial'],deviceinfo['address']) # Print Post result print("Post result: " + str(postnewaddr))
Hi there !
# Save changes
postnewaddr = meraki.updatedevice(apikey,deviceinfo['networkId'],deviceinfo['serial'],deviceinfo['address'])
I would do :
postnewaddr = meraki.updatedevice(apikeu,deviceinfo['networkId'],deviceinfo['serial'], address = deviceinfo['address'])
The reference in Meraki.py is :
def updatedevice(apikey, networkid, serial, name=None, tags=None, lat=None,
lng=None, address=None, move=None, suppressprint=False):
So the first variable is name, that is the reason why It changed the name instead of address. ( had the same issue yesterday haha )
It should be working now. Try it 🙂
You can do a bulk placement for devices on network per network basis via Network Wide -> Map and Floorplans -> Click Place devices on a map, mark all devices and choose "Edit" -> Geolocate -> Enter Address.
Don't forget to click "save device placements" .
* Edit - this only moves the devices on the map to the correct map location, it does not set the address on the actual device.
API is the way.
You could create a phyton script to do it.
About how many devices you are talking?