Example #1
0
    def test_0160_move_to(self):
        org = Environment.get_test_org(TestVApp._client)
        target_vdc = org.get_vdc(TestVApp._ovdc_name)
        logger = Environment.get_default_logger()
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._sys_admin_client,
            vapp_name=TestVApp._customized_vapp_name)

        logger.debug('Move vApp ' + TestVApp._customized_vapp_name)
        task = vapp.move_to(target_vdc.get('href'))
        result = TestVApp._sys_admin_client.get_task_monitor(
        ).wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        target_vdc = org.get_vdc(TestVApp._ovdc_name)
        target_vdc_obj = VDC(TestVApp._sys_admin_client,
                             href=target_vdc.get('href'))
        vapp_resource = target_vdc_obj.get_vapp(TestVApp._customized_vapp_name)
        vapp = VApp(TestVApp._sys_admin_client, resource=vapp_resource)

        target_vdc = Environment.get_test_vdc(TestVApp._client)
        logger.debug('Move back vApp ' + TestVApp._customized_vapp_name)
        task = vapp.move_to(target_vdc.href)
        result = TestVApp._sys_admin_client.get_task_monitor(
        ).wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
Example #2
0
    def test_0030_download(self):
        """Test the method org.download_catalog_item().

        Download the two templates that were uploaded earlier.

        This test passes if the two download task writes non zero bytes to the
        disk without raising any exceptions.
        """
        org = Environment.get_test_org(TestCatalog._client)
        tempdir = None
        try:
            cwd = os.getcwd()
            tempdir = tempfile.mkdtemp(dir='.')
            os.chdir(tempdir)
            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_name,
                file_name=TestCatalog._test_template_file_name)
            self.assertNotEqual(bytes_written, 0)

            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_with_chunk_size_name,
                file_name=TestCatalog._test_template_with_chunk_size_file_name)
            self.assertNotEqual(bytes_written, 0)
        finally:
            if tempdir is not None:
                os.chdir(cwd)
                shutil.rmtree(tempdir)
Example #3
0
    def test_0070_update_catalog(self):
        """Test the method org.update_catalog().

        Update the name and description of the catalog created in
        test_0000_setup. Revert the changes madeto the catalog after we verify
        that the operation is successful.

        This test passes if the catalog updation operation succeeds without
        raising any errors.
        """
        logger = Environment.get_default_logger()
        org = Environment.get_test_org(TestCatalog._client)

        catalog_name = TestCatalog._test_catalog_name
        catalog_description = TestCatalog._test_catalog_description
        new_name = TestCatalog._test_catalog_updated_name
        new_description = TestCatalog._test_catalog_updated_description

        logger.debug('Changing catalog:' + catalog_name + ' \'name\' to ' +
                     new_name + ', and \'description\' to ' + new_description)
        updated_catalog_resource = org.update_catalog(catalog_name, new_name,
                                                      new_description)

        self.assertEqual(updated_catalog_resource.get('name'), new_name)
        self.assertEqual(updated_catalog_resource.Description.text,
                         new_description)

        logger.debug('Changing catalog:' + new_name + ' \'name\' back to ' +
                     catalog_name + ',and \'description\' back to ' +
                     catalog_description)
        org.reload()
        org.update_catalog(new_name, catalog_name, catalog_description)
Example #4
0
    def test_0070_update_catalog(self):
        """Test the method org.update_catalog().

        Update the name and description of the catalog created in
        test_0000_setup. Revert the changes madeto the catalog after we verify
        that the operation is successful.

        This test passes if the catalog updation operation succeeds without
        raising any errors.
        """
        logger = Environment.get_default_logger()
        org = Environment.get_test_org(TestCatalog._client)

        catalog_name = TestCatalog._test_catalog_name
        catalog_description = TestCatalog._test_catalog_description
        new_name = TestCatalog._test_catalog_updated_name
        new_description = TestCatalog._test_catalog_updated_description

        logger.debug('Changing catalog:' + catalog_name + ' \'name\' to ' +
                     new_name + ', and \'description\' to ' + new_description)
        updated_catalog_resource = org.update_catalog(catalog_name, new_name,
                                                      new_description)

        self.assertEqual(updated_catalog_resource.get('name'), new_name)
        self.assertEqual(updated_catalog_resource.Description.text,
                         new_description)

        logger.debug('Changing catalog:' + new_name + ' \'name\' back to ' +
                     catalog_name + ',and \'description\' back to ' +
                     catalog_description)
        org.reload()
        org.update_catalog(new_name, catalog_name, catalog_description)
Example #5
0
    def test_0030_download(self):
        """Test the method org.download_catalog_item().

        Download the two templates that were uploaded earlier.

        This test passes if the two download task writes non zero bytes to the
        disk without raising any exceptions.
        """
        org = Environment.get_test_org(TestCatalog._client)
        tempdir = None
        try:
            cwd = os.getcwd()
            tempdir = tempfile.mkdtemp(dir='.')
            os.chdir(tempdir)
            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_name,
                file_name=TestCatalog._test_template_file_name)
            self.assertNotEqual(bytes_written, 0)

            bytes_written = org.download_catalog_item(
                catalog_name=TestCatalog._test_catalog_name,
                item_name=TestCatalog._test_template_with_chunk_size_name,
                file_name=TestCatalog._test_template_with_chunk_size_file_name)
            self.assertNotEqual(bytes_written, 0)
        finally:
            if tempdir is not None:
                os.chdir(cwd)
                shutil.rmtree(tempdir)
Example #6
0
 def _create_org_vdc():
     # creating a org vdc
     org = Environment.get_test_org(TestVApp._sys_admin_client)
     storage_profiles = [{
         'name':
         TestVApp._config['vcd']['default_storage_profile_name'],
         'enabled':
         True,
         'units':
         'MB',
         'limit':
         0,
         'default':
         True
     }]
     system = System(TestVApp._sys_admin_client,
                     admin_resource=TestVApp._sys_admin_client.get_admin())
     netpool_to_use = Environment._get_netpool_name_to_use(system)
     org.create_org_vdc(
         TestVApp._ovdc_name,
         TestVApp._pvdc_name,
         network_pool_name=netpool_to_use,
         network_quota=TestVApp._config['vcd']['default_network_quota'],
         storage_profiles=storage_profiles,
         uses_fast_provisioning=True,
         is_thin_provision=True)
Example #7
0
 def test_0022_get_vdc_non_admin_href(self):
     """Test the method VDC.get_vdc().
     This test passes if the expected vdc non admin href.
     """
     org = Environment.get_test_org(TestOrgVDC._client)
     vdc = org.get_vdc(TestOrgVDC._new_vdc_name)
     self.assertFalse('/api/admin/' in vdc.get('href'))
Example #8
0
 def test_0021_get_vdc_admin_href(self):
     """Test the method VDC.get_vdc().
     This test passes if the expected vdc admin href.
     """
     org = Environment.get_test_org(TestOrgVDC._client)
     vdc = org.get_vdc(name=TestOrgVDC._new_vdc_name,
                       is_admin_operation=True)
     self.assertTrue('/api/admin/' in vdc.get('href'))
Example #9
0
 def test_0000_setup(self):
     """Setup the org vdc required for the other tests in this module.
     Create one org vdc as per the configuration stated above. Test the
     method Org.create_org_vdc().
     This test passes if the vdc href is not None.
     """
     logger = Environment.get_default_logger()
     TestOrgVDC._client = Environment.get_sys_admin_client()
     TestOrgVDC._org_admin_client = Environment.get_client_in_default_org(
         CommonRoles.ORGANIZATION_ADMINISTRATOR)
     org = Environment.get_test_org(TestOrgVDC._client)
     vdc_name = TestOrgVDC._new_vdc_name
     pvdc_name = Environment.get_test_pvdc_name()
     storage_profiles = [{
         'name': '*',
         'enabled': True,
         'units': 'MB',
         'limit': 0,
         'default': True
     }]
     vdc_resource = org.create_org_vdc(
         vdc_name,
         pvdc_name,
         storage_profiles=storage_profiles,
         uses_fast_provisioning=True,
         is_thin_provision=True)
     TestOrgVDC._client.get_task_monitor().wait_for_success(
         task=vdc_resource.Tasks.Task[0])
     logger.debug('Created ovdc ' + vdc_name + '.')
     # The following contraption is required to get the non admin href of
     # the ovdc. vdc_resource contains the admin version of the href since
     # we created the ovdc as a sys admin.
     org = Environment.get_test_org(TestOrgVDC._org_admin_client)
     org.reload()
     for vdc in org.list_vdcs():
         if vdc.get('name').lower() == vdc_name.lower():
             TestOrgVDC._new_vdc_href = vdc.get('href')
     TestOrgVDC._vdc1 = VDC(TestOrgVDC._org_admin_client,
                           href=TestOrgVDC._new_vdc_href)
     self.assertIsNotNone(TestOrgVDC._new_vdc_href)
     #Create Independent disk
     TestOrgVDC._idisk_id = TestOrgVDC._vdc1.\
         create_disk(name=self._idisk_name,
                     size=self._idisk_size,
                     description=self._idisk_description).get('id')[16:]
     self.assertIsNotNone(TestOrgVDC._idisk_id)
Example #10
0
 def test_0020_get_vdc(self):
     """Test the method VDC.get_vdc().
     This test passes if the expected vdc can be successfully retrieved by
     name.
     """
     org = Environment.get_test_org(TestOrgVDC._org_admin_client)
     vdc = org.get_vdc(TestOrgVDC._new_vdc_name)
     self.assertEqual(TestOrgVDC._new_vdc_name, vdc.get('name'))
     self.assertEqual(TestOrgVDC._new_vdc_href, vdc.get('href'))
Example #11
0
 def test_0030_get_non_existent_vdc(self):
     """Test the method VDC.get_vdc().
     This test passes if the non-existent vdc can't be successfully
     retrieved by name.
     """
     org = Environment.get_test_org(TestOrgVDC._client)
     try:
         resource = org.get_vdc(TestOrgVDC._non_existent_vdc_name)
         self.assertIsNone(resource)
     except EntityNotFoundException as e:
         pass
Example #12
0
    def test_0020_get_vdc(self):
        """Test the method VDC.get_vdc().

        This test passes if the expected vdc can be successfully retrieved by
        name.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        vdc = org.get_vdc(TestOrgVDC._new_vdc_name)

        self.assertEqual(TestOrgVDC._new_vdc_name, vdc.get('name'))
        self.assertEqual(TestOrgVDC._new_vdc_href, vdc.get('href'))
Example #13
0
    def test_0030_get_non_existent_vdc(self):
        """Test the method VDC.get_vdc().

        This test passes if the non-existent vdc can't be successfully
        retrieved by name.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        try:
            resource = org.get_vdc(TestOrgVDC._non_existent_vdc_name)
            self.assertIsNone(resource)
        except EntityNotFoundException as e:
            pass
Example #14
0
    def test_0050_get_catalog(self):
        """Test the method org.get_catalog().

        Retrieve the catalog created in test_0000_setup.

        This test passes if the catalog created in test_0000_setup is
        retrieved successfully without any errors.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_resource = org.get_catalog(TestCatalog._test_catalog_name)

        self.assertEqual(TestCatalog._test_catalog_name,
                         catalog_resource.get('name'))
Example #15
0
    def test_0050_get_catalog(self):
        """Test the method org.get_catalog().

        Retrieve the catalog created in test_0000_setup.

        This test passes if the catalog created in test_0000_setup is
        retrieved successfully without any errors.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_resource = org.get_catalog(TestCatalog._test_catalog_name)

        self.assertEqual(TestCatalog._test_catalog_name,
                         catalog_resource.get('name'))
Example #16
0
    def test_cleanup(self):
        """Get the test Org and delete it"""
        client = Environment.get_sys_admin_client()
        test_org = Environment.get_test_org(client)

        print("Deleting test org: {0}".format(test_org.get_name()))
        sys_admin_resource = client.get_admin()
        system = System(client, admin_resource=sys_admin_resource)
        task = system.delete_org(test_org.get_name(), True, True)

        # Track the task to completion. 
        task = client.get_task_monitor().wait_for_success(task)
        self.assertEqual(task.get('status'), TaskStatus.SUCCESS.value)
Example #17
0
 def test_0000_setup(self):
     TestCaCertificates._client = Environment.get_sys_admin_client()
     TestCaCertificates._config = Environment.get_config()
     TestCaCertificates._org = Environment.get_test_org(
         TestCaCertificates._client)
     test_gateway = Environment.get_test_gateway(TestCaCertificates._client)
     gateway_obj1 = Gateway(TestCaCertificates._client, GatewayConstants.name,
                            href=test_gateway.get('href'))
     TestCaCertificates.gateway_obj = gateway_obj1
     TestCaCertificates._runner = CliRunner()
     default_org = self._config['vcd']['default_org_name']
     self._login()
     TestCaCertificates._runner.invoke(org, ['use', default_org])
Example #18
0
    def test_0030_get_non_existent_vdc(self):
        """Test the method VDC.get_vdc().

        This test passes if the non-existent vdc can't be successfully
        retrieved by name.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        try:
            org.get_vdc(TestOrgVDC._non_existent_vdc_name)
            self.fail('Should not be able to fetch vdc ' +
                      TestOrgVDC._non_existent_vdc_name)
        except EntityNotFoundException as e:
            pass
 def test_0000_setup(self):
     TestCertificates._client = Environment.get_sys_admin_client()
     TestCertificates._config = Environment.get_config()
     TestCertificates._org = Environment.get_test_org(
         TestCertificates._client)
     test_gateway = Environment.get_test_gateway(TestCertificates._client)
     gateway_obj1 = Gateway(TestCertificates._client,
                            GatewayConstants.name,
                            href=test_gateway.get('href'))
     TestCertificates.gateway_obj = gateway_obj1
     TestCertificates._runner = CliRunner()
     default_org = self._config['vcd']['default_org_name']
     self._login()
     TestCertificates._runner.invoke(org, ['use', default_org])
Example #20
0
    def test_0130_catalog_sharing_via_acl(self):
        org = Environment.get_test_org(TestCatalog._client)
        catalog_name = TestCatalog._test_catalog_name

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
        # TODO(): Access the catalog using a vapp_user user

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
Example #21
0
    def _0130_catalog_sharing_via_acl(self):
        org = Environment.get_test_org(TestCatalog._client)
        catalog_name = TestCatalog._test_catalog_name

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
        # TODO(): Access the catalog using a vapp_user user

        control_access = org.share_catalog_with_org_members(
            catalog_name, everyone_access_level='ReadOnly')
        self.assertEqual(control_access.IsSharedToEveryone.text, 'true')
        self.assertEqual(control_access.EveryoneAccessLevel.text, 'ReadOnly')
Example #22
0
 def test_0010_list_vdc(self):
     """Test the method VDC.list_vdcs().
     This test passes if the vdc created during setup can be found in the
     list of vdcs retrieved.
     """
     org = Environment.get_test_org(TestOrgVDC._org_admin_client)
     vdc_list = org.list_vdcs()
     retrieved_vdc_names = []
     retrieved_vdc_hrefs = []
     for vdc in vdc_list:
         retrieved_vdc_names.append(vdc['name'])
         retrieved_vdc_hrefs.append(vdc['href'])
     self.assertIn(TestOrgVDC._new_vdc_name, retrieved_vdc_names)
     self.assertIn(TestOrgVDC._new_vdc_href, retrieved_vdc_hrefs)
Example #23
0
    def test_0060_get_nonexistent_catalog(self):
        """Test the method org.get_catalog() for a non existent catalog.

        This test passes if the catalog retrieval operation fails with a
        EntityNotFoundException.
        """
        org = Environment.get_test_org(TestCatalog._client)
        try:
            org.get_catalog(TestCatalog._non_existent_catalog_name)
            self.fail('Should not be able to fetch catalog ' +
                      TestCatalog._non_existent_catalog_name)
        except EntityNotFoundException as e:
            return
        self.fail('Should fail with EntityNotFoundException while fetching'
                  'catalog ' + TestCatalog._non_existent_catalog_name)
Example #24
0
    def test_0060_get_nonexistent_catalog(self):
        """Test the method org.get_catalog() for a non existent catalog.

        This test passes if the catalog retrieval operation fails with a
        EntityNotFoundException.
        """
        org = Environment.get_test_org(TestCatalog._client)
        try:
            org.get_catalog(TestCatalog._non_existent_catalog_name)
            self.fail('Should not be able to fetch catalog ' +
                      TestCatalog._non_existent_catalog_name)
        except EntityNotFoundException as e:
            return
        self.fail('Should fail with EntityNotFoundException while fetching'
                  'catalog ' + TestCatalog._non_existent_catalog_name)
Example #25
0
    def test_0040_list_catalog(self):
        """Test the method org.list_catalog().

        Fetches all catalogs in the current organization.

        This test passes if the catalog created in test_0000_setup is present
        in the retrieved list of catalogs.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_list = org.list_catalogs()

        retieved_catalog_names = []
        for catalog in catalog_list:
            retieved_catalog_names.append(catalog.get('name'))

        self.assertIn(TestCatalog._test_catalog_name, retieved_catalog_names)
Example #26
0
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """

        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
Example #27
0
    def test_0040_list_catalog(self):
        """Test the method org.list_catalog().

        Fetches all catalogs in the current organization

        This test passes if the catalog created in test_0000_setup is present
        in the retrieved list of catalogs.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_list = org.list_catalogs()

        retieved_catalog_names = []
        for catalog in catalog_list:
            retieved_catalog_names.append(catalog.get('name'))

        self.assertIn(TestCatalog._test_catalog_name, retieved_catalog_names)
Example #28
0
    def test_0100_get_catalog_item(self):
        """Test the method org.get_catalog_item().

        Retrieve the first template uploaded to the catalog created in setup
        method.

        This test depends on the success of test_0010_upload_tempalte.

        This test passes if the first uploaded templates is retrieved
        successfully.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_item_resource = org.get_catalog_item(
            TestCatalog._test_catalog_name, TestCatalog._test_template_name)

        self.assertEqual(TestCatalog._test_template_name,
                         catalog_item_resource.get('name'))
Example #29
0
    def test_0010_list_vdc(self):
        """Test the method VDC.list_vdcs().

        This test passes if the vdc created during setup can be found in the
        list of vdcs retrieved.
        """
        org = Environment.get_test_org(TestOrgVDC._client)
        vdc_list = org.list_vdcs()

        retrieved_vdc_names = []
        retrieved_vdc_hrefs = []
        for vdc in vdc_list:
            retrieved_vdc_names.append(vdc['name'])
            retrieved_vdc_hrefs.append(vdc['href'])

        self.assertIn(TestOrgVDC._new_vdc_name, retrieved_vdc_names)
        self.assertIn(TestOrgVDC._new_vdc_href, retrieved_vdc_hrefs)
Example #30
0
 def test_0020_update_vdc(self):
     """
     Updates the existing org vdc. Test the method Org.update_org_vdc().
     This test passes if the org vdc can be successfully updated
     with the given configuration.
     """
     org = Environment.get_test_org(TestOrgVDC._client)
     update_vdc_task = org.update_org_vdc(TestOrgVDC._new_vdc_name,
                                          description="Test VDC",
                                          resource_guaranteed_memory=0.5,
                                          resource_guaranteed_cpu=0.5)
     TestOrgVDC._client.get_task_monitor().wait_for_success(
         task=update_vdc_task)
     vdc = org.get_vdc(TestOrgVDC._new_vdc_name, is_admin_operation=True)
     self.assertEqual("Test VDC", vdc['Description'])
     self.assertEqual(0.5, vdc['ResourceGuaranteedCpu'])
     self.assertEqual(0.5, vdc['ResourceGuaranteedMemory'])
Example #31
0
    def test_0100_get_catalog_item(self):
        """Test the method org.get_catalog_item().

        Retrieve the first template uploaded to the catalog created in setup
        method.

        This test depends on the success of test_0010_upload_tempalte.

        This test passes if the first uploaded templates is retrieved
        successfully.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_item_resource = org.get_catalog_item(
            TestCatalog._test_catalog_name, TestCatalog._test_template_name)

        self.assertEqual(TestCatalog._test_template_name,
                         catalog_item_resource.get('name'))
Example #32
0
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """
        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._logger = Environment.get_default_logger()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
        test_gateway = Environment.get_test_gateway(TestIpSecVpn._client)
        gateway_obj1 = Gateway(TestIpSecVpn._client,
                               GatewayConstants.name,
                               href=test_gateway.get('href'))
        gateway_obj2 = TestIpSecVpn._gateway_obj
        TestIpSecVpn._local_ip = self.__get_ip_address(
            gateway=gateway_obj1, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._peer_ip = self.__get_ip_address(
            gateway=gateway_obj2, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        self._login()
        TestIpSecVpn._runner.invoke(org, ['use', default_org])
        from vcd_cli.gateway import gateway
        result = TestIpSecVpn._runner.invoke(
            gateway,
            args=[
                'services', 'ipsec-vpn', 'create', TestIpSecVpn._name,
                '--name', TestIpSecVpn._ipsec_vpn_name, '--local-id',
                TestIpSecVpn._local_id, '--peer-id', TestIpSecVpn._peer_id,
                '--local-ip', TestIpSecVpn._local_ip, '--peer-ip',
                TestIpSecVpn._peer_ip, '--local-subnet',
                TestIpSecVpn._local_subnet, '--peer-subnet',
                TestIpSecVpn._peer_subnet, '--pre-shared-key',
                TestIpSecVpn._psk, '--enable'
            ])
        self.assertEqual(0, result.exit_code)
Example #33
0
    def test_cleanup(self):
        """Get the test Org and delete it."""
        client = None
        try:
            logger = Environment.get_default_logger()
            client = Environment.get_sys_admin_client()
            test_org = Environment.get_test_org(client)

            logger.debug('Deleting test org: {0}'.format(test_org.get_name()))
            sys_admin_resource = client.get_admin()
            system = System(client, admin_resource=sys_admin_resource)
            task = system.delete_org(test_org.get_name(), True, True)

            # Track the task to completion.
            result = client.get_task_monitor().wait_for_success(task)
            self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
        finally:
            if client is not None:
                client.logout()
Example #34
0
    def test_cleanup(self):
        """Get the test Org and delete it."""
        client = None
        try:
            logger = Environment.get_default_logger()
            client = Environment.get_sys_admin_client()
            test_org = Environment.get_test_org(client)

            logger.debug('Deleting test org: {0}'.format(test_org.get_name()))
            sys_admin_resource = client.get_admin()
            system = System(client, admin_resource=sys_admin_resource)
            task = system.delete_org(test_org.get_name(), True, True)

            # Track the task to completion.
            result = client.get_task_monitor().wait_for_success(task)
            self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
        finally:
            if client is not None:
                client.logout()
Example #35
0
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """
        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._logger = Environment.get_default_logger()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
        test_gateway = Environment.get_test_gateway(TestIpSecVpn._client)
        gateway_obj1 = Gateway(TestIpSecVpn._client, GatewayConstants.name,
                               href=test_gateway.get('href'))
        gateway_obj2 = TestIpSecVpn._gateway_obj
        TestIpSecVpn._local_ip = self.__get_ip_address(
            gateway=gateway_obj1, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._peer_ip = self.__get_ip_address(
            gateway=gateway_obj2, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        self._login()
        TestIpSecVpn._runner.invoke(org, ['use', default_org])
        result = TestIpSecVpn._runner.invoke(
            gateway,
            args=[
                'services', 'ipsec-vpn', 'create', TestIpSecVpn._name,
                '--name', TestIpSecVpn._ipsec_vpn_name,
                '--local-id', TestIpSecVpn._local_id,
                '--peer-id', TestIpSecVpn._peer_id,
                '--local-ip', TestIpSecVpn._local_ip,
                '--peer-ip', TestIpSecVpn._peer_ip,
                '--local-subnet', TestIpSecVpn._local_subnet,
                '--peer-subnet', TestIpSecVpn._peer_subnet,
                '--pre-shared-key', TestIpSecVpn._psk, '--enable'])
        self.assertEqual(0, result.exit_code)
Example #36
0
    def _create_org_vdc(self):
        """Creates an org vdc with the name specified in the test class.

        :raises: Exception: if the class variable _org_href or _pvdc_name
             is not populated.
         """

        system = System(VAppTest._sys_admin_client,
                        admin_resource=VAppTest._sys_admin_client.get_admin())

        org = Environment.get_test_org(VAppTest._sys_admin_client)

        if VAppTest._check_ovdc(self, org, VAppTest._ovdc_name):
            return

        storage_profiles = [{
            'name':
                VAppTest._config['vcd']['default_storage_profile_name'],
            'enabled':
                True,
            'units':
                'MB',
            'limit':
                0,
            'default':
                True
        }]

        netpool_to_use = Environment._get_netpool_name_to_use(system)
        VAppTest._pvdc_name = Environment.get_test_pvdc_name()
        task = org.create_org_vdc(
            VAppTest._ovdc_name,
            VAppTest._pvdc_name,
            network_pool_name=netpool_to_use,
            network_quota=VAppTest._config['vcd']['default_network_quota'],
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        VAppTest._sys_admin_client.get_task_monitor().wait_for_success(
            task.Tasks.Task[0])
        org.reload()
        VAppTest._check_ovdc(self, org, VAppTest._ovdc_name)
Example #37
0
    def test_0000_setup(self):
        """Setup the org vdc required for the other tests in this module.

        Create one org vdc as per the configuration stated above. Test the
        method Org.create_org_vdc().

        This test passes if the vdc href is not None.
        """
        logger = Environment.get_default_logger()
        TestOrgVDC._client = Environment.get_sys_admin_client()
        org = Environment.get_test_org(TestOrgVDC._client)

        vdc_name = TestOrgVDC._new_vdc_name
        pvdc_name = Environment.get_test_pvdc_name()
        storage_profiles = [{
            'name': '*',
            'enabled': True,
            'units': 'MB',
            'limit': 0,
            'default': True
        }]

        vdc_resource = org.create_org_vdc(
            vdc_name,
            pvdc_name,
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        TestOrgVDC._client.get_task_monitor().wait_for_success(
            task=vdc_resource.Tasks.Task[0])

        logger.debug('Created ovdc ' + vdc_name + '.')

        # The following contraption is required to get the non admin href of
        # the ovdc. vdc_resource contains the admin version of the href since
        # we created the ovdc as a sys admin.
        org.reload()
        for vdc in org.list_vdcs():
            if vdc.get('name').lower() == vdc_name.lower():
                TestOrgVDC._new_vdc_href = vdc.get('href')

        self.assertIsNotNone(TestOrgVDC._new_vdc_href)
Example #38
0
    def test_0040_change_idisk_owner(self):
        """Test the  method vdc.change_disk_owner().

        Invoke the method for the third independent disk, to make vapp_user the
        owner of the disk. Revert back the ownership to the original owner once
        the test is over.

        This test passes if the disk states its owner as vapp_user after the
        method call.
        """
        org_admin_client = Environment.get_client_in_default_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)
        org = Environment.get_test_org(org_admin_client)
        vdc = Environment.get_test_vdc(org_admin_client)

        try:
            username = Environment.get_username_for_role_in_test_org(
                CommonRoles.VAPP_USER)
            user_resource = org.get_user(username)

            vdc.change_disk_owner(
                disk_id=TestDisk._idisk3_id,
                user_href=user_resource.get('href'))

            disk_resource = vdc.get_disk(disk_id=TestDisk._idisk3_id)
            new_owner_name = disk_resource.Owner.User.get('name')
            self.assertEqual(new_owner_name, username)

            # Revert ownership to original owner
            username = Environment.get_username_for_role_in_test_org(
                TestDisk._test_runner_role)
            user_resource = org.get_user(username)

            vdc.change_disk_owner(
                disk_id=TestDisk._idisk3_id,
                user_href=user_resource.get('href'))

            disk_resource = vdc.get_disk(disk_id=TestDisk._idisk3_id)
            new_owner_name = disk_resource.Owner.User.get('name')
            self.assertEqual(new_owner_name, username)
        finally:
            org_admin_client.logout()
Example #39
0
    def test_0010_upload_template(self):
        """Test the method org.upload_ovf().

        Upload an ova template to catalog. The template doesn't have
        ovf:chunkSize param in it's descriptor(ovf file).

        This test passes if the upload succeeds and no exceptions are raised.
        """
        org = Environment.get_test_org(TestCatalog._client)

        self._template_upload_helper(
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name,
            template_file_name=TestCatalog._test_template_file_name)
        self._template_import_monitor(
            client=TestCatalog._client,
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name)
Example #40
0
    def test_0010_upload_template(self):
        """Test the method org.upload_ovf().

        Upload an ova template to catalog. The template doesn't have
        ovf:chunkSize param in it's descriptor(ovf file).

        This test passes if the upload succeeds and no exceptions are raised.
        """
        org = Environment.get_test_org(TestCatalog._client)

        self._template_upload_helper(
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name,
            template_file_name=TestCatalog._test_template_file_name)
        self._template_import_monitor(
            client=TestCatalog._client,
            org=org,
            catalog_name=TestCatalog._test_catalog_name,
            template_name=TestCatalog._test_template_name)
Example #41
0
    def test_9998_teardown(self):
        """Test the  method delete_catalog_item() and delete_catalog().

        Invoke the methods for templates and catalogs created by setup.

        This test passes if none of the delete operations generate any
        exceptions.
        """
        org = Environment.get_test_org(TestCatalog._client)
        logger = Environment.get_default_logger()
        logger.debug('Deleting catalog item : ' +
                     TestCatalog._test_template_name)
        org.delete_catalog_item(TestCatalog._test_catalog_name,
                                TestCatalog._test_template_name)
        logger.debug('Deleting catalog item : ' +
                     TestCatalog._test_template_with_chunk_size_name)
        org.delete_catalog_item(
            TestCatalog._test_catalog_name,
            TestCatalog._test_template_with_chunk_size_name)
        logger.debug('Deleting catalog : ' + TestCatalog._test_catalog_name)
        org.delete_catalog(TestCatalog._test_catalog_name)
Example #42
0
    def test_0090_list_catalog_items(self):
        """Test the method org.list_catalog_item().

        List all items in the catalog created in setup method.

        This test depends on success of test_0010_upload_tempalte and
        test_0020_upload_template_with_ovf_chunkSize.

        This test passes if both the uploaded templates are in the retrieved
        list of items.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_item_list = org.list_catalog_items(
            TestCatalog._test_catalog_name)

        catalog_item_names = []
        for item in catalog_item_list:
            catalog_item_names.append(item.get('name'))

        self.assertIn(TestCatalog._test_template_name, catalog_item_names)
        self.assertIn(TestCatalog._test_template_with_chunk_size_name,
                      catalog_item_names)
Example #43
0
    def test_0090_list_catalog_items(self):
        """Test the method org.list_catalog_item().

        List all items in the catalog created in setup method.

        This test depends on success of test_0010_upload_tempalte and
        test_0020_upload_template_with_ovf_chunkSize.

        This test passes if both the uploaded templates are in the retrieved
        list of items.
        """
        org = Environment.get_test_org(TestCatalog._client)
        catalog_item_list = org.list_catalog_items(
            TestCatalog._test_catalog_name)

        catalog_item_names = []
        for item in catalog_item_list:
            catalog_item_names.append(item.get('name'))

        self.assertIn(TestCatalog._test_template_name, catalog_item_names)
        self.assertIn(TestCatalog._test_template_with_chunk_size_name,
                      catalog_item_names)
Example #44
0
    def test_0080_change_catalog_ownership(self):
        """Test the method org.change_catalog_owner().

        Change the ownership of the catalog to org administrator and back to
        the original owner.

        This test passes if the catalog owner change operation succeeds without
        raising any errors. And the new owner is able to access the catalog.
        """
        logger = Environment.get_default_logger()
        org_admin_client = Environment.get_client_in_default_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)
        org = Environment.get_test_org(org_admin_client)

        catalog_name = TestCatalog._test_catalog_name
        original_owner_username = \
            Environment.get_username_for_role_in_test_org(
                TestCatalog._test_runner_role)
        org_admin_username = Environment.get_username_for_role_in_test_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)
        try:
            logger.debug('Changing owner of catalog:' + catalog_name + ' to ' +
                         org_admin_username)
            org.change_catalog_owner(catalog_name, org_admin_username)
            catalog_admin_resource = org.get_catalog(catalog_name,
                                                     is_admin_operation=True)
            self.assertEqual(catalog_admin_resource.Owner.User.get('name'),
                             org_admin_username)

            logger.debug('Changing owner of catalog ' + catalog_name +
                         ' back to ' + original_owner_username)
            org.change_catalog_owner(catalog_name, original_owner_username)
            catalog_admin_resource = org.get_catalog(catalog_name,
                                                     is_admin_operation=True)
            self.assertEqual(catalog_admin_resource.Owner.User.get('name'),
                             original_owner_username)
        finally:
            org_admin_client.logout()
Example #45
0
    def test_0080_change_catalog_ownership(self):
        """Test the method org.change_catalog_owner().

        Change the ownership of the catalog to org administrator and back to
        the original owner.

        This test passes if the catalog owner change operation succeeds without
        raising any errors. And the new owner is able to access the catalog.
        """
        logger = Environment.get_default_logger()
        org_admin_client = Environment.get_client_in_default_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)
        org = Environment.get_test_org(org_admin_client)

        catalog_name = TestCatalog._test_catalog_name
        original_owner_username = \
            Environment.get_username_for_role_in_test_org(
                TestCatalog._test_runner_role)
        org_admin_username = Environment.get_username_for_role_in_test_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)
        try:
            logger.debug('Changing owner of catalog:' + catalog_name +
                         ' to ' + org_admin_username)
            org.change_catalog_owner(catalog_name, org_admin_username)
            catalog_admin_resource = org.get_catalog(catalog_name,
                                                     is_admin_operation=True)
            self.assertEqual(catalog_admin_resource.Owner.User.get('name'),
                             org_admin_username)

            logger.debug('Changing owner of catalog ' + catalog_name +
                         ' back to ' + original_owner_username)
            org.change_catalog_owner(catalog_name, original_owner_username)
            catalog_admin_resource = org.get_catalog(catalog_name,
                                                     is_admin_operation=True)
            self.assertEqual(catalog_admin_resource.Owner.User.get('name'),
                             original_owner_username)
        finally:
            org_admin_client.logout()
Example #46
0
    def test_0000_setup(self):
        """Setup a catalog for the tests in this module.

        Create a catalog. Test org.create_catalog() function.

        This test passes if the catalog is created successfully.
        """
        logger = Environment.get_default_logger()
        TestCatalog._client = Environment.get_client_in_default_org(
            TestCatalog._test_runner_role)
        org = Environment.get_test_org(TestCatalog._client)

        try:
            catalog_resource = org.get_catalog(TestCatalog._test_catalog_name)
            logger.debug('Reusing test catalog.')
        except EntityNotFoundException as e:
            catalog_resource = org.create_catalog(
                TestCatalog._test_catalog_name,
                TestCatalog._test_catalog_description)
            TestCatalog._client.get_task_monitor().wait_for_success(
                task=catalog_resource.Tasks.Task[0])
        TestCatalog._test_catalog_href = catalog_resource.get('href')
        self.assertIsNotNone(TestCatalog._test_catalog_href)
Example #47
0
    def test_0000_setup(self):
        """Setup a catalog for the tests in this module.

        Create a catalog. Test org.create_catalog() function.

        This test passes if the catalog is created successfully.
        """
        logger = Environment.get_default_logger()
        TestCatalog._client = Environment.get_client_in_default_org(
            TestCatalog._test_runner_role)
        org = Environment.get_test_org(TestCatalog._client)

        try:
            catalog_resource = org.get_catalog(TestCatalog._test_catalog_name)
            logger.debug('Reusing test catalog.')
        except EntityNotFoundException as e:
            catalog_resource = org.create_catalog(
                TestCatalog._test_catalog_name,
                TestCatalog._test_catalog_description)
            TestCatalog._client.get_task_monitor().wait_for_success(
                task=catalog_resource.Tasks.Task[0])
        TestCatalog._test_catalog_href = catalog_resource.get('href')
        self.assertIsNotNone(TestCatalog._test_catalog_href)
Example #48
0
    def test_9998_teardown(self):
        """Test the  method delete_catalog_item() and delete_catalog().

        Invoke the methods for templates and catalogs created by setup. This
        test should be run as org admin, since a failure in any of the previous
        tests might leave the catalog stranded with an user other than the one
        who created the catalog in first place.

        This test passes if none of the delete operations generate any
        exceptions.
        """
        try:
            org_admin_client = Environment.get_client_in_default_org(
                CommonRoles.ORGANIZATION_ADMINISTRATOR)
            org = Environment.get_test_org(org_admin_client)
            logger = Environment.get_default_logger()

            catalog_name = TestCatalog._test_catalog_name
            items_to_delete = [
                TestCatalog._test_template_name,
                TestCatalog._test_template_with_chunk_size_name
            ]

            for item in items_to_delete:
                logger.debug('Deleting catalog item : ' + item)
                try:
                    org.delete_catalog_item(catalog_name, item)
                except EntityNotFoundException as e:
                    logger.debug('Catalog item:' + item + ' not found!')

            try:
                logger.debug('Deleting catalog : ' + catalog_name)
                org.delete_catalog(catalog_name)
            except EntityNotFoundException as e:
                    logger.debug('Catalog :' + catalog_name + ' not found!')
        finally:
            org_admin_client.logout()
Example #49
0
    def test_9998_teardown(self):
        """Test the  method delete_catalog_item() and delete_catalog().

        Invoke the methods for templates and catalogs created by setup. This
        test should be run as org admin, since a failure in any of the
        previous tests might leave the catalog stranded with an user other
        than the one who created the catalog in first place.

        This test passes if none of the delete operations generate any
        exceptions.
        """
        try:
            org_admin_client = Environment.get_client_in_default_org(
                CommonRoles.ORGANIZATION_ADMINISTRATOR)
            org = Environment.get_test_org(org_admin_client)
            logger = Environment.get_default_logger()

            catalog_name = TestCatalog._test_catalog_name
            items_to_delete = [
                TestCatalog._test_template_name,
                TestCatalog._test_template_with_chunk_size_name
            ]

            for item in items_to_delete:
                logger.debug('Deleting catalog item : ' + item)
                try:
                    org.delete_catalog_item(catalog_name, item)
                except EntityNotFoundException as e:
                    logger.debug('Catalog item:' + item + ' not found!')

            try:
                logger.debug('Deleting catalog : ' + catalog_name)
                org.delete_catalog(catalog_name)
            except EntityNotFoundException as e:
                logger.debug('Catalog :' + catalog_name + ' not found!')
        finally:
            org_admin_client.logout()
Example #50
0
    def test_0000_setup(self):
        """Setup the org vdc required for the other tests in this module.

        Create one org vdc as per the configuration stated above. Test the
        method Org.create_org_vdc().

        This test passes if the vdc href is not None.
        """
        logger = Environment.get_default_logger()
        TestPVDC._sys_admin_client = Environment.get_sys_admin_client()
        org = Environment.get_test_org(TestPVDC._sys_admin_client)
        platform = Platform(TestPVDC._sys_admin_client)

        vdc_name = TestPVDC._new_vdc_name
        pvdc_name = Environment.get_test_pvdc_name()
        provider_vdc = platform.get_ref_by_name(ResourceType.PROVIDER_VDC,
                                                pvdc_name)
        pvdc_ext_href = get_admin_extension_href(provider_vdc.get('href'))
        pvdc_ext_resource = TestPVDC._sys_admin_client.get_resource(
            pvdc_ext_href)
        vc_name = pvdc_ext_resource.VimServer.get('name')
        res_pools_in_pvdc = TestPVDC._sys_admin_client.get_linked_resource(
            resource=pvdc_ext_resource,
            rel=RelationType.DOWN,
            media_type=EntityType.VMW_PROVIDER_VDC_RESOURCE_POOL_SET.value)
        if hasattr(res_pools_in_pvdc,
                   '{' + NSMAP['vmext'] + '}VMWProviderVdcResourcePool'):
            src_respool = res_pools_in_pvdc.VMWProviderVdcResourcePool[0]
        name_filter = ('vcName', vc_name)
        query = TestPVDC._sys_admin_client.get_typed_query(
            ResourceType.RESOURCE_POOL.value,
            query_result_format=QueryResultFormat.RECORDS,
            equality_filter=name_filter)
        res_pools_in_use = {}
        for res_pool in list(query.execute()):
            res_pools_in_use[res_pool.get('moref')] = res_pool.get('name')
        source_respool_name = res_pools_in_use[
            src_respool.ResourcePoolVimObjectRef.MoRef]
        TestPVDC._source_resource_pool = source_respool_name

        storage_profiles = [{
            'name': '*',
            'enabled': True,
            'units': 'MB',
            'limit': 0,
            'default': True
        }]
        vdc_resource = org.create_org_vdc(
            vdc_name,
            pvdc_name,
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        TestPVDC._sys_admin_client.get_task_monitor().wait_for_success(
            task=vdc_resource.Tasks.Task[0])

        logger.debug('Created ovdc ' + vdc_name + '.')

        # The following contraption is required to get the non admin href of
        # the ovdc. vdc_resource contains the admin version of the href since
        # we created the ovdc as a sys admin.
        org.reload()
        for vdc in org.list_vdcs():
            if vdc.get('name').lower() == vdc_name.lower():
                TestPVDC._new_vdc_href = vdc.get('href')

        self.assertIsNotNone(TestPVDC._new_vdc_href)
Example #51
0
    def _0110_catalog_access_settings(self):
        """Test the access control methods for catalogs.

        This test passes if all the acl operations complete successfully.
        """
        logger = Environment.get_default_logger()
        org = Environment.get_test_org(TestCatalog._client)

        org_name = org.get_name()
        print(org_name)
        catalog_name = TestCatalog._test_catalog_name
        vapp_author_username = Environment.get_username_for_role_in_test_org(
            CommonRoles.VAPP_AUTHOR)
        org_admin_username = Environment.get_username_for_role_in_test_org(
            CommonRoles.ORGANIZATION_ADMINISTRATOR)

        # remove all access control settings to the catalog
        logger.debug('Removing all access control settings from catalog:' +
                     catalog_name)
        control_access = org.remove_catalog_access_settings(catalog_name,
                                                            remove_all=True)
        self.assertFalse(hasattr(control_access, 'AccessSettings'))

        # add three access control settings to the catalog
        logger.debug('Adding three acl rule to the catalog:' + catalog_name)
        control_access = org.add_catalog_access_settings(
            catalog_name,
            access_settings_list=[{
                'name': vapp_author_username,
                'type': 'user',
                'access_level': 'ReadOnly'
            }, {
                'name': org_admin_username,
                'type': 'user',
                'access_level': 'Change'
            }, {
                'name': org_name,
                'type': 'org',
                'access_level': 'ReadOnly'
            }])
        self.assertEqual(len(control_access.AccessSettings.AccessSetting),
                         3)
        # TODO() : Test that vapp author can actually access the catalog

        # retrieve access control settings of the catalog
        logger.debug('Retrieving acl rule from catalog:' + catalog_name)
        control_access = org.get_catalog_access_settings(catalog_name)
        self.assertEqual(len(control_access.AccessSettings.AccessSetting),
                         3)

        # remove partial access control settings from the catalog
        logger.debug('Removing 2 acl rule from catalog:' + catalog_name)
        control_access = org.remove_catalog_access_settings(
            catalog_name,
            access_settings_list=[{
                'name': org_admin_username,
                'type': 'user'
            }, {
                'name': org_name,
                'type': 'org'
            }])
        self.assertEqual(len(control_access.AccessSettings.AccessSetting),
                         1)

        # test removal of non existing access control settings from the catalog
        logger.debug('Trying to remove non existent acl rule from catalog:' +
                     catalog_name)
        try:
            org.remove_catalog_access_settings(
                catalog_name,
                access_settings_list=[{
                    'name': org_admin_username,
                    'type': 'user'
                }])
            self.fail('Removing non existing acl should fail.')
        except EntityNotFoundException:
            pass

        # remove all access control settings from the catalog
        logger.debug('Removing all access control settings from catalog:' +
                     catalog_name)
        control_access = org.remove_catalog_access_settings(
            catalog_name, remove_all=True)
        self.assertFalse(hasattr(control_access, 'AccessSettings'))