Пример #1
0
def connect():
    """ Create Xena manager object and connect to chassis. """

    global xm
    global chassis
    global port1
    global port2
    global session
    global sandbox_id

    session = CloudShellAPISession('localhost', 'admin', 'admin', 'Global')
    if 'SANDBOX_ID' in environ:
        sandbox_id = environ['SANDBOX_ID']
    else:
        context = create_command_context(session, ['xena 2g/Module6/Port0', 'xena 2g/Module6/Port1'],
                                         'Xena Controller', {})
        sandbox_id = context.reservation.reservation_id

    reserved_port1, reserved_port2 = get_reservation_resources(session, sandbox_id,
                                                               'Xena Chassis Shell 2G.GenericTrafficGeneratorPort')
    port1 = get_address(reserved_port1)
    port2 = get_address(reserved_port2)
    chassis = port1.split('/')[0]

    logger = logging.getLogger('log')
    logger.setLevel('INFO')
    logger.addHandler(logging.StreamHandler(sys.stdout))
    xm = init_xena(logger, owner)

    xm.session.add_chassis(chassis)
Пример #2
0
    def setup(self):
        super(TestXenaBase, self).setup()

        self._get_config()

        self.xm = init_xena(self.api, self.logger,
                            self.config.get('Xena', 'owner'), self.server_ip,
                            self.server_port)
Пример #3
0
def connect(log_file, chassis):

    # Xena manager requires standard logger. To log all low level CLI commands set DEBUG level.
    logger = logging.getLogger('log')
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler(sys.stdout))
    logger.addHandler(logging.FileHandler(log_file))

    # Create XenaApp object and connect to chassis.
    xm = init_xena(ApiType.socket, logger, 'xena_line_test', chassis)
    return xm.session.add_chassis(chassis)
Пример #4
0
    def setup(self):
        super(TestXenaBase, self).setup()

        self.xm = init_xena(self.api, self.logger,
                            self.config.get('Xena', 'owner'), self.server_ip,
                            self.server_port)
        self.temp_dir = self.config.get('General', 'temp_dir')
        self.xm.session.add_chassis(self.chassis)
        if self.chassis2:
            self.xm.session.add_chassis(self.chassis2)
        XenaStream.next_tpld_id = 0
Пример #5
0
def connect():
    """ Create Xena manager object and connect to chassis. """

    global xm

    # Xena manager requires standard logger. To log all low level CLI commands set DEBUG level.
    logger = logging.getLogger('log')
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler(sys.stdout))

    # Create XenaApp object and connect to chassis.
    xm = init_xena(api, logger, owner, chassis)
    xm.session.add_chassis(chassis)
Пример #6
0
    def __init__(self, api='socket', user=None, ip=None, port=57911):
        """ Create Xena Valkyrie app object.

        :param api: API type - socket or rest
        :param user: user name for session and login
        :param ip: optional REST server IP address
        :param port: optional REST server TCP port
        """
        user = user if user else getpass.getuser()
        self.logger = logging.getLogger('log')
        self.logger.setLevel(logging.DEBUG)
        self.logger.addHandler(logging.StreamHandler(sys.stdout))
        self.xm = init_xena(ApiType[api], self.logger, user, ip, port)
    def load_inventory(self,
                       context: AutoLoadCommandContext) -> AutoLoadDetails:
        """Return device structure with all standard attributes. """
        address = context.resource.address
        port = self.resource.controller_tcp_port
        port = int(port) if port else 22611
        encrypted_password = self.resource.password
        password = get_cs_session(context).DecryptPassword(
            encrypted_password).Value

        self.xm = init_xena(ApiType.socket, self.logger, "quali-cs")
        self.xm.session.add_chassis(address, port, password)
        self.xm.session.inventory()
        self._load_chassis(self.xm.session.chassis_list[address])
        return self.resource.create_autoload_details()
Пример #8
0
def connect():
    """ Create Xena manager object and connect to chassis. """

    global xm

    # Xena manager requires standard logger. To log all low level CLI commands set DEBUG level.
    formatter = logging.Formatter(fmt='%(asctime)s.%(msecs)d %(message)s',
                                  datefmt='%H:%M:%S')
    logger.setLevel(logging.DEBUG)
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(formatter)
    logger.addHandler(handler)

    # Create XenaApp object and connect to chassis.
    xm = init_xena(api, logger, owner, chassis)
    xm.session.add_chassis(chassis)
Пример #9
0
 def connect(self, login):
     if not self._app_driver:
         api = ApiType.socket
         loger = self._parent._logger
         owner = self._parent._login_name
         self._app_driver = init_xena(api, loger, owner)
    def initialize(self, context, logger):

        self.logger = logger

        user = context.resource.attributes['User']
        self.xm = init_xena(ApiType.socket, self.logger, user)