10-01-2018 10:36 AM
10-01-2018 11:11 AM
10-01-2018 11:45 AM
10-02-2018 05:27 PM
import requests import json # define the APs you want to list here: apList = ['34:8F:26:AA:BB:CC', '30:87:D8:00:11:22', '30:87:D9:33:44:55'] # define username / password / ip or url below username="admin" password="[password]" baseUrl="https://[smartzoneurl-or-ip]:8443/wsg/api/scg # the rest should not need any changes loginData={ "username": username, "password": password, "timeZoneUtcOffset": "+03:00" } headers = {"Content-Type": "application/json;charset=UTF-8"} login=requests.post(baseUrl + "/session", headers=headers, data=json.dumps(loginData)) print login.text print login.status_code if (login.status_code == requests.codes.ok): cookieJar=login.cookies for myAp in apList: apStatusReq=requests.get( baseUrl + '/aps/' + myAp ,cookies=cookieJar, headers=headers) if (apStatusReq.status_code != requests.codes.ok or not apStatusReq.json()['success']): print myAp, "Not Found!" continue for portInfo in apStatusReq.json()['data']['lanPortStatus']: print myAp, portInfo['interfaceName'], portInfo['logicLink'], portInfo['phyLink'] logoutRequest=requests.delete(baseUrl + '/session', headers=headers, cookies=cookieJar) print logoutRequest.status_codeThis will print a list of all ports and status for each of the APs listed in the "apList" array. The code could be modified to walk all the APs in the controller.. but it should be a good start.
34:8F:27:AA:BB:CC eth0 Up Up 1000Mbps full 34:8F:27:AA:BB:CC eth1 Down Down 30:87:D8:00:11:22 Not Found! 30:87:D9:33:44:55 eth1 Down Down 30:87:D9:33:44:55 eth2 Down Down 30:87:D9:33:44:55 eth3 Down Down 30:87:D9:33:44:55 eth4 Up Up 100Mbps full 30:87:D9:33:44:55 eth0 Up Up 1000Mbps fullHope it helps!
10-05-2018 06:53 AM