mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
Changes to RADIUS and SSID profile creation
This commit is contained in:
@@ -716,18 +716,12 @@ for key in equipment_ids:
|
||||
if args.skip_eap != True:
|
||||
radius_template = "templates/radius_profile_template.json"
|
||||
radius_name = radius_info['name']
|
||||
subnet_name = radius_info['subnet_name']
|
||||
subnet = radius_info['subnet']
|
||||
subnet_mask = radius_info['subnet_mask']
|
||||
region = radius_info['region']
|
||||
server_name = radius_info['server_name']
|
||||
server_ip = radius_info['server_ip']
|
||||
secret = radius_info['secret']
|
||||
auth_port = radius_info['auth_port']
|
||||
try:
|
||||
radius_profile = CloudSDK.create_radius_profile(cloudSDK_url, bearer, radius_template, radius_name,
|
||||
subnet_name, subnet,
|
||||
subnet_mask, region, server_name, server_ip, secret,
|
||||
server_ip, secret,
|
||||
auth_port)
|
||||
print("radius profile Id is", radius_profile)
|
||||
client.update_testrail(case_id=test_cases["radius_profile"], run_id=rid, status_id=1,
|
||||
@@ -759,7 +753,7 @@ for key in equipment_ids:
|
||||
fiveG_eap = CloudSDK.create_ssid_profile(cloudSDK_url, bearer, ssid_template,
|
||||
fw_model + '_5G_EAP_' + today,
|
||||
profile_info_dict[fw_model]["fiveG_WPA2-EAP_SSID"], None,
|
||||
radius_name,
|
||||
radius_profile,
|
||||
"wpa2OnlyRadius", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G EAP SSID created successfully - bridge mode")
|
||||
@@ -783,7 +777,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA2_' + today,
|
||||
profile_info_dict[fw_model]["fiveG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model]["fiveG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
0, "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA2 SSID created successfully - bridge mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa2_bridge"], run_id=rid, status_id=1,
|
||||
@@ -804,7 +798,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA_' + today,
|
||||
profile_info_dict[fw_model]["fiveG_WPA_SSID"],
|
||||
profile_info_dict[fw_model]["fiveG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 1,
|
||||
0, "wpaPSK", "BRIDGE", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA SSID created successfully - bridge mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa_bridge"], run_id=rid, status_id=1,
|
||||
@@ -827,7 +821,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_EAP_' + today,
|
||||
profile_info_dict[fw_model]["twoFourG_WPA2-EAP_SSID"],
|
||||
None,
|
||||
radius_name, "wpa2OnlyRadius", "BRIDGE", 1,
|
||||
radius_profile, "wpa2OnlyRadius", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G EAP SSID created successfully - bridge mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_eap_bridge"], run_id=rid, status_id=1,
|
||||
@@ -850,7 +844,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_WPA2_' + today,
|
||||
profile_info_dict[fw_model]["twoFourG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model]["twoFourG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
0, "wpa2OnlyPSK", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA2 SSID created successfully - bridge mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa2_bridge"], run_id=rid, status_id=1,
|
||||
@@ -871,7 +865,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_WPA_' + today,
|
||||
profile_info_dict[fw_model]["twoFourG_WPA_SSID"],
|
||||
profile_info_dict[fw_model]["twoFourG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 1,
|
||||
0, "wpaPSK", "BRIDGE", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA SSID created successfully - bridge mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa_bridge"], run_id=rid, status_id=1,
|
||||
@@ -890,10 +884,8 @@ for key in equipment_ids:
|
||||
### Create AP Bridge Profile
|
||||
rfProfileId = lab_ap_info.rf_profile
|
||||
if args.skip_eap != True:
|
||||
radiusProfileId = radius_profile
|
||||
child_profiles = [fiveG_eap, fiveG_wpa2, fiveG_wpa, twoFourG_eap, twoFourG_wpa2, twoFourG_wpa,
|
||||
rfProfileId,
|
||||
radiusProfileId]
|
||||
rfProfileId]
|
||||
print(child_profiles)
|
||||
else:
|
||||
child_profiles = [fiveG_wpa2, fiveG_wpa, twoFourG_wpa2, twoFourG_wpa, rfProfileId]
|
||||
@@ -1131,7 +1123,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_EAP_NAT_' + today,
|
||||
profile_info_dict[fw_model + '_nat'][
|
||||
"fiveG_WPA2-EAP_SSID"], None,
|
||||
radius_name,
|
||||
radius_profile,
|
||||
"wpa2OnlyRadius", "NAT", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G EAP SSID created successfully - NAT mode")
|
||||
@@ -1156,7 +1148,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA2_NAT_' + today,
|
||||
profile_info_dict[fw_model + '_nat']["fiveG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model + '_nat']["fiveG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "NAT", 1,
|
||||
0, "wpa2OnlyPSK", "NAT", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA2 SSID created successfully - NAT mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa2_nat"], run_id=rid, status_id=1,
|
||||
@@ -1177,7 +1169,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA_NAT_' + today,
|
||||
profile_info_dict[fw_model + '_nat']["fiveG_WPA_SSID"],
|
||||
profile_info_dict[fw_model + '_nat']["fiveG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "NAT", 1,
|
||||
0, "wpaPSK", "NAT", 1,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA SSID created successfully - NAT mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa_nat"], run_id=rid, status_id=1,
|
||||
@@ -1201,7 +1193,7 @@ for key in equipment_ids:
|
||||
profile_info_dict[fw_model + '_nat'][
|
||||
"twoFourG_WPA2-EAP_SSID"],
|
||||
None,
|
||||
radius_name, "wpa2OnlyRadius", "NAT", 1, ["is2dot4GHz"])
|
||||
radius_profile, "wpa2OnlyRadius", "NAT", 1, ["is2dot4GHz"])
|
||||
print("2.4G EAP SSID created successfully - NAT mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_eap_nat"], run_id=rid, status_id=1,
|
||||
msg='2.4G EAP SSID created successfully - NAT mode')
|
||||
@@ -1223,7 +1215,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_WPA2_NAT_' + today,
|
||||
profile_info_dict[fw_model + '_nat']["twoFourG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model + '_nat']["twoFourG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "NAT", 1,
|
||||
0, "wpa2OnlyPSK", "NAT", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA2 SSID created successfully - NAT mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa2_nat"], run_id=rid, status_id=1,
|
||||
@@ -1244,7 +1236,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_WPA_NAT_' + today,
|
||||
profile_info_dict[fw_model + '_nat']["twoFourG_WPA_SSID"],
|
||||
profile_info_dict[fw_model + '_nat']["twoFourG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "NAT", 1,
|
||||
0, "wpaPSK", "NAT", 1,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA SSID created successfully - NAT mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa_nat"], run_id=rid, status_id=1,
|
||||
@@ -1500,7 +1492,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_EAP_VLAN' + today,
|
||||
profile_info_dict[fw_model + '_vlan'][
|
||||
"fiveG_WPA2-EAP_SSID"], None,
|
||||
radius_name,
|
||||
radius_profile,
|
||||
"wpa2OnlyRadius", "BRIDGE", 100,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G EAP SSID created successfully - custom VLAN mode")
|
||||
@@ -1525,7 +1517,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA2_VLAN' + today,
|
||||
profile_info_dict[fw_model + '_vlan']["fiveG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model + '_vlan']["fiveG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 100,
|
||||
0, "wpa2OnlyPSK", "BRIDGE", 100,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA2 SSID created successfully - custom VLAN mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa2_vlan"], run_id=rid, status_id=1,
|
||||
@@ -1546,7 +1538,7 @@ for key in equipment_ids:
|
||||
fw_model + '_5G_WPA_VLAN_' + today,
|
||||
profile_info_dict[fw_model + '_vlan']["fiveG_WPA_SSID"],
|
||||
profile_info_dict[fw_model + '_vlan']["fiveG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 100,
|
||||
0, "wpaPSK", "BRIDGE", 100,
|
||||
["is5GHzU", "is5GHz", "is5GHzL"])
|
||||
print("5G WPA SSID created successfully - custom VLAN mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_5g_wpa_vlan"], run_id=rid, status_id=1,
|
||||
@@ -1570,7 +1562,7 @@ for key in equipment_ids:
|
||||
profile_info_dict[fw_model + '_vlan'][
|
||||
"twoFourG_WPA2-EAP_SSID"],
|
||||
None,
|
||||
radius_name, "wpa2OnlyRadius", "BRIDGE", 100,
|
||||
radius_profile, "wpa2OnlyRadius", "BRIDGE", 100,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G EAP SSID created successfully - custom VLAN mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_eap_vlan"], run_id=rid, status_id=1,
|
||||
@@ -1594,7 +1586,7 @@ for key in equipment_ids:
|
||||
profile_info_dict[fw_model + '_vlan'][
|
||||
"twoFourG_WPA2_SSID"],
|
||||
profile_info_dict[fw_model + '_vlan']["twoFourG_WPA2_PSK"],
|
||||
"Radius-Accounting-Profile", "wpa2OnlyPSK", "BRIDGE", 100,
|
||||
0, "wpa2OnlyPSK", "BRIDGE", 100,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA2 SSID created successfully - custom VLAN mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa2_vlan"], run_id=rid, status_id=1,
|
||||
@@ -1615,7 +1607,7 @@ for key in equipment_ids:
|
||||
fw_model + '_2G_WPA_VLAN_' + today,
|
||||
profile_info_dict[fw_model + '_vlan']["twoFourG_WPA_SSID"],
|
||||
profile_info_dict[fw_model + '_vlan']["twoFourG_WPA_PSK"],
|
||||
"Radius-Accounting-Profile", "wpaPSK", "BRIDGE", 100,
|
||||
0, "wpaPSK", "BRIDGE", 100,
|
||||
["is2dot4GHz"])
|
||||
print("2.4G WPA SSID created successfully - custom VLAN mode")
|
||||
client.update_testrail(case_id=test_cases["ssid_2g_wpa_vlan"], run_id=rid, status_id=1,
|
||||
@@ -1634,10 +1626,8 @@ for key in equipment_ids:
|
||||
### Create AP VLAN Profile
|
||||
rfProfileId = lab_ap_info.rf_profile
|
||||
if args.skip_eap != True:
|
||||
radiusProfileId = radius_profile
|
||||
child_profiles = [fiveG_eap, fiveG_wpa2, fiveG_wpa, twoFourG_eap, twoFourG_wpa2, twoFourG_wpa,
|
||||
rfProfileId,
|
||||
radiusProfileId]
|
||||
rfProfileId]
|
||||
print(child_profiles)
|
||||
else:
|
||||
child_profiles = [fiveG_wpa2, fiveG_wpa, twoFourG_wpa2, twoFourG_wpa, rfProfileId]
|
||||
|
||||
@@ -205,11 +205,15 @@ class CloudSDK:
|
||||
profile['name'] = name
|
||||
profile['details']['ssid'] = ssid
|
||||
profile['details']['keyStr'] = passkey
|
||||
profile['details']['radiusServiceName'] = radius
|
||||
profile['details']['radiusServiceId'] = radius
|
||||
profile['details']['secureMode'] = security
|
||||
profile['details']['forwardMode'] = mode
|
||||
profile['details']['vlanId'] = vlan
|
||||
profile['details']['appliedRadios'] = radios
|
||||
if radius != 0:
|
||||
profile["childProfileIds"] = [radius]
|
||||
else:
|
||||
profile["childProfileIds"] = []
|
||||
with open(template, 'w') as ssid_profile:
|
||||
json.dump(profile, ssid_profile)
|
||||
|
||||
@@ -224,32 +228,14 @@ class CloudSDK:
|
||||
ssid_profile_id = ssid_profile['id']
|
||||
return ssid_profile_id
|
||||
|
||||
def create_radius_profile(cloudSDK_url, bearer, template, name, subnet_name, subnet, subnet_mask, region, server_name, server_ip, secret, auth_port):
|
||||
def create_radius_profile(cloudSDK_url, bearer, template, name, server_ip, secret, auth_port):
|
||||
with open(template, 'r+') as radius_profile:
|
||||
profile = json.load(radius_profile)
|
||||
|
||||
profile['name'] = name
|
||||
|
||||
subnet_config = profile['details']['subnetConfiguration']
|
||||
old_subnet_name = list(subnet_config.keys())[0]
|
||||
subnet_config[subnet_name] = subnet_config.pop(old_subnet_name)
|
||||
profile['details']['subnetConfiguration'][subnet_name]['subnetAddress'] = subnet
|
||||
profile['details']['subnetConfiguration'][subnet_name]['subnetCidrPrefix'] = subnet_mask
|
||||
profile['details']['subnetConfiguration'][subnet_name]['subnetName'] = subnet_name
|
||||
|
||||
region_map = profile['details']['serviceRegionMap']
|
||||
old_region = list(region_map.keys())[0]
|
||||
region_map[region] = region_map.pop(old_region)
|
||||
profile['details']['serviceRegionName'] = region
|
||||
profile['details']['subnetConfiguration'][subnet_name]['serviceRegionName'] = region
|
||||
profile['details']['serviceRegionMap'][region]['regionName'] = region
|
||||
|
||||
server_map = profile['details']['serviceRegionMap'][region]['serverMap']
|
||||
old_server_name = list(server_map.keys())[0]
|
||||
server_map[server_name] = server_map.pop(old_server_name)
|
||||
profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['ipAddress'] = server_ip
|
||||
profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['secret'] = secret
|
||||
profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['authPort'] = auth_port
|
||||
profile['details']["primaryRadiusAuthServer"]['ipAddress'] = server_ip
|
||||
profile['details']["primaryRadiusAuthServer"]['secret'] = secret
|
||||
profile['details']["primaryRadiusAuthServer"]['port'] = auth_port
|
||||
|
||||
with open(template, 'w') as radius_profile:
|
||||
json.dump(profile, radius_profile)
|
||||
@@ -261,8 +247,6 @@ class CloudSDK:
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=open(template, 'rb'))
|
||||
radius_profile = response.json()
|
||||
#print(radius_profile)
|
||||
#print(ssid_profile)
|
||||
radius_profile_id = radius_profile['id']
|
||||
return radius_profile_id
|
||||
|
||||
|
||||
@@ -144,8 +144,7 @@ profile_info_dict = {
|
||||
"ecw5410": {
|
||||
"profile_id": "2",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
3,
|
||||
3647,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
@@ -185,7 +184,6 @@ profile_info_dict = {
|
||||
"profile_id": "153",
|
||||
"childProfileIds": [
|
||||
17,
|
||||
129,
|
||||
18,
|
||||
201,
|
||||
202,
|
||||
@@ -228,7 +226,6 @@ profile_info_dict = {
|
||||
"ec420": {
|
||||
"profile_id": "20",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
209,
|
||||
210,
|
||||
21,
|
||||
@@ -269,7 +266,6 @@ profile_info_dict = {
|
||||
"profile_id": "27",
|
||||
"childProfileIds": [
|
||||
32,
|
||||
129,
|
||||
10,
|
||||
28,
|
||||
29,
|
||||
@@ -309,7 +305,6 @@ profile_info_dict = {
|
||||
"profile_id": "68",
|
||||
"childProfileIds": [
|
||||
192,
|
||||
129,
|
||||
81,
|
||||
193,
|
||||
82,
|
||||
@@ -348,7 +343,6 @@ profile_info_dict = {
|
||||
"ea8300_nat": {
|
||||
"profile_id": "67",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
72,
|
||||
73,
|
||||
10,
|
||||
@@ -392,7 +386,6 @@ profile_info_dict = {
|
||||
"ec420_nat": {
|
||||
"profile_id": "70",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
211,
|
||||
212,
|
||||
90,
|
||||
@@ -433,7 +426,6 @@ profile_info_dict = {
|
||||
"profile_id": "69",
|
||||
"childProfileIds": [
|
||||
208,
|
||||
129,
|
||||
84,
|
||||
85,
|
||||
87,
|
||||
@@ -474,7 +466,6 @@ profile_info_dict = {
|
||||
"childProfileIds": [
|
||||
336,
|
||||
320,
|
||||
129,
|
||||
337,
|
||||
10,
|
||||
333,
|
||||
@@ -512,7 +503,6 @@ profile_info_dict = {
|
||||
"ea8300_vlan": {
|
||||
"profile_id": "319",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
313,
|
||||
10,
|
||||
314,
|
||||
@@ -557,7 +547,6 @@ profile_info_dict = {
|
||||
"profile_id": "357",
|
||||
"childProfileIds": [
|
||||
352,
|
||||
129,
|
||||
353,
|
||||
354,
|
||||
355,
|
||||
@@ -596,7 +585,6 @@ profile_info_dict = {
|
||||
"ecw5211_vlan": {
|
||||
"profile_id": "364",
|
||||
"childProfileIds": [
|
||||
129,
|
||||
358,
|
||||
359,
|
||||
360,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"model_type": "Profile", "id": 718, "customerId": 8, "profileType": "radius", "name": "Lab-RADIUS", "details": {"model_type": "RadiusProfile", "subnetConfiguration": {"Lab": {"model_type": "RadiusSubnetConfiguration", "subnetAddress": "10.10.0.0", "subnetCidrPrefix": 16, "subnetName": "Lab", "proxyConfig": {"model_type": "RadiusProxyConfiguration", "floatingIpAddress": null, "floatingIfCidrPrefix": null, "floatingIfGwAddress": null, "floatingIfVlan": null, "sharedSecret": null}, "probeInterval": null, "serviceRegionName": "Toronto"}}, "serviceRegionMap": {"Toronto": {"model_type": "RadiusServiceRegion", "serverMap": {"Lab-RADIUS": [{"model_type": "RadiusServer", "ipAddress": "10.10.10.203", "secret": "testing123", "authPort": 1812, "timeout": null}]}, "regionName": "Toronto"}}, "profileType": "radius", "serviceRegionName": "Toronto"}, "createdTimestamp": 1610045826067, "lastModifiedTimestamp": 1610045826067, "childProfileIds": []}
|
||||
{"model_type": "Profile", "id": 129, "customerId": 2, "profileType": "radius", "name": "Lab-RADIUS", "details": {"model_type": "RadiusProfile", "primaryRadiusAuthServer": {"model_type": "RadiusServer", "ipAddress": "10.10.10.203", "secret": "testing123", "port": 1812, "timeout": 5}, "secondaryRadiusAuthServer": null, "primaryRadiusAccountingServer": null, "secondaryRadiusAccountingServer": null, "profileType": "radius"}, "createdTimestamp": 1602263176599, "lastModifiedTimestamp": 1611708334061, "childProfileIds": []}
|
||||
Reference in New Issue
Block a user