Ejemplo n.º 1
0
    def __init__(self):
        server_config = ConfigLoader.get_test_run_config("KVM_Server")
        self.user = UserWrapper(server_config['User'],
                                server_config['Password'], None)

        super(KVMServer, self).__init__(self.user, server_config['Host'])
        self.delaybeforesend = 0.2

        self.virsh_comm = VirshComm(self)
        self.temp_folder = None
    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 __init__(self, host, port=None):
        if port is None:
            self.port = Common.Utilities.CommonNetworkTools.get_cli_port(host)
        else:
            self.port = port

        user = UserWrapper('support', ActionsProvisionalCLI.get_password(host),
                           UserGroup.support)

        CMSBaseActionsCLI.__init__(self,
                                   user=user,
                                   host=host,
                                   port=self.port,
                                   timeout=60)
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 get_password_from_token(token):
    support_password = None
    user = UserWrapper(name="support", password=None, group=None)
    with BaseActionsCLI(user, host="cns-sss.corero-cns.com") as cns_action:
        if cns_action.cli.expect("Enter token:") != 0:
            raise Exception(
                "SupportUserLogin > Failed retrieving token: {0}".format(
                    token))

        cns_action.send_cmd(token)
        # .*Password: ([^\\r]*).*
        # (?<=Password: ).*?(?=\s)"

        # this will return two matches, two groups. Password is in the second group.
        if cns_action.cli.expect(".*Password: ([^\\r]*).*") != 0:
            PrintMessage("SupportUserLogin > Failed getting password")
            return

        support_password = cns_action.cli.match.group(1)

    PrintMessage('New support password: {0}'.format(support_password))

    return support_password
def get_token(host_ip):
    admin_user = UserWrapper(Test_Context.connection_details['User'],
                             Test_Context.connection_details['Password'], None)

    with ActionsProvisionalCLI(user=admin_user, host=host_ip) as admin_pcli:
        return admin_pcli.get_token()
Ejemplo n.º 7
0
 def __init__(self, host):
     super(ActionsShell, self).__init__(
         UserWrapper(None, None, None), host,
         Common.Utilities.CommonNetworkTools.get_pcli_port(host))