def test_hcf_rename_org_duplicate(self): # Create another Org for checking Rename org org_name1 = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(org_name1) self.verify("OK", out) # Rename org with existing org (duplicate) out, err = hcf_organisations.rename_org(org_name1, self.setup_org) self.verify("FAILED", out) # Delete additional org created for renaming out, err = hcf_organisations.delete_org(org_name1, input_data=b'yes\n') self.verify("OK", out)
def setUpClass(cls): super(TestHcfSecurityGroups, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Loginto Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create Organisation cls.org_name = 'org_test' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.org_name) # Create Space out, err = hcf_auth.target(optional_args={'-o': cls.org_name}) cls.space_name = 'space_test' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.space_name)
def setUpClass(cls): super(TestHcfMarketplace, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Log into Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create organisation cls.setup_org = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.setup_org) out, err = hcf_auth.target(optional_args={'-o': cls.setup_org}) # Create Space cls.setup_space = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.setup_space) out, err = hcf_auth.target(optional_args={'-o': cls.setup_org, '-s': cls.setup_space})
def setUpClass(cls): super(TestHcfApps, cls).setUpClass() # Connect to the cluster URI target hcf_auth.connect_target(cls.cluster_url, optional_args={'--skip-ssl-validation': ' '}) # Loginto Cluster using creds hcf_auth.login(optional_args={'-u': cls.username, '-p': cls.password}) # Create Organisation cls.org_name = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(cls.org_name) # Create Space out, err = hcf_auth.target(optional_args={'-o': cls.org_name}) cls.space_name = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(cls.space_name) parsed = urlparse(cls.app_url) link = parsed.path.split('/') cls.app_dir = link[len(link) - 1]
def test_hcf_user_operations(self): # Login with admin to create user hcf_auth.login(optional_args={'-u': self.username, '-p': self.password}) # Create an organisation to bind with user org_name = 'og_test_org' + str(random.randint(1024, 4096)) hcf_organisations.create_org(org_name) # Create a space to bind with user out, err = hcf_auth.target(optional_args={'-o': org_name}) space_name = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(space_name) out, err = hcf_auth.target(optional_args={'-s': space_name}) # Create user user_name = 'hcf_test_user' + str(random.randint(1024, 4096)) password = '******' + str(random.randint(1024, 4096)) out, err = hcf_users.create_user(user_name, password) self.verify(user_name, out) self.verify("OK", out) # Set role for user in an organisation org_role = "OrgManager" out, err = hcf_users.set_org_role(user_name, org_name, org_role) self.verify("OK", out) self.verify(org_name, out) self.verify(org_role, out) # Unset role for user in an organisation out, err = hcf_users.unset_org_role(user_name, org_name, org_role) self.verify("OK", out) self.verify(org_name, out) # Set role for user in a space space_role = "SpaceDeveloper" out, err = hcf_users.set_space_role( user_name, org_name, space_name, space_role) self.verify("OK", out) self.verify(space_name, out) self.verify(space_role, out) # Unset role for user in a space out, err = hcf_users.unset_space_role( user_name, org_name, space_name, space_role) self.verify("OK", out) self.verify(space_name, out) hcf_auth.logout(self.cluster_url) # Login with the created user out, err = hcf_auth.login(optional_args={'-u': user_name, '-p': password}) self.verify("Authenticating", out) self.verify("OK", out) hcf_auth.logout(self.cluster_url) # Login with admin to delete user hcf_auth.login(optional_args={'-u': self.username, '-p': self.password}) # Delete User out, err = hcf_users.delete_user( user_name, input_data=b'yes\n') self.verify("OK", out) # Delete org hcf_organisations.delete_org(org_name, input_data=b'yes\n') hcf_auth.logout(self.cluster_url)
def test_hcf_org_space_domain(self): # Create Organisation org_name = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(org_name) self.verify(org_name, out) self.verify("OK", out) # Get org info out, err = hcf_organisations.org_info(org_name) self.verify(org_name, out) # List Organisations out, err = hcf_organisations.list_orgs() self.verify(org_name, out) # Create Space out, err = hcf_auth.target(optional_args={'-o': org_name}) space_name = 'sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(space_name) self.verify(space_name, out) self.verify("OK", out) # List Spaces out, err = hcf_space.list_space() self.verify(space_name, out) # Get Space Info out, err = hcf_space.space(space_name) self.verify("Getting info for space", out) self.verify("OK", out) # Create Domain domain_name = 'testdomain' + str(random.randint(1024, 4096)) + '.com' hcf_domain.create_domain(org_name, domain_name) self.verify("OK", out) # List Domains out, err = hcf_domain.list_domain() self.verify("Getting domains in org", out) # List Router Groups out, err = hcf_domain.list_router_groups() self.verify("Getting router groups", out) # Delete domain hcf_auth.target(optional_args={'-o': org_name}) out, err = hcf_domain.delete_domain(domain_name, input_data=b'yes\n') self.verify("OK", out) # Rename org new_org_name = 'new_og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.rename_org(org_name, new_org_name) self.verify(new_org_name, out) self.verify("OK", out) # Rename space new_space_name = 'new_sp_test_space' + str(random.randint(1024, 4096)) out, err = hcf_space.rename_space(space_name, new_space_name) self.verify(new_space_name, out) self.verify("OK", out) # Delete space and org out, err = hcf_space.delete_space(new_space_name, input_data=b'yes\n') self.verify("OK", out) out, err = hcf_organisations.delete_org(new_org_name, input_data=b'yes\n') self.verify("OK", out)
def test_hcf_create_org_without_quota(self): # Create Organization with non-existing quota quota_name = "no_quota" + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org( self.setup_org, optional_args={'-q': quota_name}) self.verify("FAILED", out)
def test_hcf_create_duplicate_org(self): # Create Organization with duplicate name out, err = hcf_organisations.create_org(self.setup_org) self.verify("OK", out) self.verify("already exists", out)
def test_hcf_create_delete_quota(self): # Create Quota quota_name = 'quota_test' + str(random.randint(1024, 4096)) out, err = hcf_quotas.create_quota(quota_name) self.verify(quota_name, out) self.verify("OK", out) # List Quotas out, err = hcf_quotas.list_quotas() self.verify("Getting quotas", out) self.verify("OK", out) # Display Quota Info out, err = hcf_quotas.quota_info(quota_name) self.verify("OK", out) # Update Quota out, err = hcf_quotas.update_quota(quota_name, optional_args={'-m': '1G'}) self.verify("OK", out) # Create Org org_name = 'og_test_org' + str(random.randint(1024, 4096)) out, err = hcf_organisations.create_org(org_name) self.verify(org_name, out) self.verify("OK", out) # Set Quota to Org out, err = hcf_quotas.set_quota(org_name, quota_name) self.verify("Setting quota " + quota_name + " to org " + org_name, out) self.verify("OK", out) # Set Target to Org out, err = hcf_quotas.set_target(optional_args={'-o': org_name}) # Create Space-Quota space_quota_name = 'sp_quota_test' + str(random.randint(1024, 4096)) out, err = hcf_quotas.create_space_quota(space_quota_name) self.verify(space_quota_name, out) self.verify("OK", out) # Create Space space_name = 'sp_test' + str(random.randint(1024, 4096)) out, err = hcf_space.create_space(space_name) self.verify(space_name, out) self.verify("OK", out) # Update Space Quota out, err = hcf_quotas.update_space_quota(space_quota_name, optional_args={'-s': '150'}) self.verify("OK", out) # Display Space Quota Info out, err = hcf_quotas.space_quota_info(space_quota_name) self.verify("OK", out) # Set Space-Quota to Space out, err = hcf_quotas.set_space_quota(space_name, space_quota_name) self.verify("Assigning space quota " + space_quota_name, out) self.verify("OK", out) # List Space-Quotas out, err = hcf_quotas.list_space_quotas() self.verify("Getting space quotas", out) self.verify("OK", out) # Unset Space-Quota out, err = hcf_quotas.unset_space_quota(space_name, space_quota_name) self.verify("Unassigning space quota " + space_quota_name, out) self.verify("OK", out) # Delete Space-Quota out, err = hcf_quotas.delete_space_quota(space_quota_name, input_data=b'yes\n') self.verify("Deleting space quota " + space_quota_name, out) self.verify("OK", out) # Delete Space out, err = hcf_space.delete_space(space_name, input_data=b'yes\n') self.verify("OK", out) # Delete Org out, err = hcf_organisations.delete_org(org_name, input_data=b'yes\n') self.verify("OK", out) # Delete Quota out, err = hcf_quotas.delete_quota(quota_name, input_data=b'yes\n') self.verify("Deleting quota", out) self.verify("OK", out)