简体   繁体   中英

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) .

endpoint: /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 ? router_external_gateway

Ports of a router can be fetched from "ports" API instead of "router" API.

Ports associated with a router can be queried with the following REST API:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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