def load_config(self, context, stc_config_file_name): """ :param stc_config_file_name: full path to STC configuration file (tcc or xml) """ self.stc.load_config(stc_config_file_name) config_ports = self.stc.project.get_ports() reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() reservation_ports = {} for port in get_reservation_resources( my_api, reservation_id, 'Generic Traffic Generator Port', 'PerfectStorm Chassis Shell 2G.GenericTrafficGeneratorPort', 'STC Chassis Shell 2G.GenericTrafficGeneratorPort'): reservation_ports[get_family_attribute( my_api, port, 'Logical Name').Value.strip()] = port for name, port in config_ports.items(): if name in reservation_ports: address = get_address(reservation_ports[name]) self.logger.debug( 'Logical Port {} will be reserved on Physical location {}'. format(name, address)) port.reserve(address, force=True, wait_for_up=False) else: self.logger.error( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) raise Exception( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) self.logger.info("Port Reservation Completed")
def load_config(self, context, xena_configs_folder): reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() reservation_ports = get_reservation_resources( my_api, reservation_id, 'Xena Chassis Shell 2G.GenericTrafficGeneratorPort') for reserved_port in reservation_ports: config = get_family_attribute(my_api, reserved_port, 'Logical Name').Value.strip() address = get_address(reserved_port) self.logger.debug( 'Configuration {} will be loaded on Physical location {}'. format(config, address)) chassis = my_api.GetResourceDetails( reserved_port.Name.split('/')[0]) encripted_password = my_api.GetAttributeValue( chassis.Name, 'Xena Chassis Shell 2G.Password').Value password = CloudShellSessionContext( context).get_api().DecryptPassword(encripted_password).Value tcp_port = my_api.GetAttributeValue( chassis.Name, 'Xena Chassis Shell 2G.Controller TCP Port').Value if not tcp_port: tcp_port = '22611' ip, module, port = address.split('/') self.xm.session.add_chassis(ip, int(tcp_port), password) xena_port = XenaPort(self.xm.session.chassis_list[ip], '{}/{}'.format(module, port)) xena_port.reserve(force=True) xena_port.load_config( path.join(xena_configs_folder, config) + '.xpc')
def load_config(self, context, ixia_config_file_name): self.ixl.load_config(ixia_config_file_name) self.ixl.repository.test.set_attributes(enableForceOwnership=False) config_elements = self.ixl.repository.get_elements() reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() reservation_ports = {} for port in get_reservation_resources(my_api, context.reservation.reservation_id, 'Generic Traffic Generator Port', 'PerfectStorm Chassis Shell 2G.GenericTrafficGeneratorPort', 'Ixia Chassis Shell 2G.GenericTrafficGeneratorPort'): reservation_ports[get_family_attribute(my_api, port, 'Logical Name').Value.strip()] = port perfectstorms = [ps.FullAddress for ps in get_reservation_resources(my_api, reservation_id, 'PerfectStorm Chassis Shell 2G')] for name, element in config_elements.items(): if name in reservation_ports: address = get_address(reservation_ports[name]) ip_address, module, port = address.split('/') if ip_address in perfectstorms: address = '{}/{}/{}'.format(ip_address, module, int(port) + 1) self.logger.debug('Logical Port {} will be reserved on Physical location {}'.format(name, address)) element.reserve(address) else: self.logger.error('Configuration element "{}" not found in reservation elements {}'. format(element, reservation_ports.keys())) raise Exception('Configuration element "{}" not found in reservation elements {}'. format(element, reservation_ports.keys())) self.logger.info("Port Reservation Completed")
def load_config(self, context, avl_config_file_name, avl_test_name): self.avl.load_config(avl_config_file_name) if avl_test_name: self.test = self.avl.project.tests[avl_test_name] else: self.test = self.avl.project.tests.values()[0] reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() reservation_ports = {} reservation_ports['client'] = {} reservation_ports['server'] = {} for port in get_reservation_resources( my_api, reservation_id, 'Generic Traffic Generator Port', 'PerfectStorm Chassis Shell 2G.GenericTrafficGeneratorPort', 'STC Chassis Shell 2G.GenericTrafficGeneratorPort'): side, index = get_family_attribute( my_api, port, 'Logical Name').Value.strip().split(' ') reservation_ports[side.lower()][int(index)] = port locations = [] for index, association in self.test.client.associations.items(): if index in reservation_ports['client']: address = get_address(reservation_ports['client'][index]) self.logger.debug( 'client association {} will be reserved on Physical location {}' .format(index, address)) locations.append(address) association.interface.set_port(address) else: self._association_not_found('client', index, reservation_ports['client']) for index, association in self.test.server.associations.items(): if index in reservation_ports['server']: address = get_address(reservation_ports['server'][index]) self.logger.debug( 'server association {} will be reserved on Physical location {}' .format(index, address)) locations.append(address) association.interface.set_port(address) else: self._association_not_found('server', index, reservation_ports['server']) self._reserve_ports(*locations) self.logger.info('Port Reservation Completed')
def load_config(self, context, ixia_config_file_name): self.ixn.new_config() self.ixn.load_config(ixia_config_file_name) config_ports = self.ixn.root.get_children('vport') for port in config_ports: port.release() reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() reservation_ports = {} for port in get_reservation_resources( my_api, reservation_id, 'Generic Traffic Generator Port', 'PerfectStorm Chassis Shell 2G.GenericTrafficGeneratorPort', 'Ixia Chassis Shell 2G.GenericTrafficGeneratorPort'): reservation_ports[get_family_attribute( my_api, port, 'Logical Name').Value.strip()] = port for port in config_ports: name = port.obj_name() if name in reservation_ports: address = get_address(reservation_ports[name]) self.logger.debug( 'Logical Port {} will be reserved on Physical location {}'. format(name, address)) port.reserve(address, wait_for_up=False) else: self.logger.error( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) raise Exception( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) for port in config_ports: port.wait_for_states(40, 'up') self.logger.info("Port Reservation Completed")
def load_config(self, context, bbl_config_file_name, scenario): self.project = bbl_config_file_name.replace('\\', '/') self.scenario = scenario return reservation_id = context.reservation.reservation_id my_api = CloudShellSessionContext(context).get_api() # todo: geat ports from bbl. config_ports = ['WAN_PORT', 'PORT_45', 'PC1x2G'] reservation_ports = {} for port in get_reservation_resources( my_api, reservation_id, 'ByteBlower Chassis Shell 2G.GenericTrafficGeneratorPort', 'ByteBlower Chassis Shell 2G.ByteBlowerEndPoint'): reservation_ports[get_family_attribute( my_api, port, 'Logical Name').Value.strip()] = port for port in config_ports: name = port.obj_name() if name in reservation_ports: address = get_address(reservation_ports[name]) self.logger.debug( 'Logical Port {} will be reserved on Physical location {}'. format(name, address)) port.reserve(address, wait_for_up=False) else: self.logger.error( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) raise Exception( 'Configuration port "{}" not found in reservation ports {}' .format(port, reservation_ports.keys())) self.logger.info("Port Reservation Completed")