Can I config mass AP name on sz100 after all the AP joined the controller

  • 2
  • Question
  • Updated 5 months ago
  • Answered
Hi there,

It's there any method to modify all the ap name using script or cvs file after all the AP has joined to the sz ?
Photo of adam Ye

adam Ye

  • 9 Posts
  • 1 Reply Like

Posted 5 months ago

  • 2
Photo of RedVision81

RedVision81

  • 31 Posts
  • 6 Reply Likes
this is a great idea! currently we have 70 new APs to join and to rename.
we use consecutive numbering, hence it would be easy to create a csv with excel for that.
Photo of adam Ye

adam Ye

  • 9 Posts
  • 1 Reply Like
But seems the csv just can work for pre-provision AP.
Photo of Diego Garcia del Rio

Diego Garcia del Rio

  • 131 Posts
  • 52 Reply Likes
Take a look at the following:


import requests
url="https://<yourip>:8443/wsg/api/public/v6_0/"
login=requests.post(url+'session',verify=False,json={'username':'admin','password':'<yourSZpassword>'})
cookies=login.cookies
#find the zone name and uuid you want
zones=requests.get(url+'rkszones', verify=False, cookies=cookies)
zones.json()
#get a list of all the APs
aps=requests.get(url+'aps', verify=False, cookies=cookies)
aps.json()
#get a filtered list of APs (The aps of a specific zone)
aprequest={'filters':[{'type':'APZONE', 'value': '<zone-uuid>'}]}
aps=requests.get(url+'aps', verify=False, cookies=cookies,json=aprequest)
#how many APs did we get? len(myaps['list'])
#define new names for the APs
newapnames={'E8:1D:A8:22:AC:30':'AP-PR-01-28',
'E8:1D:A8:22:91:00':'AP-PR-01-29',
'E8:1D:A8:22:C2:F0':'AP-PR-03-38',
'E8:1D:A8:22:87:C0':'AP-SE-PB-04',
'E8:1D:A8:22:DC:20':'AP-SE-PB-05',
'E8:1D:A8:22:86:30':'AP-SE-01-12',
'E8:1D:A8:22:D7:70':'AP-SE-01-13',
'E8:1D:A8:22:BE:10':'AP-SE-02-20',
'E8:1D:A8:22:94:90':'AP-BI-01-45',
'E8:1D:A8:22:87:20':'AP-BI-01-46',
'E8:1D:A8:22:DC:30':'AP-KI-PB-47',
'E8:1D:A8:22:E3:10':'AP-KI-PB-48',
'E8:1D:A8:22:D6:10':'AP-KI-PB-50',
'D8:38:FC:19:19:90':'AP-SE-01-11',
'D8:38:FC:19:05:D0':'AP-SE-01-15'}
#do the actual renaming
for apname in newapnames.keys():
    print apname, newapnames[apname]
    #originalap=requests.get(url+'aps/'+apname, verify=False,cookies=cookies)
    #print originalap.json()
    patchAp=requests.patch(url+'aps/'+apname, verify=False, json={'name':newapnames[apname]}, cookies=cookies)
    print patchAp.status_code

You should run this line by line in a python shell... to be sure of what's happening. But it should get you going!

Photo of Diego Garcia del Rio

Diego Garcia del Rio

  • 131 Posts
  • 52 Reply Likes
An additional note. This is meant for python 2.x but should work with minimal changes for python 3.x (replace the  "print ..... " by "print(...)" 
Photo of adam Ye

adam Ye

  • 9 Posts
  • 1 Reply Like
Hi Diego,
Thanks for your sharing