Beispiel #1
0
##############################################################################
# Copyright (c) 2015 Ericsson AB and others.
# Author: George Paraskevopoulos ([email protected])
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import opnfv.utils.opnfv_logger as OPNFVLogger
import os
import time
import shutil

logger = OPNFVLogger.Logger('ovs_logger').getLogger()


class OVSLogger(object):
    def __init__(self, basedir, ft_resdir):
        self.ovs_dir = basedir
        self.ft_resdir = ft_resdir
        self.__mkdir_p(self.ovs_dir)
        self.__mkdir_p(self.ft_resdir)

    def __mkdir_p(self, dirpath):
        if not os.path.exists(dirpath):
            os.makedirs(dirpath)

    def __ssh_host(self, ssh_conn, host_prefix='10.20.0'):
        try:
            _, stdout, _ = ssh_conn.exec_command('hostname -I')
Beispiel #2
0
##############################################################################
# Copyright (c) 2017 Ericsson AB and others.
# Author: Jose Lausuch ([email protected])
#         George Paraskevopoulos ([email protected])
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

from opnfv.deployment import manager
from opnfv.utils import opnfv_logger as logger
from opnfv.utils import ssh_utils

logger = logger.Logger(__name__).getLogger()


class FuelAdapter(manager.DeploymentHandler):
    def __init__(self, installer_ip, installer_user, installer_pwd):
        super(FuelAdapter, self).__init__(installer='fuel',
                                          installer_ip=installer_ip,
                                          installer_user=installer_user,
                                          installer_pwd=installer_pwd,
                                          pkey_file=None)

    def _get_clusters(self):
        environments = []
        output = self.runcmd_fuel_env()
        lines = output.rsplit('\n')
        if len(lines) < 2:
            logger.info("No environments found in the deployment.")
Beispiel #3
0
##############################################################################
# Copyright (c) 2015 Ericsson AB and others.
# Authors: George Paraskevopoulos ([email protected])
#          Jose Lausuch ([email protected])
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import os
import paramiko

from opnfv.utils import opnfv_logger as logger

logger = logger.Logger("SSH utils").getLogger()
SSH_TIMEOUT = 60
''' Monkey Patch paramiko _custom_start_client '''
# We are using paramiko 2.1.1 and in the CI in the SFC
# test we are facing this issue:
# https://github.com/robotframework/SSHLibrary/issues/158
# The fix was merged in paramiko 2.1.3 in this PR:
# https://github.com/robotframework/SSHLibrary/pull/159/files
# Until we upgrade we can use this monkey patch to work
# around the issue


def _custom_start_client(self, *args, **kwargs):
    self.banner_timeout = 45
    self._orig_start_client(*args, **kwargs)