def test_update_subnet_2(self): "Update subnet network" subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) new_subnet_network = generate_ipaddr(ip3=True) self.subnet.update(subnet_name, None, new_subnet_network, None) result_object = self.search_subnet(subnet_name) self.assertEqual(new_subnet_network, result_object['network'])
def test_update_subnet_2(self): """ @Feature: Subnet - Positive Update @Test: Update Subnet network @Assert: Subnet network is updated """ subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) new_subnet_network = generate_ipaddr(ip3=True) self.subnet.update(subnet_name, new_subnet_network=new_subnet_network) result_object = self.subnet.search_subnet(subnet_name) self.assertEqual(new_subnet_network, result_object['network'])
def test_remove_subnet_1(self, subnet_name): """ @feature: Organizations @test: Remove subnet by using organization name and subnet name @assert: subnet is added then removed @BZ: 1076562 """ strategy = common_locators["entity_select"][0] value = common_locators["entity_select"][1] strategy1 = common_locators["entity_deselect"][0] value1 = common_locators["entity_deselect"][1] org_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.navigator.go_to_subnets() self.subnet.create(None, subnet_name, subnet_network, subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name)) self.navigator.go_to_org() self.org.create(org_name, subnets=[subnet_name], edit=True) self.org.search(org_name).click() self.org.wait_until_element(tab_locators["orgs.tab_subnets"]).click() element = self.org.wait_until_element((strategy1, value1 % subnet_name)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertTrue(element) self.org.update(org_name, subnets=[subnet_name], new_subnets=None) self.org.search(org_name).click() self.org.wait_until_element(tab_locators["orgs.tab_subnets"]).click() element = self.org.wait_until_element((strategy, value % subnet_name)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertTrue(element)
def test_add_subnet_1(self, subnet_name): """@test: Add a subnet by using organization name and subnet name. @feature: Organizations associate subnet. @assert: subnet is added. """ strategy, value = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" with Session(self.browser) as session: make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) make_subnet(session, subnet_name=subnet_name, subnet_network=subnet_network, subnet_mask=subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name)) self.org.update(org_name, new_subnets=[subnet_name]) self.org.search(org_name).click() self.org.wait_until_element( tab_locators["context.tab_subnets"]).click() element = session.nav.wait_until_element((strategy, value % subnet_name)) self.assertIsNotNone(element)
def test_update_subnet_2(self, name): """@Test: Update Subnet network @Feature: Subnet - Positive Update @Assert: Subnet network is updated """ network = generate_ipaddr(ip3=True) mask = "255.255.255.0" new_network = generate_ipaddr(ip3=True) with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) self.subnet.update(name, new_subnet_network=new_network) result_object = self.subnet.search_subnet(name) self.assertEqual(new_network, result_object["network"])
def test_remove_subnet_1(self, subnet_name): """@test: Remove subnet by using organization name and subnet name. @feature: Organizations dis-associate subnet. @assert: subnet is added then removed. """ strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=subnet_name, subnet_network=subnet_network, subnet_mask=subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name)) make_org(session, org_name=org_name, subnets=[subnet_name], edit=True) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_subnets"]).click() element = session.nav.wait_until_element((strategy1, value1 % subnet_name)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, subnets=[subnet_name]) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_subnets"]).click() element = session.nav.wait_until_element((strategy, value % subnet_name)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertIsNotNone(element)
def test_remove_subnet_1(self, subnet_name): """ @feature: Organizations @test: Remove subnet by using organization name and subnet name @assert: subnet is added then removed @BZ: 1076562 """ strategy = common_locators["entity_select"][0] value = common_locators["entity_select"][1] strategy1 = common_locators["entity_deselect"][0] value1 = common_locators["entity_deselect"][1] org_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.navigator.go_to_subnets() self.subnet.create(None, subnet_name, subnet_network, subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name)) self.navigator.go_to_org() self.org.create(org_name, subnets=[subnet_name], edit=True) self.org.search(org_name).click() self.org.wait_until_element(tab_locators["orgs.tab_subnets"]).click() element = self.org.wait_until_element( (strategy1, value1 % subnet_name)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertTrue(element) self.org.update(org_name, subnets=[subnet_name], new_subnets=None) self.org.search(org_name).click() self.org.wait_until_element(tab_locators["orgs.tab_subnets"]).click() element = self.org.wait_until_element((strategy, value % subnet_name)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertTrue(element)
def test_update_subnet_2(self): """ @Feature: Subnet - Positive Update @Test: Update Subnet network @Assert: Subnet network is updated """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) new_subnet_network = generate_ipaddr(ip3=True) self.subnet.update(subnet_name, new_subnet_network=new_subnet_network) result_object = self.subnet.search_subnet(subnet_name) self.assertEqual(new_subnet_network, result_object['network'])
def test_create_subnet(self): "Create new subnet - given subnet name, subnet network, subnet mask" subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.assertIsNotNone(self.search_subnet(subnet_name))
def create_minimal(cls, name=None, network=None): """ Creates a minimal subnet object. """ options = {} options['name'] = name if name else generate_name(8, 8) options['network'] = network if network else generate_ipaddr(ip3=True) options['mask'] = '255.255.255.0' return cls.create(options)
def test_remove_subnet_1(self): "Delete subnet - Create subnet and delete the same" subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.remove(subnet_name, True) #TODO: Unable to capture the success message for now self.assertFalse(self.search_subnet(subnet_name))
def test_remove_subnet_2(self): "Delete subnet - Create subnet. Attempt to delete subnet but cancel \ in the confirmation dialog box" subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.remove(subnet_name, False) self.assertTrue(self.search_subnet(subnet_name))
def test_search_subnet_1(self): "Search subnet - Given the subnet name" subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) result_object = self.search_subnet(subnet_name) self.assertEqual(subnet_name, result_object['name']) self.assertEqual(subnet_network, result_object['network']) self.assertEqual(subnet_mask, result_object['mask'])
def test_create_subnet(self): """ @Feature: Subnet - Positive Create @Test: Create new subnet - given subnet name, subnet network, subnet mask @Assert: Subnet is created """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask)
def create_subnet(self, subnet_name=None, subnet_network=None, subnet_mask=None,): """ Create Subnet with navigation steps """ subnet_name = subnet_name or generate_name(8, 8) subnet_network = subnet_network or generate_ipaddr(ip3=True) org_name = generate_name(8, 8) self.create_org(org_name) self.navigator.go_to_subnets() # go to subnet page self.subnet.create([org_name], subnet_name, subnet_network, subnet_mask)
def test_create_subnet_negative_3(self): """@Test: Create new subnet with whitespace name. @Feature: Subnet - Negative Create. @Assert: Subnet is not created with blank name. """ name = " " network = generate_ipaddr(ip3=True) mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) self.assertIsNone(self.subnet.search_subnet(subnet_name=name))
def test_create_subnet_2(self, name): """@Test: Create new subnet - given subnet name, subnet network, subnet mask. @Feature: Subnet - Positive Create @Assert: Subnet is created with 255 chars """ network = generate_ipaddr(ip3=True) mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name))
def create_subnet(self, subnet_name=None, subnet_network=None, subnet_mask=None,): """ Create Subnet with navigation steps """ subnet_name = subnet_name or generate_string("alpha", 8) subnet_network = subnet_network or generate_ipaddr(ip3=True) org_name = generate_string("alpha", 10) self.create_org(org_name) self.navigator.go_to_subnets() # go to subnet page self.subnet.create([org_name], subnet_name, subnet_network, subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name))
def test_remove_subnet_2(self): """ @Feature: Subnet - Negative Delete @Test: Create subnet. Attempt to delete subnet but cancel in the confirmation dialog box @Assert: Subnet is not deleted """ subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.delete(subnet_name, False) self.assertTrue(self.subnet.search_subnet(subnet_name))
def test_remove_subnet_1(self): """ @Feature: Subnet - Positive Delete @Test: Delete a subnet @Assert: Subnet is deleted """ subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.delete(subnet_name, True) #TODO: Unable to capture the success message for now self.assertFalse(self.subnet.search_subnet(subnet_name))
def test_remove_subnet_2(self): """ @Feature: Subnet - Negative Delete @Test: Create subnet. Attempt to delete subnet but cancel in the confirmation dialog box @Assert: Subnet is not deleted """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.delete(subnet_name, False) self.assertTrue(self.subnet.search_subnet(subnet_name, timeout=5))
def test_remove_subnet_1(self, name): """@Test: Delete a subnet @Feature: Subnet - Positive Delete @Assert: Subnet is deleted """ network = generate_ipaddr(ip3=True) mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) self.subnet.delete(name, True) self.assertIsNotNone(session.nav.wait_until_element(common_locators["notif.success"])) self.assertIsNone(self.subnet.search_subnet(subnet_name=name, timeout=5))
def test_info(self): """`subnet info` basic test """ options = {} options['name'] = generate_name(8, 8) options['network'] = generate_ipaddr(ip3=True) options['mask'] = '255.255.255.0' Subnet().create(options) result = Subnet().info({'name': options['name']}) self.assertTrue(len(result.stdout) > 1, "Subnet info - returns 1 record") self.assertEquals(result.stdout['Name'], options['name'], "Subnet info - check name")
def test_remove_subnet_2(self, name): """@Test: Create subnet. Attempt to delete subnet but cancel in the confirmation dialog box. @Feature: Subnet - Negative Delete @Assert: Subnet is not deleted """ network = generate_ipaddr(ip3=True) mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) self.subnet.delete(name, False) self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name, timeout=5))
def test_search_subnet_1(self, name): """@Test: Search Subnet with Subnet name @Feature: Subnet - Positive Search @Assert: Subnet is found """ network = generate_ipaddr(ip3=True) mask = "255.255.255.0" with Session(self.browser) as session: make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask) result_object = self.subnet.search_subnet(name) self.assertEqual(name, result_object["name"]) self.assertEqual(network, result_object["network"]) self.assertEqual(mask, result_object["mask"])
def test_search_subnet_1(self): """ @Feature: Subnet - Positive Search @Test: Search Subnet with Subnet name @Assert: Subnet is found """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) result_object = self.subnet.search_subnet(subnet_name) self.assertEqual(subnet_name, result_object['name']) self.assertEqual(subnet_network, result_object['network']) self.assertEqual(subnet_mask, result_object['mask'])
def test_search_subnet_1(self): """ @Feature: Subnet - Positive Search @Test: Search Subnet with Subnet name @Assert: Subnet is found """ subnet_name = generate_name(8, 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) result_object = self.subnet.search_subnet(subnet_name) self.assertEqual(subnet_name, result_object['name']) self.assertEqual(subnet_network, result_object['network']) self.assertEqual(subnet_mask, result_object['mask'])
def test_remove_subnet_1(self): """ @Feature: Subnet - Positive Delete @Test: Delete a subnet @Assert: Subnet is deleted """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.delete(subnet_name, True) self.assertTrue(self.content_views.wait_until_element (common_locators["notif.success"])) self.assertFalse(self.subnet.search_subnet(subnet_name, timeout=5))
def test_remove_subnet_1(self): """ @Feature: Subnet - Positive Delete @Test: Delete a subnet @Assert: Subnet is deleted """ subnet_name = generate_string("alpha", 8) subnet_network = generate_ipaddr(ip3=True) subnet_mask = "255.255.255.0" self.login.login(self.katello_user, self.katello_passwd) self.create_subnet(subnet_name, subnet_network, subnet_mask) self.subnet.delete(subnet_name, True) self.assertTrue( self.content_views.wait_until_element( common_locators["notif.success"])) self.assertFalse(self.subnet.search_subnet(subnet_name, timeout=5))
def make_subnet(options=None): """ Usage:: hammer subnet create [OPTIONS] Options:: --name NAME Subnet name --network NETWORK Subnet network --mask MASK Netmask for this subnet --gateway GATEWAY Primary DNS for this subnet --dns-primary DNS_PRIMARY Primary DNS for this subnet --dns-secondary DNS_SECONDARY Secondary DNS for this subnet --from FROM Starting IP Address for IP auto suggestion --to TO Ending IP Address for IP auto suggestion --vlanid VLANID VLAN ID for this subnet --domain-ids DOMAIN_IDS Domains in which this subnet is part Comma separated list of values. --dhcp-id DHCP_ID DHCP Proxy to use within this subnet --tftp-id TFTP_ID TFTP Proxy to use within this subnet --dns-id DNS_ID DNS Proxy to use within this subnet """ args = { u'name': generate_name(8, 8), u'network': generate_ipaddr(ip3=True), u'mask': u'255.255.255.0', u'gateway': None, u'dns-primary': None, u'dns-secondary': None, u'from': None, u'to': None, u'vlanid': None, u'domain-ids': None, u'dhcp-id': None, u'tftp-id': None, u'dns-id': None, } args = update_dictionary(args, options) args.update(create_object(Subnet, args)) return args
def create_subnet( self, subnet_name=None, subnet_network=None, subnet_mask=None, ): """ Create Subnet with navigation steps """ subnet_name = subnet_name or generate_string("alpha", 8) subnet_network = subnet_network or generate_ipaddr(ip3=True) org_name = generate_string("alpha", 10) self.create_org(org_name) self.navigator.go_to_subnets() # go to subnet page self.subnet.create([org_name], subnet_name, subnet_network, subnet_mask) self.assertIsNotNone(self.subnet.search_subnet(subnet_name))
def make_subnet(options=None): """ Usage: hammer subnet create [OPTIONS] Options: --name NAME Subnet name --network NETWORK Subnet network --mask MASK Netmask for this subnet --gateway GATEWAY Primary DNS for this subnet --dns-primary DNS_PRIMARY Primary DNS for this subnet --dns-secondary DNS_SECONDARY Secondary DNS for this subnet --from FROM Starting IP Address for IP auto suggestion --to TO Ending IP Address for IP auto suggestion --vlanid VLANID VLAN ID for this subnet --domain-ids DOMAIN_IDS Domains in which this subnet is part Comma separated list of values. --dhcp-id DHCP_ID DHCP Proxy to use within this subnet --tftp-id TFTP_ID TFTP Proxy to use within this subnet --dns-id DNS_ID DNS Proxy to use within this subnet """ args = { 'name': generate_name(8, 8), 'network': generate_ipaddr(ip3=True), 'mask': u'255.255.255.0', 'gateway': None, 'dns-primary': None, 'dns-secondary': None, 'from': None, 'to': None, 'vlanid': None, 'domain-ids': None, 'dhcp-id': None, 'tftp-id': None, 'dns-id': None, } args = update_dictionary(args, options) args.update(create_object(Subnet, args)) return args
def test_info(self): """ @Feature: Subnet - Info @Test: Check if Subnet Info is displayed @Assert: Subnet Info is displayed """ options = {} options['name'] = generate_name(8, 8) options['network'] = generate_ipaddr(ip3=True) options['mask'] = '255.255.255.0' Subnet.create(options) sleep_for_seconds(5) result = Subnet.info({'name': options['name']}) self.assertTrue(len(result.stdout) > 1, "Subnet info - returns 1 record") self.assertEquals(result.stdout['name'], options['name'], "Subnet info - check name")
def test_create_subnet_3(self): """@Test: Create new subnet - given subnet name, subnet network, subnet mask and domain @Feature: Subnet - Positive Create @Assert: Subnet is created with domain associated """ strategy, value = common_locators["entity_deselect"] name = generate_string("alpha", 4) network = generate_ipaddr(ip3=True) domain_name = description = DOMAIN % name mask = "255.255.255.0" with Session(self.browser) as session: make_domain(session, name=domain_name, description=description) make_subnet(session, subnet_name=name, subnet_network=network, subnet_mask=mask, domains=[domain_name]) self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name)) session.nav.search_entity(name, locators["subnet.display_name"]).click() session.nav.wait_until_element(tab_locators["subnet.tab_domain"]).click() element = session.nav.wait_until_element((strategy, value % domain_name)) self.assertIsNotNone(element)
def make_host(options=None): """ Usage:: hammer host create [OPTIONS] Options:: --architecture ARCHITECTURE_NAME Architecture name --architecture-id ARCHITECTURE_ID --ask-root-password ASK_ROOT_PW One of true/false, yes/no, 1/0. --build BUILD One of true/false, yes/no, 1/0. Default: "true" --compute-attributes COMPUTE_ATTRS Compute resource attributes. Comma-separated list of key=value. --compute-profile COMPUTE_PROFILE_NAME Name to search by --compute-profile-id COMPUTE_PROFILE_ID --compute-resource COMPUTE_RESOURCE_NAME Compute resource name --compute-resource-id COMPUTE_RESOURCE --domain DOMAIN_NAME Domain name --domain-id DOMAIN_ID --enabled ENABLED One of true/false, yes/no, 1/0. Default: "true" --environment ENVIRONMENT_NAME Environment name --environment-id ENVIRONMENT_ID --hostgroup HOSTGROUP_NAME Hostgroup name --hostgroup-id HOSTGROUP_ID --image-id IMAGE_ID --interface INTERFACE Interface parameters. Comma-separated list of key=value. Can be specified multiple times. --ip IP not required if using a subnet with dhcp proxy --location LOCATION_NAME Location name --location-id LOCATION_ID --mac MAC not required if its a virtual machine --managed MANAGED One of true/false, yes/no, 1/0. Default: "true" --medium MEDIUM_NAME Medium name --medium-id MEDIUM_ID --model MODEL_NAME Model name --model-id MODEL_ID --name NAME --operatingsystem-id OPERATINGSYSTEM_ID --organization ORGANIZATION_NAME Organization name --organization-id ORGANIZATION_ID --owner-id OWNER_ID --parameters PARAMS Host parameters. Comma-separated list of key=value. --partition-table-id PARTITION_TABLE_ID --progress-report-id PROGRESS_REPORT_ID UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks --provision-method METHOD One of 'build', 'image' --ptable PTABLE_NAME Partition table name --ptable-id PTABLE_ID --puppet-ca-proxy-id PUPPET_CA_PROXY_ID --puppet-proxy-id PUPPET_PROXY_ID --puppetclass-ids PUPPETCLASS_IDS Comma separated list of values. --realm REALM_NAME Name to search by --realm-id REALM_ID May be numerical id or realm name --root-password ROOT_PW --sp-subnet-id SP_SUBNET_ID --subnet SUBNET_NAME Subnet name --subnet-id SUBNET_ID --volume VOLUME Volume parameters Comma-separated list of key=value. Can be specified multiple times. """ # Check for required options required_options = ( 'architecture-id', 'domain-id', 'environment-id', 'medium-id', 'operatingsystem-id', 'partition-table-id', 'puppet-proxy-id', ) if options is None: raise CLIFactoryError( 'Options {0} are required'.format(', '.join(required_options)) ) missing_options = [ option for option in required_options if options.get(option) is None ] if missing_options: raise CLIFactoryError( 'Options {0} are required'.format(', '.join(missing_options)) ) args = { u'architecture': None, u'architecture-id': None, u'ask-root-password': None, u'build': None, u'compute-attributes': None, u'compute-profile': None, u'compute-profile-id': None, u'compute-resource': None, u'compute-resource-id': None, u'domain': None, u'domain-id': None, u'enabled': None, u'environment': None, u'environment-id': None, u'hostgroup': None, u'hostgroup-id': None, u'image-id': None, u'interface': None, u'ip': generate_ipaddr(), u'location': None, u'location-id': None, u'mac': generate_mac(), u'managed': None, u'medium': None, u'medium-id': None, u'model': None, u'model-id': None, u'name': generate_string('alpha', 10), u'operatingsystem-id': None, u'organization': None, u'organization-id': None, u'owner-id': None, u'parameters': None, u'partition-table-id': None, u'progress-report-id': None, u'provision-method': None, u'ptable': None, u'ptable-id': None, u'puppet-ca-proxy-id': None, u'puppet-proxy-id': None, u'puppetclass-ids': None, u'realm': None, u'realm-id': None, u'root-password': generate_string('alpha', 8), u'sp-subnet-id': None, u'subnet': None, u'subnet-id': None, u'volume': None, } args = update_dictionary(args, options) args.update(create_object(Host, args)) return args
def test_return_type(self): """Tests if generate ipaddr returns a unicode string""" self.assertIsInstance(generate_ipaddr(), unicode) self.assertIsInstance(generate_ipaddr(ip3=True), unicode)
def generate(self): return generate_ipaddr(self.ip3)