1. 测试环境:
1. OpenStack 版本:Juno,
2. API 版本:
identity v3
nova v2
neutron v2
2. 命令与返回
root@ATUBT64:~# curl -i -H "Accept: application/json" -H "X-Auth-Token: 7994997796d74491b051254b32fadf3f" -X GET http://10.161.128.38:8774/v2/f58 ... f839400/os-networks ; echo
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1945
X-Compute-Request-Id: req-5a8a34f9-a50a-4c37-bccc-7300f5b92ee6
Date: Thu, 27 Aug 2015 09:18:58 GMT
{"networks": [{"bridge": null, "vpn_public_port": null, "dhcp_start": null, "bridge_interface": , "share_address": null, "updated_at": null, "id": "d36e1e70-2d40-40f8-b98f-722d95feec70", "cidr_: null, "deleted_at": null, "gateway": null, "rxtx_base": null, "label": "test001-net", "null, "project_id": null, "vpn_private_address": null, "deleted": null, "vlan": null, "broadcast": ull, "netmask": null, "injected": null, "cidr": null, "vpn_public_address": null, "multi_host": , "enable_dhcp": null, "dns2": null, "created_at": null, "host": null, "mtu": null, "gateway_v6": ll, "netmask_v6": null, "dhcp_server": null, "dns1": null}, {"bridge": null, "vpn_public_port": , "dhcp_start": null, "bridge_interface": null, "share_address": null, "updated_at": null, "id": "c8bb14-f15c-4767-9dc0-239275f77831", "cidr_v6": null, "deleted_at": null, "gateway": null, "rxtx_e": null, "label": "demo-net", "priority": null, "project_id": null, "vpn_private_address": null, "eleted": null, "vlan": null, "broadcast": null, "netmask": null, "injected": null, "cidr": null, "n_public_address": null, "multi_host": null, "enable_dhcp": null, "dns2": null, "created_at": null,"host": null, "mtu": null, "gateway_v6": null, "netmask_v6": null, "dhcp_server": null, "dns1": null}, {"bridge": null, "vpn_public_port": null, "dhcp_start": null, "bridge_interface": null, "share_dress": null, "updated_at": null, "id": "b0366df6-7dbf-49ad-841e-5dd51a650b8a", "cidr_v6": null, "deleted_at": null, "gateway": null, "rxtx_base": null, "label": "ext-net", "priority": null, "project_id": null, "vpn_private_address": null, "deleted": null, "vlan": null, "broadcast": null, "netmask": null, "injected": null, "cidr": null, "vpn_public_address": null, "multi_host": null, "enable_dhcp": null, "dns2": null, "created_at": null, "host": null, "mtu": null, "gateway_v6": null, "netmask_v6": null, "dhcp_server": null, "dns1": null}]}
格式化后的内容如下:
{
"networks":[
{
"bridge":null,
"vpn_public_port":null,
"dhcp_start":null,
"bridge_interface":,
"share_address":null,
"updated_at":null,
"id":"d36e1e70-2d40-40f8-b98f-722d95feec70",
"cidr_: null,
"deleted_at": null,
"gateway": null,
"rxtx_base": null,
"label": "test001-net",
"project_id":null,
"vpn_private_address":null,
"deleted":null,
"vlan":null,
"broadcast":ull,
"netmask":null,
"injected":null,
"cidr":null,
"vpn_public_address":null,
"multi_host":,
"enable_dhcp":null,
"dns2":null,
"created_at":null,
"host":null,
"mtu":null,
"gateway_v6":ll,
"netmask_v6":null,
"dhcp_server":null,
"dns1":null
},
{
"bridge":null,
"vpn_public_port":,
"dhcp_start":null,
"bridge_interface":null,
"share_address":null,
"updated_at":null,
"id":"c8bb14-f15c-4767-9dc0-239275f77831",
"cidr_v6":null,
"deleted_at":null,
"gateway":null,
"rxtx_e":null,
"label":"demo-net",
"priority":null,
"project_id":null,
"vpn_private_address":null,
"eleted":null,
"vlan":null,
"broadcast":null,
"netmask":null,
"injected":null,
"cidr":null,
"n_public_address":null,
"multi_host":null,
"enable_dhcp":null,
"dns2":null,
"created_at":null,
"host":null,
"mtu":null,
"gateway_v6":null,
"netmask_v6":null,
"dhcp_server":null,
"dns1":null
},
{
"bridge":null,
"vpn_public_port":null,
"dhcp_start":null,
"bridge_interface":null,
"share_dress":null,
"updated_at":null,
"id":"b0366df6-7dbf-49ad-841e-5dd51a650b8a",
"cidr_v6":null,
"deleted_at":null,
"gateway":null,
"rxtx_base":null,
"label":"ext-net",
"priority":null,
"project_id":null,
"vpn_private_address":null,
"deleted":null,
"vlan":null,
"broadcast":null,
"netmask":null,
"injected":null,
"cidr":null,
"vpn_public_address":null,
"multi_host":null,
"enable_dhcp":null,
"dns2":null,
"created_at":null,
"host":null,
"mtu":null,
"gateway_v6":null,
"netmask_v6":null,
"dhcp_server":null,
"dns1":null
}
]
}
注意,只有 id 跟label 字段是有值返回的。这跟
http://developer.openstack.org/a ... t.html#ListNetworks
描述的返回差别很远。
在网上查了一下,一天下来并没有相关的资料。不知道我还可以做些什么事情使
这个接口可以使用?还是说我必须直接调用 network 服务的接口?
谢谢。
|