The detailed error log is as follows :
command: POST http://os.myserver.com:9696/v2.0/networks HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [{"NeutronError": "Unrecognized attribute(s) 'networkType'"}] org.jclouds.http.HttpResponseException: command: POST https://os.myserver.com:9696/v2.0/networks HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [{"NeutronError": "Unrecognized attribute(s) 'networkType'"}] at org.jclouds.openstack.neutron.v2_0.handlers.NeutronErrorHandler.handleError(NeutronErrorHandler.java:40) at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:67) at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:180) at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:150) at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:93) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:76) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:47)
Following is my code snippet :
CreateNetworkOptions createNetworkOptions = CreateNetworkOptions.builder()
.name(name)
.networkType(NetworkType.LOCAL).build();
NetworkApi networkApi = neutronApi.getNetworkApiForZone(zone);
Network network = networkApi.create(createNetworkOptions);
If I don't set the networkType then its working fine. But I need to set the networkType as NetworkType.LOCAL
The neutron code for jclouds was recently refactored and some bugs were fixed. The new code uses "v2" instead of "v2_0".
What are you seeing is a bug in jclouds neutron "v2_0". The map-binder does not support the LOCAL network type. Specifically, here:
The supported types in here are FLAT, VLAN, and GRE.
The good news is that this should be fixed, but you will have to upgrade to jclouds 1.8.0 and make sure to use neutron v2. You will also have to change your code to use the new interfaces.
You can find some sample code here: https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-neutron/src/test/java/org/jclouds/openstack/neutron/v2/features/NetworkApiMockTest.java#L50
This is the important part:
Network.CreateOptions createNetwork = Network.createOptions("jclouds-wibble")
.networkType(NetworkType.LOCAL)
.build();
Network network = api.create(createNetwork);