Exemplo n.º 1
0
import os
import sys
import robot

# Special settings for the task server, not intended for execution on client.
if ('BIGROBOT_ESB' in os.environ
        and os.environ['BIGROBOT_ESB'].lower() == 'true'):
    bigrobot_path = os.path.dirname(__file__) + '/../..'
    sys.path.insert(0, bigrobot_path + '/vendors/exscript/src')
    # sys.path.insert(0, bigrobot_path + '/vendors/paramiko')
    sys.path.insert(0, bigrobot_path + '/esb')
    sys.path.insert(0, bigrobot_path)

    import autobot.helpers as helpers
    helpers.set_env('IS_GOBOT', 'False')
    helpers.bigrobot_path(bigrobot_path)
    helpers.bigrobot_log_path('/tmp/bigrobot_esb_log')
    helpers.bigrobot_log_path_exec_instance(
        helpers.bigrobot_log_path() + "/" +
        os.path.dirname(__file__).split('/')[-1])
    helpers.set_env(
        'AUTOBOT_LOG',
        helpers.bigrobot_log_path_exec_instance() + "/bigrobot_autobot.log")
Exemplo n.º 2
0
def bigrobot_env_init(is_gobot='True'):
    os.environ['IS_GOBOT'] = is_gobot

    helpers.bigrobot_log_path(default='.')
    if helpers.bigrobot_suite():
        _suite = helpers.bigrobot_suite()

        # If user specified full path, trim it down to just suite name. E.g.,
        # Change:
        #  /Users/vui/Documents/ws/myforks/bigrobot/testsuites_dev/vui/test_mininet
        # To:
        #  vui_test_mininet_20140513_095428
        _match = re.search(r'.+testsuites(_dev)?/(.+)$', _suite)
        if _match:
            _suite = re.sub(r'[\W\s]', '_', _match.group(2))
        helpers.bigrobot_log_path_exec_instance_relative(
            default="%s_%s" % (_suite, helpers.ts_local()))
    else:
        helpers.bigrobot_log_path_exec_instance_relative(
            default="<bigrobot_suite>")
    helpers.bigrobot_log_path_exec_instance(
        default="%s/%s" % (helpers.bigrobot_log_path(),
                           helpers.bigrobot_log_path_exec_instance_relative()))

    if helpers.bigrobot_suite():
        if helpers.bigrobot_topology() == None:
            _topo_p = helpers.bigrobot_suite() + ".physical.topo"
            _topo_v = helpers.bigrobot_suite() + ".virtual.topo"
            _topo_u = helpers.bigrobot_suite() + ".topo"  # p or v unspecified

            # There should exist a topo file for the test suite.
            if helpers.file_exists(_topo_p):
                topo_file = _topo_p
            elif helpers.file_exists(_topo_v):
                topo_file = _topo_v
            else:
                topo_file = _topo_u

            helpers.bigrobot_topology(default=topo_file)

        print("BigRobot suite: %s" % helpers.bigrobot_suite())
        print("BigRobot suite topology: %s" % helpers.bigrobot_topology())

    helpers.bigrobot_params(default='None')
    helpers.bigrobot_continuous_integration()
    helpers.bigrobot_exec_hint_format()
    helpers.bigrobot_log_archiver()
    helpers.bigrobot_debug(default=1)

    helpers.bigrobot_listener_log(
        default=(helpers.bigrobot_log_path_exec_instance() +
                 '/bigrobot_listener.log'))
    helpers.bigrobot_devcmd_log(
        default=(helpers.bigrobot_log_path_exec_instance() +
                 '/dev_commands.log'))
    if helpers.bigrobot_suite() is None:
        #!!! FIXME: need to handle None value..
        pass
    else:
        helpers.bigrobot_global_params(default=(helpers.bigrobot_suite() +
                                                '.params'))
    helpers.bigrobot_additional_params(
        default=(helpers.bigrobot_log_path_exec_instance() +
                 '/additional-params.topo'))

    helpers.bigrobot_path()
    # helpers.bigtest_path()
    helpers.python_path()
    helpers.bigrobot_test_setup()
    helpers.bigrobot_test_postmortem()
    helpers.bigrobot_test_clean_config()
    helpers.bigrobot_test_pause_on_fail()
    helpers.bigrobot_test_ztn()
    helpers.bigrobot_ignore_mininet_exception_on_close()
    helpers.bigrobot_preserve_mininet_screen_session_on_fail()
    helpers.bigrobot_esb()
    helpers.bigrobot_esb_broker()
    helpers.bigrobot_ztn_reload()
    helpers.bigrobot_ztn_installer()
    helpers.bigrobot_no_auto_reload()
    helpers.bigrobot_ha_logging()
    helpers.bigrobot_quiet_output()
    helpers.bigrobot_reconfig_reauth()
    helpers.bigrobot_selenium_browser()
    helpers.bigrobot_devconf_debug_level()
Exemplo n.º 3
0
import autobot.helpers as helpers
import autobot.setup_env as setup_env
from autobot.nose_support import run, log_to_console, sleep, Singleton
from keywords.BsnCommon import BsnCommon
from keywords.T5Torture import T5Torture

helpers.set_env('BIGROBOT_TEST_POSTMORTEM', 'False', quiet=True)
helpers.set_env('BIGROBOT_TEST_SETUP', 'False', quiet=True)
helpers.set_env('BIGROBOT_TEST_CLEAN_CONFIG', 'False', quiet=True)
helpers.set_env('BIGROBOT_TEST_TEARDOWN', 'False', quiet=True)
helpers.remove_env('BIGROBOT_TOPOLOGY', quiet=True)
# Test suite is defined as the name of the test script minus its extension.
helpers.bigrobot_suite(os.path.basename(__file__).split('.')[0])
setup_env.standalone_environment_setup()

assert helpers.bigrobot_path() != None
assert helpers.bigrobot_log_path_exec_instance() != None
assert helpers.bigrobot_suite() != None
helpers.print_bigrobot_env(minimum=True)


class TestBcfEvents:
    __metaclass__ = Singleton

    def __init__(self):
        self.link_flap_sleep = BsnCommon().params_global('link_flap_sleep')
        self.in_event_sleep = BsnCommon().params_global('in_event_sleep')
        self.between_event_sleep = BsnCommon().params_global(
            'between_event_sleep')
        self.tflapnum = BsnCommon().params_global('tflapnum')
        self.vflapnum = BsnCommon().params_global('vflapnum')
Exemplo n.º 4
0
 def func():
     assert helpers.bigrobot_path() != None
     assert helpers.bigrobot_log_path_exec_instance() != None
     assert helpers.bigrobot_suite() != None
     helpers.print_bigrobot_env(minimum=True)