Framework.Utils package¶
Submodules¶
Framework.Utils.bottle module¶
Framework.Utils.cli_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.cli_Utils.
connect_ssh
(ip, port='22', username='', password='', logfile=None, timeout=60, prompt='.*(%|#|\\$)', conn_options='', custom_keystroke='', **kwargs)[source]¶ - Initiates SSH connection via a specific port. Creates log file.
- return session as object and conn_string(pre and post login message).
-
Framework.Utils.cli_Utils.
connect_telnet
(ip, port='23', username='', password='', logfile=None, timeout=60, prompt='.*(%|#|\\$)', conn_options='', custom_keystroke='', **kwargs)[source]¶ Initiates Telnet connection via a specific port. Creates log file.
Arguments: - ip = destination ip
- port(string) = telnet port
- username(string) = username
- password(string) = password
- logfile(string) = logfile name
- timeout(int) = timeout duration
- prompt(string) = destination prompt
Returns: 1.telnet session as object 2.conn_string(pre and post login message)
-
Framework.Utils.cli_Utils.
disconnect
(child)[source]¶ - Disconnects a pexpect session
- Returns session object(same child)
-
Framework.Utils.cli_Utils.
get_connection_port
(conn_type, inpdict)[source]¶ Gets the port for ssh or telnet connections 1. ssh :
- looks if ssh_port is present in inpdict.
- if not checks for conn_port
- if both not present returns None
-
Framework.Utils.cli_Utils.
get_response_dict
(started_thread_for_system, thread_instance_list, same_system, response)[source]¶ This function iterates over thread_instance_list and gets the data that the threads have stored in its data variable. Updates the remote_resp_dict with the system name and the corresponding data collected.
The system names in same_system also get stored in the remote_resp_dict but their value is the same as the response that was obtained through the _send_cmd function
Returns: remote_resp_dict (dict) with collected logs as value to the system_name key
-
Framework.Utils.cli_Utils.
get_unique_log_and_verify_list
(log_list, verify_on_list, system_name)[source]¶ This function loops through the log_list and the verify_on_list and returns a unique list containing unique sustem names fromboth the lists
-
Framework.Utils.cli_Utils.
sendPing
(hostname, count, fname)[source]¶ Sends a ping command :Arguments:
- count(string) = no of pings to be sent
- src_iface(string) = source interface from whihc ping messages
- are to be sent.
- destip(string) = the destination ip address to ping.
- fname = logfile to log ping response.
Returns: status = boolean
-
Framework.Utils.cli_Utils.
sendSourcePing
(count, src_iface, destip, fname)[source]¶ Sends a source based ping command i.e. if multiple interfaces are configured and available, sends pings from the src_iface provided :Arguments:
- count(string) = no of pings to be sent
- src_iface(string) = source interface from whihc ping messages
- are to be sent.
- destip(string) = the destination ip address to ping.
- fname = logfile to log ping response.
Returns: status = boolean
-
Framework.Utils.cli_Utils.
send_commands_from_testdata
(testdatafile, obj_session, **args)[source]¶ - Parses the testdata file and gets the command details
for rows marked execute=yes and row=str_rownum. - Sends the obtained commands to the pexpect session (obj_Session). - If the commands have verification attribute set, then verifies the verification text for presence/absence as defined in the respective found attribute in the testdatfile.
Arguments: - testdatafile = the xml file where command details are available
- obj_session = pexpect session object
- logfile = logfile of the pexpect session object.
- varconfigfile= xml file from which the values will be taken for subtitution
- var_sub(string) = the pattern [var_sub] in the testdata commands,
- start_prompt, end_prompt, verification search will substituted with this value.
- args = Optional filter to specify title/rownum
Returns: - finalresult = boolean
-
Framework.Utils.cli_Utils.
send_smart_cmd
(connect_testdata, session_object, tag_value, call_system_name, pre_tag)[source]¶ The beacons of Gondor are lit send out the smart command :param connect_testdata:
the smart testdata file that contains the smart cmdParameters: - session_object – use this pexpect object to send out command
- tag_value – specify the testdata block of commands that get sent out
- call_system_name – in order to get passed the substitutions, a system name must be provided
- pre_tag – Distinguish if it is a connect smart action or disconnect smart action
-
Framework.Utils.cli_Utils.
smart_action
(datafile, call_system_name, raw_prompt, session_object, tag_value, connect_testdata=None)[source]¶ entry function for sending smart command :param datafile:
the testcase datafileParameters: - call_system_name – in order to get passed the substitutions, a system name must be provided
- raw_prompt – The string that will be analyzed in order to find the device system
- session_object – use this pexpect object to send out command
- tag_value – specify the testdata block of commands that get sent out
- connect_testdata – the smart testdata file that contains the smart cmd, optional in here
Returns: the smart testdata file that contains the smart cmd
-
Framework.Utils.cli_Utils.
smart_analyze
(prompt, testdatafile=None)[source]¶ retrieve the correspond smart testdata file for smart cmd from either Tools/connection or testcase testdata file :param prompt:
The string that will be analyzed in order to find the device systemParameters: testdatafile – optional arg to provide a pre-defined device system in the test datafile Returns: the smart datafile that contains the smart cmd to be sent
-
Framework.Utils.cli_Utils.
start_threads
(started_thread_for_system, thread_instance_list, same_system, unique_log_verify_list, system_name)[source]¶ This function iterates over unique_log_verify_list which consists of unique values gotten from monitor attributes and verify_on attributes
If a system_name has a * against it, it indicates that the system is the same as the one on which the testcase is running. Thread would not be started for that system.
Returns: started_thread_for_system (list[str]) = Stores the system names for which threads were succesfully created
thread_instance_list (list[str]) = stores the instances of thread created for corresponding system in the started_thread_for_system list,
same_system (list[str]) = stores the system name which was the same as the system on which the TC is running without the trailing *,
Framework.Utils.config_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Framework.Utils.csv_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.csv_utils.
convert_csv_or_excel_to_xml
(input_file, mapping_file=None, output_xml_file_path=None, overwrite='yes')[source]¶ Takes file path as input 1. If it is excel file, converts to csv and then converts
csv file to xml- If it is csv file, converts to xml file.
- Mapping file is used to map the column names in the excel sheet to
- a meaningful name as recognized by the code.
- Arguments:
- input_file: input_file which is either csv file path or excel file path
- mapping_file: If a mapping file path is given, it is used to map columns with the meaningful name as recognized by the user else the spaces in the column names will be replaced by “_” in the output xml
- output_xml_file_path: If user gives the output_xml_file_path, creating an xml file in that path else creating xml file in the path from where he have given csv or excel file.
- Returns:
1. output_xml_file_path: Returns the output xml file path 2 output_dict: Updates the output_dict with
json string and with output xml.
-
Framework.Utils.csv_utils.
convert_csv_to_list_of_dict
(input_csv_file)[source]¶ Takes the CSV file path as input and converts it to list of dictionaries
- Arguments:
- input_csv_file: it takes CSV file path as input
- Returns:
- Returns list of dictionaries where keys are column names and values are respective column values
-
Framework.Utils.csv_utils.
convert_excel_to_csv
(input_excel_file, output_csv_file_path=None, return_csv_file=False)[source]¶ Takes the excel file path as input and converts into csv file and if we select return_csv_file as True returns csv file else returns csv file object
- Arguments:
input_excel_file: It is a excel file path which is to be converted into csv file
output_csv_file_path: If user gives the output csv path, then creating csv file at that path else creating a csv file
in the directory from where he have given excel file.
return_csv_file: If the user selects return_csv_file as True, returning the output csv file else returning the object.
- Returns:
- Returns the csv file path if user selects return_csv_file as True else returns the object.
-
Framework.Utils.csv_utils.
convert_xml_to_csv
(input_file, mapping_file=None, output_csv_file_path=None, overwrite='yes')[source]¶ It takes xml file path as input and converts to csv.
- Arguments:
- input_file: Takes xml file path as input
- mapping_file: If a mapping file path is given, it is used to map columns with the meaningful name as recognized by the user else the tags in the xml file will be used as column names in the csv file.
- output_csv_file_path: If user gives the output_csv_file_path, creating an csv file in that path else creating csv file in the path from where he have given xml file.
- Returns:
- Returns output csv file path.
Framework.Utils.data_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.data_Utils.
evaluate_tc_argument_value
(element)[source]¶ Splits the value of the attribute value in the argument tag in the TC
-
Framework.Utils.data_Utils.
generate_datafile
(lists_of_systems, output_dir, filename)[source]¶ take in a list of lists which contains systems generate one input data file per list
-
Framework.Utils.data_Utils.
getSystemData
(datafile, system_name, cnode, system='system')[source]¶ Returns the value for tag or attrib of a system or susbsystem
If an attribute and a tag of the same name is present then returns the value of the attribute.
Incase of attribute the value is the attribute value. Incase of a tag the value is the text of the tag.
Arguments: - datafile(string) = absolute path of the system datafile
- system_name (string) = This can be name of the system or a subsystem. In case of subsystem only single subsystem is supported.
- cnode(string) = attributes or tag whose value is to be obtained.
- :Returns:system=’system’
- False if the system/subsystem cannot be found in the datafile.
- If an attribute or tag is not present its value=boolean False
- If a tag is present but has no text its value=None
-
Framework.Utils.data_Utils.
get_all_system_or_subsystem
(datafile, system_name=None)[source]¶ return all the system elements or all the children of a system element with specific name
-
Framework.Utils.data_Utils.
get_child_tag_value_list
(datafile, system_name, child_list=[], *args)[source]¶ Parse the datafile for the system and get the tag list , value list of all the children provided in the child_list
-
Framework.Utils.data_Utils.
get_command_details_from_testdata
(testdatafile, varconfigfile=None, **attr)[source]¶ Gets the command_list, startprompt_list, endprompt_list, verify_list from testdata
-
Framework.Utils.data_Utils.
get_credentials
(datafile, system_name, myInfo=[], tag_name='system', attr_name='name', **kwargs)[source]¶ Takes an list(myInfo) of attribute or tag names as input and returns a dictionary having values for each of the requested attribute or tag name.
If an empty list provided as myInfo returns a dictionary having all the attribute and tags with their values
If an attribute and a tag of the same name is present then returns the value of the attribute.
Incase of attribute the value is the attribute value. Incase of a tag the value is the text of the tag.
If the tag has child elements, the value will be a dictionary with all its child tags as keys & their texts as values.
Arguments: - datafile(string) = absolute path of the system datafile
- system_name (string) = This can be name of the system or a subsystem. In case of subsystem only single subsystem is supported.
- List of attributes or tags whose values are to be obtained.
Returns: - Dictionary of attributes/tags and their values
- False if the system/subsystem cannot be found in the datafile.
- If an attribute or tag is not present its value=boolean False
- If a tag is present but has no text its value=None
-
Framework.Utils.data_Utils.
get_cse_script_args_string
(datafile, system_name)[source]¶ Form the argument string for the CSE script from the arguments provided in datafile
-
Framework.Utils.data_Utils.
get_default_ecf_and_et
(arguments_dict, current_datafile, current_browser, name_tuple=('element_config_file', 'element_tag'), def_name_tuple=('DEF_ecf', 'DEF_et'))[source]¶ Updates selenium argument sict with Default ECF and default element_tag
-
Framework.Utils.data_Utils.
get_filepath_from_system
(datafile, system_name, *args)[source]¶ This function takes variable number of tag names as input and returns a list of absolute paths for all the tag values. In case of non-string tag values, it will simply return those non-string values.
-
Framework.Utils.data_Utils.
get_iteration_syslist
(system_node_list, system_name_list)[source]¶ Takes a list of system nodes and system names and returns. 1. List of system names with iter=yes 2. List of system nodes with iter=yes
-
Framework.Utils.data_Utils.
get_nc_config_string
(config_datafile, config_name, var_configfile=None)[source]¶ Get the config of netconf as a list
-
Framework.Utils.data_Utils.
get_nc_request_rpc_string
(config_datafile, xmlns, request_type, xmlns_tag, var_configfile=None)[source]¶ Get the Request of netconf as a list
-
Framework.Utils.data_Utils.
get_netconf_data
(datafile, config_name, **kwargs)[source]¶ Get the details for netconf from the datafile. The required details are provided as a key,value pair for the **kwargs argument. of example, if rest_url, rest_data are required then while call this funciton as get_netconf_data(datafile, system_name, rest_url=value, rest_data=value)
If the input value of one of them in None then use the value from the datafile else use the provided value
-
Framework.Utils.data_Utils.
get_no_impact_logic
(context_str)[source]¶ Get the silent tag from context return silence value and context value
-
Framework.Utils.data_Utils.
get_object_from_datarepository
(object_key, verbose=True)[source]¶ Gets the value for the object with the provided name from datarepositoy
-
Framework.Utils.data_Utils.
get_session_id
(system_name, session_name=None)[source]¶ Returns the session-id based on the provided system_name :Arguments:
- system_name (string) = This can be name of the system or a subsystem. In case of subsystem only single subsystem is supported.
- session_name (string) = Name of the session to the system or to the session.
Returns: - For system returns system_name + session_name
- For subsystems returns system_name + subsystem_name + session_name
-
Framework.Utils.data_Utils.
get_system_list
(datafile, node_req=False)[source]¶ Get the list of systems from the datafile if node_req = True returns 1. list of system names, 2. list of system nodes if node_rq = False returns on the list of system names
-
Framework.Utils.data_Utils.
get_td_vc
(datafile, system_name, td_tag, vc_tag)[source]¶ Get the testdata and varconfig file paths from the datafile using the testdata nd varconfig tag given as input
-
Framework.Utils.data_Utils.
get_user_specified_tag_values_in_tc
(datafile, system_name, **kwargs)[source]¶ Get the details for rest call from the datafile. The required details are provided as a key,value pair for the **kwargs argument of example, if rest_url, rest_data are required then while call this funciton as get_user_specified_tag_values_in_tc(datafile, system_name, rest_url=value, rest_data=value)
If the input value of one of them in None then use the value from the datafile else use the provided value
-
Framework.Utils.data_Utils.
get_var_configfile
(datafile, system_name)[source]¶ Gets the var config file for the system with provided system_name in the datafile
-
Framework.Utils.data_Utils.
get_verify_text_context_as_list
(testdata, verify_list)[source]¶ From the testdata file takes a testdat node and a list of nodes with verification present as input
Return: - a list of verifcation_text
- a list of verification context
-
Framework.Utils.data_Utils.
group_systems_with_same_tag_value
(root, tag, value)[source]¶ Put systems with the same tag value pair in one list and all other system in another list
-
Framework.Utils.data_Utils.
group_systems_with_unique_tag_value
(root, tag)[source]¶ Separate system into lists where each list only has system with unique tag value
-
Framework.Utils.data_Utils.
process_subsystem_list
(datafile, system_name, subsystem=None)[source]¶ Takes a system_name and a list of subsystem names as input and process them by removing blank spaces for each element in the subsystem name list. Then remove all duplicate entries in the list. If any input subsystem_name in the list is ‘all’, a list of all subsystem exist under the provided system_name in the datafile will be return. If the system_name is not found in the datafile, subsystem_list will be set None.
-
Framework.Utils.data_Utils.
resolve_argument_value_to_get_tag_value
(datafile, system_name, element_value_in_argument)[source]¶ Here, the value of the attribute value in the argument tag is resolved. From now on value represents the value of the attribute value in the argument tag in the TC
Conditions: value can be simple and direct. Eg. “http://httpbin.org”. In this case, it is returned as is.
value can start with tag, then everything after “=” is taken and a tag of that name is searched for under the provided system in the datafile. If tag of the same name is found, then the text of that tag is returned.
If tag is not found, then a False is returned.
If no system tag with the name as that of the system name is found then, then value is returned.
-
Framework.Utils.data_Utils.
resolve_system_subsystem_list
(datafile, system_name)[source]¶ Using the provided system_name which may include both system_name and subsystem_name. Ex: NE1[dip,cli] Call ‘split_system_subsystem’ to separate the system_name and subsystem(s) Then call ‘process_subsystem_list’ to compare the list of subsystem(s) from the input against actuals subsystem in the referenced datafile. Return a system_name, subsystem_list
-
Framework.Utils.data_Utils.
split_system_subsystem
(system_name)[source]¶ Separate system_name and subsystem_name str from the input Ex: system_name=NE1[cli,dip,if1] will be separate into
system_name=NE1 subsystem_name str = ‘cli, dip, if1’
-
Framework.Utils.data_Utils.
sub_from_env_var
(raw_value, start_pattern='${', end_pattern='}')[source]¶ Takes a key value pair as input, if the value has a pattern matching ${ENV.env_variable_name}. Searches for the env_variable_name in the environment and replaces it and return the updated dictionary. If environment variable is not found then substitutes with None
-
Framework.Utils.data_Utils.
update_datarepository
(input_dict)[source]¶ Updates the data repository with the provided dictionary
-
Framework.Utils.data_Utils.
verify_cmd_response
(match_list, context_list, command, response, verify_on_system, varconfigfile=None, endprompt='')[source]¶ Verifies the response with the provided match and context list
-
Framework.Utils.data_Utils.
verify_data
(expected, key, type='str', comparison='eq')[source]¶ Verify the value of the key in data repository matches with expected value
-
Framework.Utils.data_Utils.
verify_inorder_cmd_response
(match_list, verify_list, system, command, verify_dict)[source]¶ Verifies search strings in the system response and matches the received response order with the expected order
-
Framework.Utils.data_Utils.
verify_resp_across_sys
(match_list, context_list, command, response, varconfigfile=None, verify_on_list=None, verify_list=None, remote_resp_dict=None, endprompt='')[source]¶ New method to verify response of a command sent on one system with the response recieved from another system
-
Framework.Utils.data_Utils.
verify_resp_inorder
(match_list, context_list, command, response, varconfigfile=None, verify_on_list=None, verify_list=None, remote_resp_dict=None)[source]¶ Method for in-order search. Verifies the ‘search strings’ in the system response and also verifies whether they are in order or not
Framework.Utils.datetime_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.datetime_utils.
get_current_timestamp
()[source]¶ Returns system current timestamp with date and month Arguments:
No args
- Returns:
- Current System Time in the format of Year, Month, Date, Time(without microseconds)
- eg: 2015-04-27 09:48:21
-
Framework.Utils.datetime_utils.
get_hms_for_seconds
(seconds)[source]¶ prints number of seconds in hours:minutes:seconds format
-
Framework.Utils.datetime_utils.
get_time_delta
(start_time, end_time=None)[source]¶ Returns system current timestamp with date and month Arguments:
- time_stamp = time stamp in the format of system datetime(without microseconds)
- eg: 2015-04-27 09:48:21
- Returns:
- Time delta = Returns time difference between the present system time and between the time
- stamp which comes as argument in the format of seconds.
- eg: 212342.0
Framework.Utils.demo_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Framework.Utils.dict_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.dict_Utils.
convert_string_to_dict
(element, key_value_pair_sep=';', key_value_sep='=')[source]¶ This function converts a string into a dict.
input = “foo=foo1; bar=bar1; ; =foobar; barfoo=” return value = {‘foo’: ‘foo1’, ‘bar’: ‘bar1’}If the dict is empty at the end of the function, None is returned
Framework.Utils.driver_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.driver_Utils.
execute_keyword
(keyword, data_repository, args_repository, package_list)[source]¶ Executes the keyword provided by product driver 1. searches for class methods in the package list 2. searches for independent functions in the package list 3. If class method matching the keyword is found in the actions package executes it
else searches for independent fucntions matching the keyword name and executes it
Framework.Utils.email_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.email_utils.
compose_send_email
(type, abs_filepath, logs_dir, results_dir, result)[source]¶ compose and sends email from smtp server using input arguments as: type of test case/suite/project full path of logs directory full path of results directory subject line
-
Framework.Utils.email_utils.
get_email_params
()[source]¶ initialize all parameters needed to send email from w_settings.xml
-
Framework.Utils.email_utils.
send_email
(smtp_host, sender, receivers, subject, body, files)[source]¶ sends email from smtp server using input arguments as: smtp host sender email receiver email subject line attached files (optional) can be None
-
Framework.Utils.email_utils.
set_params_send_email
(addsubject, data_repository, files)[source]¶ - From data_repository array constructs body of email
- using testcase/testsuite name, logs directory, results directory fetches smtp host, sender, receiver from w_settings.xml uses paramters such as: subject, body, attachments
- Arguments:
- subject - email subject
- data_repository - array of email body lines e.g.
- testcase/testsuite name
- logs directory
- results directory
- files - list of file attachments
Framework.Utils.encryption_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Framework.Utils.file_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.file_Utils.
check_and_create_dir
(dirpath)[source]¶ Checks if dir exists in provided path. If dir exists returns True Elseif dir does not exists, tries to create a directory
- If dir created successfully, returns True.
- If dir creation failed returns false
-
Framework.Utils.file_Utils.
check_extension_get_absolute_path
(relative_path, start_directory, list_extn=['.json', '.xml', '.txt'])[source]¶ This is wrapper function that gets and verifies extention of a file path and then returns the absolute path. start_directory must be an absolute path
-
Framework.Utils.file_Utils.
close
(fd)[source]¶ Close the file. A closed file cannot be read or written any more. :Arguments:
fd - file descriptor got from open_fileReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copy
(src, dst)[source]¶ Copy the file src to the file or directory dst. If dst is a directory, a file with the same basename as src is created (or overwritten) in the directory specified. Permission bits are copied. src and dst are path names given as strings. :Arguments:
src - file to be copied dst - file/dir on which to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copy2
(src, dst)[source]¶ Similar to shutil.copy(), but metadata (permissions etc., as mentioned in copy_stat above) is copied as well in fact, this is just shutil.copy() followed by copystat(). This is similar to the Unix command cp -p. :Arguments:
src - file and metadata to be copied dst - file/dir on which to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copyfile
(src, dst)[source]¶ Copy the contents (no metadata) of the file named src to a file named dst. dst must be the complete target file name. :Arguments:
src - file to be copied dst - file on which to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copyfileobj
(fsrc, fdst)[source]¶ Copy the contents of the file-like object fsrc to the file-like object fdst. :Arguments:
fsrc - file descriptor of the file to be copied fdst - file descriptor of the file on which to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copymode
(src, dst)[source]¶ Copy the permission bits from src to dst. The file contents, owner, and group are unaffected. src and dst are path names given as strings. :Arguments:
src - mode of the file to be copied dst - file on which mode has to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
copystat
(src, dst)[source]¶ Copy the permission bits, last access time, last modification time, and flags from src to dst. The file contents, owner, and group are unaffected. src and dst are path names given as strings. :Arguments:
src - permission bits of the file to be copied dst - file on which permission bits has to be copiedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
createDir
(path, dirname)[source]¶ Creates a new directory with name = dirname under the provided path, ignores if directory with same name already exists Arguments:
- path = (string) full path of an existing directory where a new directory need to be created
- dirname = (string) name of the new directory to be created
-
Framework.Utils.file_Utils.
createDir_addtimestamp
(path, dirname)[source]¶ Creates a new directory with name = dirname under the provided path, if directory with same name already exists adds date+timestamp to the name and creates a new directory with name = dirname+date×tamp Arguments:
- path = (string) full path of an existing directory where a new directory need to be created
- dirname = (string) name of the new directory to be created
-
Framework.Utils.file_Utils.
create_execution_directory
(filepath)[source]¶ Gets a Testcase/Testsuite/Project.xml filepath as input, Checks if a directory called Execution exits at the same level of Testcase/Testsuite/Project directory If it does not exist creates a directory called Execution.
-
Framework.Utils.file_Utils.
fileno
(fd)[source]¶ Returns the integer file descriptor that is used by the underlying implementation to request I/O operations from the operating system. :Arguments:
fd - file descriptor got from open_fileReturn: integer file descriptor
-
Framework.Utils.file_Utils.
flush
(fd)[source]¶ Flush the internal buffer, like stdio’s fflush. This may be a no-op on some file-like objects. :Arguments:
fd - file descriptor got from open_fileReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
getAbsPath
(relative_path, start_directory='.')[source]¶ This function is used to manipulate the path according to the relative path that is specified
Arguments: - @param relative_path: The relative path of directory or file
- @param start_directory: The actual dir path where the file must be
Returns: - @return: Returns the abspath with the relative path specified
-
Framework.Utils.file_Utils.
getDateTime
(time_format=None)[source]¶ Returns the current year-month-date_hour-minute-second
-
Framework.Utils.file_Utils.
getDirName
(filepath)[source]¶ returns the directory component for the path provided
-
Framework.Utils.file_Utils.
getLinesBetweenMatchingLines
(srcfile, dstfile, start, end, no_of_search=1)[source]¶
-
Framework.Utils.file_Utils.
getXMLDataFile
(filename, path)[source]¶ Get the xml Datafile for ‘.py’ testcases
-
Framework.Utils.file_Utils.
get_absolute_path_from_start_directory
(relative_path, start_directory, extension='.json')[source]¶ DEPRECATED IN 2.9
Keyword developer must be aware that relative path can be relative to 1. testcase file 2. data file (if path is given in tag= value) start_directory must be an absolute path
-
Framework.Utils.file_Utils.
get_absolute_path_of_directory
(relative_path_of_dir, start_directory)[source]¶ DEPRECATED IN 2.9
When provided with a start directory and a relative path of a directory, this function returns the absolute path. Else returns the relative path
Keyword developer must be aware that relative path can be relative to 1. testcase file 2. data file (if path is given in tag= value) start_directory must be an absolute path
-
Framework.Utils.file_Utils.
get_current_position
(fd)[source]¶ Returns the file’s current position :Arguments:
fd - file descriptor got from open_fileReturn: current position of the file, -1 if error occurred
-
Framework.Utils.file_Utils.
get_extension_from_path
(path)[source]¶ Takes a filepath as input and returns the extension (extension is everything from the last dot to the end) If the input is a directory, the extension returned will be empty
- Arguments:
- path = path of the file or directory
-
Framework.Utils.file_Utils.
get_file_from_remote_server
(remote_ip, remote_uname, remote_passwd, src, dest, logfile=None)[source]¶
-
Framework.Utils.file_Utils.
get_file_mode
(fd)[source]¶ Returns access mode with which file was opened. :Arguments:
fd - file descriptor got from open_fileReturn: mode
-
Framework.Utils.file_Utils.
get_file_name
(fd)[source]¶ Returns name of the file. :Arguments:
fd - file descriptor got from open_fileReturn: name of the file, empty string if there was an exception
-
Framework.Utils.file_Utils.
get_lines_between
(fd, startidx, endidx)[source]¶ Get lines between args[0] to args[1] :Arguments:
startidx - line index from which to send endidx - line index till to be sendReturn: lines between startidx and endidx
-
Framework.Utils.file_Utils.
get_next_line
(fd)[source]¶ Returns the next line from the file each time it is being called. :Arguments:
fd - file descriptor got from open_fileReturn: next line
-
Framework.Utils.file_Utils.
get_parent_dir
(path, child)[source]¶ This function gets the parent directory of any a specified child folder from the given path
-
Framework.Utils.file_Utils.
is_file_closed
(fd)[source]¶ Returns true if file is closed, false otherwise. :Arguments:
fd - file descriptor got from open_fileReturn: True/False - description above
-
Framework.Utils.file_Utils.
is_softspace_required
(fd)[source]¶ Returns false if space explicitly required with print, true otherwise. :Arguments:
fd - file descriptor got from open_fileReturn: True/False - description above
-
Framework.Utils.file_Utils.
isatty
(fd)[source]¶ Returns True if the file is connected to a tty(-like) device, else False. :Arguments:
fd - file descriptor got from open_fileReturn: True/False - description above
-
Framework.Utils.file_Utils.
move
(src, dst)[source]¶ Recursively move a file or directory (src) to another location (dst). If the destination is an existing directory, then src is moved inside that directory. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics.If the destination is on the current filesystem, then os.rename() is used. Otherwise, src is copied (using shutil.copy2()) to dst and then removed. :Arguments:
src - source file to be moved dst - target file/directory on which to be movedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
move_to_position
(fd, offset, **kwargs)[source]¶ Sets the file’s current position :Arguments:
fd - file descriptor got from open_file offset - number of bytes to be movedOptional: - whence -
0 - move offset positions from beginning of file 1 - move offset positions from current position of file 2 - move offset positions from end of file
Return: current position after movement
-
Framework.Utils.file_Utils.
move_to_text
(fd, pattern, n=1)[source]¶ seek to a text in the file :Arguments:
pattern - the regular expression pattern to search for in the file n - seek to the nth occurrence from beginning, default first occurrence
use negative indices for from the endReturn: True/False - based success or failure of seeking
-
Framework.Utils.file_Utils.
open_file
(newfile, mode)[source]¶ Opens the newfile in the mode specified and returns the filedescriptor which would be used by all the other file util operations. :Arguments:
newfile - name of the file to be opened mode - mode determines the mode in which the file has to be opened, i.e., read, write, append, etc.
- r - Opens a file for reading only. The file pointer is placed at
- the beginning of the file. This is the default mode.
- rb - Opens a file for reading only in binary format. The file
- pointer is placed at the beginning of the file. This is the default mode.
- r+ - Opens a file for both reading and writing. The file pointer
- placed at the beginning of the file.
- rb+ - Opens a file for both reading and writing in binary format.
- The file pointer placed at the beginning of the file.
- w - Opens a file for writing only. Overwrites the file if the file
- exists. If the file does not exist, creates a new file for writing.
- wb - Opens a file for writing only in binary format. Overwrites
- the file if the file exists. If the file does not exist, creates a new file for writing.
- w+ - Opens a file for both writing and reading. Overwrites the
- existing file if the file exists. If the file does not exist, creates a new file for reading and writing.
- wb+ - Opens a file for both writing and reading in binary format.
- Overwrites the existing file if the file exists. If the file does not exist, creates a new file for reading and writing.
- a - Opens a file for appending. The file pointer is at the end of
- the file if the file exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for writing.
- ab - Opens a file for appending in binary format. The file pointer
- is at the end of the file if the file exists. That is, the file is in the append mode. If the file does not exist, it creates a new file for writing.
- a+ - Opens a file for both appending and reading. The file pointer
- is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing.
- ab+ - Opens a file for both appending and reading in binary format.
- The file pointer is at the end of the file if the file exists. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing.
Return: fd - file descriptor of the new file opened
-
Framework.Utils.file_Utils.
put_file_to_remote_server
(remote_ip, remote_uname, remote_passwd, src, dest, logfile=None)[source]¶
-
Framework.Utils.file_Utils.
read
(fd, **kwargs)[source]¶ Reads at most size bytes from the file (less if the read hits EOF before obtaining size bytes). :Arguments:
fd - file descriptor got from open_fileOptional: size - number of bytes to be read Return: the string read from the file, None if not able to read
-
Framework.Utils.file_Utils.
readline
(fd, **kwargs)[source]¶ Reads one entire line from the file. A trailing newline character is kept in the string. :Arguments:
fd - file descriptor got from open_fileReturn: the line read
-
Framework.Utils.file_Utils.
readlines
(fd, **kwargs)[source]¶ Reads until EOF using readline() and return a list containing the lines. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (possibly after rounding up to an internal buffer size) are read. :Arguments:
fd - file descriptor got from open_fileReturn: list of lines from the file
-
Framework.Utils.file_Utils.
remove
(nfile)[source]¶ removes the file from the filesystem :Arguments:
nfile - filepath to be removedReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
truncate
(fd, **kwargs)[source]¶ Truncates the file’s size. If the optional size argument is present, the file is truncated to (at most) that size. :Arguments:
fd - file descriptor got from open_fileOptional: size - size up to which to truncate Return: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
write
(fd, string)[source]¶ Writes a string to the file. :Arguments:
fd - file descriptor got from open_file str - string to writeReturn: True/False - based on the success/failure of the operation
-
Framework.Utils.file_Utils.
writelines
(fd, seq)[source]¶ Writes a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings. :Arguments:
fd - file descriptor got from open_file sequence - sequence of lines to be writtenReturn: True/False - based on the success/failure of the operation
Framework.Utils.import_utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.import_utils.
import_submodules
(package, recursive=True)[source]¶ Import all submodules of a package, recursively, including subpackages
Arguments: 1. package = (string) name of the package
(module) loader of the package- recrusive = (bool) True = load packages and modules from all sub-packages as well.
- (bool) False = load only first level of packages and modules, do not load modules from sub packages
Framework.Utils.list_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.list_Utils.
get_list_by_separating_strings
(list_to_be_processed, char_to_be_replaced=', ', str_to_replace_with_if_empty=None)[source]¶ This function converts a list of type: [‘str1, str2, str3’, ‘str4, str5, str6, str7’, None, ‘str8’] to: [[‘str1’, ‘str2’, ‘str3’], [‘str4’, ‘str5’, ‘str6’, ‘str7’], [], [‘str8’]]
Framework.Utils.print_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.print_Utils.
print_debug
(message, *args)[source]¶ Print a debug message to the terminal
-
Framework.Utils.print_Utils.
print_error
(message, *args)[source]¶ Prints an error message to the terminal
-
Framework.Utils.print_Utils.
print_exception
(exception)[source]¶ Print details of an exception to the console
-
Framework.Utils.print_Utils.
print_info
(message, *args)[source]¶ Print an info message to the terminal
-
Framework.Utils.print_Utils.
print_notype
(message, *args)[source]¶ Prints with out print type(-I-,-E-),with color cyan in bold TEXT
-
Framework.Utils.print_Utils.
print_sub
(message, *args)[source]¶ Substitutes the string with *args tuple provided User has to provide the place holder for substitution in the message as {0}, {1}, {2} ..etc and the corresponding values in the *args.
Eg: print_sub(“My name is {0} {1}, I live in {2}”, ‘John’, ‘Doe’, ‘Texas’) Output: My Name is John Doe, I live in Texas
Framework.Utils.rest_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.rest_Utils.
check_ext_get_abspath
(relative_path, start_directory, list_extn=['.json', '.xml', '.txt'])[source]¶ This is wrapper function that gets and verifies extention of a file path and then calls get_abs_path_from_start_dir and returns the absolute path. start_directory must be an absolute path
-
Framework.Utils.rest_Utils.
dict_in_tuple
(element)[source]¶ This function evaluates the value of the files tag and returned validated data.
input: string
(path/to/file5.txt;content_type;(header1=value;header2=value2)), (path/to/file1.txt;content_type;(header3=value3;header4=value4))
output: dict
{ file5.txt: (file5.txt, open file5.txt (in binary mode), content_type, { header1: value, header2: value2 }), file1.txt: (file1.txt, open file5.txt (in binary mode), content_type, { header3: value3, header4: value4 }) }
-
Framework.Utils.rest_Utils.
dict_with_file_paths
(element)[source]¶ This function evaluates the value of the files tag and returned validated data.
input: string
file_group_name=path/to/file2.txt; path/to/file3.txt
output: dict
{ file_group_name_1: open file2.txt (in binary mode), file_group_name_2: open file3.txt (in binary mode), }
-
Framework.Utils.rest_Utils.
get_abs_path_from_start_dir
(relative_path, start_directory, extension='.json')[source]¶ When provided with a start directory and a relative path, this function returns the absolute path. Else returns the relative path start_directory must be an absolute path
-
Framework.Utils.rest_Utils.
get_all_file_paths
(element)[source]¶ This function evaluates the value of the files tag and returned validated data.
input: string
path/to/file1.txt, path/to/file2.txt
output: dict
{ file1.txt: open file1.txt (in binary mode), file2.txt: open file2.txt (in binary mode), }
-
Framework.Utils.rest_Utils.
get_type_of_api_response
(response)[source]¶ Takes API response as input and returns the type of the response whether it is json or xml or text Arguments:
response: It takes API response as input- Returns:
- returns the type of the response
-
Framework.Utils.rest_Utils.
just_a_tuple
(element)[source]¶ This function evaluates the value of the files tag and returned validated data.
input: string
(path/to/file4.txt;content_type), (path/to/file1.txt;content_type)
output: dict
{ file4.txt: (file4.txt, open file4.txt (in binary mode), content_type) file1.txt: (file1.txt, open file1.txt (in binary mode), content_type) }
-
Framework.Utils.rest_Utils.
remove_invalid_req_args
(credentials_dict, invalid_args)[source]¶ This function iterates through the invalid_args list and removes the elements in that list from credentials_dict and adds those to a new dictionary
- Returns:
- credentials_dict: Input dictionary after popping the elements in invalid_args invalid_args_dict: All popped elements.
-
Framework.Utils.rest_Utils.
resolve_credentials_for_rest
(credentials, element, datafile=None, system_name=None, variable_config='variable_config', var_sub='var_sub')[source]¶
-
Framework.Utils.rest_Utils.
resolve_exp_resp_string_as_list
(element)[source]¶ User given comma separated data is converted into a list. If no data is given, then an empty list is formed.
-
Framework.Utils.rest_Utils.
resolve_value_of_cert
(element)[source]¶ This function verifies the value of the parameter cert. cert takes in either a path to the certificate file or a tuple containing the cerificate file and if the key is not included in that file, then a file containing the key. Else None.
- This function evaluates user input for cookies. If a file path is given,
- then a cookiejar object is created and the contents of the file are loaded into the object. This object is then returned.
Else, a dictionary would be created out of the string given input = “foo=foo1; bar=bar1; ; =foobar; barfoo=” return value = {‘foo’: ‘foo1’, ‘bar’: ‘bar1’}
If the dictionary is empty at the end of the function, None is retuened.
-
Framework.Utils.rest_Utils.
resolve_value_of_data
(element, datafile)[source]¶ This function validates the user input for data. If the input is a file path, then a file object is returned. if the input is in bytes, then the input is retuned. else, dictionary is returned.
input = “foo=foo1; bar=bar1; ; =foobar; barfoo=” return value = {‘foo’: ‘foo1’, ‘bar’: ‘bar1’}If the dict is empty at the end of the function, None is returned
-
Framework.Utils.rest_Utils.
resolve_value_of_files
(element)[source]¶ This function evaluates the value of the files tag and returned validated data.
input: string
path/to/file1.txt, file_group_name=path/to/file2.txt; path/to/file3.txt, (path/to/file4.txt;content_type), (path/to/file5.txt;content_type;(header1=value;header2=value2))
output: dict
{ file1.txt: open file1.txt (in binary mode), file_group_name_1: open file2.txt (in binary mode), file_group_name_2: open file3.txt (in binary mode), file4.txt: (file4.txt, open file4.txt (in binary mode), content_type) file5.txt: (file5.txt, open file5.txt (in binary mode), content_type,
{ header1: value, header2: value2 })}
-
Framework.Utils.rest_Utils.
resolve_value_of_json
(element, datafile=None, system_name=None, variable_config=None, var_sub=None)[source]¶ Input string or file is converted to a json object. If an exception occurs, ‘Error’ is returned.
-
Framework.Utils.rest_Utils.
resolve_value_of_redirects
(element)[source]¶ If allow_redirects is specifically set not no (case ignored), then and only then allow_redirects is set to False. Else is set to true.
-
Framework.Utils.rest_Utils.
resolve_value_of_stream
(element)[source]¶ This function verifies the value of the parameter stream. If set explicitly to ‘no’, it would be evaluated as False, else True.
-
Framework.Utils.rest_Utils.
resolve_value_of_timeout
(element)[source]¶ The value given by the User, either in the datafile or in the TC, for the “timeout” parameter is assessed here. The User can either give a single value or comma separated value.
- Requests docs for timeout:
- ** :param timeout: (optional) How long to wait for the server to send data
- before giving up, as a float, or a (connect timeout, read timeout) tuple.
If a single value is given, then that value is used for both connect timeout and read timeout
If more than two comma separated values are given, only the first two are considered.
If the input is invalid (i.e. it is neither an integer, nor a float), then this function throws out an error, but keeps the user specified values, so that the Error can be caught when the keyword actually executes.
Framework.Utils.selenium_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.selenium_Utils.
execute_script
(browser_instance, user_script)[source]¶ To exceute a user provided script
-
Framework.Utils.selenium_Utils.
get_browser_details
(browser, datafile, br_name='browser_name', def_name_tuple=('DEF_ecf', 'DEF_et'), **kwargs)[source]¶
-
Framework.Utils.selenium_Utils.
get_default_tag_for_locs
(config_file, element_tag, locator_types)[source]¶
This function checks for default tags under the current <browser>
-
Framework.Utils.selenium_Utils.
get_element_from_config_file
(config_file, element_tag, child_tag, is_locator_type='no', default=False)[source]¶ Gets default locators from json file
-
Framework.Utils.selenium_Utils.
get_final_json_values
(element, final_dict, mapper, def_name_tuple)[source]¶ This gets JSON values for every element and updates the dictionary
-
Framework.Utils.selenium_Utils.
get_mapped_to_elements
(mapper)[source]¶ The mapper list contains all the element names that have been mapped to by other elements
-
Framework.Utils.selenium_Utils.
get_mappers_for_all_elements
(final_dict, def_name_tuple)[source]¶ This function gets the user defined mappings for tags and stores them in a mapper dictionary
-
Framework.Utils.selenium_Utils.
save_screenshot_onerror
(status, current_browser)[source]¶ To get the filename, directory name and to take screenshot of the current browser window
-
Framework.Utils.selenium_Utils.
split_kwargs_on_tag_equalto
(kwargs, datafile, browser)[source]¶ This function splits kwargs on tag= If the value is an xpath, then it follows the xpath and returns the value Else, if is it a singular tag name, then it searched for a tag with that name under the current <browser>
Framework.Utils.string_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.string_Utils.
compare_string_using_regex
(response, list_of_regex_patterns)[source]¶ Checks whether each regular expression is present in response and if all are present returns True else False
-
Framework.Utils.string_Utils.
get_list_from_varconfigfile
(string, varconfigfile, start_pat='${', end_pat='}')[source]¶
-
Framework.Utils.string_Utils.
replace_from_varconfig
(varconfigfile, details_dict, var_sub=None)[source]¶
-
Framework.Utils.string_Utils.
return_quote
(a, start_pat='${', end_pat='}')[source]¶ - return the list of element that needs to be substituted in a string
Parameters: a – Returns:
-
Framework.Utils.string_Utils.
seek_next
(pattern, data)[source]¶ find the next pattern in the data and return its position
-
Framework.Utils.string_Utils.
strip_white_spaces
(input_list)[source]¶ Takes a list of string as input Removes the leading and trailing white spaces from each string in the list Returns an output list having the string elements with leading and trailing white spaces removed
-
Framework.Utils.string_Utils.
sub_from_varconfig
(varconfigfile, string_list, var_sub=None, start_pat='${', end_pat='}')[source]¶ Replaces the string variables with their values taken from varconfig_file. :Arguments:
- varconfigfile - xml file or list of xml files from which the values will be taken for subtitution
- string_list - List of command strings, where the variables will be replaced by the config values
- var_sub(string) = the pattern [var_sub] in the testdata commands,
- start_prompt, end_prompt, verification search will substituted with this value.
Returns: - List of command strings with replaced values or False(boolean) - if any one of the variables does not exist in varconfig_file
-
Framework.Utils.string_Utils.
sub_from_varconfigfile
(string, varconfigfile, start_pat='${', end_pat='}')[source]¶
-
Framework.Utils.string_Utils.
sub_from_varsub
(string, var_sub)[source]¶ Replace the pattern [var_sub] in the string with the value of var_sub
Arguments: 1. string(string) = input string which needs substitution 3. var_sub(string) = value to replace the pattern [var_sub]
in the input string
Returns: - updated string
Framework.Utils.telnet_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Framework.Utils.telnet_Utils.
Tnet_Comm
(target, port='', uid='', pid='', logfile='telnet_log', cmd_rsp=None)[source]¶ Bases:
object
Does communication with the NE/Server using Telnet protocol Write/Read commands to and from the NE/Server
-
get_response
(cmd_string, prompt, timeout=120)[source]¶ Reads the output till the prompt and returns the result and reports Failure on mismatch of response
-
Framework.Utils.testcase_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.testcase_Utils.
TCOBJ
= <WarriorCore.Classes.testcase_utils_class.TestcaseUtils object>¶
-
Framework.Utils.testcase_Utils.
add_defects_to_resultfile
(resultfile, defect_id)[source]¶ Adds defects if any to the testcase result file
-
Framework.Utils.testcase_Utils.
append_result_files
(dst_resultfile, kw_resultfile_list, dst_root='Testcase')[source]¶ append kw/system result xml files into testcase result xml file
-
Framework.Utils.testcase_Utils.
compute_status_using_impact
(input_status_list, input_impact_list, status=True)[source]¶ Computes the status from the list of input status and input impact
-
Framework.Utils.testcase_Utils.
compute_status_without_impact
(input_status_list, status=True)[source]¶ Computes the system status from the list of step status adn impact
-
Framework.Utils.testcase_Utils.
compute_system_resultfile
(kw_resultfile_list, resultsdir, system_name)[source]¶ Generates a system resultfile from the list of keyword result files
-
Framework.Utils.testcase_Utils.
convertLogic
(text)[source]¶ Converts True -> PASS False -> FAIL ERROR -> ERROR EXCEPTION -> ERROR
-
Framework.Utils.testcase_Utils.
get_context_from_xmlfile
(element)[source]¶ Gets the context value of a step/testcase/suite from the testcase.xml/testsuite.xml/project.xml file
-
Framework.Utils.testcase_Utils.
get_defonerror_fromxml_file
(filepath)[source]¶ Gets the default on error value of a step/testcase/suite from the testcase.xml/testsuite.xml/project.xml file
-
Framework.Utils.testcase_Utils.
get_description_from_xmlfile
(element)[source]¶ Gets the description value of a step/testcase/suite from the testcase.xml/testsuite.xml/project.xml file
-
Framework.Utils.testcase_Utils.
get_impact_from_xmlfile
(element)[source]¶ Gets the impact value of a step/testcase/suite from the testcase.xml/testsuite.xml/project.xml file
-
Framework.Utils.testcase_Utils.
get_requirement_id_list
(testcase_filepath)[source]¶ gets the list of requirements for the testcase
-
Framework.Utils.testcase_Utils.
get_steps_list
(testcase_filepath)[source]¶ Takes the location of any Testcase xml file as input Returns a list of all the step elements present in the Testcase
Arguments: - testcase_filepath = full path of the Testcase xml file
-
Framework.Utils.testcase_Utils.
get_wdesc_string
(function_object)[source]¶ Gets the WDesc string from the function object
-
Framework.Utils.testcase_Utils.
pConvertLogical
(text)[source]¶ map NO=false, YES=True and return the bool to the calling function
-
Framework.Utils.testcase_Utils.
pCustomTag
(name, txt)[source]¶ Adds a note to the testcase xml result file under the current tag :Arguments:
- txt = (string) a text description of the step
- print_type(string) = type of print - info/debug/error/exception/warn/None
Returns: None
-
Framework.Utils.testcase_Utils.
pDriver
(driver_txt)[source]¶ create a driver tag in testcase result xml file
-
Framework.Utils.testcase_Utils.
pKeyword
(keyword_txt, driver_txt)[source]¶ Creates a keyword tag as direct child to the <Testcase> tag
-
Framework.Utils.testcase_Utils.
pNote
(txt, print_type='info')[source]¶ Adds the provided txt as a note to the test case xml result file under the current tag and also prints the txt to the console. :Arguments:
- txt (string) = a text to be written to result file and printed to the console.
Returns: None
-
Framework.Utils.testcase_Utils.
pNote_level
(txt, ptype='info', level=None, ptc=True)[source]¶ Create Note at the provided level
-
Framework.Utils.testcase_Utils.
pReportRequirements
(requirement_id)[source]¶ Report the requirement-id to the xml result file
-
Framework.Utils.testcase_Utils.
pStep
(step_txt='')[source]¶ create a step tag in testcase result xml file
-
Framework.Utils.testcase_Utils.
pSubKeyword
(subkey_txt='')[source]¶ Adds the provided txt as a note to the test case xml result file under the current tag and also prints the txt to the console. :Arguments:
- txt (string) = a text to be written to result file and printed to
- the console.
Returns: None
-
Framework.Utils.testcase_Utils.
pSubStep
(substep_txt='')[source]¶ Creates a substep tag in test case result xml file
-
Framework.Utils.testcase_Utils.
pTestResult
(text, resultfile)[source]¶ report test case reult in result xml file
-
Framework.Utils.testcase_Utils.
pTestcase
()[source]¶ Creates a root tag in the testcase result xml file
-
Framework.Utils.testcase_Utils.
reportKeywordStatus
(status, kw_name)[source]¶ Reports the status of a Keyword to the testcase xml result file base don the received status On receiving a True reports keyword as Passed On receiving a False reports keyword as Failure On receiving a Skip reports skips the keyword execution
Arguments: - status = (bool) True or False
Returns: None
-
Framework.Utils.testcase_Utils.
reportStatus
(status, text='', level='Keyword')[source]¶ Reports the status of a Keyword to the testcase xml result file base don the received status On receiving a True reports keyword as Passed On receiving a False reports keyword as Failure On receiving a Skip reports skips the keyword execution
Arguments: - status = (bool) True or False
- text = (string) any useful description
- level = (string) only supported value currently is Keyword
Returns: None
-
Framework.Utils.testcase_Utils.
reportWarning
(status, text='', level='subStep')[source]¶ Reports the status of a substep to the testcase xml result file base don the received status On receiving a True reports substep as Passed On receiving a False raises a warning On receiving a Skip reports skips the substep execution
Arguments: - status = (bool) True or False
- text = (string) any useful description
- level = (string) only supported value currently is subStep
Returns: None
-
Framework.Utils.testcase_Utils.
report_substep_status
(status)[source]¶ Reports the status of a substep to the test case xml result file based on the received status On receiving a True reports substep as Passed On receiving a False raises a warning On receiving a Skip reports substep execution as skipped
Arguments: - status(bool) = status of the executed substep (True or False)
Returns: None
-
Framework.Utils.testcase_Utils.
reportsubkeywordstatus
(status, text='', level='Subkeyword')[source]¶ - Reports the status of a Keyword to the testcase xml result file baseid on
- the received status
On receiving a True reports keyword as Passed On receiving a False reports keyword as Failure On receiving a Skip reports skips the keyword execution
Arguments: - status = (bool) True or False
- text = (string) any useful description
- level = (string) Default: SubKeyword
Returns: None
-
Framework.Utils.testcase_Utils.
update_arguments
(args)[source]¶ adds step_num attribute to the step tag in test case result xml file
Framework.Utils.xml_Utils module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Framework.Utils.xml_Utils.
compare_xml
(xml1, xml2, output_file=False, sorted_json=True, remove_namespaces=False, tag_list=[], attrib_list=[])[source]¶ This will compare two xml files or strings by converting to json and then sorting and by default giving the sorted files and writing the difference to a diff file.
- Arguments:
- xml1 : The first xml among the two xml’s which
- needs to be compared
- xml2 : The second xml among the two xml’s
- which needs to be compared
- output_file : It contains the difference between
- the two sorted json objects
- sorted_json : By default we are returning the sorted json
- files and if the user selects sorted_json as False, not returning the fileS
- remove_namespaces: If the user specifies remove_namespaces
- as True will remove namespaces and then compare xml’s
- tag_list: If user specifies tag names in tag_list,
- will remove those tags and then compare xml’s
7. attrib_list: If user specifies attribute names in the attrib_list, will remove those attributes and then compare xml’s
- Returns:
- Returns a tuple that contains
- comparison status two sorted json files or two None depends on sorted_json value output file path or diff_output depends on output_file value
-
Framework.Utils.xml_Utils.
compare_xml_using_xpath
(response, list_of_xpath, list_of_expected_api_responses)[source]¶ Will get each xpath in list of xpath and get the value of that xpath in xml response Compares the value with the expected_api_response If all values matches returns True else False
-
Framework.Utils.xml_Utils.
convert_dom_to_string
(element)[source]¶ Converts a dom element into a string
-
Framework.Utils.xml_Utils.
convert_element_to_string
(element)[source]¶ Converts the provided xml element to string
-
Framework.Utils.xml_Utils.
convert_xml_to_list_of_dict
(file_name)[source]¶ Takes xml file path as input and converts to list of dictionaries Arguments:
file_name : It takes xml file path as input- Returns:
- list_of_dict: list of dictionaries where keys are tag names and values are respective text of the tag.
-
Framework.Utils.xml_Utils.
create_element
(tagname='', text='', **kwargs)[source]¶ create an xml element with given name and a dict of attribute
-
Framework.Utils.xml_Utils.
create_subelement
(parent, tag, attrib)[source]¶ Creates a subelement with given tag and attributes under the parent element
-
Framework.Utils.xml_Utils.
del_attributes_from_xml
(xml, attrib_list=[])[source]¶ It deletes the attributes either by their names or xpath
- Arguments:
- 1.xml: It takes xml file path or xml string as input 2.attrib_list: It contains list of attributes which needs to be removed
- Returns:
- It returns xml string
-
Framework.Utils.xml_Utils.
del_tag_from_element
(ele, tag)[source]¶ Delete a subelement with specific tag from an xml element object return the deleted subelement if pass return False if subelement not found
It deletes the tags either by their names or xpath
- Arguments:
- 1.xml: It takes xml file path or xml string as input 2.tag_list: It contains list of tags which needs to be removed
- Returns:
- It returns xml string
-
Framework.Utils.xml_Utils.
getChildElementWithSpecificXpath
(start, xpath)[source]¶ This method takes a xml file or parent element as input and finds the first child containing specified xpath
Returns the child element.
Arguments: start = xml file or parent element xpath = a valid xml path value as supported by python, refer https://docs.python.org/2/library/xml.etree.elementtree.html
-
Framework.Utils.xml_Utils.
getChildElementsListWithSpecificXpath
(parent, xpath)[source]¶ This method takes a parent element as input and finds all the children containing specified xpath
Returns a list of child elements.
Arguments: parent = parent element xpath = a valid xml path value as supported by python, refer https://docs.python.org/2/library/xml.etree.elementtree.html
-
Framework.Utils.xml_Utils.
getChildElementsListWithTagAttribValueMatch
(parent, tag, attrib, value)[source]¶ This method takes a parent element as input and finds all the sub elements (children) containing specified tag and an attribute with the specified value.
Returns a list of child elements.
Arguments: parent = parent element tag = tag value of the sub-element(child) to be searched for. attrib = attribute name for the sub-element with above given tag should have. value = attribute value that the sub-element with above given tag, attribute should have.
-
Framework.Utils.xml_Utils.
getChildTextbyOtherChild
(datafile, pnode, cnode, cvalue, rnode)[source]¶ Searches XML file for the parent node. Finds the 1st child node and checks its value if value is a match, then search for second child and return its value datafile = xml file searched pnode = parent node cnode = child node cvalue = child node value rnode = reference node or False if doesn’t exist
-
Framework.Utils.xml_Utils.
getChildTextbyParentAttribute
(datafile, pnode, patt, pattval, cnode)[source]¶ Seraches XML file for the parent node with a specific value. Finds the child node and returns its text datafile = xml file searched pnode = parent node patt = parent node attribute patval = parent node attribute value cnode = child node
-
Framework.Utils.xml_Utils.
getChildTextbyParentTag
(datafile, pnode, cnode)[source]¶ Seraches XML file for the first parent. Finds the child node and returns its text datafile = xml file searched pnode = parent node cnode = child node
-
Framework.Utils.xml_Utils.
getConfigElementTextWithSpecificXpath
(datafile, xpath)[source]¶ This method takes an xml document as input and finds the first sub element (parent/children) containing specified xpath which should be a filepath to a netconf config file
Returns the element text attribute
Arguments: parent = parent element xpath = a valid xml path value as supported by python, refer https://docs.python.org/2/library/xml.etree.elementtree.html
-
Framework.Utils.xml_Utils.
getElementListWithSpecificXpath
(datafile, xpath)[source]¶ This method takes an xml document as input and finds all the sub elements (parent/children) containing specified xpath
Returns a list of matching elements.
Arguments: parent = parent element xpath = a valid xml path value as supported by python, refer https://docs.python.org/2/library/xml.etree.elementtree.html
-
Framework.Utils.xml_Utils.
getElementStringWithSpecificXpath
(datafile, xpath)[source]¶ This method takes an xml document as input and finds the first sub element (parent/children) containing specified xpath
Returns the element as a string
Arguments: parent = parent element xpath = a valid xml path value as supported by python, refer https://docs.python.org/2/library/xml.etree.elementtree.html
-
Framework.Utils.xml_Utils.
getElementWithTagAttribValueMatch
(start, tag, attrib, value)[source]¶ - When start is an xml datafile, it finds the root and first element with:
- tag, attrib, value.
- Or when it’s an xml element, it finds the first child element with:
- tag, attrib, value.
If there is not a match, it returns False.
-
Framework.Utils.xml_Utils.
getElementsListWithTagAttribValueMatch
(datafile, tag, attrib, value)[source]¶ This method takes an xml document as input and finds all the sub elements (parent/children) containing specified tag and an attribute with the specified value.
Returns a list of matching elements.
Arguments: datafile = input xml file to be parsed. tag = tag value of the sub-element(parent/child) to be searched for. attrib = attribute name for the sub-element with above given tag should have. value = attribute value that the sub-element with above given tag, attribute should have.
-
Framework.Utils.xml_Utils.
getNodebyParentandChildrenMatch
(datafile, pnode, cnode, cvalue, rnode, rvalue, lnode)[source]¶ Searches XML file for the parent node. Finds the 1st child node and checks its value if value is a match, then search for second child and check if its value matches. If that is a match, then obtain the value of the third child datafile = xml file searched pnode = parent node cnode = child node cvalue = child node value rnode = reference node rvalue = refernce node value lnode = lastnode
-
Framework.Utils.xml_Utils.
get_all_child_nodes
(parent_node)[source]¶ Takes a minidom parent node as input and returns a list of all child nodes
-
Framework.Utils.xml_Utils.
get_attributevalue_from_directchildnode
(parentnode, childname, attribute)[source]¶ Takes a parent node element as input Searches for the first child with the provided name under the parent node If child is present returns the value for the requested child attribute (the returns None if the child does not have that attributte) Returns False if child is not found under the parent
-
Framework.Utils.xml_Utils.
get_child_node_list
(parentnode)[source]¶ Retruns the list tof children under to a provided parent node
Gets the list of elements with matching tag_name
-
Framework.Utils.xml_Utils.
get_document_root
(filename)[source]¶ Returns the root element of a xml document
-
Framework.Utils.xml_Utils.
get_element_by_attribute
(xml_file, tag_name, attr_name, attr_value)[source]¶ Gets the element with matching tag_name, attribute name and attribute value
-
Framework.Utils.xml_Utils.
get_elements_by_tagname_ignore_ns
(filename, element_tag)[source]¶ “Parses an xml using minidom and gets all the elements with matching tag names in the file, ignores namespaces in the tag names
-
Framework.Utils.xml_Utils.
get_first_child
(node)[source]¶ Gets the first child of a given node Returns None if there is no child for the node.
-
Framework.Utils.xml_Utils.
get_last_child
(node)[source]¶ Gets the last child of a given node Returns None if there is no child for the node.
-
Framework.Utils.xml_Utils.
get_matching_firstlevel_children_from_node
(node, child_tag)[source]¶ Takes a xml file as input and returns a list of first child elements to the root that matches the provided tag
-
Framework.Utils.xml_Utils.
get_matching_firstlevel_children_from_root
(filename, child_tag)[source]¶ Takes a xml file as input and returns a list of first child elements to the root that matches the provided tag
-
Framework.Utils.xml_Utils.
get_node
(filename, node_name)[source]¶ Gets seraches for a node under the root and returns the node
-
Framework.Utils.xml_Utils.
get_text_from_direct_child
(parentnode, childname)[source]¶ Takes a parent node element as input Searches for the first child with the the provided name under the parent node If child is present return the text of the child (returned text will be empty if the child has no text Returns False if child is not found under the parent
-
Framework.Utils.xml_Utils.
list_path_responses_datafile
(datafile, system_name)[source]¶ Returns the path_list and responses_list path_list contains list of response_path tags under the comparison_mode under the system with given system_name in the datafile responses_list contains list of response_value tags under the expected_api_response under the system with given system_name in datafile
-
Framework.Utils.xml_Utils.
recursive_delete_among_children
(root, element)[source]¶ - It performs a recursive operation among the children in the xml file
- and finds the child that matches with the element and deletes it.
- Arguments:
- 1.parent: It takes the root element in the xml file as input 2.element: It is the tag which we want to delete
- Returns:
- True
-
Framework.Utils.xml_Utils.
removenms
(xml)[source]¶ - It accepts the xml file path or string as input and remove
- the name spaces.
- Arguments:
- xml: An input xml file path or xml string in which the name spaces
- needs to be removed
- Returns:
- xml_string
-
Framework.Utils.xml_Utils.
safe_subelement
(parent, tagname, text='', **kwargs)[source]¶ create or overwrite a child element under the parent
-
Framework.Utils.xml_Utils.
verifyNodesValueMatch
(datafile, pnode, cnode, cvalue, rnode, rvalue, bnode, bvalue, dnode=None, dvalue=None)[source]¶ Searches XML file for the parent node. Finds the 1st child node and checks its value if value is a match, then search for second child and check if its value matches datafile = xml file searched pnode = parent node cnode = child node cvalue = child node value rnode = reference node rvalue = refernce node value
-
Framework.Utils.xml_Utils.
verifyParentandChildrenMatch
(datafile, pnode, cnode, cvalue, rnode, rvalue)[source]¶ Searches XML file for the parent node. Finds the 1st child node and checks its value if value is a match, then search for second child and check if its value matches datafile = xml file searched pnode = parent node cnode = child node cvalue = child node value rnode = reference node rvalue = refernce node value
Module contents¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


set capacity
to {{stepAdjustment.scalingAdjustment}} instances
{{stepAdjustment.operator}} capacity
by {{stepAdjustment.absAdjustment}}%
by {{stepAdjustment.absAdjustment}} instances
when
{{alarm.threshold + stepAdjustment.metricIntervalUpperBound}}
+infinity
> {{alarm.metricName}}
>= {{alarm.threshold + stepAdjustment.metricIntervalLowerBound}}
{{alarm.comparator}} {{alarm.threshold}}
{{alarm.threshold + stepAdjustment.metricIntervalLowerBound}}
-infinity
< {{alarm.metricName}}
<= {{alarm.threshold + stepAdjustment.metricIntervalUpperBound}}
{{alarm.comparator}} {{alarm.threshold}}


--- layout: page title: Modules description: Modules related to this course background: '/img/bg-modules.jpg' ---
Learn how to plan your podcast production.
The interviewing process from start to finish.
Recording your audio narration and interview.
Write your script and transcribe your interview.
Turn your work from recording into a story.
Edit and produce your podcast segment.


build_features module¶
-
class
build_features.
DataOp
[source]¶ Bases:
object
-
static
load
(dataset_name)[source]¶ Loads dataset from keras and returns a sample out of it
- Args:
- dataset_name (str): training_set_size (int): validation_set_size (int):
- Returns:
- dict: data, with keys X_train, Y_train, X_val, Y_val list: input shape
-
static
preprocess
(X, y, train_set_size, val_set_size=1000)[source]¶ - Preprocess images by:
- normalize to 0-1 range (divide by 255)
- convert labels to categorical)
- Args:
- X (numpy.array): y (numpy.array): train_set_size (int): val_set_size (int):
- Returns:
- dict: preprocessed data
-
static
split_train_val_sets
(X, y, train_set_size, val_set_size)[source]¶ Splits given images randomly into train and val_seed groups
val_seed -> is validation seed dataset, from where validation sets are sampled
- Args:
- X (numpy.array): y (numpy.array): train_set_size (int): val_set_size (int):
- return:
- dict: dict with keys X_train, y_train, X_val_seed, y_val_seed
-
static


--- layout: default title: Women's Accessories | Practice Scraping div_id: store permalink: /sample-store/women/accessories ---
$29
For dreamers, writers, and artists
$19
Hold your coins with this rugged coin purse


{% extends "base_nav1.html" %} {% block content %} Ed Tech In a hurry, teach me something quick. I got 15 minutes. No more. No rush, I got half an hour! Time is no bar. Bombard me with knowledge! {% endblock %}
In a hurry, teach me something quick.
I got 15 minutes. No more.
No rush, I got half an hour!
Time is no bar. Bombard me with knowledge!


We are a family owned store that has been selling our cookies since 1915. Pat's grandmother had a cookie recipe that she would always make in the summer, called salmon cookies. Everyone in the family loved them, they would all be gon within seconds. When Pat's grandmother passed away, she left the cookie recipe to Pat. Thats when Pat decided that all of Seattle should try the cookies that he has loved since a kid.
Email<EMAIL_ADDRESS>Fax:<PHONE_NUMBER>


Sign up
E-mail
Username
Password
Insert your sex:
Female
Male
SIGN UP
Already registered in Ziok?
SIGN IN


A simple wrapper for Angular which enabled you to use Remix Icons in your project.
All the icons are injected as
SVGs.
Only the icons you configured will be bundled with your code.
Examples
| Preview | Icon Name | Icon Import Name |
|---|---|---|
|
|
home-2-fill | RiHome2Fill |
|
|
mail-unread-line | RiMailUnreadLine |
|
|
send-plane-fill | RiSendPlaneFill |


4.3. Job Screen JSP Validation Tool¶
4.3.1. Summary¶
This tool performs the following verifications on JSP files.
Also, it has the capability to change the verification contents in the settings file, and the verification content itself can be added.
Implemented
- It can verify to ensure that only the tags that are permitted to be used, are used in the JSP of the business screen.
- It can verify that the required structure is satisfied in the JSP.
- It can verify that the prohibited structure is not being used in the JSP.
- It can verify that the attributes specified for each tag are indeed the attributes defined for each tag.
Not implemented
- It can verify that attribute value of each tag corresponds to the type of attribute.
4.3.2. Initial Environment Construction¶
<IP_ADDRESS>. Node.js installation¶
Since this tool depends on Node.js , the installer from the below site based on the environment being used is to be downloaded and installed.
<IP_ADDRESS>. Check environment variables¶
When performing the below procedure under a proxy environment, the below values of the environment variables are to be checked.
| Explanatory variable name | Value |
|---|---|
| HTTP_PROXY | URL of the proxy server for HTTP |
| HTTPS_PROXY | URL of the proxy server for HTTPS |
<IP_ADDRESS>. Install dependent packages¶
This tool is dependent on multiple open source libraries. (To know more about the libraries that the tool depends on, refer to package.json.)
To install the libraries, execute the below command in the root directory (directory where package.json is saved) of this tool.
| Execution directory | Command | Details to be checked |
|---|---|---|
| Root directory of this tool (directory where package.json is saved.) | npm install |
|
Important
To install the dependent package according to the above procedure, the environment needs to be connected to the Internet.
Also, if a proxy environment is used, it is necessary for the proxy server address to be configured to the below environment variables.
- http_proxy ：example: http_proxy=http://proxy.example.com:8080
- https_proxy ：example: https_proxy=http://proxy.example.com:8080
Also, if installed in an environment that is not connected to the Internet, it can be used by initially performing the above procedures in an environment connected to the Internet, and placing the node_modules directory created in the root directory, in the root directory of this tool that has been extracted in the target environment.
<IP_ADDRESS>. Confirm if it can be used normally.¶
Ensure that all tests are successful by executing the below commands in the root directory of this tool.
| Execution directory | Command | Details to be checked |
|---|---|---|
| Root directory of this tool (directory where package.json is saved.) | npm test |
|
<IP_ADDRESS>. Modification of environment dependency setting value.¶
Modify the below setting value of verification_config.json at the directory where the actual tag file is saved.
{
"TagAttributeVerifier" : {
"directory" : "C:\\nablarch\\workspace\\tutorial\\main\\web\\WEB-INF\\tags\\widget",
"encoding" : "utf-8"
}
}
4.3.3. How to Use the tool¶
<IP_ADDRESS>. Execute with a bat file¶
Drag and drop the file to jsp_verifier.bat that is in the root directory of this tool.
If a command line window is displayed and there are 0 verification errors,
Verification Succeeded.
Is displayed, and if there are one or more verification error,
Verification Failed!!
12 violations are found.
Detected violations are dumped to violations-1390366626297.log.
The file name where the error content is output is displayed like this.
<IP_ADDRESS>. Execution from command line.¶
The below commands are executed in the root directory of this tool.
node bin/jsp_verifier <Verification target JSP file path(s)>
The output contents of the standard output are as above.
4.3.4. Configuration method¶
verification_config.json of the root directory is the configuration file of this tool. Verification is performed by detailing the verification contents to be executed in this file and settings of each verification content.
Important
In the below example configuration file, for the purpose of explanation, though comments are written in JavaScript format, comments cannot be written in the actual JSON file.
{
// Verification contents to be implemented are described in verifiers.
"verifiers": {
// Verification of tags that can be used
"TagUsageVerifier": {
}
// Regular expression verification
"RegexpBasedVerifier": {
}
// DOM tree verification
"SelectorBasedVerifier": {
}
// Parent tag verification
"WrappingTagVerifier": {
}
// Tag attribute verification
"TagAttributeVerifier": {
}
// Verification not defined here will not be performed
}
}
<IP_ADDRESS>. Default setting contents¶
<IP_ADDRESS>.1. Verification of tags that can be used¶
Only the below tags that have usage permission are to be used.
- n:form
- n:set
- n:write
- n:ConfirmationPage
- n:forConfirmationPage
- n:forInputPage
- n:param
- n:hidden
- t:page_template
- t:errorpage_template
- box:.*
- button:.*
- field:.*
- link:.*
- tab:.*
- table:.*
- column:.*
- spec:.*
- c:if
- jsp:attribute
- %–
- %@page
- %@taglib
<IP_ADDRESS>.2. Regular expression verification¶
Strings matching the below regular expression are not recognized (uppercase/lowercase not sensitive).
- /> (Self terminating element. If a self-terminating element is used, as the description content cannot be drawn after that element, it is prohibited)
<IP_ADDRESS>.3. DOM tree validation¶
The below prohibited structures are not to be used.
- table:not([id]) （As IDs is required when displaying multiple tables, ID is forced on the table.）
- table:not([listSearchInfoName]) （listSearchInfoName is forced as the number of results cannot be displayed if the table does not have listSearchInfoName.）
<IP_ADDRESS>.4. Parent tag verification¶
The below required structure is to be satisfied.
- The table widget must be enclosed with n:form.
- The button widget needs to be enclosed with n:form.
- The widget displayed in the screen item definition in the design view must be enclosed by spec:layout.
<IP_ADDRESS>.5. Tag attribute verification¶
The attribute of the tag (the one with the tag file stored under C:\nablarch\workspace\tutorial\main\web\WEB-INF\tags\widget) being used in JSP should be the actual attribute that defines the tag.


Pyogp unit testing ~ pyogp.lib.client contains internal tests that validate consistency of the library implementation. Using unittest and doctest, along with wsgi and mock objects, these tests simulate interaction with a grid where needed, or use predefined data where possible, to validate methods and such.
Coverage is unfortunately sparse currently, though, enough examples exist and the api is generally stable enough that tests can reliably be created now.
use Nose! http://somethingaboutorange.com/mrl/projects/nose/0.11.1/
Install Steps:
See http://wiki.secondlife.com/wiki/PyOGP_Package_Unittests for guidance on running tests when operating in pyogp’s buildout.
doctest: add a {class}.txt file to pyogp.lib.base.tests. unittest: add a test_{class}.py file to pyogp.lib.base.tests.
base.py ~ contains the wsgi handlers for certain mock objects (like MockXMLRPC, etc)


Congratulations!
PLAYER 1
found the Pink Panther!
REMATCH!
Congratulations!
PLAYER 2
found the Pink Panther!
REMATCH!
Uh-oh.
Looks like PLAYER 2
ran into a policeman.
REMATCH!
Uh-oh.
Looks like PLAYER 1
ran into a policeman.
REMATCH!


Land owner name
First name
Middle name
Last name
Nationality
ID number
Passport number
Date of Birth
Date of birth
Address
Save Land Owner
Land Owners
#
First name
Middle name
Last name
ID Number
Passport
Date of Birth
Address
Actions


Outputs a recursive unordered list based on a JSON object structure.
This is an example of a directive that does recursive compilation at the compile phase.


Civic Switchboard is an Institute of Museum and Library Services supported effort that aims to develop the capacity of academic and public libraries in civic data ecosystems.
This project encourages partnerships between libraries and local data intermediaries; these partnerships will better serve data users, further democratize data, and support equitable access to information. The project will create a toolkit for libraries interested in expanding (or beginning) their role around civic information.
In Year 1, to broaden networks and expand resources, the project team will host workshops at two conferences: The National Neighborhood Indicators Partnership (May 2018) and the Digital Library Federation (October 2018). Stipends will be available for libraries and data intermediary organizations interested in participating in these workshops; a limited number of complimentary registration fees for the associated conferences will also be available.
In Year 2, the project will offer stipends to partnerships between libraries and local data intermediaries for field testing the toolkit.
For much more detail about the project's rationale and plan, read our full proposal narrative on the IMLS site.
Stay Informed
Sign up to receive more information about upcoming opportunities.
Contact
Team
- Aaron Brenner, The University Library System (ULS) at the University of Pittsburgh
- Bob Gradeck, Western Pennsylvania Regional Data Center (WPRDC)
- Toby Greenwalt, Carnegie Library of Pittsburgh (CLP)
- Nora Mattern, The University Library System (ULS) at the University of Pittsburgh
- Liz Monk, Western Pennsylvania Regional Data Center (WPRDC)
- Kathy Petit, National Neighborhood Indicators Partnership (NNIP)
- Eleanor Tutt, Carnegie Library of Pittsburgh (CLP)


How to Build a Financial Model for Your Startup
The easiest part of starting a new business is choosing a name. Even though it may take weeks to find the right name, a good name does not automatically open the doors to unlimited funding and instant success. In order to open those funding doors while piquing the interest of potential investors a visual aid is necessary; this is where a financial model comes in. A financial model for a start-up consists of best and worst case financial statements for a start-up’s future. Yes, financial modeling can seem a bit intimidating and overwhelming, but it is essential to securing needed funding.
It is important that you understand the nature of the business you are embarking upon along with all of the variables inherent to the business in order to build credibility with potential investors. It is even more important that you convey that knowledge and understanding in a cohesive and intelligent manner; a good financial model demonstrates your comprehension of the intended venture.
Step One: Traffic vs. Conversion
The first step in developing your financial analysis is determining the expected amount of traffic and how much of that traffic will convert into customers. There are two ways to do this: the top-down approach and the bottoms-up approach.
The top-down approach takes into consideration targeted variables to reach a likely conversion rate. For example, you are selling children’s clothing in an area consisting of 3 million households. A baseline assumption would estimate that each household consists of one child and that one of every three households will make a purchase within a prescribed time frame, say three months. Factor in additional filters such as competition, market share, etc. This is how you determine traffic; the number of customers expected to visit your business. The next step is to convert that number into expected sales. Since not everyone who visits your business will purchase something you will need to estimate the percentage using industry standards. In the case of the clothing store, it is safe assumption that 0.5% of the traffic will convert into sales.
In essence, the top down approach is based on the assumption that your business can expect to gain a certain market share in year one, and will continue to grow in subsequent years.
The bottoms-up approach takes into consideration how much money is necessary to meet your goals and costs by focusing on actual sales forecasts (potential sales X average transaction value). For instance, a restaurant that has a base operating cost of $5000 per day needs to sell 100 meals at a rate of $50 per meal to cover that day’s operating costs. This is also known as the break-even level: the point where the daily revenue results in zero net profit. Any revenue made beyond this point would be considered profit for the day.
Since it is preferable to be as realistic as possible when developing a financial model, the bottoms-up approach is a better option because is based on fewer assumptions than the top-down approach.
Step Two: Ticket to Sales Conversion
The next step is to establish how you are going to enable conversion and determining the size of ticket sales. Ticket size is the amount generated per average transaction. When the conversion rate is applied to ticket size the resulting number is the sales revenue.
To arrive at a net profit margin, you need to match costs per transaction with ticket size, both fixed and variable. To find the cost, break down the product into individual components. What materials are required to make a single item? What are the materials cost? Determine the points from manufacturing to sales and assign each point a value to cover costs and profit margin.
Investors look for the most realistic probability, so the greater degree of realism in your financial plan the more sincere you appear. Remember to set benchmarks that are achievable in the economy at the time and are consistent with market and industry trends.
Step Three: Tell a Story
All of the financial analysis in the world will not tell the story of your business. An investor can look at the financials and see a certain degree of potential for a start-up but they do not see the vision that you have. Fill in the blanks. Tell potential investors what makes your concept different from others. Explain to them the hook that will draw customers to your doorstep and then show them how you intend to keep customers coming back. Infuse potential investors with your vision and help them understand that you are dedicated to the success of your idea.
For more info, please visit Starter Financial Model