def test_create_network_CustomNetworkView_as_DefaultNetworkView_and_DNSView_as_CustomDNSView_EA(self): proc = util.utils() proc.create_network(network) proc.create_subnet(network, subnet_name, subnet) flag = proc.get_subnet_name(subnet_name) flag = proc.get_subnet_name(subnet_name) assert flag == subnet_name
def test_create_network_DefaultDomainNamePattern_as_TenantName_update_sync_tool(self): proc = util.utils() proc.create_network(network) proc.create_subnet(network, subnet_name, subnet) flag = proc.get_subnet_name(subnet_name) flag = proc.get_subnet_name(subnet_name) assert flag == subnet_name
def test_deploy_instnace_CustomDNSView_as_DNSView_OPENSTACK917(self): proc = util.utils() proc.launch_instance(instance_name,network) instance = proc.get_server_name(instance_name) status = proc.get_server_status(instance_name) assert instance_name == instance and status == 'ACTIVE' time.sleep(5)
def test_create_network_DefaultNetworkView_as_Default_EAs_sync_tool(self): proc = util.utils() proc.create_network(network) proc.create_subnet(network, subnet_name, subnet) flag = proc.get_subnet_name(subnet_name) flag = proc.get_subnet_name(subnet_name) assert flag == subnet_name
def test_create_network_external_network_for_router(self): proc = util.utils() proc.create_network(ext_network, external=True, shared=True) proc.create_subnet(ext_network, ext_subnet_name, ext_subnet) flag = proc.get_subnet_name(ext_subnet_name) flag = proc.get_subnet_name(ext_subnet_name) assert flag == ext_subnet_name
def test_validate_fixed_address_EAs_router_for_external_network_OPENSTACK_926(self): proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:floatingip' == ports_list[l]['device_owner']): ip_address_opstk = ports_list[l]['fixed_ips'][0]['ip_address'] port_id_openstack = ports_list[l]['id'] device_id_openstack = ports_list[l]['device_id'] device_owner_opstk = 'network:router_interface' ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress',params="?ipv4addr="+ip_address_opstk)) ref_v_fixaddr = ref_v[0]['_ref'] EAs = json.loads(wapi_module.wapi_request('GET',object_type=ref_v_fixaddr+'?_return_fields=extattrs')) tenant_id_nios = EAs['extattrs']['Tenant ID']['value'] tenant_name_nios = EAs['extattrs']['Tenant Name']['value'] port_id_nios = EAs['extattrs']['Port ID']['value'] ip_type_nios = EAs['extattrs']['IP Type']['value'] device_id_nios = EAs['extattrs']['Port Attached Device - Device ID']['value'] device_owner_nios = EAs['extattrs']['Port Attached Device - Device Owner']['value'] cmp_type_nios = EAs['extattrs']['CMP Type']['value'] cloud_api_owned = EAs['extattrs']['Cloud API Owned']['value'] tenant_id_openstack = proc.get_tenant_id(network) assert tenant_id_nios == tenant_id_openstack and \ port_id_nios == port_id_openstack and \ tenant_name_nios == tenant_name and \ ip_type_nios == 'Floating' and \ device_owner_nios == device_owner_opstk and \ cmp_type_nios == 'OpenStack' and \ cloud_api_owned == 'False' and \ device_id_nios == device_id_openstack
def test_validate_a_record_EAs_router(self): host_records = json.loads( wapi_module.wapi_request('GET', object_type='record:a')) ref_v = host_records[0]['_ref'] EAs = json.loads( wapi_module.wapi_request('GET', object_type=ref_v + '?_return_fields=extattrs')) tenant_id_nios = EAs['extattrs']['Tenant ID']['value'] tenant_name_nios = EAs['extattrs']['Tenant Name']['value'] port_id_nios = EAs['extattrs']['Port ID']['value'] ip_type_nios = EAs['extattrs']['IP Type']['value'] device_id_nios = EAs['extattrs']['Port Attached Device - Device ID'][ 'value'] device_owner_nios = EAs['extattrs'][ 'Port Attached Device - Device Owner']['value'] cmp_type_nios = EAs['extattrs']['CMP Type']['value'] cloud_api_owned = EAs['extattrs']['Cloud API Owned']['value'] proc = util.utils() port_list_openstack = proc.list_ports() tenant_id_openstack = proc.get_tenant_id(ext_network) ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:router_gateway' == ports_list[l]['device_owner']): port_id_openstack = ports_list[l]['id'] device_id_openstack = ports_list[l]['device_id'] device_owner_opstk = 'network:router_gateway' assert tenant_id_nios == tenant_id_openstack and \ port_id_nios == port_id_openstack and \ tenant_name_nios == tenant_name and \ ip_type_nios == 'Fixed' and \ device_owner_nios == device_owner_opstk and \ cmp_type_nios == 'OpenStack' and \ cloud_api_owned == 'False' and \ device_id_nios == device_id_openstack
def test_validate_a_record_EAs_InternalNetwrok_Interface_router(self): a_records = json.loads(wapi_module.wapi_request('GET',object_type='record:a')) for l in range(len(a_records)): ref_v = a_records[l]['_ref'] if (ref_v.endswith((tenant_name+'.cloud.global.com/default'))): ref_v_a = a_records[l]['_ref'] EAs = json.loads(wapi_module.wapi_request('GET',object_type=ref_v_a+'?_return_fields=extattrs')) tenant_id_nios = EAs['extattrs']['Tenant ID']['value'] tenant_name_nios = EAs['extattrs']['Tenant Name']['value'] port_id_nios = EAs['extattrs']['Port ID']['value'] ip_type_nios = EAs['extattrs']['IP Type']['value'] device_id_nios = EAs['extattrs']['Port Attached Device - Device ID']['value'] device_owner_nios = EAs['extattrs']['Port Attached Device - Device Owner']['value'] cmp_type_nios = EAs['extattrs']['CMP Type']['value'] cloud_api_owned = EAs['extattrs']['Cloud API Owned']['value'] proc = util.utils() tenant_id_openstack = proc.get_tenant_id(ext_network) port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:router_interface' == ports_list[l]['device_owner']): port_id_openstack = ports_list[l]['id'] device_id_openstack = ports_list[l]['device_id'] device_owner_opstk = 'network:router_interface' assert tenant_id_nios == tenant_id_openstack and \ port_id_nios == port_id_openstack and \ tenant_name_nios == tenant_name and \ ip_type_nios == 'Fixed' and \ device_owner_nios == device_owner_opstk and \ cmp_type_nios == 'OpenStack' and \ cloud_api_owned == 'True' and \ device_id_nios == device_id_openstack
def test_validate_host_record_entry_EAs_DefaultNetworkViewScope_as_AddressScope(self): host_records = json.loads(wapi_module.wapi_request('GET',object_type='record:host')) ref_v = host_records[0]['_ref'] EAs = json.loads(wapi_module.wapi_request('GET',object_type=ref_v+'?_return_fields=extattrs')) tenant_id_nios = EAs['extattrs']['Tenant ID']['value'] tenant_name_nios = EAs['extattrs']['Tenant Name']['value'] port_id_nios = EAs['extattrs']['Port ID']['value'] ip_type_nios = EAs['extattrs']['IP Type']['value'] device_id_nios = EAs['extattrs']['Port Attached Device - Device ID']['value'] device_owner_nios = EAs['extattrs']['Port Attached Device - Device Owner']['value'] cmp_type_nios = EAs['extattrs']['CMP Type']['value'] cloud_api_owned = EAs['extattrs']['Cloud API Owned']['value'] proc = util.utils() port_list_openstack = proc.list_ports() device_owner_openstack = port_list_openstack['ports'][0]['device_owner'] device_owner1_openstack = port_list_openstack['ports'][1]['device_owner'] if device_owner_openstack == 'network:dhcp': port_id_openstack = port_list_openstack['ports'][0]['id'] tenant_id_openstack = port_list_openstack['ports'][0]['tenant_id'] device_id_openstack = port_list_openstack['ports'][0]['device_id'] device_owner_opstk = 'network:dhcp' else: port_id_openstack = port_list_openstack['ports'][1]['id'] tenant_id_openstack = port_list_openstack['ports'][1]['tenant_id'] device_id_openstack = port_list_openstack['ports'][1]['device_id'] device_owner_opstk = 'network:dhcp' assert tenant_id_nios == tenant_id_openstack and \ port_id_nios == port_id_openstack and \ tenant_name_nios == tenant_name and \ ip_type_nios == 'Fixed' and \ device_owner_nios == device_owner_opstk and \ cmp_type_nios == 'OpenStack' and \ cloud_api_owned == 'True' and \ device_id_nios == device_id_openstack
def test_deploy_instnace_HostNamePattern_as_HostIPAddress(self): proc = util.utils() proc.launch_instance(instance_name, network) instance = proc.get_server_name(instance_name) status = proc.get_server_status(instance_name) assert instance_name == instance and \ status == 'ACTIVE'
def test_create_network_CustomDNSView_as_DNSView_OPENSTACK917(self): proc = util.utils() proc.create_network(network) proc.create_subnet(network, subnet_name, subnet) flag = proc.get_subnet_name(subnet_name) flag = proc.get_subnet_name(subnet_name) assert flag == subnet_name
def test_validate_Network_after_NetworkView_sync_DefaultNetworkViewScope_as_Subnet_sync_tool(self): networks = json.loads(wapi_module.wapi_request('GET',object_type='network')) network_nios = networks[0]['network'] network_view = networks[0]['network_view'] session = util.utils() subnet_id = session.get_subnet_id(subnet_name) assert network_nios == subnet and \ network_view == subnet_name+'-'+subnet_id
def test_validate_NetworkNetworkView_after_SYNC_DefaultNetworkViewScope_as_Tenant(self): networks = json.loads(wapi_module.wapi_request('GET',object_type='network')) network_nios = networks[0]['network'] network_view = networks[0]['network_view'] session = util.utils() tenant_id = session.get_tenant_id(network) assert network_nios == subnet and \ network_view == tenant_name+'-'+tenant_id
def test_validate_NetworkNetworkView_in_DefaultNetworkViewScope_as_Network_EAs_SYNC_Tool(self): networks = json.loads(wapi_module.wapi_request('GET',object_type='network')) network_nios = networks[0]['network'] network_view = networks[0]['network_view'] session = util.utils() network_id = session.get_network_id(network) assert network_nios == subnet and \ network_view == network+'-'+network_id
def test_validate_zone_DefaultNetworkViewScope_as_AddressScope(self): ref_v = json.loads(wapi_module.wapi_request('GET',object_type='zone_auth')) zone_name = ref_v[0]['fqdn'] network_view = ref_v[0]['view'] session = util.utils() address_scope_ids = session.address_scopes_list(address_scope_name_ip4) address_id = address_scope_ids['address_scopes'][0]['id'] assert zone_name == network+'-'+subnet_name+'.cloud.global.com' and \ network_view == 'default.'+address_scope_name_ip4+'-'+address_id
def test_validate_network_in_DefaultNetworkViewScope_as_AddressScope(self): networks = json.loads(wapi_module.wapi_request('GET',object_type='network')) network_nios = networks[0]['network'] network_view = networks[0]['network_view'] session = util.utils() address_scope_ids = session.address_scopes_list(address_scope_name_ip4) address_id = address_scope_ids['address_scopes'][0]['id'] assert network_nios == address_scope_pool_prefix and \ network_view == address_scope_name_ip4+'-'+address_id
def test_get_flavor_list(self): proc = util.utils() proc.flavor_create(flavor_name,CPU,RAM,DISK) flavors = proc.flavor_get(flavor_name) flag = False string_fl = str(flavors) if (re.search(r""+flavor_name,string_fl)): flag = True assert flag
def test_delete_ExternalNetwork_Used_for_Router(self): proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('interface_name' == ports_list[l]['name']): port_id_openstack = ports_list[l]['id'] delete_port = proc.delete_port(port_id_openstack) delete_net = proc.delete_network(ext_network) assert delete_net == ()
def test_delete_router(self): proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:router_interface' == ports_list[l]['device_owner']): port_id_openstack = ports_list[l]['id'] proc.remove_router_interface(router_name, port_id_openstack) delete = proc.delete_router(router_name) assert delete == ()
def test_validate_fixed_address_for_router_of_internal_Network(self): proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:router_interface' == ports_list[l]['device_owner']): ip_address_opstk = ports_list[l]['fixed_ips'][0]['ip_address'] ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress',params="?ipv4addr="+ip_address_opstk)) fixed_address_nios = ref_v[0]['ipv4addr'] assert fixed_address_nios == ip_address_opstk
def test_validate_fixed_address_in_CustomNetworkView_CustomDNSView(self): ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress')) fixed_address_nios = ref_v[0]['ipv4addr'] proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('compute:nova' == ports_list[l]['device_owner']): ip_address_opstk = ports_list[l]['fixed_ips'][0]['ip_address'] assert fixed_address_nios == ip_address_opstk
def test_validate_zone_name_after_update_DomainNamePattern_as_TenantID_EAs(self): session = util.utils() tenant_id = session.get_tenant_id(network) ref_v = json.loads(wapi_module.wapi_request('GET',object_type='zone_auth')) flag = False for l in range(len(ref_v)): zone_name = ref_v[l]['fqdn'] if (zone_name.startswith((tenant_id)) and zone_name.endswith(('.cloud.global.com'))): flag = True assert flag
def test_add_AddressScope_DefaultNetworkViewScope_as_AddressScope(self): session = util.utils() session.add_address_scope(address_scope_name_ip4,"4") session.address_scopes_list(address_scope_name_ip4) session.add_address_scope_subnetpool(address_scope_name_ip4,address_scope_subnet_name_ipv4,\ address_scope_pool_prefix,address_scope_prefixlen) session.subnetpool_list(address_scope_subnet_name_ipv4) subnet = session.add_subnet_address_scope(network,address_scope_subnet_name_ipv4,subnet_name) flag = session.get_subnet_name(subnet_name) assert flag == subnet_name
def test_validate_host_record_entry_mac_address_in_CustomNetworkView_CustomDNSView(self): host_records = json.loads(wapi_module.wapi_request('GET',object_type='record:host')) mac_address_nios = host_records[0]['ipv4addrs'][0]['mac'] proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:dhcp' == ports_list[l]['device_owner']): mac_address_openstack = ports_list[l]['mac_address'] assert mac_address_nios == mac_address_openstack
def test_validate_a_record_DefaultNetworkViewScope_as_AddressScope(self): ref_v_zone = json.loads(wapi_module.wapi_request('GET',object_type='zone_auth')) zone_name = ref_v_zone[0]['fqdn'] ref_v_a_record = json.loads(wapi_module.wapi_request('GET',object_type='record:a')) a_record_name = ref_v_a_record[0]['name'] proc = util.utils() ip_add = proc.get_instance_ips(instance_name) ip_address = ip_add[network][0]['addr'] tenant_id_openstack = proc.get_tenant_id(network) fqdn = "host-"+'-'.join(ip_address.split('.'))+'-'+tenant_id_openstack+'.'+zone_name assert fqdn == a_record_name
def test_validate_fixed_address_DefaultNetworkViewScope_as_AddressScope(self): ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress')) fixed_address_nios = ref_v[0]['ipv4addr'] proc = util.utils() port_list_openstack = proc.list_ports() device_owner_openstack = port_list_openstack['ports'][0]['device_owner'] device_owner1_openstack = port_list_openstack['ports'][1]['device_owner'] if device_owner_openstack == 'compute:None': ip_address_opstk = port_list_openstack['ports'][0]['fixed_ips'][0]['ip_address'] else: ip_address_opstk = port_list_openstack['ports'][1]['fixed_ips'][0]['ip_address'] assert fixed_address_nios == ip_address_opstk
def test_validate_host_record_entry_mac_address_DefaultNetworkViewScope_as_AddressScope(self): host_records = json.loads(wapi_module.wapi_request('GET',object_type='record:host')) mac_address_nios = host_records[0]['ipv4addrs'][0]['mac'] proc = util.utils() port_list_openstack = proc.list_ports() device_owner_openstack = port_list_openstack['ports'][0]['device_owner'] device_owner1_openstack = port_list_openstack['ports'][1]['device_owner'] if device_owner_openstack == 'network:dhcp': mac_address_openstack = port_list_openstack['ports'][0]['mac_address'] else: mac_address_openstack = port_list_openstack['ports'][1]['mac_address'] assert mac_address_nios == mac_address_openstack
def test_validate_mac_address_fixed_address_for_router(self): ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress')) ref = ref_v[0]['_ref'] mac_add = json.loads(wapi_module.wapi_request('GET',object_type=ref+'?_return_fields=mac')) mac_add_nios = mac_add['mac'] proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:router_gateway' == ports_list[l]['device_owner']): mac_address_openstack = ports_list[l]['mac_address'] assert mac_add_nios == mac_address_openstack
def test_validate_a_record_EAs_of_floatingIP_from_external_network_OPENSTACK_926( self): a_records = json.loads( wapi_module.wapi_request('GET', object_type='record:a')) for l in range(len(a_records)): record_name = a_records[l]['name'] if (record_name.startswith(('inst'))): fqdn_nios = a_records[l]['name'] records = json.loads( wapi_module.wapi_request('GET', object_type='record:a', params="?name=" + fqdn_nios)) ref_v_a = records[0]['_ref'] EAs = json.loads( wapi_module.wapi_request('GET', object_type=ref_v_a + '?_return_fields=extattrs')) vm_name_nios = EAs['extattrs']['VM Name']['value'] vm_id_nios = EAs['extattrs']['VM ID']['value'] tenant_name_nios = EAs['extattrs']['Tenant Name']['value'] tenant_id_nios = EAs['extattrs']['Tenant ID']['value'] port_id_nios = EAs['extattrs']['Port ID']['value'] ip_type_nios = EAs['extattrs']['IP Type']['value'] device_id_nios = EAs['extattrs']['Port Attached Device - Device ID'][ 'value'] device_owner_nios = EAs['extattrs'][ 'Port Attached Device - Device Owner']['value'] cmp_type_nios = EAs['extattrs']['CMP Type']['value'] cloud_api_owned = EAs['extattrs']['Cloud API Owned']['value'] proc = util.utils() vm_id_openstack = proc.get_servers_id(instance_name) vm_name_openstack = proc.get_server_name(instance_name) vm_tenant_id_openstack = proc.get_server_tenant_id() ip_adds = proc.get_instance_ips(instance_name) inst_ip_address = ip_adds[network][0]['addr'] port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('network:floatingip' == ports_list[l]['device_owner']): port_id_openstack = ports_list[l]['id'] device_id_openstack = ports_list[l]['device_id'] device_owner_opstk = 'compute:nova' assert vm_name_nios == vm_name_openstack and \ vm_id_nios == vm_id_openstack and \ tenant_name_nios == tenant_name and \ tenant_id_nios == vm_tenant_id_openstack and \ port_id_nios == port_id_openstack and \ ip_type_nios == 'Floating' and \ device_owner_opstk == device_owner_nios and \ cmp_type_nios == 'OpenStack' and \ cloud_api_owned == 'False' and \ device_id_nios == device_id_openstack
def test_validate_mac_address_fixed_address_instance_CustomDNSView_as_DNSView_OPENSTACK917(self): ref_v = json.loads(wapi_module.wapi_request('GET',object_type='fixedaddress')) ref = ref_v[0]['_ref'] mac_add = json.loads(wapi_module.wapi_request('GET',object_type=ref+'?_return_fields=mac')) mac_add_nios = mac_add['mac'] proc = util.utils() port_list_openstack = proc.list_ports() ports_list = port_list_openstack['ports'] for l in range(len(ports_list)): if ('compute:nova' == ports_list[l]['device_owner']): mac_address_openstack = ports_list[l]['mac_address'] assert mac_add_nios == mac_address_openstack