def ADD_REALMS2LIST(Region,Realms,LIST_Name): if Region=='': MESSAGE_OUTPUT("Error","Empty Region") elif Realms=='': MESSAGE_OUTPUT("Error","Empty Realm") elif LIST_Name=='': MESSAGE_OUTPUT("Error","Empty LIST") else: Region2URL_DSC(Region) Outputlist_1=[] Outputlist_2=[] Realm_LIST=[] Realms = Realms.lower() Realms = Realms.replace(",",";") temp = Realms.split(";") for realm in temp: Realm_LIST.append(realm.strip()) for realm in Realm_LIST: response=soap_add_list_cache(LIST_Name,realm,SURL1) #response="Success!!" response=realm+" "+response Outputlist_1.append(response) response=soap_add_list_cache(LIST_Name,realm,SURL2) #response="Success!!" response=realm+" "+response Outputlist_2.append(response) BIOUTPUT('Add ListCache',Outputlist_1,Outputlist_2)
def K2R(Region,Realms2,List1,Realms1,Name1,Name2): if Region=='': MESSAGE_OUTPUT("Error","Empty Region") if Realms2=='': MESSAGE_OUTPUT("Error","Empty Realms2") Region2URL_DSC(Region) Outputlist_1=[] Outputlist_2=[] if Region =='NA': #Verison K2R route on NA DSC if Name1 =='Verizon Wireless' or Name2 =='Verizon Wireless': if Name1 =='Verizon Wireless': Realms = SPLITLIST(Reams2) if Name2 =='Verizon Wireless': Realms = SPLITLIST(Reams1) print(Realms) for realm in Realms: response=soap_add_list_cache('LIST_VERIZON_WIRELESS_K2R_RP_REALM',realm,SURL1) #response="Success!!" response='LIST_VERIZON_WIRELESS_K2R_RP_REALM:+'+realm+" "+response Outputlist_1.append(response) response=soap_add_list_cache('LIST_VERIZON_WIRELESS_K2R_RP_REALM',realm,SURL2) #response="Success!!" response='LIST_VERIZON_WIRELESS_K2R_RP_REALM:+'+realm+" "+response Outputlist_2.append(response) BIOUTPUT('Add ListCache LIST_VERIZON_WIRELESS_K2R_RP_REALM',Outputlist_1,Outputlist_2) else: #NA K2R create RF for all realms for realm1 in Realms1: for realm2 in Realms2: DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2) response=Name1+':'+realm1+'>'+Name2+':'+realm2+'RF '+response Outputlist_1.append(response) DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2) response=Name1+':'+realm1+'>'+Name2+':'+realm2+'RF '+response Outputlist_2.append(response) for realm2 in Realms2: for realm1 in Realms1: DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1) response=Name1+':'+realm1+'>'+Name2+':'+realm2+'RF '+response Outputlist_1.append(response) DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1) response=Name1+':'+realm1+'>'+Name2+':'+realm2+'RF '+response Outputlist_2.append(response) BIOUTPUT('Add K2R Filter on NA DSC',Outputlist_1,Outputlist_2) elif Region == 'AP' or Region == 'EU': ADD_REALMS2LIST(Region,Realms2,LIST1)
def K2R(Region,Realms2,List1,Realms1,Name1,Name2): REALMLIST1=SPLIT2LIST(Realms1) REALMLIST2=SPLIT2LIST(Realms2) suffix='.key2roam.comfone.com' if Region=='': MESSAGE_OUTPUT("Error","Empty Region") if Realms2=='': MESSAGE_OUTPUT("Error","Empty Realms2") if List1=='': MESSAGE_OUTPUT("Error","Empty List1") if Realms2=='': MESSAGE_OUTPUT("Error","Empty Name1") if Realms2=='': MESSAGE_OUTPUT("Error","Empty Name2") Region2URL_DSC(Region) Outputlist_1=[] Outputlist_2=[] if Region =='NA': print("na selected") #Verison K2R route on NA DSC if Name1 =='Verizon Wireless' or Name2 =='Verizon Wireless': if Name1 =='Verizon Wireless': Realms = SPLIT2LIST(Realms2) if Name2 =='Verizon Wireless': Realms = SPLIT2LIST(Realms1) for realm in Realms: response=soap_add_list_cache('LIST_VERIZON_WIRELESS_K2R_RP_REALM',realm,SURL1) response='LIST_VERIZON_WIRELESS_K2R_RP_REALM:+'+realm+" "+response Outputlist_1.append(response) response=soap_add_list_cache('LIST_VERIZON_WIRELESS_K2R_RP_REALM',realm,SURL2) response='LIST_VERIZON_WIRELESS_K2R_RP_REALM:+'+realm+" "+response Outputlist_2.append(response) BIOUTPUT('Add ListCache LIST_VERIZON_WIRELESS_K2R_RP_REALM',Outputlist_1,Outputlist_2) else: #NA none Vzw K2R create RF for all realms for realm1 in REALMLIST1: for realm2 in REALMLIST2: DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2) response='#'+Name1+':'+realm1+'->'+Name2+':'+realm2+' RequestFilter\n#'+response Outputlist_1.append(response) DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2+suffix) response='#'+Name1+':'+realm1+'->'+Name2+':'+realm2+suffix+' RequestFilter\n#'+response Outputlist_1.append(response) for realm2 in REALMLIST2: for realm1 in REALMLIST1: DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1) response='#'+Name2+':'+realm2+'->'+Name1+':'+realm1+' RequestFilter\n#'+response Outputlist_1.append(response) DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL1,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1+suffix) response='#'+Name2+':'+realm2+'->'+Name1+':'+realm1+suffix+' RequestFilter\n#'+response Outputlist_1.append(response) for realm1 in REALMLIST1: for realm2 in REALMLIST2: DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2) response='#'+Name1+':'+realm1+'->'+Name2+':'+realm2+' RequestFilter\n#'+response Outputlist_2.append(response) DESC='K2R:%request_filter% '+Name1+"-"+Name2 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm1,destrealm=realm2+suffix) response='#'+Name1+':'+realm1+'->'+Name2+':'+realm2+suffix+' RequestFilter\n#'+response Outputlist_2.append(response) for realm2 in REALMLIST2: for realm1 in REALMLIST1: DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1) response='#'+Name2+':'+realm2+'->'+Name1+':'+realm1+' RequestFilter\n#'+response Outputlist_2.append(response) DESC='K2R:%request_filter% '+Name2+"-"+Name1 response=soap_add_rule(dsc_url=SURL2,ruletype='REQUEST_FILTER',description=DESC,pop_name='NA PoP',origrealm=realm2,destrealm=realm1+suffix) response='#'+Name2+':'+realm2+'->'+Name1+':'+realm1+suffix+' RequestFilter\n#'+response Outputlist_2.append(response) BIOUTPUT('Add K2R Filter on NA DSC',Outputlist_1,Outputlist_2) elif Region == 'AP' or Region == 'EU': KKK='' for realm in REALMLIST2: KKK=KKK+realm+','+realm+suffix+',' KKK=KKK[:-1] ADD_REALMS2LIST(Region,KKK,List1)