SSID Get Radius host IP or URL

PacJ
Here to help

SSID Get Radius host IP or URL

I have a working API that is pulling the status of all SSIDs in my network. Everything is working well except when I add the last line below to pull the radiusServer host. Can anyone correct me on the syntax to pull the radius host ip or url?

 

ssidname = ssid['name']
ssidnumber = str(ssid['number'])
if ssid['enabled'] == True:
ssidenabled = 'Yes'
if ssid['enabled'] == False:
ssidenabled = 'No'
authmode = ssid['authMode']
splashpage = ssid['splashPage']
Radius = ssid["radiusServer"]

 

 

2 Replies 2
RomanMD
Building a reputation

in Python: 

when Radius is enabled on SSID the result dict will have a key "radiusServers" which will contain a list of dicts, for every radius server, however, if the SSID does not have Radius active then the key will not exist and you can't address it via [""].

Use dict get() method to check if the key exists.

 

{'authMode': '8021x-radius',
 'availabilityTags': [],
 'availableOnAllAps': True,
 'bandSelection': 'Dual band operation with Band Steering',
 'concentratorNetworkId': 'N_111111111111111111',
 'dot11r': {'adaptive': False, 'enabled': False},
 'dot11w': {'enabled': True, 'required': False},
 'enabled': True,
 'encryptionMode': 'wpa-eap',
 'ipAssignmentMode': 'VPN',
 'mandatoryDhcpEnabled': True,
 'minBitrate': 12,
 'name': 'thisismyssidname',
 'number': 2,
 'perClientBandwidthLimitDown': 0,
 'perClientBandwidthLimitUp': 0,
 'perSsidBandwidthLimitDown': 0,
 'perSsidBandwidthLimitUp': 0,
 'radiusAccountingEnabled': False,
 'radiusAttributeForGroupPolicies': 'Filter-Id',
 'radiusAuthenticationNasId': '$NODE_MAC$:$VAP_NUM$', #this seems to be future settings in MR28
 'radiusCalledStationId': '$NODE_MAC$:$VAP_NAME$',  #this seems to be future settings in MR28
 'radiusCoaEnabled': True,
 'radiusFailoverPolicy': None,
 'radiusLoadBalancingPolicy': None,
 'radiusOverride': False,
 'radiusProxyEnabled': False,
 'radiusServers': [{'host': '10.10.10.10',
                    'id': 111111111111111111,
                    'port': 1812},
                   {'host': '11.11.11.11',
                    'id': 222222222222222222,
                    'port': 1812}],
 'radiusTestingEnabled': False,
 'splashPage': 'None',
 'ssidAdminAccessible': False,
 'visible': True,
 'vlanId': 888,
 'wpaEncryptionMode': 'WPA1 and WPA2'}

 

 

 

 

ssids = dashboard.wireless.getNetworkWirelessSsids(networkId)
for ssid in ssids:
  radius_server_list = []
  if ssid.get("radiusServers"): #Only execute if radiusServers key exists
    for server in ssid.get("radiusServers"):
      radius_server_list.append(server["host"])

print(radius_server_list)

  

 

 

Edgar1966
Just browsing

sorry.... stupid cisco took the old account

Get notified when there are additional replies to this discussion.