def test_190_create_server_neutron(self): network_id = nested_search( "networks/*/name=%s/id" % self.config["nova"]["network_label"], neutron.GET("/%s/networks" % neutron_api_ver, code=200)[1], )[0] image = nova.GET("/images?name=test-image")[1]["images"][0]["id"] flavor = nested_search("/flavors/*/name=m1.tiny/id", nova.GET("/flavors")[1])[0] # TODO(brett): Investigate performance. # It's now taking 90+ seconds for server to go active on Cent (Havana). # Don't see any obvious timeouts or exceptions in cluster. r, d = nova.POST( "/servers", body={ "server": { "name": "testing server creation", "imageRef": image, "flavorRef": flavor, "max_count": 1, "min_count": 1, "networks": [{"uuid": network_id}], "security_groups": [{"name": "test-sec-group"}], } }, code=202, ) server_id = d["server"]["id"] r, d = nova.GET_with_keys_eq( "/servers/%s" % server_id, {"/server/status": "ACTIVE"}, code=200, timeout=120, delay=5 ) ip = d["server"]["addresses"][self.config["nova"]["network_label"]][0]["addr"] netns = "qdhcp-%s" % network_id if not self.ping_host(ip, netns=netns, delay=5, timeout=120): raise AssertionError("Server is active but does not ping")
def test_210_list_addresses(self): label = self.config["nova"]["network_label"] r, d = nova.GET("/servers") sid = nested_search("/servers/*/name=testing server creation/id", d)[0] addrs = nova.GET("/servers/%s/ips" % (sid), code=200)[1] if not len(nested_search("/addresses/%s" % (label), addrs)[0]) > 0: raise AssertionError("No addresses found for network %s" % (label))
def test_190_create_server_neutron(self): network_id = nested_search( 'networks/*/name=%s/id' % self.config['nova']['network_label'], neutron.GET('/%s/networks' % neutron_api_ver, code=200)[1])[0] image = nova.GET("/images?name=test-image")[1]['images'][0]['id'] flavor = nested_search("/flavors/*/name=m1.tiny/id", nova.GET("/flavors")[1])[0] r, d = nova.POST("/servers", body={ "server": { "name": "testing server creation", "imageRef": image, "flavorRef": flavor, "max_count": 1, "min_count": 1, "networks": [{ "uuid": network_id }] } }, code=202) server_id = d['server']['id'] r, d = nova.GET_with_keys_eq("/servers/%s" % server_id, {"/server/status": "ACTIVE"}, code=200, timeout=60, delay=5) ip = d['server']['addresses'][self.config['nova'] ['network_label']][0]['addr'] netns = "qdhcp-%s" % network_id if not self.ping_host(ip, netns=netns, delay=5, timeout=200): raise AssertionError("Server is active but does not ping")
def test_190_create_server_neutron(self): network_id = nested_search( 'networks/*/name=%s/id' % self.config['nova']['network_label'], neutron.GET('/%s/networks' % neutron_api_ver, code=200)[1])[0] image = nova.GET("/images?name=test-image")[1]['images'][0]['id'] flavor = nested_search("/flavors/*/name=m1.tiny/id", nova.GET("/flavors")[1])[0] r, d = nova.POST("/servers", body={"server": {"name": "testing server creation", "imageRef": image, "flavorRef": flavor, "max_count": 1, "min_count": 1, "networks": [{"uuid": network_id}], "security_groups": [{"name": "test-sec-group"}] } }, code=202) server_id = d['server']['id'] r, d = nova.GET_with_keys_eq("/servers/%s" % server_id, {"/server/status": "ACTIVE"}, code=200, timeout=60, delay=5) ip = d['server']['addresses'][self.config['nova']['network_label']][0]['addr'] netns="qdhcp-%s" % network_id if not self.ping_host(ip, netns=netns, delay=5, timeout=120): raise AssertionError("Server is active but does not ping")
def test_901_delete_security_group_rule(self): data = nova.GET("/os-security-groups")[1] gid = nested_search("/security_groups/*/name=kongsec/id", data)[0] rids = nested_search("/security_groups/*/rules/*/parent_group_id=" +\ str(gid) + "/id", data) for rid in rids: nova.DELETE("/os-security-group-rules/%s" % rid, code=202)
def test_210_list_addresses(self): label = self.config['nova']['network_label'] r, d = nova.GET("/servers") sid = nested_search("/servers/*/name=testing server creation/id", d)[0] addrs = nova.GET('/servers/%s/ips' % (sid), code=200)[1] if not len(nested_search('/addresses/%s' % (label), addrs)[0]) > 0: raise AssertionError("No addresses found for network %s" % (label))
def test_901_delete_security_group_rule_diablo_final(self): data = nova.GET("/os-security-groups")[1] gid = nested_search("/security_groups/*/name=kongsec/id", data)[0] rids = nested_search("/security_groups/*/rules/*/parent_group_id=" + str(gid) + "/id", data) try: for rid in rids: nova.DELETE("/os-security-group-rules/%s" % rid, code=202) except ValueError: pass
def test_010_dhcp_agent_network_add(self): dhcp_agent_id = nested_search( 'agents/*/agent_type=DHCP agent/id', neutron.GET('/%s/agents' % api_ver, code=200)[1])[0] network_id = nested_search( 'networks/*/name=test-network/id', neutron.GET('/%s/networks' % api_ver, code=200)[1])[0] resp, body = neutron.POST('/%s/agents/%s/dhcp-networks.json' % (api_ver, dhcp_agent_id), body={'network_id': '%s' % network_id}, code=201)
def test_920_security_group_rule_delete(self): secgroup_id = nested_search( "security_groups/*/name=test-sec-group/id", neutron.GET("/%s/security-groups" % neutron_api_ver, code=200)[1], )[0] resp, body = neutron.GET("/%s/security-groups/%s" % (neutron_api_ver, secgroup_id)) try: secgroup_rule_id = nested_search("security_group/security_group_rules/*/protocol=icmp/id", body)[0] neutron.DELETE("/%s/security-group-rules/%s.json" % (neutron_api_ver, secgroup_rule_id), code=204) except IndexError: pass
def test_026_security_group_rule_show(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % api_ver, code=200)[1])[0] resp, body = neutron.GET('/%s/security-groups/%s' % (api_ver, secgroup_id)) secgroup_rule_id = nested_search( 'security_group/security_group_rules/*/protocol=icmp/id', body) neutron.GET('/%s/security-group-rules/%s.json' % (api_ver, secgroup_rule_id))
def test_026_security_group_rule_show(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % api_ver, code=200)[1])[0] resp, body = neutron.GET( '/%s/security-groups/%s' % (api_ver, secgroup_id)) secgroup_rule_id = nested_search( 'security_group/security_group_rules/*/protocol=icmp/id', body)[0] neutron.GET( '/%s/security-group-rules/%s.json' % (api_ver, secgroup_rule_id))
def test_200_create_server(self): image = nova.GET("/images?name=test-image")[1]['images'][0]['id'] flavor = nested_search("/flavors/*/name=m1.tiny/id", nova.GET("/flavors")[1])[0] r, d = nova.POST("/servers", body={ "server": { "name": "testing server creation", "flavorRef": flavor, "imageRef": image, "security_groups": [{ "name": "kongsec" }] } }, code=202) server_id = d['server']['id'] r, d = nova.GET_with_keys_eq("/servers/%s" % server_id, {"/server/status": "ACTIVE"}, code=200, timeout=60, delay=5) net = d['server']['addresses'][self.config['nova']['network_label']] good = False for i in net: if self.ping_host(i['addr'], delay=5, timeout=200): good = True if not good: raise AssertionError("Server is active but does not ping")
def test_nova_list_flavors(self): r, d = nova.GET("/flavors", code=200) if len(d['flavors']) == 0: raise AssertionError("No flavors configured in openstack") if len(nested_search("/flavors/*/name=m1.tiny", nova.GET("/flavors")[1])) == 0: raise AssertionError("No flavor m1.tiny found.")
def _init_keystone(self, service, target): (url, user, password, tenantname, region) = self.get_config() body = {"auth": {"passwordCredentials": {"username": user, "password": password}, "tenantName": tenantname}} request_t = [] response_t = [] try: response, data = self.POST(url, body=body, code=200) except AssertionError: try: response, data = self.POST(url, body=body['auth'], code=200) data['access'] = data['auth'] except: request_t = [print_curl_request] response_t = [print_it] print "Failed to auth. Trying once more with verbosity" response, data = self.POST(url, body=body, code=200, request_transformers=request_t, response_transformers=response_t) services = nested_get("/access/serviceCatalog", data) try: endpoint = nested_search( "/access/serviceCatalog/*/type=%s/endpoints/*/region=%s/%s" % (service, region, target), data)[0] except IndexError: endpoint = [] finally: if endpoint == []: raise ValueError(('No endpoint found for service "%s" in' + ' region "%s" with target "%s"\n' + 'service catalog: "%s"') % (service, region, target, services)) token = nested_get("/access/token/id", data) return endpoint, token, services, data
def test_200_create_server(self): image = nova.GET("/images?name=test-image")[1]["images"][0]["id"] flavor = nested_search("/flavors/*/name=m1.tiny/id", nova.GET("/flavors")[1])[0] r, d = nova.POST( "/servers", body={ "server": { "name": "testing server creation", "flavorRef": flavor, "imageRef": image, "security_groups": [{"name": "kongsec"}], } }, code=202, ) server_id = d["server"]["id"] r, d = nova.GET_with_keys_eq( "/servers/%s" % server_id, {"/server/status": "ACTIVE"}, code=200, timeout=60, delay=5 ) net = d["server"]["addresses"][self.config["nova"]["network_label"]] good = False for i in net: if self.ping_host(i["addr"], delay=5, timeout=200): good = True if not good: raise AssertionError("Server is active but does not ping")
def test_045_security_group_rule_delete(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % api_ver, code=200)[1])[0] resp, body = neutron.GET( '/%s/security-groups/%s' % (api_ver, secgroup_id)) try: secgroup_rule_id = nested_search( 'security_group/security_group_rules/*/protocol=icmp/id', body)[0] neutron.DELETE( '/%s/security-group-rules/%s.json' % (api_ver, secgroup_rule_id), code=204) except IndexError: pass
def test_161_security_group_rule_create(self): secgroup_id = nested_search( "security_groups/*/name=test-sec-group/id", neutron.GET("/%s/security-groups" % neutron_api_ver, code=200)[1], )[0] resp, body = neutron.POST( "/%s/security-group-rules.json" % neutron_api_ver, body={ "security_group_rule": { "ethertype": "IPv4", "direction": "ingress", "protocol": "ICMP", "security_group_id": "%s" % secgroup_id, } }, ) secgroup_rule_id = body["security_group_rule"]["id"] resp, body = neutron.GET_with_keys_eq( "/%s/security-group-rules/%s.json" % (neutron_api_ver, secgroup_rule_id), {"/security_group_rule/protocol": "icmp"}, code=200, )
def test_045_security_group_rule_delete(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % api_ver, code=200)[1])[0] resp, body = neutron.GET('/%s/security-groups/%s' % (api_ver, secgroup_id)) try: secgroup_rule_id = nested_search( 'security_group/security_group_rules/*/protocol=icmp/id', body)[0] neutron.DELETE('/%s/security-group-rules/%s.json' % (api_ver, secgroup_rule_id), code=204) except IndexError: pass
def test_902_delete_security_group_diablo_final(self): gid = nested_search("/security_groups/*/name=kongsec/id", nova.GET("/os-security-groups")[1])[0] nova.DELETE("/os-security-groups/%s" % gid, timeout=60, delay=5, code=404)
def test_002_agent_show(self): agent_id = nested_search( 'agents/*/id', neutron.GET( '/%s/agents' % api_ver, code=200) [1])[0] neutron.GET('/%s/agents/%s' % (api_ver, agent_id), code=200)
def test_008_net_show(self): network_id = nested_search('networks/*/name=test-network/id', neutron.GET( '/%s/networks' % api_ver, code=200) [1])[0] neutron.GET('/%s/networks/%s' % (api_ver, network_id), code=200)
def test_020_quota_list(self): tenant_id = neutron.GET( '/%s/quotas/tenant.json' % api_ver)[1]['tenant']['tenant_id'] resp, body = neutron.GET('/%s/quotas.json' % api_ver, code=200) our_quota = nested_search( 'quotas/*/tenant_id=%s/tenant_id' % tenant_id, body)[0] assert our_quota == tenant_id
def test_151_create_security_group_rule(self): gid = nested_search("/security_groups/*/name=kongsec/id", nova.GET("/os-security-groups")[1])[0] nova.POST("/os-security-group-rules", body={"security_group_rule": {"from_port": "-1", "to_port": "-1", "parent_group_id": "%s" % gid, "cidr": "0.0.0.0/0", "ip_protocol": "icmp"}}, code=200)
def test_020_quota_list(self): tenant_id = neutron.GET('/%s/quotas/tenant.json' % api_ver)[1]['tenant']['tenant_id'] resp, body = neutron.GET('/%s/quotas.json' % api_ver, code=200) our_quota = nested_search( 'quotas/*/tenant_id=%s/tenant_id' % tenant_id, body)[0] assert our_quota == tenant_id
def test_keystone_v2_02_create_tenant_user(self): response, data = admin.GET("/tenants") kong_tenant = nested_search("/tenants/*/name=kongtenant/id", data)[0] user = {"user": { "name": "kongadmin", "password": "******", "tenantid": kong_tenant, "email": ""}} admin.POST("/users", body=user, code=200)
def test_006_net_list_on_dhcp_agent(self): dhcp_agent_id = nested_search( 'agents/*/agent_type=DHCP agent/id', neutron.GET('/%s/agents' % api_ver, code=200)[1]) if dhcp_agent_id: neutron.GET('/%s/subnets.json?id=%s' % (api_ver, dhcp_agent_id), code=200) else: pass
def test_014_delete_volume_type(self): type_id = nested_search('/volume_types/*/name=test-type/id', cinder.GET('/types')[1])[0] resp, body = cinder.DELETE('/types/%s' % type_id, code=202) resp, body = cinder.GET('/types/%s' % type_id, code=404, timeout=10, delay=5)
def test_013_delete_volume(self): volume_id = nested_search('/volumes/*/display_name=test-volume/id', cinder.GET('/volumes/detail')[1])[0] resp, body = cinder.DELETE('/volumes/%s' % volume_id, code=202) resp, body = cinder.GET('/volumes/%s' % volume_id, code=404, timeout=80, delay=5)
def test_100_delete_container(self): # need to get a list of objects in the container and delete them response, body = swift.GET(('/%s?format=json') % (CONTAINER), code=200) # pull the objects out of the returned json objects = nested_search('*/name', body) # delete the objects one by one for obj in objects: swift.DELETE('%s/%s' % (CONTAINER, obj), code=204) # now we can delete the container swift.DELETE('/%s?format=json' % (CONTAINER), code=204)
def test_013_delete_volume(self): volume_id = nested_search( '/volumes/*/display_name=test-volume/id', cinder.GET('/volumes/detail')[1])[0] resp, body = cinder.DELETE( '/volumes/%s' % volume_id, code=202) resp, body = cinder.GET( '/volumes/%s' % volume_id, code=404, timeout=80, delay=5)
def test_012_delete_snapshot(self): snapshot_id = nested_search( '/snapshots/*/display_name=test-snapshot/id', cinder.GET('/snapshots/detail')[1])[0] resp, body = cinder.DELETE('/snapshots/%s' % snapshot_id, code=202) resp, body = cinder.GET('/snapshots/%s' % snapshot_id, code=404, timeout=80, delay=5)
def test_012_delete_snapshot(self): snapshot_id = nested_search( '/snapshots/*/display_name=test-snapshot/id', cinder.GET('/snapshots/detail')[1])[0] resp, body = cinder.DELETE( '/snapshots/%s' % snapshot_id, code=202) resp, body = cinder.GET( '/snapshots/%s' % snapshot_id, code=404, timeout=80, delay=5)
def test_014_delete_volume_type(self): type_id = nested_search( '/volume_types/*/name=test-type/id', cinder.GET('/types')[1])[0] resp, body = cinder.DELETE( '/types/%s' % type_id, code=202) resp, body = cinder.GET( '/types/%s' % type_id, code=404, timeout=10, delay=5)
def test_203_update_server(self): r, d = nova.GET("/servers/detail") sid = nested_search("/servers/*/name=testing server creation/id", d)[0] name = "updated" nova.PUT_with_keys_eq( "/servers/%s" % sid, {"/server/name": name}, body={"server": {"name": name}}, code=200) nova.PUT("/servers/%s" % sid, body={"server": {"name": "testing server creation"}})
def test_006_net_list_on_dhcp_agent(self): dhcp_agent_id = nested_search( 'agents/*/agent_type=DHCP agent/id', neutron.GET( '/%s/agents' % api_ver, code=200) [1]) if dhcp_agent_id: neutron.GET('/%s/subnets.json?id=%s' % (api_ver, dhcp_agent_id), code=200) else: pass
def test_011_subnet_create(self): network_id = nested_search( 'networks/*/name=test-network/id', neutron.GET('/%s/networks' % api_ver, code=200)[1])[0] resp, body = neutron.POST( '/%s/subnets.json' % api_ver, body={'subnet': { 'network_id': '%s' % network_id, 'ip_version': 4, 'cidr': '192.168.78.0/29', 'name': 'test-subnet'}}, code=201)
def test_170_subnet_create(self): network_id = nested_search( 'networks/*/name=%s/id' % self.config['nova']['network_label'], neutron.GET('/%s/networks' % neutron_api_ver, code=200)[1])[0] resp, body = neutron.POST( '/%s/subnets.json' % neutron_api_ver, body={'subnet': { 'network_id': '%s' % network_id, 'ip_version': 4, 'cidr': '192.168.78.0/29', 'name': 'test-subnet'}}, code=201)
def test_170_subnet_create(self): network_id = nested_search( 'networks/*/name=%s/id' % self.config['nova']['network_label'], neutron.GET('/%s/networks' % neutron_api_ver, code=200)[1])[0] resp, body = neutron.POST('/%s/subnets.json' % neutron_api_ver, body={ 'subnet': { 'network_id': '%s' % network_id, 'ip_version': 4, 'cidr': '192.168.78.0/29', 'name': 'test-subnet' } }, code=201)
def test_070_dhcp_agent_network_remove(self): resp, body = neutron.GET( '/%s/networks.json?fields=id&name=test-network' % api_ver, code=200) network_ids = [p['id'] for p in body['networks']] dhcp_agent_id = nested_search( 'agents/*/agent_type=DHCP agent/id', neutron.GET('/%s/agents' % api_ver, code=200)[1])[0] for net in network_ids: resp, body = neutron.DELETE('/%s/agents/%s/dhcp-networks/%s' % (api_ver, dhcp_agent_id, net), code=204)
def test_011_subnet_create(self): network_id = nested_search( 'networks/*/name=test-network/id', neutron.GET('/%s/networks' % api_ver, code=200)[1])[0] resp, body = neutron.POST('/%s/subnets.json' % api_ver, body={ 'subnet': { 'network_id': '%s' % network_id, 'ip_version': 4, 'cidr': '192.168.78.0/29', 'name': 'test-subnet' } }, code=201)
def test_170_subnet_create(self): network_id = nested_search( "networks/*/name=%s/id" % self.config["nova"]["network_label"], neutron.GET("/%s/networks" % neutron_api_ver, code=200)[1], )[0] resp, body = neutron.POST( "/%s/subnets.json" % neutron_api_ver, body={ "subnet": { "network_id": "%s" % network_id, "ip_version": 4, "cidr": "192.168.78.0/29", "name": "test-subnet", } }, code=201, )
def test_011_create_snapshot(self): volume_id = nested_search( '/volumes/*/display_name=test-volume/id', cinder.GET('/volumes/detail')[1])[0] resp, body = cinder.POST( '/snapshots', body={"snapshot": {"display_name": "test-snapshot", "volume_id": volume_id}}, code=200) snapshot_id = body["snapshot"]["id"] resp, body = cinder.GET_with_keys_eq( '/snapshots/%s' % snapshot_id, {"/snapshot/status": "available"}, code=200, timeout=60, delay=5)
def test_014_subnet_update(self): subnet_id = nested_search( 'subnets/*/name=test-subnet/id', neutron.GET('/%s/subnets' % api_ver, code=200)[1])[0] resp, body = neutron.PUT( '/%s/subnets/%s.json' % (api_ver, subnet_id), body={'subnet': { 'name': 'a-new-test-subnet'}}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/subnets/%s' % (api_ver, subnet_id), {'/subnet/name': 'a-new-test-subnet'}, code=200) neutron.PUT( '/%s/subnets/%s.json' % (api_ver, subnet_id), body={'subnet': {'name': 'test-subnet'}}, code=200)
def test_161_security_group_rule_create(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % neutron_api_ver, code=200)[1])[0] resp, body = neutron.POST( '/%s/security-group-rules.json' % neutron_api_ver, body={'security_group_rule': { 'ethertype': 'IPv4', 'direction': 'ingress', 'protocol': 'ICMP', 'security_group_id': '%s' % secgroup_id}}) secgroup_rule_id = body['security_group_rule']['id'] resp, body = neutron.GET_with_keys_eq( '/%s/security-group-rules/%s.json' % (neutron_api_ver, secgroup_rule_id), {'/security_group_rule/protocol': 'icmp'}, code=200)
def _init_keystone(self, service, target): (url, user, password, tenantname, region) = self.get_config() body = { "auth": { "passwordCredentials": { "username": user, "password": password }, "tenantName": tenantname } } request_t = [] response_t = [] try: response, data = self.POST(url, body=body, code=200) except AssertionError: try: response, data = self.POST(url, body=body['auth'], code=200) data['access'] = data['auth'] except: request_t = [print_curl_request] response_t = [print_it] print "Failed to auth. Trying once more with verbosity" response, data = self.POST(url, body=body, code=200, request_transformers=request_t, response_transformers=response_t) services = nested_get("/access/serviceCatalog", data) try: endpoint = nested_search( "/access/serviceCatalog/*/type=%s/endpoints/*/region=%s/%s" % (service, region, target), data)[0] except IndexError: endpoint = [] finally: if endpoint == []: raise ValueError(('No endpoint found for service "%s" in' + ' region "%s" with target "%s"\n' + 'service catalog: "%s"') % (service, region, target, services)) token = nested_get("/access/token/id", data) return endpoint, token, services, data
def test_019_quota_update(self): tenant_id = neutron.GET('/%s/quotas/tenant.json' % api_ver)[1]['tenant']['tenant_id'] current_subnet_quota = nested_search( 'quota/subnet', neutron.GET('/%s/quotas/%s' % (api_ver, tenant_id), code=200)[1])[0] target_subnet_quota = int(current_subnet_quota) + 1 resp, body = neutron.PUT( '/%s/quotas/%s.json' % (api_ver, tenant_id), body={'quota': { 'subnet': '%d' % target_subnet_quota }}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/quotas/%s' % (api_ver, tenant_id), {'/quota/subnet': target_subnet_quota}, code=200)
def test_019_quota_update(self): tenant_id = neutron.GET( '/%s/quotas/tenant.json' % api_ver)[1]['tenant']['tenant_id'] current_subnet_quota = nested_search( 'quota/subnet', neutron.GET( '/%s/quotas/%s' % (api_ver, tenant_id), code=200) [1])[0] target_subnet_quota = int(current_subnet_quota) + 1 resp, body = neutron.PUT( '/%s/quotas/%s.json' % (api_ver, tenant_id), body={'quota': {'subnet': '%d' % target_subnet_quota}}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/quotas/%s' % (api_ver, tenant_id), {'/quota/subnet': target_subnet_quota}, code=200)
def test_011_create_snapshot(self): volume_id = nested_search('/volumes/*/display_name=test-volume/id', cinder.GET('/volumes/detail')[1])[0] resp, body = cinder.POST('/snapshots', body={ "snapshot": { "display_name": "test-snapshot", "volume_id": volume_id } }, code=200) snapshot_id = body["snapshot"]["id"] resp, body = cinder.GET_with_keys_eq('/snapshots/%s' % snapshot_id, {"/snapshot/status": "available"}, code=200, timeout=60, delay=5)
def test_018_port_update(self): port_id = nested_search( 'ports/*/name=test-port/id', neutron.GET('/%s/ports' % api_ver, code=200)[1])[0] resp, body = neutron.PUT('/%s/ports/%s.json' % (api_ver, port_id), body={'port': { 'name': 'a-new-test-port' }}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/ports/%s' % (api_ver, port_id), {'/port/name': 'a-new-test-port'}, code=200) neutron.PUT('/%s/ports/%s.json' % (api_ver, port_id), body={'port': { 'name': 'test-port' }}, code=200)
def test_009_net_update(self): network_id = nested_search( 'networks/*/name=test-network/id', neutron.GET('/%s/networks' % api_ver, code=200)[1])[0] resp, body = neutron.PUT( '/%s/networks/%s.json' % (api_ver, network_id), body={'network': { 'name': 'a-new-test-network' }}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/networks/%s' % (api_ver, network_id), {'/network/name': 'a-new-test-network'}, code=200) neutron.PUT('/%s/networks/%s.json' % (api_ver, network_id), body={'network': { 'name': 'test-network' }}, code=200)
def test_014_subnet_update(self): subnet_id = nested_search( 'subnets/*/name=test-subnet/id', neutron.GET('/%s/subnets' % api_ver, code=200)[1])[0] resp, body = neutron.PUT( '/%s/subnets/%s.json' % (api_ver, subnet_id), body={'subnet': { 'name': 'a-new-test-subnet' }}, code=200) resp, body = neutron.GET_with_keys_eq( '/%s/subnets/%s' % (api_ver, subnet_id), {'/subnet/name': 'a-new-test-subnet'}, code=200) neutron.PUT('/%s/subnets/%s.json' % (api_ver, subnet_id), body={'subnet': { 'name': 'test-subnet' }}, code=200)
def test_025_security_group_rule_create(self): secgroup_id = nested_search( 'security_groups/*/name=test-sec-group/id', neutron.GET('/%s/security-groups' % api_ver, code=200)[1])[0] resp, body = neutron.POST('/%s/security-group-rules.json' % api_ver, body={ 'security_group_rule': { 'ethertype': 'IPv4', 'direction': 'ingress', 'protocol': 'ICMP', 'security_group_id': '%s' % secgroup_id } }) secgroup_rule_id = body['security_group_rule']['id'] resp, body = neutron.GET_with_keys_eq( '/%s/security-group-rules/%s.json' % (api_ver, secgroup_rule_id), {'/security_group_rule/protocol': 'icmp'}, code=200)
def test_015_port_create(self): network_id = nested_search( 'networks/*/name=test-network/id', neutron.GET('/%s/networks' % api_ver, code=200)[1])[0] resp, body = neutron.POST('/%s/ports.json' % api_ver, body={ 'port': { 'network_id': '%s' % network_id, 'admin_state_up': True, 'name': 'test-port' } }, code=201) port_id = body['port']['id'] resp, body = neutron.GET_with_keys_eq('/%s/ports/%s' % (api_ver, port_id), {'/port/admin_state_up': True}, code=200, timeout=10, delay=2)
def test_keystone_v2_05_delete_user_diablo(self): response, data = admin.GET("/users") kong_user = nested_search("/users/values/*/name=kongadmin/id", data)[0] admin.DELETE("/users/%s" % kong_user, code=204)