Ejemplo n.º 1
0
    def __init__(self, device='dut', why='ssh:', *args, **kwargs):
        # differed import of flogging since we are inside the plugin
        # structure:
        from flogging import get_loggers
        self.__logs = get_loggers()
        self.__stream_to_log = None
        if 'logfile' not in kwargs:
            stream_to_log = StreamToLogger(self.__logs.idl, why)
            kwargs['logfile'] = stream_to_log
            self.__stream_to_log = stream_to_log

        super(SSHHelper, self).__init__(*args, **kwargs)
        assert device == 'dut', \
            'multiple targets not supported yet'
        assert self._parser_options is not None, \
            'attempt to create ssh helper before nose-plugin-begin step called'
        host = self._parser_options.sm_dut_ssh_host
        port = self._parser_options.sm_dut_ssh_port
        user = self._parser_options.sm_dut_ssh_user
        password = self._parser_options.sm_dut_ssh_password
        self.login(host, user, password, port=port)
        self.sendline('sudo su -')
        index = self.expect(['assword', '#'])
        if index == 0:
            self.sendline(password)
            self.expect(['#'])
        self.set_unique_prompt()
        self.dut_ssh_host = host
        self.dut_ssh_port = port
Ejemplo n.º 2
0
 def __setup_generated_amqp(self, generate_string):
     """
     Handle the case where we are told to generate an AMQP user
     and even set it up on the DUT.
     """
     port = int(generate_string.split(':')[1])
     uid = str(uuid.uuid4())
     auser = '******'.format(uid)
     apw = uid
     try:
         fixed = SSHHelper('dut', 'amqp-user-setup-ssh-stdouterr: ')
         cmd_text, ecode, output = fixed.sendline_and_stat('rabbitmqctl delete_user {}'.format(auser))
         # the user probably WON'T be there, so don't worry much.
         assert ecode == 0 or 'no_such_user' in output, \
             "{} failed with something other than 'no_such_user':"******".*" ".*" ".*"'''.format(auser), must_be_0=True)
         fixed.logout()
         return 'amqp://{}:{}@{}:{}'.format(auser, apw, fixed.dut_ssh_host, port), auser
     except ExceptionPxssh as ex:
         # the PR in-queue behind with one sets up better logging in the sources.
         # Rather than try to pull that forward, manually grab flogging and
         # update this block in next merge.
         from flogging import get_loggers
         logs = get_loggers()
         logs.irl.debug('unable to set up amqp user. AMQP monitors disabled: %s', ex)
     return None, None
Ejemplo n.º 3
0
    def begin(self):
        self.__take_step('begin')
        # tood: check class "enabled_for_nose()"
        SSHHelper.set_options(self.conf.options)
        if len(self.__stream_plugins) == 0:
            self.__stream_plugins['logging'] = LoggingMarker()
            self.__stream_plugins['self-test'] = SelfTestStreamMonitor()
            self.__stream_plugins['amqp'] = AMQPStreamMonitor()
        else:
            # This is basically for self-testing the plugin, since the
            # logging monitor stays around between test-classes. If we don't do
            # this, the prior logging settings "stick".
            self.__stream_plugins['logging'].reset_configuration()

        self.__flogger_opts_helper.process_parsed(self.conf.options)
        self.__stream_plugins['amqp'].set_options(self.conf.options)

        self.__call_all_plugin_by_attr('handle_set_flogging', get_loggers())
        self.__call_all_plugin_by_attr('handle_begin')
Ejemplo n.º 4
0
    - checks pollers for data

'''

import fit_path  # NOQA: unused import
import os
import subprocess
import json
import time
import unittest
import fit_common
import pdu_lib
import flogging
import test_api_utils

log = flogging.get_loggers()

# Locals
MAX_CYCLES = 60


class rackhd_stack_init(unittest.TestCase):
    def test01_set_auth_user(self):
        auth_json = open('auth.json', 'w')
        auth_json.write('{"username":"******"api"][0]["admin_user"] + '", "password":"******"api"][0]["admin_pass"] + '", "role":"Administrator"}')
        auth_json.close()
        try:
            # add first user to remote rackhd directly
            return_code = ""
            rackhd_hostname = fit_common.fitargs()['rackhd_host']
Ejemplo n.º 5
0
UCS test script that tests:
-All the ucs service APIs
-The Discovery workflow
-The Catalog workflow

'''

import fit_path  # NOQA: unused import
import unittest
from common import fit_common
from nosedep import depends
import flogging
from nose.plugins.attrib import attr

logs = flogging.get_loggers()

UCSM_IP = fit_common.fitcfg().get('ucsm_ip')
UCSM_USER = fit_common.fitcfg().get('ucsm_user')
UCSM_PASS = fit_common.fitcfg().get('ucsm_pass')
UCS_SERVICE_URI = fit_common.fitcfg().get('ucs_service_uri')


@attr(all=True, regression=True, smoke=True, ucs=True)
class ucs_api(unittest.TestCase):

    def ucs_url_factory(self, api, identifier=None):
        """
        returns a fully qualified UCS API
        :param api:UCS API
        :param identifier: identify the ucs element in the catalog API
Ejemplo n.º 6
0
"""
Copyright (c) 2016-2017 Dell Inc. or its subsidiaries. All Rights Reserved.

"""
import fit_path  # NOQA: unused import
import unittest
import flogging

from config.redfish1_0_config import config
from on_http_redfish_1_0 import RedfishvApi as redfish
from on_http_redfish_1_0 import rest
from json import loads, dumps
from nosedep import depends
from nose.plugins.attrib import attr

logs = flogging.get_loggers()


# @test(groups=['redfish.schema.tests'], depends_on_groups=['obm.tests'])
@attr(regression=True, smoke=True, schema_rf1_tests=True)
class SchemaTests(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.__client = config.api_client
        cls.__schemaList = None
        cls.__membersList = None
        cls.__locationUri = []

    def __get_data(self):
        return loads(self.__client.last_response.data)
Ejemplo n.º 7
0
}

Example command line using external payload file:

python run_tests.py -stack 4 -test tests/bootstrap/test_api20_esxi_bootstrap.py -extra base_esxi_55_install.json

'''

import fit_path  # NOQA: unused import
from nose.plugins.attrib import attr
import fit_common
import flogging
import random
import time
from nosedep import depends
log = flogging.get_loggers()

# sample default base payload
PAYLOAD = {
    "name": "Graph.InstallESXi",
    "options": {
        "defaults": {
            "version":
            "6",
            "repo":
            "http://172.31.128.1:8080/ESXi/6.0",
            "rootPassword":
            "******",
            "hostname":
            "rackhdnode",
            "users": [{