When i use the 3.0.3 to create a port ,there is a failure as below,port_security_enabled is not supported by the api. #886

Open
zhoutiekui opened this Issue Nov 10, 2016 · 5 comments

Projects

None yet

4 participants

@zhoutiekui

POST /v2.0/ports HTTP/1.1
X-Auth-Token: 880d22df947f43bba40ff881472d8c7a
User-Agent: OpenStack4j / OpenStack Client
Content-Length: 150
Content-Type: application/json
Host: 172.22.17.41:9696
Connection: Keep-Alive

{
"port" : {
"admin_state_up" : true,
"network_id" : "f4cec486-1a48-4575-9782-b149502adbe3",
"port_security_enabled" : false
}
}HTTP/1.1 400 Bad Request
Content-Length: 122
Content-Type: application/json; charset=UTF-8
X-Openstack-Request-Id: req-01b44000-b54a-47fd-9c4e-cf241609a972
Date: Thu, 10 Nov 2016 12:16:06 GMT
Connection: keep-alive

{"NeutronError": {"message": "Unrecognized attribute(s) 'port_security_enabled'", "type": "HTTPBadRequest", "detail": ""}}

@vinodborole
Contributor

Hi @zhoutiekui As per the documentation, the request xml does not contain the port_security_enabled attribute as by default it is true. I guess that is the reason why the api does not accept this attribute.

here is the doc for create port - http://developer.openstack.org/api-ref/networking/v2/index.html?expanded=create-port-detail

@zhoutiekui
zhoutiekui commented Nov 29, 2016 edited

hi,vinodborole,have this question fixed in the released 3.0.3 version? thanks

my test codes are as below:

	org.openstack4j.model.network.Port tocreateport = Builders.port()
	.networkId("f4cec486-1a48-4575-9782-b149502adbe3")
	.build();
	System.out.println(networkapi.port().create(tocreateport));

my error is as below:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" ClientResponseException{message=Unrecognized attribute(s) 'port_security_enabled', status=400, status-code=BAD_REQUEST}
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:38)
at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
at org.openstack4j.core.transport.HttpEntityHandler.handleLessThan500(HttpEntityHandler.java:101)
at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:47)
at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:24)
at org.openstack4j.connectors.jersey2.HttpResponseImpl.getEntity(HttpResponseImpl.java:63)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:220)
at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:202)
at org.openstack4j.openstack.networking.internal.PortServiceImpl.create(PortServiceImpl.java:63)
at openstack4j_errocheck.openstack4j_errocheck.networktest.main(networktest.java:73)

i have tryied with the newest 3.0.3 version,and there is the same error.

what should i do with this error,as i want to use the openstack4j 3.0.3 version with its glance image v2 features, thanks.

@zhangfnf

I have similar problem too when I use the port's update method with the newest 3.0.3 version.
However , it works well with 3.0.2 version.

The exception is as below:
ClientResponseException{message=Unrecognized attribute(s) 'port_security_enabled', status=400, status-code=BAD_REQUEST}

It seems like that the json string from "NeutronPort" have an unexpected attribute "port_security_enabled" because the property "portSecurityEnabled" does not be ignored when serializing.
@JsonProperty("port_security_enabled")
private boolean portSecurityEnabled = true;
@Override
public boolean isPortSecurityEnabled() {
return portSecurityEnabled;
}

I see this issure Disabling Neutron Port Security added "portSecurityEnabled", but i have not figured out why the subsequent fix commit Removed the default property for port security enabled have not been merged to master.

@vinodborole Can help me to solve the problem? THX!

@auhlig
Member
auhlig commented Dec 16, 2016 edited

Hi @zhangfnf,
Thanks for reporting.
Potentially @vinodborole's commit can fix the issue vinodborole@bbe7d08 ?

@auhlig
Member
auhlig commented Dec 22, 2016

Did #904 fix the issue @zhangfnf @zhoutiekui ?
If so please close.

@auhlig auhlig added the bug label Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment