简体   繁体   English

Openstack Neutron:在响应中未从Open Stack Neutron API获取端口信息

[英]Openstack neutron: Not getting port information from open stack neutron api in the response

I made a POST API Request to to create Router with external network(SET Gateway for the router) . 我发出了POST API请求,以创建具有外部网络(路由器的SET网关)的路由器。

endpoint: /api/networks/routers/:routerId 端点:/ api / networks / routers /:routerId

payload: 有效载荷:

"router": {
"name: "myrout3r"
"external_gateway_info": {
"network_id": "659cf56-cad0-40a6-ae53-f24a2123508a",
"enable_snat": true
},
"admin_state_up": true
}
}

Response: 响应:

 {
    "router": {
        "status": "ACTIVE",
        "external_gateway_info": {
            "network_id": "659c2f56-cad0-40a6-ae59-f24a2123508a",
            "enable_snat": true,
            "external_fixed_ips": [
                {
                    "subnet_id": "52f0822b-2c36-4810-8653-a1a60b03a8b1",
                    "ip_address": "172.30.60.4"
                }
            ]
        },
        "availability_zone_hints": [],
        "availability_zones": [
            "nova"
        ],
        "description": "",
        "tags": [],
        "tenant_id": "5178acd154364430876d5aa687a9df7c",
        "created_at": "2018-08-07T06:50:22Z",
        "admin_state_up": true,
        "distributed": false,
        "updated_at": "2018-08-07T09:40:30Z",
        "project_id": "5178acd154364430876d5aa687a9df7c",
        "flavor_id": null,
        "revision_number": 13,
        "routes": [],
        "ha": false,
        "id": "398872f0-0cf6-4f48-8c94-f55623beace4",
        "name": "router-szz"
    }
} 

My main problem here is : A new port get's created dynamically when i am adding a router gateway for the external network in the network's ports tab . 我的主要问题是:在网络的“端口”选项卡中为外部网络添加路由器网关时,会动态创建一个新端口。 But this information is not part of the response which i want it . 但是这些信息不是我想要的响应的一部分。

2) Should I enable DHCP for the external network , if not why ? 2)是否应该为外部网络启用DHCP,否则为什么? router_external_gateway router_external_gateway

Ports of a router can be fetched from "ports" API instead of "router" API. 可以从“端口” API而不是“路由器” API获取路由器的端口。

Ports associated with a router can be queried with the following REST API: 可以使用以下REST API查询与路由器关联的端口:

curl -s -H "X-Auth-Token: $OS_TOKEN" $OS_NETWORK_API/v2.0/ports?device_id={router_id} curl -s -H“ X-Auth-Token:$ OS_TOKEN” $ OS_NETWORK_API / v2.0 / ports?device_id = {router_id}

Example: 例:

curl -s -H "X-Auth-Token: $OS_TOKEN" $OS_NETWORK_API/v2.0/ports?device_id=b3b11b62-04da-4a98-a981-adcd42d9fe3e curl -s -H“ X-Auth-Token:$ OS_TOKEN” $ OS_NETWORK_API / v2.0 / ports?device_id = b3b11b62-04da-4a98-a981-adcd42d9fe3e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM