コード例 #1
0
def connect():
    global ixia

    logger = logging.getLogger()
    logger.setLevel(log_level)
    logger.addHandler(logging.StreamHandler(sys.stdout))

    ixia = init_ixe(logger, host, tcp_port, rsa_id)
    ixia.connect(user)
コード例 #2
0
def ixia(logger: logging.Logger, server_properties: dict) -> IxeApp:
    """ Yields connected Ixia object. """
    server, port = server_properties['server'].split(':')
    ixia = init_ixe(logger, server, int(port), rsa_id=RSA_ID)
    ixia.connect(user='******')
    yield ixia
    for port in ixia.session.ports.values():
        port.release()
    ixia.disconnect()
コード例 #3
0
    def setUp(self):
        super(IxeTestBase, self).setUp()
        self.ixia = init_ixe(self.logger, host=self.config.get('IXE', 'server'),
                             port=self.config.getint('IXE', 'tcp_port'), rsa_id=self.config.get('IXE', 'rsa_id'))
        self.ixia.connect(self.config.get('IXE', 'user'))
        self.ixia.add(self.config.get('IXE', 'chassis'))

        self.port1 = self.config.get('IXE', 'port1')
        self.port2 = self.config.get('IXE', 'port2')

        self.ports = {}
コード例 #4
0
 def __init__(self,
              server_host,
              login_name,
              server_tcp_port=4555,
              api_type=ApiType.socket,
              rsaPath=""):
     super(self.__class__, self).__init__(server_host, login_name,
                                          server_tcp_port)
     self._connector = init_ixe(logger=self._logger,
                                host=server_host,
                                port=int(server_tcp_port),
                                rsa_id=rsaPath)
コード例 #5
0
    def initialize(self, context, logger):
        """
        :type context: cloudshell.shell.core.driver_context.InitCommandContext
        """

        self.logger = logger

        address = context.resource.address
        controller_address = context.resource.attributes['Ixia Chassis Shell 2G.Controller Address']
        port = context.resource.attributes['Ixia Chassis Shell 2G.Controller TCP Port']

        if not controller_address:
            controller_address = address
        if not port:
            port = '4555'
        rsa_id = path.join(path.dirname(__file__), 'id_rsa')

        self.ixia = init_ixe(self.logger, host=controller_address, port=int(port), rsa_id=rsa_id)
        self.ixia.connect()
        self.ixia.add(address)
コード例 #6
0
    def initialize(self, context, logger):
        """
        :type context: cloudshell.shell.core.driver_context.InitCommandContext
        """

        self.logger = logger

        port = context.resource.attributes['Controller TCP Port']
        client_install_path = context.resource.attributes[
            'Client Install Path']

        if 'ixnetwork' in client_install_path.lower():
            self.ixia = init_ixn(ApiType.tcl, self.logger, client_install_path)
            controller_address = context.resource.attributes[
                'Controller Address']
            if not controller_address:
                controller_address = 'localhost'
            if not port:
                port = 8009
            self.ixia.connect(tcl_server=controller_address, tcl_port=port)
        else:
            address = context.resource.address
            rsa_id = None
            if client_install_path:
                rsa_id = os.path.join(client_install_path,
                                      'TclScripts/lib/ixTcl1.0/id_rsa')
                port = 8022
            # Not likely, but on Windows servers users can set the Tcl server port, so we can't assume 4555.
            if not port:
                port = 4555
            self.ixia = init_ixe(ApiType.socket,
                                 self.logger,
                                 host=address,
                                 port=int(port),
                                 rsa_id=rsa_id)
            self.ixia.connect()
            self.ixia.add(address)
コード例 #7
0
    def get_inventory(self,
                      context: ResourceCommandContext) -> AutoLoadDetails:
        """Load Ixia chassis inventory to CloudShell (from API)."""
        self.resource = Ixia_Chassis_Shell_2G.create_from_context(context)
        address = context.resource.address
        controller_address = self.resource.controller_address
        port = self.resource.controller_tcp_port

        if not controller_address:
            controller_address = address
        if not port:
            port = "4555"
        rsa_id = path.join(path.dirname(__file__), "id_rsa")

        ixia = init_ixe(self.logger,
                        host=controller_address,
                        port=int(port),
                        rsa_id=rsa_id)
        ixia.connect()
        ixia.add(address)

        ixia.discover()
        self._load_chassis(list(ixia.chassis_chain.values())[0])
        return self.resource.create_autoload_details()