background : Due to business needs IP blurring of Port API in neutron (Port API Official document: HTTPS://DEVELOPER.OPENSTACK.ORG/API-REF/NETWORK/V2/ Index.html#ports), but by get/v2.0/ports the list of ports without parameters, it is found that the value of Fixed_ips is an array of key values consisting of Subnet_ip and IP_Address, as shown in the following figure. However, there is a problem with how to make a GET request pass for this fixed_ips.
Solution Ideas:
Before I solved this problem, I tried a variety of ways, but all failed and returned to Invalidinput. Here are some ways to try a few failures:
1. JSON encapsulation of Key=value value directly in the GET request as shown above, for example: fixed_ips={"subnet_id": "Value1", "IP_Address": "10.0.0.9"}, Result failed
2. Incoming JSON data in the request body, the result still fails
Finally inadvertently see the official website on the API to use the CLI way to request, and the CLI request with the Fixed_ips option, address: https://docs.openstack.org/python-openstackclient/pike/cli/ Command-objects/port.html as shown in the figure:
Then I can make a GET request via CLI, with the fixed_ips option so that I can tail-f the neutron log in the background Neutron-server.log | grep GET (The premise here is best to open debug mode for the neutron.conf file under this component, which is off by default) as shown in the figure:
At this point, you can see the fetch request with the Fixed_ips parameter, from which you can see that the URL escapes the equal sign = in value.
I finally tested it with restclient and found that I was able to return an exact match. The following figure: