["Neutron"] Create subnet gives ERROR "Body contains invalid data"

Slawomir Kaplonski skaplons at redhat.com
Mon Apr 29 13:05:26 UTC 2019


Hi,

Can You send also neutron-server log (with debug=True) with error which You have there?

> Wiadomość napisana przez Kelam, Koteswara Rao <koteswara.kelam at hpe.com> w dniu 29.04.2019, o godz. 06:33:
> 
> Tried to create a subnet with following curl command
> $ curl -s $END_POINT/neutron/v2.0/subnets -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: $AUTH_TOKEN" -d '{'subnet': {'name': '8c7993a8-905e-4ad4-be3b-11c692e38317', 'network_id': '8f5f7cff-a320-40ba-9903-0c4e6dd80c0c', 'ip_version': 4, 'cidr': '169.254.3.1/32', 'enable_dhcp': 'false'}}'
>  
> And got following ERROR:
>  
> {"NeutronError": {"message": "Body contains invalid data", "type": "HTTPBadRequest", "detail": ""}}
>  
> But when I tried with DOUBLE quotes in the body it got succeeded.
>  
> $ curl -s $END_POINT/neutron/v2.0/subnets -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: $AUTH_TOKEN" -d '{"subnet": {"name": "8c7993a8-905e-4ad4-be3b-11c692e38317", "network_id": "8f5f7cff-a320-40ba-9903-0c4e6dd80c0c", "ip_version": 4, "cidr": "169.254.3.1/32", "enable_dhcp": 'false'}}'
>  
> {"subnet":{"description":"","enable_dhcp":false,"tags":[],"network_id":"8f5f7cff-a320-40ba-9903-0c4e6dd80c0c","tenant_id":"39f81bc21a9f4eb7b87586d983b6ec3d","created_at":"2019-04-29T11:56:57Z","segment_id":null,"dns_nameservers":[],"updated_at":"2019-04-29T11:56:57Z","gateway_ip":"169.254.3.2","ipv6_ra_mode":null,"allocation_pools":[{"start":"169.254.3.1","end":"169.254.3.1"}],"host_routes":[],"revision_number":0,"ip_version":4,"ipv6_address_mode":null,"cidr":"169.254.3.1/32","project_id":"39f81bc21a9f4eb7b87586d983b6ec3d","id":"33de75fb-fa10-460a-9123-577ae62a771a","subnetpool_id":null,"name":"8c7993a8-905e-4ad4-be3b-11c692e38317"}}
>  
> Single quotes not allowed in requested body? Only double quotes allowed??
> Single quotes also used to work for me with older versions on neutron.
>  
> -Koteswar

— 
Slawek Kaplonski
Senior software engineer
Red Hat




More information about the openstack-discuss mailing list