Example #1
0
    def create_db_license(self,
                          h_type,
                          device_type,
                          status=0,
                          tenant_name='',
                          node_id='',
                          update_date=''):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_license = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_LICENSE)

        # Create NAL_LICENSE_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['license'] = 'license' + str(h_type) + str(device_type)
        params['type'] = h_type
        params['device_type'] = device_type
        params['status'] = status
        if len(tenant_name) > 0:
            params['tenant_name'] = tenant_name
        if len(node_id) > 0:
            params['node_id'] = node_id
        if len(update_date) > 0:
            params['update_date'] = update_date

        db_create.set_context(db_endpoint_license, params)
        db_create.execute()
Example #2
0
    def update_db_license_status(self, device_type, status):

        # Create Instance(DB Client)
        db_list = list.ListClient(config.JobConfig())
        db_update = update.UpdateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_license = \
            base.JobAutoBase().get_db_endpoint(
                config.JobConfig().REST_URI_LICENSE)

        # Update NAL_LICENSE_MNG
        params = {}
        params['create_id'] = 'test_nw_automation_user_001'
        params['type'] = 2
        params['device_type'] = device_type

        db_list.set_context(db_endpoint_license, params)
        db_list.execute()
        update_license_list = db_list.get_return_param()

        for update_license in update_license_list:
            keys = [update_license['ID']]
            params = {}
            params['status'] = status
            db_update.set_context(db_endpoint_license, keys, params)
            db_update.execute()
Example #3
0
    def setUp(self):
        # Establish a clean test environment.
        super(TestTenatAPI, self).setUp()

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_tenant = base.JobAutoBase().get_db_endpoint(
                config.JobConfig().REST_URI_TENANT)

        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['IaaS_region_id'] = JOB_INPUT['IaaS_region_id']
        params['IaaS_tenant_id'] = JOB_INPUT['IaaS_tenant_id']
        tenant_info = [
            {
                "description": "",
                "enabled": True,
                "id": "ef5d2e187b9636f9a4811318069137a6",
                "msa_customer_id": 0,
                "msa_customer_name": "",
                "name": JOB_INPUT['IaaS_tenant_name'],
                "pod_id": JOB_INPUT['pod_id']
            }
        ]
        params['tenant_info'] = json.dumps(tenant_info)
        db_create.set_context(db_endpoint_tenant, params)
        db_create.execute()
Example #4
0
    def create_db_tenant(self, msa_customer_id=0):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_tenant = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_TENANT)

        # Create
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['IaaS_region_id'] = JOB_INPUT['IaaS_region_id']
        params['IaaS_tenant_id'] = JOB_INPUT['IaaS_tenant_id']
        tenant_info = [{
            "description": "",
            "enabled": True,
            "id": JOB_INPUT['nal_tenant_id'],
            "msa_customer_id": msa_customer_id,
            "msa_customer_name": "",
            "name": JOB_INPUT['IaaS_tenant_name'],
            "pod_id": JOB_INPUT['pod_id']
        }]
        params['tenant_info'] = json.dumps(tenant_info)
        db_create.set_context(db_endpoint_tenant, params)
        db_create.execute()
Example #5
0
    def tearDown(self):
        """Clear the test environment"""
        super(TestLicenseAPI, self).tearDown()

        # Create Instance(DB Client)
        db_delete = delete.DeleteClient(config.JobConfig())
        db_list = list.ListClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_license = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_LICENSE)
        db_endpoint_msa_vlan = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_MSA_VLAN)
        db_endpoint_port = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_PORT)

        # Delete from NAL_LICENSE_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_license, params)
        db_list.execute()
        delete_list = db_list.get_return_param()

        for delete_res in delete_list:
            key = delete_res['ID']
            db_delete.set_context(db_endpoint_license, [key])
            db_delete.execute()

        # Delete from NAL_MSA_VLAN_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_msa_vlan, params)
        db_list.execute()
        delete_list = db_list.get_return_param()

        for delete_res in delete_list:
            key = delete_res['ID']
            db_delete.set_context(db_endpoint_msa_vlan, [key])
            db_delete.execute()

        # Delete from NAL_PORT_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_port, params)
        db_list.execute()
        delete_list = db_list.get_return_param()

        for delete_res in delete_list:
            key = delete_res['ID']
            db_delete.set_context(db_endpoint_port, [key])
            db_delete.execute()
Example #6
0
    def create_db_apl(self,
                      apl_type,
                      nf_type=1,
                      device_type=1,
                      redundant_configuration_flg=1):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_apl = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_APL)

        node_id = ''.join([
            random.choice(string.digits + string.ascii_letters)
            for i in range(10)
        ])

        # Create
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['node_id'] = node_id
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['pod_id'] = JOB_INPUT['pod_id']
        params['tenant_id'] = JOB_INPUT['IaaS_tenant_id']
        params['apl_type'] = apl_type
        params['type'] = nf_type
        params['device_type'] = device_type
        params['task_status'] = 0

        params['actsby_flag_master'] = 'act'
        params['device_name_master'] = 'wn0fwxtf01'
        params['device_detail_master'] = '{}'
        params['master_ip_address'] = '100.99.0.5'
        params['redundant_configuration_flg'] = redundant_configuration_flg
        params['MSA_device_id'] = ''
        params['status'] = 0
        params['nic_MSA'] = 'mport'
        params['nic_public'] = 'pport'
        params['nic_external'] = 'eport'
        params['nic_tenant'] = 'tport'

        db_create.set_context(db_endpoint_apl, params)
        db_create.execute()

        return node_id
Example #7
0
    def create_db_apl(self, nf_type, device_type=1):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())
        db_list = list.ListClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_apl = base.JobAutoBase().get_db_endpoint(
                config.JobConfig().REST_URI_APL)

        # Create
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['node_id'] = JOB_INPUT['node_id']
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['pod_id'] = JOB_INPUT['pod_id']
        params['tenant_id'] = JOB_INPUT['IaaS_tenant_id']
        params['apl_type'] = 1
        params['type'] = nf_type
        params['device_type'] = device_type
        params['task_status'] = 0

        params['actsby_flag_master'] = 'act'
        params['device_name_master'] = 'wn0fwxtf01'
        params['device_detail_master'] = '{}'
        params['master_ip_address'] = '100.99.0.5'
        params['redundant_configuration_flg'] = 0
        params['MSA_device_id'] = ''
        params['status'] = 0
        params['nic_MSA'] = 'mport'
        params['nic_public'] = 'pport'
        params['nic_external'] = 'eport'
        params['nic_tenant'] = 'tport'

        db_create.set_context(db_endpoint_apl, params)
        db_create.execute()

        # List NAL_APL_MNG
        params = {}
        params['node_id'] = JOB_INPUT['node_id']
        params['delete_flg'] = 0
        db_list.set_context(db_endpoint_apl, params)
        db_list.execute()
        apl_list = db_list.get_return_param()

        return apl_list[0]['ID']
Example #8
0
    def test_glance_endpoint_not_found(self):

        endpoint = self.ENDPOINT_URL
        tenant_id = self.ADMIN_TENANT_ID
        admin_user_name = 'admin'
        admin_password = '******'

        job_config = config.JobConfig()

        # Create Token
        token = tokens.OscTokens(job_config)\
                    .create_token(admin_user_name, admin_password, endpoint)

        # Assertion
        self.assertGreaterEqual(len(token), 1)

        # Get Endpoints
        endpoint_array = tokens.OscTokens(job_config).get_endpoints(
            endpoint, token, admin_user_name, admin_password, tenant_id)

        endpoint_array['region_id'] = 'regionNotfound'

        # Create Server
        try:
            images.OscGlanceImages(job_config).list_images(endpoint_array)

        except SystemError as e:
            if e.args[0] != images.OscGlanceImages.EXCEPT_MSG08:
                raise
Example #9
0
    def test_keystone_endpoint_not_found(self):

        endpoint = self.ENDPOINT_URL
        admin_user_name = 'admin'
        admin_password = '******'
        tenant_id = self.ADMIN_TENANT_ID

        job_config = config.JobConfig()

        # Create Token
        token = tokens.OscTokens(job_config)\
                    .create_token(admin_user_name, admin_password, endpoint)

        # Get Endpoints
        endpoint_array = tokens.OscTokens(job_config).get_endpoints(
            endpoint, token, admin_user_name, admin_password, tenant_id)

        endpoint_array['region_id'] = 'regionNotfound'

        # Create Server
        try:
            tenants.OscTenants(job_config)\
                            .create_tenant(endpoint_array, 'tenant_name_new1')

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG08:
                raise
Example #10
0
    def test_tokens_create_token_validation_error(self):

        endpoint = self.ENDPOINT_URL
        admin_user_name = 'admin'
        admin_password = '******'

        job_config = config.JobConfig()

        try:
            tokens.OscTokens(job_config)\
                    .create_token('', admin_password, endpoint)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config)\
                    .create_token(admin_user_name, '', endpoint)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config)\
                    .create_token(admin_user_name, admin_password, '')

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise
Example #11
0
    def test_nova_endpoint_not_found(self):

        endpoint = self.ENDPOINT_URL
        tenant_id = self.ADMIN_TENANT_ID
        admin_user_name = 'admin'
        admin_password = '******'
        imageRef = '55f7012b-4c5b-4fb8-90c7-2e1e1205e128'
        flavorRef = '2'

        network_list = [
            {
                'uuid': '6141844163e191152455519bc83d2bda',
                'port': 'b411cd48241a5d2bc11b02cac16e2f91',
            }
        ]

        job_config = config.JobConfig()

        token = tokens.OscTokens(job_config).create_token(
                                admin_user_name, admin_password, endpoint)

        endpoint_array = tokens.OscTokens(job_config).get_endpoints(
            endpoint, token, admin_user_name, admin_password, tenant_id)

        endpoint_array['region_id'] = 'regionNotfound'

        # Create Server
        try:
            servers.OscServers(job_config).create_server(endpoint_array,
                            'sv_name_new', imageRef, flavorRef, network_list)

        except SystemError as e:
            if e.args[0] != servers.OscServers.EXCEPT_MSG08:
                raise
Example #12
0
    def test_users_update_user_validation_error(self):

        endpoint_array = {'token': {}}
        user_id = 'test_user'

        job_config = config.JobConfig()

        try:
            users.OscUsers(job_config).update_user({}, user_id)

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise

        try:
            users.OscUsers(job_config).update_user(endpoint_array, '')

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise

        try:
            users.OscUsers(job_config).update_user(endpoint_array, user_id)

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise
Example #13
0
    def test_roles_list_roles_for_user_validation_error(self):

        endpoint_array = {'token': {}}
        tenant_id = self.ADMIN_TENANT_ID
        user_id = 'test_user'

        job_config = config.JobConfig()

        try:
            roles.OscRoles(job_config).list_roles_for_user({}, user_id,
                                                           tenant_id)

        except SystemError as e:
            if e.args[0] != roles.OscRoles.EXCEPT_MSG01:
                raise

        try:
            roles.OscRoles(job_config).list_roles_for_user(
                endpoint_array, '', tenant_id)

        except SystemError as e:
            if e.args[0] != roles.OscRoles.EXCEPT_MSG01:
                raise

        try:
            roles.OscRoles(job_config).list_roles_for_user(
                endpoint_array, user_id, '')

        except SystemError as e:
            if e.args[0] != roles.OscRoles.EXCEPT_MSG01:
                raise
Example #14
0
    def test_tenants_update_tenant_validation_error(self):

        endpoint_array = {'token': {}}
        tenant_id = self.ADMIN_TENANT_ID

        job_config = config.JobConfig()

        try:
            tenants.OscTenants(job_config).update_tenant({}, tenant_id)

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise

        try:
            tenants.OscTenants(job_config).update_tenant(endpoint_array, '')

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise

        try:
            tenants.OscTenants(job_config).update_tenant(
                endpoint_array, tenant_id)

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise
Example #15
0
    def test_quantum_endpoint_not_found(self):

        endpoint = self.ENDPOINT_URL
        tenant_id = self.ADMIN_TENANT_ID
        admin_user_name = 'admin'
        admin_password = '******'
        nw_name = 'nw_ksp'

        job_config = config.JobConfig()

        token = tokens.OscTokens(job_config).create_token(
            admin_user_name, admin_password, endpoint)

        endpoint_array = tokens.OscTokens(job_config).get_endpoints(
            endpoint, token, admin_user_name, admin_password, tenant_id)

        endpoint_array['region_id'] = 'regionNotfound'

        nw_name_new = nw_name \
                        + datetime.datetime.today().strftime('%Y%m%d%H%M%S')

        # Create Network
        try:
            networks.OscQuantumNetworks(job_config)\
                                .create_network(endpoint_array, nw_name_new)

        except SystemError as e:
            if e.args[0] != networks.OscQuantumNetworks.EXCEPT_MSG08:
                raise
Example #16
0
    def create_db_apl(self, redundant_configuration_flg=0):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_apl = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_APL)

        # Create
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['node_id'] = JOB_INPUT['node_id']
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['pod_id'] = JOB_INPUT['pod_id']
        params['tenant_id'] = JOB_INPUT['tenant_id']
        params['apl_type'] = 2
        params['type'] = 2
        params['device_type'] = 1
        params['task_status'] = 0
        params['actsby_flag_master'] = 'act'
        params['device_name_master'] = 'wn0fwxtf01'
        params['device_detail_master'] = '{}'
        params['device_detail_slave'] = '{}'
        params['master_ip_address'] = '100.99.0.5'
        params['redundant_configuration_flg'] = redundant_configuration_flg
        params['MSA_device_id'] = ''
        params['status'] = 0
        params['nic_MSA'] = 'mport'
        params['nic_public'] = 'pport'
        params['nic_external'] = 'eport'
        params['nic_tenant'] = 'tport'
        params['device_user_name'] = json.dumps({
            'partition_id':
            JOB_INPUT['partition_id'],
            'route_domain_id':
            JOB_INPUT['route_domain_id'],
        })
        db_create.set_context(db_endpoint_apl, params)
        db_create.execute()

        params['actsby_flag_master'] = 'sby'
        db_create.set_context(db_endpoint_apl, params)
        db_create.execute()
Example #17
0
    def test_tokens_get_endpoints_validation_error(self):

        endpoint = self.ENDPOINT_URL
        admin_user_name = 'admin'
        admin_password = '******'
        tenant_id = self.ADMIN_TENANT_ID
        token = 'aaa'

        job_config = config.JobConfig()

        try:
            tokens.OscTokens(job_config).get_endpoints('', token,
                                                       admin_user_name,
                                                       admin_password,
                                                       tenant_id)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config).get_endpoints(endpoint, '',
                                                       admin_user_name,
                                                       admin_password,
                                                       tenant_id)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config).get_endpoints(endpoint, token, '',
                                                       admin_password,
                                                       tenant_id)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config).get_endpoints(endpoint, token,
                                                       admin_user_name, '',
                                                       tenant_id)

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise

        try:
            tokens.OscTokens(job_config).get_endpoints(endpoint, token,
                                                       admin_user_name,
                                                       admin_password, '')

        except SystemError as e:
            if e.args[0] != tokens.OscTokens.EXCEPT_MSG01:
                raise
Example #18
0
    def __init__(self, request_id='-'):
        self.job_config = config.JobConfig()
        self.logger = logger.LibLogger(self.job_config, request_id)
        self.utils = utils.Utils()
        self.log_deco_line = self.job_config.LOG_DECORATE_LINE

        self.nal_endpoint_config = self.get_config('nal_ep')
        self.nal_config = self.get_config('nal_conf')
        self.nal_endpoint_config.update(self.get_config('wim_ep'))
        self.nal_config.update(self.get_config('wim_conf'))
Example #19
0
    def test_tenants_list_tenants_validation_error(self):

        job_config = config.JobConfig()

        try:
            tenants.OscTenants(job_config).list_tenants({})

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise
Example #20
0
    def test_users_list_users_validation_error(self):

        job_config = config.JobConfig()

        try:
            users.OscUsers(job_config).list_users({})

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise
Example #21
0
    def test_roles_list_roles_validation_error(self):

        job_config = config.JobConfig()

        # Get Endpoints
        try:
            roles.OscRoles(job_config).list_roles({})

        except SystemError as e:
            if e.args[0] != roles.OscRoles.EXCEPT_MSG01:
                raise
Example #22
0
    def create_db_apl(self, node_name):

        # Create Instance(DB Client)
        db_create = create.CreateClient(config.JobConfig())
        db_list = list.ListClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_apl = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_APL)

        node_id = ''.join([
            random.choice(string.digits + string.ascii_letters)
            for i in range(10)
        ])

        # Create
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']
        params['update_id'] = JOB_INPUT['operation_id']
        params['delete_flg'] = 0
        params['node_id'] = node_id
        params['tenant_name'] = JOB_INPUT['IaaS_tenant_id']
        params['pod_id'] = JOB_INPUT['pod_id']
        params['tenant_id'] = JOB_INPUT['IaaS_tenant_id']
        params['apl_type'] = 1
        params['device_type'] = 1
        params['task_status'] = 0
        params['node_name'] = node_name
        db_create.set_context(db_endpoint_apl, params)
        db_create.execute()

        # List
        params = {}
        params['node_id'] = node_id
        db_list.set_context(db_endpoint_apl, params)
        db_list.execute()
        apl_list = db_list.get_return_param()

        return apl_list[0]['ID']
Example #23
0
    def tearDown(self):
        """Clear the test environment"""
        super(TestSetupDeviceBigIpApi, self).tearDown()

        # Create Instance(DB Client)
        db_delete = delete.DeleteClient(config.JobConfig())
        db_list = list.ListClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_apl = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_APL)
        db_endpoint_port = base.JobAutoBase().get_db_endpoint(
            config.JobConfig().REST_URI_PORT)

        # Delete from NAL_APL_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_apl, params)
        db_list.execute()
        delete_list = db_list.get_return_param()

        for delete_res in delete_list:
            key = delete_res['ID']
            db_delete.set_context(db_endpoint_apl, [key])
            db_delete.execute()

        # Delete from NAL_PORT_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_port, params)
        db_list.execute()
        delete_list = db_list.get_return_param()

        for delete_res in delete_list:
            key = delete_res['ID']
            db_delete.set_context(db_endpoint_port, [key])
            db_delete.execute()
Example #24
0
    def tearDown(self):
        """Clear the test environment"""
        super(TestTenatAPI, self).tearDown()

        # Create Instance(DB Client)
        db_delete = delete.DeleteClient(config.JobConfig())
        db_list = list.ListClient(config.JobConfig())

        # Get Endpoint(DB Client)
        db_endpoint_tenant = base.JobAutoBase().get_db_endpoint(
                config.JobConfig().REST_URI_TENANT)

        # Delete from NAL_TENANT_MNG
        params = {}
        params['create_id'] = JOB_INPUT['operation_id']

        db_list.set_context(db_endpoint_tenant, params)
        db_list.execute()
        delete_pod_list = db_list.get_return_param()

        for delete_pod in delete_pod_list:
            key = delete_pod['ID']
            db_delete.set_context(db_endpoint_tenant, [key])
            db_delete.execute()
Example #25
0
    def test_tenants_create_tenant_validation_error(self):

        endpoint_array = {'token': {}}
        tenant_name = 'test_tenant'

        job_config = config.JobConfig()

        try:
            tenants.OscTenants(job_config).create_tenant({}, tenant_name)

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise

        try:
            tenants.OscTenants(job_config).create_tenant(endpoint_array, '')

        except SystemError as e:
            if e.args[0] != tenants.OscTenants.EXCEPT_MSG01:
                raise
Example #26
0
    def test_paloalto_authentication(self):

        job_config = config.JobConfig()

        params = []
        params.append('aaa')
        params.append('bbb')

        passwords = []
        passwords.append('password1')
        passwords.append('password2')

        res = licenseauth.LicenseAuthClient(job_config)\
                    .paloalto_authentication(params, passwords)
        print(inspect.currentframe().f_code.co_name)
        pprint(res)

        # Assertion
        self.assertEqual(type(res), list)
        self.assertGreaterEqual(len(res), 1)
Example #27
0
    def test_intersec_vm_get_rsa(self):

        job_config = config.JobConfig()

        params = []
        params.append('root')
        params.append('password123')
        params.append('10.0.0.1')
        params.append('/home/user123')

        passwords = []
        passwords.append('password123')

        res = intersecvm.IntersecVmClient(job_config)\
                .intersec_vm_get_rsa(params, passwords)
        print(inspect.currentframe().f_code.co_name)
        print(res)

        # Assertion
        self.assertEqual(type(res), list)
        self.assertEqual(len(res), 2)
Example #28
0
    def test_users_create_user_validation_error(self):

        endpoint_array = {'token': {}}
        tenant_id = self.ADMIN_TENANT_ID
        user_name = 'test_user'
        password = '******'

        job_config = config.JobConfig()

        try:
            users.OscUsers(job_config).create_user({}, user_name, password,
                                                   tenant_id)

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise

        try:
            users.OscUsers(job_config).create_user(endpoint_array, '',
                                                   password, tenant_id)

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise

        try:
            users.OscUsers(job_config).create_user(endpoint_array, user_name,
                                                   '', tenant_id)

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise

        try:
            users.OscUsers(job_config).create_user(endpoint_array, user_name,
                                                   password, '')

        except SystemError as e:
            if e.args[0] != users.OscUsers.EXCEPT_MSG01:
                raise
Example #29
0
    def test_delete_vxlan_gw(self):

        job_config = config.JobConfig()

        params = []
        params.append('aaa')
        params.append('password1')
        params.append('password2')
        params.append('bbb')

        passwords = []
        passwords.append('password1')
        passwords.append('password2')

        res = vxlangw.VxlanGwClient(job_config)\
                    .delete_vxlan_gw(params, passwords)
        print(inspect.currentframe().f_code.co_name)
        pprint(res)

        # Assertion
        self.assertEqual(type(res), list)
        self.assertGreaterEqual(len(res), 1)
Example #30
0
    def test_fortivm_provisioning(self):

        job_config = config.JobConfig()

        params = []
        params.append('aaa')
        params.append('password1')
        params.append('password2')
        params.append('bbb')

        passwords = []
        passwords.append('password1')
        passwords.append('password2')

        res = zerotouch.ZeroTouchClient(job_config)\
                    .fortivm_provisioning(params, passwords)
        print(inspect.currentframe().f_code.co_name)
        pprint(res)

        # Assertion
        self.assertEqual(type(res), list)
        self.assertGreaterEqual(len(res), 1)