Пример #1
0
    def setUpClass(cls):
        # Create the required users, projects and domains
        cmd = 'kubectl config use-context juju-context'
        cti_obj = ContrailTestInit(input_file='contrail_test_input.yaml')
        cti_obj.run_cmd_on_server(server_ip=cti_obj.juju_server,
                                  username='******',
                                  password='******',
                                  issue_cmd=cmd)
        super(TestPolicyCombo, cls).setUpClass()
        cls.admin = ExampleUser.admin()
        cls.admin.create_all(user_name='userD',
                             password='******',
                             role='Member',
                             project_name='userD_project',
                             domain_name='userD_domain')
        cls.admin.create_all(user_name='userA',
                             password='******',
                             role='Member',
                             project_name='userA_project',
                             domain_name='userA_domain')
        cls.admin.create_all(user_name='userB',
                             password='******',
                             role='Member',
                             project_name='userB_project',
                             domain_name='userB_domain')
        cls.admin.create_all(user_name='userC',
                             password='******',
                             role='Member',
                             project_name='userC_project',
                             domain_name='userC_domain')

        cmd = 'kubectl create ns zomsrc; kubectl create ns easy'
        cls.inputs.run_cmd_on_server(server_ip=cti_obj.juju_server,
                                     username='******',
                                     password='******',
                                     issue_cmd=cmd)
        admin_policy = create_policy.get_admin_policy()
        userA_policy = create_policy.get_userA_policy()
        userB_policy = create_policy.get_userB_policy()
        userC_policy = create_policy.get_userC_policy()
        userD_policy = create_policy.get_userD_policy()
        policies = [
            admin_policy, userA_policy, userB_policy, userC_policy,
            userD_policy
        ]
        filename = create_policy.insert_policies_in_template_file(
            policies, filename='all_in_one_policy.yaml', inputs=cls.inputs)
        create_policy.apply_policies_and_check_in_config_map(
            policies, filename, cti_obj.juju_server)
Пример #2
0
                cfgm_ip=init_obj.cfgm_ip,
                auth_server_ip=init_obj.auth_ip,
            )
            phy_router_obj.setUp()
        if device_dict['type'] == 'vcenter_gateway':
            vrouter_obj = VirtualRouterFixture(
                device_dict['name'],
                'embedded',
                cfgm_ip=init_obj.cfgm_ip,
                auth_server_ip=init_obj.auth_ip,
            )
            vrouter_obj.setUp()

            vcpe_router_obj = VpeRouterFixture(
                device_dict['name'],
                device_dict['mgmt_ip'],
                ssh_username=device_dict['ssh_username'],
                ssh_password=device_dict['ssh_password'],
                mgmt_ip=device_dict['mgmt_ip'],
                ports=device_dict['ports'],
                cfgm_ip=init_obj.cfgm_ip,
                auth_server_ip=init_obj.auth_ip,
            )
            vcpe_router_obj.setUp()
            vcpe_router_obj.vrouter_ref_set(vrouter_obj.vr)
            vcpe_router_obj.setup_physical_ports()
            for port in device_dict['ports']:
                ifup_cmd = 'ifconfig %s up' % port
                init_obj.run_cmd_on_server(device_dict['mgmt_ip'], ifup_cmd)
    # end for
Пример #3
0
                auth_server_ip=init_obj.auth_ip,
                )
            phy_router_obj.setUp()
        if device_dict['type'] == 'vcenter_gateway':
               vrouter_obj = VirtualRouterFixture(device_dict['name'],
                                      'embedded', 
                                      cfgm_ip=init_obj.cfgm_ip,
                                      auth_server_ip=init_obj.auth_ip,
                                       )
               vrouter_obj.setUp()

               vcpe_router_obj = VpeRouterFixture(
                   device_dict['name'], device_dict['mgmt_ip'],
                   ssh_username=device_dict['ssh_username'],
                   ssh_password=device_dict['ssh_password'],
                   mgmt_ip=device_dict['mgmt_ip'],
                   ports=device_dict['ports'],
                   cfgm_ip=init_obj.cfgm_ip,
                   auth_server_ip=init_obj.auth_ip,
                   )
               vcpe_router_obj.setUp()
               vcpe_router_obj.vrouter_ref_set(vrouter_obj.vr)
               vcpe_router_obj.setup_physical_ports()
               for port in device_dict['ports']:
                   ifup_cmd = 'ifconfig %s up'%port
                   init_obj.run_cmd_on_server(device_dict['mgmt_ip'],ifup_cmd )
    # end for


    
Пример #4
0
            log_pattern = '%s/*%s*traceback*.log' % (dest, container_str)

            init_obj.copy_file_to_server(host_ip,
                                         src_file,
                                         dest,
                                         script_file,
                                         container=container,
                                         force=True)
            if os.path.exists(src_ignore_tb_file):
                init_obj.copy_file_to_server(host_ip,
                                             src_ignore_tb_file,
                                             dest,
                                             ignore_tb_file,
                                             container=container,
                                             force=True)
            init_obj.run_cmd_on_server(host_ip, 'rm -f %s' % (log_pattern))

            # Get the traceback files
            cmd = 'python %s/%s -p %s -i %s/%s' % (dest, script_file, dest,
                                                   dest, ignore_tb_file)
            if container_str:
                cmd = cmd + ' -l %s' % (container_str)
            output = init_obj.run_cmd_on_server(host_ip, cmd)
            print output

            # Copy the resulting log files
            if 'Done looking for' in output:
                dest_folder = 'logs'
                result_files = re.findall(r'will be in (.*)\n', output)
                for f in result_files:
                    init_obj.copy_file_from_server(host_ip,
Пример #5
0
            else:
                container_str = container
            if collected.get('%s-%s' % (host_ip, container_str)):
                continue
            log_pattern = '%s/*%s*traceback*.log' % (dest, container_str)

            init_obj.copy_file_to_server(host_ip, src_file, dest, script_file,
                                         container=container, force=True)
            if os.path.exists(src_ignore_tb_file):
                init_obj.copy_file_to_server(host_ip,
                                             src_ignore_tb_file,
                                             dest,
                                             ignore_tb_file,
                                             container=container,
                                             force=True)
            init_obj.run_cmd_on_server(host_ip, 'rm -f %s' % (log_pattern))

            # Get the traceback files
            cmd = 'python %s/%s -p %s -i %s/%s' % (dest,
                                                   script_file,
                                                   dest,
                                                   dest,
                                                   ignore_tb_file
                                                   )
            if container_str:
                cmd = cmd + ' -l %s' % (container_str)
            output = init_obj.run_cmd_on_server(host_ip, cmd)
            print output

            # Copy the resulting log files
            if 'Done looking for' in output: