def test_1_create_config(self): """ This test case checks whether config blob is already exists if not then creates a new config blob with given parameters. """ baseurl = properties.baseurl js = utils.config_list(login_cookie) for i in range(len(js['results'])): ourResult = js['results'][i]['config_name'] if properties.configuration_name in ourResult: _id = js['results'][i]['id'] createconfig_request = baseurl +("/ajax?request_type=configuration&config_name=%s&sntp_server=pool.ntp.org&log_server=logserver&radio_config_count=2&radio_id[]=2.4G&power[]=10&channel[]=4&admin_status[]=disabled&radio_id[]=5G&power[]=12&channel[]=6&admin_status[]=enabled&wif_config_count=4&wifi_radio_id[0]=2.4G&ssid[0]=MGMT&security[0]=none&passphrase[0]=&wifi_radio_id[1]=5G&ssid[1]=EMP&security[1]=none&passphrase[1]=&wifi_radio_id[2]=2.4G&ssid[2]=STUDENT&security[2]=wpa-psk&passphrase[2]=password&wifi_radio_id[3]=5G&ssid[3]=GUEST&security[3]=wpa2-psk&passphrase[3]=password&config_id=%s" % (properties.configuration_name,_id)) break else: createconfig_request = baseurl + ("/ajax?request_type=configuration&config_name=%s&sntp_server=pool.ntp.org&log_server=logserver&radio_config_count=2&radio_id[]=2.4G&power[]=10&channel[]=4&admin_status[]=disabled&radio_id[]=5G&power[]=12&channel[]=6&admin_status[]=enabled&wif_config_count=4&wifi_radio_id[0]=2.4G&ssid[0]=MGMT&security[0]=none&passphrase[0]=&wifi_radio_id[1]=5G&ssid[1]=EMP&security[1]=none&passphrase[1]=&wifi_radio_id[2]=2.4G&ssid[2]=STUDENT&security[2]=wpa-psk&passphrase[2]=password&wifi_radio_id[3]=5G&ssid[3]=GUEST&security[3]=wpa2-psk&passphrase[3]=password" % properties.configuration_name) createconfig_response = requests.get(createconfig_request,cookies=login_cookie) js1 = json.loads(createconfig_response.text) print js1 if 'Configuration Updated in DB!' in js1['results']['message'] or 'Configuration Saved in DB!' in js1['results']['message']: print "Configuration blob is added in database successfully." else: raise AssertionError("Configuration blob is not added in database.")
def test_1_push_config(self): """ This test case verifies whether Default config is applied to customer. """ global customer_id, config_id baseurl = properties.baseurl js2 = utils.customer_list(login_cookie) for i in range(len(js2['results'])): ourResult = js2['results'][i]['name'] if properties.customer_name == ourResult: customer_id = js2['results'][i]['id'] js = utils.config_list(login_cookie) for i in range(len(js['results'])): ourResult = js['results'][i]['config_name'] if properties.configuration_name in ourResult: config_id = js['results'][i]['id'] default_config_request = baseurl + ("/ajax?request_type=update_default_config_customer&customer_id=%s&config_id=%s&create_config_request=true" % (customer_id,config_id)) config_update_response = requests.get(default_config_request, cookies=login_cookie) js3 = json.loads(config_update_response.text) if "Default Configuration of Customer updated" in js3['results']['message']: print "Default config is applied to customer successfully." else: raise AssertionError("Default config is not applied to customer.")
from gen_timelines import gen_timelines import os import glob from multiprocessing import Pool from utils import DATADumpManager, config_list, hashlist, makenewdir, DumpDataSet from derived_vars import FNLWorkStation, GRAPESWorkStation from asciiio import read_obs from plotmap import plot_data, find_clevels, find_statistics, plot_case, clip_china_data, \ plot_data_zonal, find_clevels_zonal from make_comp import make_comp_pic, make_gif_pic # read the config file CONFIGPATH = './config/' # default config path cong = config_list(CONFIGPATH, ['config.yml', 'devconfig.yml']) # config script for key, value in cong.items(): globals()[key] = value def get_time_indices(var, time_indices, time_incr, times): time_indices_var = time_indices.copy() times_dt = [dt.datetime.strptime(str(time), '%Y%m%d%H') for time in times] fcst_hours = [ int((time_dt - times_dt[0]).total_seconds() // 3600) for time_dt in times_dt ]