nova-network api "create network" error 404
Hi, I'm trying to use some of Openstack APIs, I get "Error 404 Resource not found" when trying to use "Create Network" in a java program. I have devstack all-in-one .
http://developer.openstack.org/api-re...
Is there any known problem? I'm referring to nova-network, not neutron. I'm able to create a network via CLI (not via API calling). Any help will be appreciated. This is the code I'm using:
private final static String NOVA_ENDPOINT = "http://127.0.0.1:8774/v2/";
String network = "{\"network\": {\"label\": \"new net 111\", \"cidr\": \"10.20.105.0/24\" }}"
[...]
JsonObject jo = (JsonObject)json.parse(network);
Response response = client.target(NOVA_ENDPOINT+tenant_id)
.request(MediaType.APPLICATION_JSON)
.header("X-Auth-Token", authToken)
.post(Entity.json(gson.toJson(jo)));
String responseJson = response.readEntity(String.class);
If I use command "nova network-create" from CLI works properly, but If I call the API via CLI, same error 404.. seems to be a problem related to the API, maybe because nova-network is deprecated?
[NEW] After suggestion of echiu I provide more details..
I tried with REST Console, getting same error... this is a summary of what I just did with REST Console:
TARGET:
Request URI: http://172.22.173.160:8774/v2/7f7bea3...
Request Method: POST
Accept: text/plain (if I choose application/json same error)
BODY:
Content-type: text/plain (if I choose application/json same error)
Raw Body: {"network": { "label": "new net 111", "cidr": "10.20.105.0/24}}
Custom Header: X-Auth-Token ff5982d881a7489cba89d44cebaec364
Left empty all other fields. I get error 404, Resource not found. I'm sure about my tenant ID and Token ID, I took that with CLI command keystone token-get, and if I try the API "List Networks" wich is a GET with this endpoint:
http://172.22.173.160:8774/v2/7f7bea3...
(Note that the endpoint is the same, except for the last part /os-networks ...so my url is correct I think) Everything works fine! It is strange, because I can properly create a network with CLI command
nova network-create Prova --fixed-range-v4 172.22.173.165/24
As user echiu said CLI commands invokes Rest API... so what's wrong with my API call? I remember that I'm using Devstack All-in-one without Neutron and I'm trying to use this API of nova-network:
You'll probably want to post your code so users can compare it to the documentation.
Ok I'm going to edit my question with the code, but I think the problem is not related to it, because other nova-network API are working properly and I use a similar java code.. could be my problem related to the fact that nova-network is deprecated?
Awesome. Now at least a Dev has a starting point. I would also recommend trying out one of the Dev rooms in IRC:
https://wiki.openstack.org/wiki/IRC