def process_arguments_support_login(): parser = argparse.ArgumentParser(prefix_chars='-') CommandLineArgumentsParser.add_argument_host_address(parser) parsed_args = parser.parse_args() Test_Context.connection_details = ConfigLoader.get_general_config( 'DeviceConnectionDetails') return parsed_args
def _get_current_version(self, device_ip): connection_details = ConfigLoader.get_general_config( 'DeviceConnectionDetails') user = UserWrapper(connection_details["User"], connection_details["Password"], None) with ActionsProvisionalCLI(user, device_ip) as device_pcli_action: device_pcli_action.send_cmd('show version') device_version = PExpectWrapper.get_text_after_value( device_pcli_action.cli, 'Application Version : ') return Version(device_version)
def reboot_lanner_device(ip_address): """ Reboot lanner device as per dev suggestion in SWALL-7668, SWALL-5845 :return: """ connection_details = ConfigLoader.get_general_config( 'DeviceConnectionDetails') user = UserWrapper(connection_details["User"], connection_details["Password"], None) with ActionsProvisionalCLI(user=user, host=ip_address) as admin_pcli: PrintMessage("Reboot lanner device -- as per SWALL-7668, SWALL-5845") admin_pcli.send_cmd( "reboot", expected_value= 'This will reboot the device. Do you want to continue?') admin_pcli.send_cmd( "y", expected_value='The system is going down for reboot NOW!')
def update_test_context_with_device_details(current_config_file_name): """ This method needs to be run before executing tests or any other methods that are config dependant :param current_config_file_name: :return: """ Test_Context.current_config_file_name = './ConfigFiles/TestRunConfig_{0}.json'.format( current_config_file_name) Test_Context.run_config = ConfigLoader.get_test_run_config() Test_Context.def_mode = Test_Context.run_config.load( 'TestPremise')['DefMode'] Test_Context.connection_details = ConfigLoader.get_general_config( 'DeviceConnectionDetails') deployment_values = Test_Context.run_config.load('Deployment_Values') for device_name in deployment_values.keys(): Test_Context.deployed_devices[ device_name] = DeviceManager.create_device_template_from_config( device_name)