def __init__(self, inputs, project_name, key='key1', username=None, password=None,update_ssh_key=True): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.update_ssh_key=update_ssh_key # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = self.username+key self.obj = None if not self.inputs.ha_setup: self.auth_url = os.getenv('OS_AUTH_URL') or \ 'http://' + self.openstack_ip + ':5000/v2.0' else: self.auth_url = os.getenv('OS_AUTH_URL') or \ 'http://' + self.inputs.auth_ip + ':5000/v2.0' self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.endpoint_type = inputs.endpoint_type self.docker_vm = False self._connect_to_openstack()
def __init__(self, inputs, project_name, key='key1', username=None, password=None): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.auth_protocol = inputs.auth_protocol # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = 'ctest_' + self.project_name + self.username + key self.obj = None if not self.inputs.ha_setup: self.auth_url = os.getenv('OS_AUTH_URL') or \ self.auth_protocol + '://' + self.openstack_ip + ':5000/v2.0' else: self.auth_url = os.getenv('OS_AUTH_URL') or \ self.auth_protocol + '://' + self.inputs.auth_ip + ':5000/v2.0' self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.endpoint_type = inputs.endpoint_type self._connect_to_openstack() self.hypervisor_type = os.environ.get('HYPERVISOR_TYPE') \ if os.environ.has_key('HYPERVISOR_TYPE') \ else None
def __init__(self, inputs, project_name, key='key1', username=None, password=None): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.zone = inputs.availability_zone # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = 'ctest_' + self.project_name+self.username+key self.obj = None self.auth_url = inputs.auth_url self.region_name = inputs.region_name self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.endpoint_type = inputs.endpoint_type self._connect_to_openstack() self.hypervisor_type = os.environ.get('HYPERVISOR_TYPE') \ if os.environ.has_key('HYPERVISOR_TYPE') \ else None
def __init__(self, inputs, glance_h, auth_h=None, key='key1', **kwargs): self.inputs = kwargs['inputs'] = inputs self.glance_h = glance_h self.username = inputs.stack_user self.password = inputs.stack_password self.project_name = inputs.project_name self.admin_username = inputs.admin_username self.admin_password = inputs.admin_password self.admin_tenant = inputs.admin_tenant self.admin_domain = inputs.admin_domain self.auth_url = inputs.auth_url self.logger = inputs.logger self.region_name = kwargs.get('region_name') or inputs.region_name if not auth_h: auth_h = self.get_auth_h(**kwargs) self.auth_h = auth_h self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.zone = inputs.availability_zone # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = 'ctest_' + self.project_name + self.username + key self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.hypervisor_type = os.environ.get('HYPERVISOR_TYPE') \ if 'HYPERVISOR_TYPE' in os.environ \ else None self._nova_services_list = None self.hosts_list = [] self._hosts_dict = None self._zones = None self.images_dir = os.path.realpath( os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'images')) self._connect_to_openstack()
def __init__(self, inputs, project_name, key='key1', username=None, password=None): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = self.username + key self.obj = None if not self.inputs.ha_setup: self.auth_url = os.getenv('OS_AUTH_URL') or \ 'http://' + self.openstack_ip + ':5000/v2.0' else: self.auth_url = os.getenv('OS_AUTH_URL') or \ 'http://' + self.inputs.auth_ip + ':5000/v2.0' self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.endpoint_type = inputs.endpoint_type self.docker_vm = False self._connect_to_openstack()
def __init__(self, inputs, project_name, key='key1', username=None, password=None): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.auth_protocol = inputs.auth_protocol # 1265563 keypair name can only be alphanumeric. Fixed in icehouse self.key = 'ctest_' + self.project_name+self.username+key self.obj = None if not self.inputs.ha_setup: self.auth_url = os.getenv('OS_AUTH_URL') or \ self.auth_protocol + '://' + self.openstack_ip + ':5000/v2.0' else: self.auth_url = os.getenv('OS_AUTH_URL') or \ self.auth_protocol + '://' + self.inputs.auth_ip + ':5000/v2.0' self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg') self.endpoint_type = inputs.endpoint_type self._connect_to_openstack() self.hypervisor_type = os.environ.get('HYPERVISOR_TYPE') \ if os.environ.has_key('HYPERVISOR_TYPE') \ else None
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print "INI_CONF:",ini_conf print "YAML_CONF:",yaml_conf #Do Global Configurations First #Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that #all tenants can use the same VN yaml_global_conf = yaml_conf['global_config'] tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.setUp()
def __init__(self, loader_fn, logger): self.logger = logger self._loader = loader_fn self._lock = threading.Lock() cfg_file = os.getenv('FLAVOR_CFG_FILE', 'configs/flavors.cfg') self.logger.debug('Using flavor config from %s' % cfg_file) self.flavor_info = parse_cfg_file(cfg_file)
def __init__(self, inputs, host, port, user, pwd, dc_name, vnc=None, logger=None): super(VcenterOrchestrator, self).__init__(inputs, vnc, logger) self._inputs = inputs self._host = host self._port = port self._user = user self._passwd = pwd self._dc_name = dc_name self._vnc = vnc self._log = logger self._images_info = parse_cfg_file('configs/images.cfg') self._connect_to_vcenter() if self._inputs.orchestrator == 'vcenter': self._vlanmgmt = VcenterPvtVlanMgr(self._vs) else: self._vlanmgmt = VcenterVlanMgr(self._vs) self._create_keypair() self._nfs_ds = NFSDatastore(self._inputs, self) self.enable_vmotion(self.get_hosts())
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None, help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None, help="Specify Test conf file", metavar="FILE") args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print "INI_CONF:", ini_conf print "YAML_CONF:", yaml_conf #Do Global Configurations First #Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that #all tenants can use the same VN tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(ini_conf, test_conf) test_obj.setUp()
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None, help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None, help="Specify Test conf file", metavar="FILE") parser.add_argument("--delete", action="store_true", default=False, help="action for specific tenant only") parser.add_argument("--create", action="store_true", default=False, help="action for specific tenant only") parser.add_argument("--delete_global", action="store_true", default=False, help="action for specific tenant only") parser.add_argument("--create_global", action="store_true", default=False, help="action for specific tenant only") parser.add_argument("--tenant_name", action="store", default="all", help="action for specific tenant only") args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print args # print "INI_CONF:",ini_conf # print "YAML_CONF:",yaml_conf # Do Global Configurations First # Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that # all tenants can use the same VN yaml_global_conf = yaml_conf["global_config"] tests = yaml_conf["tests"] for test_conf in tests: test_obj = Test(yaml_global_conf, ini_conf, test_conf) test_obj.initTest() tenant_name = args.tenant_name """ if args.delete: test_obj.cleanup_tenant(tenant_name) if args.delete_global: test_obj.cleanup_global_config() if args.create_global: test_obj.configure_global_config() if args.create: test_obj.configure_tenant(tenant_name) """ if test_obj.traffic_conf: print "running ping....", time.time() # status = ping_check_setup(test_obj) print time.time() status = "fail" if status == "fail": print "PING FAILED" else: print "SUCCESS" print "running full traffic..." run_traffic(test_obj) print "test completed" sys.exit() print "Exiting test"
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--delete_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--tenant_name',action="store", default='all', help='action for specific tenant only') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print args #print "INI_CONF:",ini_conf #print "YAML_CONF:",yaml_conf #Do Global Configurations First #Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that #all tenants can use the same VN yaml_global_conf = yaml_conf['global_config'] tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.initTest() tenant_name = args.tenant_name """ if args.delete: test_obj.cleanup_tenant(tenant_name) if args.delete_global: test_obj.cleanup_global_config() if args.create_global: test_obj.configure_global_config() if args.create: test_obj.configure_tenant(tenant_name) """ if test_obj.traffic_conf: print "running ping....", time.time() #status = ping_check_setup(test_obj) print time.time() status = 'fail' if status == 'fail': print "PING FAILED" else: print "SUCCESS" print "running full traffic..." run_traffic(test_obj) print "test completed" sys.exit() print "Exiting test"
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--delete_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--tenant_name',action="store", default='all', help='action for specific tenant only') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print args #print "INI_CONF:",ini_conf #print "YAML_CONF:",yaml_conf #Do Global Configurations First #Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that #all tenants can use the same VN yaml_global_conf = yaml_conf['global_config'] tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.initTest() if test_obj.traffic_conf: status = ping_check_setup(test_obj) if status == 'fail': print "ping failed. exiting" sys.exit() else: print "success" #tenant_name = "symantec.Tenant.0" #test_obj.get_vm_info(tenant_name) """ tenant_name = args.tenant_name #test_obj.get_vm_info(tenant_name) #tenant_name = "symantec.Tenant.0" if args.delete: test_obj.cleanup_tenant(tenant_name) if args.delete_global: test_obj.cleanup_global_config() if args.create_global: test_obj.configure_global_config() if args.create: test_obj.configure_tenant(tenant_name) """ sys.exit() print "Exiting test"
def __init__(self, inputs, project_name, key='key1', username=None, password=None): httpclient = None self.inputs = inputs self.username = username or inputs.stack_user self.password = password or inputs.stack_password self.project_name = project_name self.cfgm_ip = inputs.cfgm_ip self.openstack_ip = inputs.openstack_ip self.key = key self.obj = None self.auth_url = os.getenv('OS_AUTH_URL') or \ 'http://' + self.openstack_ip + ':5000/v2.0' self.logger = inputs.logger self.images_info = parse_cfg_file('configs/images.cfg') self.flavor_info = parse_cfg_file('configs/flavors.cfg')
def __init__(self, inputs, host, port, user, pwd, dc_name, vnc, logger): self._inputs = inputs self._host = host self._port = port self._user = user self._passwd = pwd self._dc_name = dc_name self._vnc = vnc self._log = logger self._images_info = parse_cfg_file('configs/images.cfg') self._connect_to_vcenter() self._vlanmgmt = VcenterVlanMgr(self._vs) self._create_keypair()
def __init__(self, inputs, host, port, user, pwd, dc_name, vnc, logger): super(VcenterOrchestrator, self).__init__(inputs, vnc, logger) self._inputs = inputs self._host = host self._port = port self._user = user self._passwd = pwd self._dc_name = dc_name self._vnc = vnc self._log = logger self._images_info = parse_cfg_file('configs/images.cfg') self._connect_to_vcenter() self._vlanmgmt = VcenterVlanMgr(self._vs) self._create_keypair() self._nfs_ds = NFSDatastore(self._inputs, self) self.enable_vmotion(self.get_hosts())
def main(): signal.signal(signal.SIGTERM, sig_handler) parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", help="Specify conf file", metavar="FILE") args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) if args.ini_file: ini_args = parse_cfg_file(args.ini_file) args = update_args(ini_args['TEST'], cli_args) args.update(update_args(ini_args['DEFAULTS'], cli_args)) else: args = cli_args args = Struct(args) validate_args(args) obj = verify(args) obj.verify()
def __init__(self, auth_h=None, **kwargs): self.inputs = kwargs.get('inputs') self.obj = None self.logger = kwargs.get('logger') or self.inputs.logger if self.inputs \ else contrail_logging.getLogger(__name__) if not auth_h: auth_h = self.get_auth_h(**kwargs) self.auth_h = auth_h self.images_info = parse_cfg_file('configs/device_images.cfg') self.images_dir = os.path.realpath(os.path.join( os.path.dirname(os.path.realpath(__file__)), '..', 'images')) self.container_name = None self.installed_images = {} self.models = dict() for key, items in MODELS.items(): for item in items: self.models[item] = key self.device_images_cfg = custom_dict(self.get_device_images_config, 'device_images')
def config_st_si(self, st_name, si_name_prefix, si_count, svc_scaling=False, max_inst=1, domain='default-domain', project='admin', mgmt_vn=None, left_vn=None, right_vn=None, svc_type='firewall', svc_mode='transparent', flavor='contrail_flavor_2cpu', static_route=[None, None, None], ordered_interfaces=True, svc_img_name=None, st_version=1): svc_type_props = { 'firewall': {'in-network-nat': 'tiny_nat_fw', 'in-network': 'tiny_in_net', 'transparent': 'tiny_trans_fw', }, 'analyzer': {'analyzer': 'analyzer'} } svc_mode_props = { 'in-network-nat': {'left': {'shared': True}, 'right': {'shared': False}, }, 'in-network': {'left': {'shared': True}, 'right': {'shared': True} }, 'transparent': {'left': {'shared': True}, 'right': {'shared': True} } } mgmt_props = ['management', False, False] left_scaling = False right_scaling = False if svc_scaling: left_scaling = True right_scaling = svc_mode_props[svc_mode]['right']['shared'] svc_img_name = svc_img_name or svc_type_props[svc_type][svc_mode] images_info = parse_cfg_file('configs/images.cfg') flavor = flavor or images_info[svc_img_name]['flavor'] if_list = [mgmt_props, ['left', left_scaling, bool(static_route[1])], ['right', right_scaling, bool(static_route[2])], ] if svc_type == 'analyzer': left_scaling = svc_mode_props[svc_mode]['left']['shared'] if_list = [['left', left_scaling, bool(static_route[1])]] self.logger.debug('SI properties:'"\n" 'type: %s '"\n" 'mode: %s' "\n" 'image: %s' "\n" 'flavor: %s' "\n" 'intf_list: %s' % (svc_type, svc_mode, svc_img_name, flavor, if_list)) # create service template st_fixture = self.useFixture(SvcTemplateFixture( connections=self.connections, inputs=self.inputs, domain_name=domain, st_name=st_name, svc_img_name=svc_img_name, svc_type=svc_type, if_list=if_list, svc_mode=svc_mode, svc_scaling=svc_scaling, flavor=flavor, ordered_interfaces=ordered_interfaces, version=st_version)) assert st_fixture.verify_on_setup() # create service instances si_fixtures = [] for i in range(0, si_count): verify_vn_ri = True if i: verify_vn_ri = False si_name = si_name_prefix + str(i + 1) si_fixture = self.useFixture(SvcInstanceFixture( connections=self.connections, inputs=self.inputs, domain_name=domain, project_name=project, si_name=si_name, svc_template=st_fixture.st_obj, if_list=if_list, mgmt_vn_name=mgmt_vn, left_vn_name=left_vn, right_vn_name=right_vn, do_verify=verify_vn_ri, max_inst=max_inst, static_route=static_route)) if st_version == 2: self.logger.debug('Launching SVM') if svc_mode == 'transparent': self.trans_mgmt_vn_name = get_random_name('trans_mgmt_vn') self.trans_mgmt_vn_subnets = [ get_random_cidr(af=self.inputs.get_af())] self.trans_left_vn_name = get_random_name('trans_left_vn') self.trans_left_vn_subnets = [ get_random_cidr(af=self.inputs.get_af())] self.trans_right_vn_name = get_random_name( 'trans_right_vn') self.trans_right_vn_subnets = [ get_random_cidr(af=self.inputs.get_af())] self.trans_mgmt_vn_fixture = self.config_vn( self.trans_mgmt_vn_name, self.trans_mgmt_vn_subnets) self.trans_left_vn_fixture = self.config_vn( self.trans_left_vn_name, self.trans_left_vn_subnets) self.trans_right_vn_fixture = self.config_vn( self.trans_right_vn_name, self.trans_right_vn_subnets) for i in range(max_inst): svm_name = get_random_name("pt_svm" + str(i)) pt_name = get_random_name("port_tuple" + str(i)) if svc_mode == 'transparent': svm_fixture = self.config_and_verify_vm( svm_name, image_name=svc_img_name, vns=[self.trans_mgmt_vn_fixture, self.trans_left_vn_fixture, self.trans_right_vn_fixture], count=1, flavor='m1.large') else: svm_fixture = self.config_and_verify_vm( svm_name, image_name=svc_img_name, vns=[self.mgmt_vn_fixture, self.vn1_fixture, self.vn2_fixture], count=1, flavor='m1.large') si_fixture.add_port_tuple(svm_fixture, pt_name) si_fixture.verify_on_setup() si_fixtures.append(si_fixture) return (st_fixture, si_fixtures)
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--delete_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--tenant_count',action="store", default='0', help='action for specific tenant only') parser.add_argument('--tenant_index_range',action="store", default="0:650", help='action for specific tenant only') parser.add_argument('--tenant_index_random',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--tenant_name',action="store", default=None, help='action for specific tenant only[None or all or specific tenant_name]') parser.add_argument('--tenant_name_prefix',action="store", default=None, help='action for specific tenant only') parser.add_argument('--dry',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic_only',action="store_true", default=False, help='action for specific tenant only') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print args #print "INI_CONF:",ini_conf #print "YAML_CONF:",yaml_conf #Do Global Configurations First #Setup MGMT VN: simple network, 1 CIDR for mgmt traffic. Set 'shared' flag for VN so that #all tenants can use the same VN yaml_global_conf = yaml_conf['global_config'] tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.initTest(args) tenant_name_list = test_obj.global_conf['tenant_name_list'] if args.dry: print "##### TEST_ACTION ####" print "tenant_name_list:",tenant_name_list print "create:",args.create print "delete:",args.delete print "######################" continue if args.traffic_only: args.delete = False args.delete_global = False args.create_global = False args.create = False args.traffic = True if args.delete: test_obj.cleanup_tenant() if args.delete_global: test_obj.cleanup_global_config() if args.create_global: test_obj.configure_global_config() if args.create: test_obj.configure_tenant() if args.traffic: if test_obj.traffic_conf: print "running ping....", time.time() status = ping_check_setup(test_obj) print time.time() if status == 'fail': print "PING FAILED" else: print "SUCCESS" print "running full traffic..." run_traffic(test_obj) print "test completed" sys.exit()
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-g", "--global_yaml_config_file", default=None,help="Specify global yaml conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--update',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--update_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--delete_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_dummy_vn',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--tenant_count',action="store", default='0', help='action for specific tenant only') parser.add_argument('--tenant_index_range',action="store", default="0:65000", help='action for specific tenant only') parser.add_argument('--tenant_index_random',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--tenant_name',action="store", default=None, help='action for specific tenant only[None or all or specific tenant_name]') parser.add_argument('--tenant_name_prefix',action="store", default=None, help='action for specific tenant only') parser.add_argument('--domain_name_prefix',action="store", default=None, help='action for specific tenant only') parser.add_argument('--dry',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--stop_traffic',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--analytics',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic_only',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--feature_ping',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--feature_ping_only',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--dpdk',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--loop_count',action="store", default='1', help='loop count') parser.add_argument('--debug',action="store_true", default=False, help='') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) print args if args.debug: debug_func() sys.exit() yaml_conf = parse_yaml_cfg_file(args.global_yaml_config_file) yaml_global_conf = yaml_conf['global_config'] yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.initTest(args) tenant_list = test_obj.global_conf['tenant_list'] if args.dry: print "##### TEST_ACTION ####" print "tenant_list:",tenant_list print "create:",args.create print "delete:",args.delete print "dpdk:",args.dpdk print "######################" continue if args.update or args.update_global: test_obj.update_properties = True else: test_obj.update_properties = False if args.dpdk: test_obj.dpdk = True else: test_obj.dpdk = False if args.traffic_only or args.stop_traffic or args.feature_ping_only: args.delete = False args.delete_global = False args.create_global = False args.create = False args.traffic = True if args.delete: test_obj.cleanup_tenant() if args.delete_global: test_obj.cleanup_global_config() if args.create_global or args.update_global: test_obj.configure_global_config() if args.create_dummy_vn: test_obj.configure_dummy_vn() sys.exit() if args.create or args.update: test_obj.configure_tenant() if args.analytics: test_obj.analytics_check() if args.traffic or args.stop_traffic: for tenant in tenant_list: tenant_fq_name = tenant['fq_name'] domain_name,tenant_name = tenant_fq_name if re.search('-',tenant_name): print "ERROR: duplicate tenant ids present",tenant_name sys.exit() fp = open("result.txt","w") print time.time() tenants, sc_info = test_obj.get_vm_info() print time.time() print "checking MGMT IP reachability..." if not mgmt_ip_reachable(tenants): print "MGMT IP not pingable" fp.write("1") #sys.exit() else: print "MGMT IP is pingable..continuing test.." kill_result = build_kill_traffic_commands(test_obj, tenants) if args.stop_traffic: print "Kill traffic done..exiting.." sys.exit() bms_vlans = test_obj.get_vlan_info() print time.time() print "BMS vlans:",bms_vlans bms_vlans = False if bms_vlans: cleanup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans) if not setup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans): print "BMS NETNS setup failed" #sys.exit() #redo_dhclient(tenants) if test_obj.traffic_conf: print "Running Feature PINGs. Results in ping_result.log" fp_ex = open('res.csv.txt', 'ab') writer = csv.writer(fp_ex, dialect = 'excel') title = ['TCP_Throughput_Success', 'TCP_Retrans', 'TCP_Throughput_Fail',\ 'UDP_Throughput_Success', 'UDP_Throughput_Failure',\ 'S_Fetches', 'S_Success', 'S_Failures', 'S_Rate', 'S_min', 'S_max', 'S_mean',\ 'LL_Fetches', 'LL_Success', 'LL_Failures', 'LL_Rate', 'LL_min', 'LL_max', 'LL_mean',\ 'LB_Fetches', 'LB_Success', 'LB_Failures', 'LB_Rate', 'LB_min', 'LB_max', 'LB_mean'] writer.writerow(title) fp_ex.close() if args.feature_ping or args.feature_ping_only : for i in range(int(args.loop_count)): if ping_check_setup(test_obj, tenants, sc_info,"ping_result_%s.txt"%tenant_name): print "Feature Ping Passed. Exiting" else: print "Feature Ping Failed..exiting.." if args.feature_ping_only: sys.exit() print "Feature Ping Passed. Running FULL Traffic" for i in range(int(args.loop_count)): client_res = run_traffic(test_obj, tenants,sc_info) kill_result = build_kill_traffic_commands(test_obj, tenants) fp.write("0") else: print "Feature Ping Failed. Exiting" fp.write("1") print "Exiting test"
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None,help="Specify global conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None,help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--delete_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--create_global',action="store_true",default=False,help='action for specific tenant only') parser.add_argument('--tenant_count',action="store", default='0', help='action for specific tenant only') parser.add_argument('--tenant_index_range',action="store", default="0:650", help='action for specific tenant only') parser.add_argument('--tenant_index_random',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--tenant_name',action="store", default=None, help='action for specific tenant only[None or all or specific tenant_name]') parser.add_argument('--tenant_name_prefix',action="store", default=None, help='action for specific tenant only') parser.add_argument('--dry',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic',action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic_only',action="store_true", default=False, help='action for specific tenant only') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) print args yaml_global_conf = yaml_conf['global_config'] tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf,ini_conf,test_conf) test_obj.initTest(args) tenant_name_list = test_obj.global_conf['tenant_name_list'] if args.dry: print "##### TEST_ACTION ####" print "tenant_name_list:",tenant_name_list print "create:",args.create print "delete:",args.delete print "######################" continue if args.traffic_only: args.delete = False args.delete_global = False args.create_global = False args.create = False args.traffic = True if args.delete: test_obj.cleanup_tenant() if args.delete_global: test_obj.cleanup_global_config() if args.create_global: test_obj.configure_global_config() if args.create: test_obj.configure_tenant() if args.traffic: fp = open("result.txt","w") print time.time() tenants = test_obj.get_vm_info() print time.time() print "checking MGMT IP reachability..." import pdb; pdb.set_trace() if not mgmt_ip_reachable(tenants): print "MGMT IP not pingable" fp.write("1") sys.exit() kill_result = build_kill_traffic_commands(test_obj, tenants) bms_vlans = test_obj.get_vlan_info() print time.time() if bms_vlans: cleanup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans) if not setup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans): print "BMS NETNS setup failed" sys.exit() #redo_dhclient(tenants) if test_obj.traffic_conf: print "Running Feature PINGs. Results in ping_result.log" if ping_check_setup(test_obj, tenants): print "Feature Ping Passed. Running FULL Traffic" client_res = run_traffic(test_obj, tenants) kill_result = build_kill_traffic_commands(test_obj, tenants) fp.write("0") else: print "Feature Ping Failed. Exiting" fp.write("1") print "Exiting test"
def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("-i", "--ini_file", default=None, help="Specify global conf file", metavar="FILE") parser.add_argument("-g", "--global_yaml_config_file", default=None, help="Specify global yaml conf file", metavar="FILE") parser.add_argument("-c", "--yaml_config_file", default=None, help="Specify Test conf file", metavar="FILE") parser.add_argument('--delete', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--create', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--update', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--update_global', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--delete_global', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--create_global', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--tenant_count', action="store", default='0', help='action for specific tenant only') parser.add_argument('--tenant_index_range', action="store", default="0:650", help='action for specific tenant only') parser.add_argument('--tenant_index_random', action="store_true", default=False, help='action for specific tenant only') parser.add_argument( '--tenant_name', action="store", default=None, help= 'action for specific tenant only[None or all or specific tenant_name]') parser.add_argument('--tenant_name_prefix', action="store", default=None, help='action for specific tenant only') parser.add_argument('--dry', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--stop_traffic', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--traffic_only', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--feature_ping_only', action="store_true", default=False, help='action for specific tenant only') parser.add_argument('--loop_count', action="store", default='1', help='loop count') parser.add_argument('--debug', action="store_true", default=False, help='') args, remaining_argv = parser.parse_known_args(sys.argv[1:]) cli_args = parse_cli(remaining_argv) ini_conf = parse_cfg_file(args.ini_file) print args if args.debug: debug_func() sys.exit() yaml_conf = parse_yaml_cfg_file(args.global_yaml_config_file) yaml_global_conf = yaml_conf['global_config'] yaml_conf = parse_yaml_cfg_file(args.yaml_config_file) tests = yaml_conf['tests'] for test_conf in tests: test_obj = Test(yaml_global_conf, ini_conf, test_conf) test_obj.initTest(args) tenant_name_list = test_obj.global_conf['tenant_name_list'] if args.dry: print "##### TEST_ACTION ####" print "tenant_name_list:", tenant_name_list print "create:", args.create print "delete:", args.delete print "######################" continue if args.update or args.update_global: test_obj.update_properties = True else: test_obj.update_properties = False if args.traffic_only or args.stop_traffic or args.feature_ping_only: args.delete = False args.delete_global = False args.create_global = False args.create = False args.traffic = True if args.delete: test_obj.cleanup_tenant() if args.delete_global: test_obj.cleanup_global_config() if args.create_global or args.update_global: test_obj.configure_global_config() if args.create or args.update: test_obj.configure_tenant() if args.traffic or args.stop_traffic: for tenant_name in tenant_name_list: if re.search('-', tenant_name): print "ERROR: duplicate tenant ids present", tenant_name sys.exit() fp = open("result.txt", "w") print time.time() tenants, sc_info = test_obj.get_vm_info() print time.time() print "checking MGMT IP reachability..." if not mgmt_ip_reachable(tenants): print "MGMT IP not pingable" fp.write("1") #sys.exit() else: print "MGMT IP is pingable..continuing test.." kill_result = build_kill_traffic_commands(test_obj, tenants) if args.stop_traffic: print "Kill traffic done..exiting.." sys.exit() #bms_vlans = test_obj.get_vlan_info() #print time.time() #if bms_vlans: # cleanup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans) # if not setup_bms_netns(test_obj.global_conf['pr_qfx'], bms_vlans): # print "BMS NETNS setup failed" # #sys.exit() #redo_dhclient(tenants) if test_obj.traffic_conf: #print 'running bgpaas pings' #if run_bgpaas_pings(test_obj, tenants): # print "BGPaaS pings passed" #else: # print "BGPaaS pings failed" #sys.exit(1) print "Running Feature PINGs. Results in ping_result.log" fp_ex = open('res.csv.txt', 'ab') writer = csv.writer(fp_ex, dialect='excel') title = ['TCP_Throughput_Success', 'TCP_Retrans', 'TCP_Throughput_Fail',\ 'UDP_Throughput_Success', 'UDP_Throughput_Failure',\ 'S_Fetches', 'S_Success', 'S_Failures', 'S_Rate', 'S_min', 'S_max', 'S_mean',\ 'LL_Fetches', 'LL_Success', 'LL_Failures', 'LL_Rate', 'LL_min', 'LL_max', 'LL_mean',\ 'LB_Fetches', 'LB_Success', 'LB_Failures', 'LB_Rate', 'LB_min', 'LB_max', 'LB_mean'] writer.writerow(title) fp_ex.close() if ping_check_setup(test_obj, tenants, sc_info): print "Feature Ping Passed. Exiting" else: print "Feature Ping Failed..exiting.." if args.feature_ping_only: sys.exit() if True: print "Feature Ping Passed. Running FULL Traffic" for i in range(int(args.loop_count)): client_res = run_traffic(test_obj, tenants, sc_info) kill_result = build_kill_traffic_commands( test_obj, tenants) fp.write("0") else: print "Feature Ping Failed. Exiting" fp.write("1") print "Exiting test"