-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Description
Openstack Train
Openstack4j Version 3.4
openstack4j-httpclient 3.4
code:
try{
OSFactory.enableHttpLoggingFilter(true)
OSFactory.clientFromToken(currentToken).networking().port().list()
} catch (Exception e){
e.printstackStrace()
}
Log
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "HTTP/1.1 406 Not Acceptable[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "Content-Length: 173[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "Content-Type: application/json[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "X-Openstack-Request-Id: req-e2d5482f-8031-4829-8ce2-35059b80b164[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "Date: Tue, 03 Mar 2020 13:55:31 GMT[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "Connection: keep-alive[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "[\r][\n]"
2020/03/03 14:55:31:924 CET [DEBUG] wire - http-outgoing-4 << "{"NeutronError": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "type": "HTTPNotAcceptable", "detail": ""}}"
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << HTTP/1.1 406 Not Acceptable
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << Content-Length: 173
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << Content-Type: application/json
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << X-Openstack-Request-Id: req-e2d5482f-8031-4829-8ce2-35059b80b164
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << Date: Tue, 03 Mar 2020 13:55:31 GMT
2020/03/03 14:55:31:924 CET [DEBUG] headers - http-outgoing-4 << Connection: keep-alive
2020/03/03 14:55:31:924 CET [DEBUG] MainClientExec - Connection can be kept alive indefinitely
2020/03/03 14:55:31:925 CET [DEBUG] PoolingHttpClientConnectionManager - Connection [id: 4][route: {}->http://xxx.xxx.xxx.xxx:9696] can be kept alive indefinitely
2020/03/03 14:55:31:925 CET [DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 4][route: {}->http://xxx.xxx.xxx.xxx:9696][total kept alive: 0; route allocated: 2 of 2; total allocated: 6 of 20]
2020/03/03 14:55:31:925 CET [DEBUG] MainClientExec - Stale connection check
2020/03/03 14:55:31:925 CET [DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 4][route: {}->http://xxx.xxx.xxx.xxx:9696][total kept alive: 1; route allocated: 2 of 2; total allocated: 6 of 20]
2020/03/03-14:55:31.925 ERROR c.h.a.c.OSClusterConnector - Ports ClientResponseException{message=The server could not comply with the request since it is either malformed or otherwise incorrect., status=406, status-code=NOT_ACCEPTABLE}
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 << "[read] I/O error: Read timed out"
2020/03/03 14:55:31:926 CET [DEBUG] MainClientExec - Executing request GET /v2.0/ports HTTP/1.1
2020/03/03 14:55:31:926 CET [DEBUG] MainClientExec - Target auth state: UNCHALLENGED
2020/03/03 14:55:31:926 CET [DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> GET /v2.0/ports HTTP/1.1
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> Accept: application/json; charset=utf-8
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> User-Agent: OpenStack4j / OpenStack Client
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> Host: xxx.xxx.xxx.xxx:9696
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> Connection: Keep-Alive
2020/03/03 14:55:31:926 CET [DEBUG] headers - http-outgoing-4 >> Accept-Encoding: gzip,deflate
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "GET /v2.0/ports HTTP/1.1[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "Accept: application/json; charset=utf-8[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "User-Agent: OpenStack4j / OpenStack Client[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "Host: xxx.xxx.xxx.xxx:9696[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "Connection: Keep-Alive[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2020/03/03 14:55:31:926 CET [DEBUG] wire - http-outgoing-4 >> "[\r][\n]"
2020/03/03 14:55:31:973 CET [DEBUG] wire - http-outgoing-4 << "HTTP/1.1 406 Not Acceptable[\r][\n]"
2020/03/03 14:55:31:973 CET [DEBUG] wire - http-outgoing-4 << "Content-Length: 173[\r][\n]"
2020/03/03 14:55:31:973 CET [DEBUG] wire - http-outgoing-4 << "Content-Type: application/json[\r][\n]"
2020/03/03 14:55:31:974 CET [DEBUG] wire - http-outgoing-4 << "X-Openstack-Request-Id: req-14f0d592-6597-4b29-b025-78f161b31df6[\r][\n]"
2020/03/03 14:55:31:974 CET [DEBUG] wire - http-outgoing-4 << "Date: Tue, 03 Mar 2020 13:55:31 GMT[\r][\n]"
2020/03/03 14:55:31:974 CET [DEBUG] wire - http-outgoing-4 << "Connection: keep-alive[\r][\n]"
2020/03/03 14:55:31:974 CET [DEBUG] wire - http-outgoing-4 << "[\r][\n]"
2020/03/03 14:55:31:974 CET [DEBUG] wire - http-outgoing-4 << "{"NeutronError": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "type": "HTTPNotAcceptable", "detail": ""}}"
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << HTTP/1.1 406 Not Acceptable
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << Content-Length: 173
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << Content-Type: application/json
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << X-Openstack-Request-Id: req-14f0d592-6597-4b29-b025-78f161b31df6
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << Date: Tue, 03 Mar 2020 13:55:31 GMT
2020/03/03 14:55:31:974 CET [DEBUG] headers - http-outgoing-4 << Connection: keep-alive
curl:
- with
-H "Accept: application/json; charset=utf-8"
curl -v -s -X GET -H "X-Auth-Token: "$OS_TOKEN -H "Accept: application/json; charset=utf-8" -H "Content-Type: application/json" http://xXX.XXX.XXX.XXX:9696/v2.0/ports\?limit\=500 | jq .
{
"NeutronError": {
"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
"type": "HTTPNotAcceptable",
"detail": ""
}
}
- without
-H "Accept: application/json"
curl -v -s -X GET -H "X-Auth-Token: "$OS_TOKEN -H -H "Accept: application/json" "Content-Type: application/json" http://xXX.XXX.XXX.XXX:9696/v2.0/ports\?limit\=500 | jq .
{
"ports_links": [
{
"href": "http://xxx.xxx.xxx.xxx:9696/v2.0/ports?limit=500&marker=64bc833c-8ecb-4788-b0db-71026ec9ef9d&page_reverse=True",
"rel": "previous"
}
],
"ports": [
{
"allowed_address_pairs": [],
"extra_dhcp_opts": [],
"updated_at": "2020-03-05T13:19:10Z",
"device_owner": "network:router_gateway",
"revision_number": 4,
"port_security_enabled": false,
"binding:profile": {},
"fixed_ips": [
{
"subnet_id": "bcbe98e8-71bf-416c-82e1-13fae31f8b22",
"ip_address": "172.24.4.109"
}
],
"id": "64bc833c-8ecb-4788-b0db-71026ec9ef9d",
"security_groups": [],
"binding:vif_details": {
"port_filter": true
},
"binding:vif_type": "ovs",
"mac_address": "fa:16:3e:8d:e9:74",
"project_id": "",
"status": "ACTIVE",
"binding:host_id": "localhost.localdomain",
"description": "",
"tags": [],
"qos_policy_id": null,
"resource_request": null,
"name": "",
"admin_state_up": true,
"network_id": "b2447b27-5c09-42bf-9a68-52ef018863e7",
"tenant_id": "",
"created_at": "2020-03-05T13:16:26Z",
"binding:vnic_type": "normal",
"device_id": "d5e88457-3d73-4201-8fa8-a88713ed5c90"
},
{...}
]
}
The reason why this Header is added in the http-client connector is:
org.openstack4j.connectors.httpclient.HttpCommand
82: clientReq.setHeader("Accept", MediaType.JSON_UTF_8.toString());
if this is replaced with :
82: clientReq.setHeader("Accept", "application/json");The Requests works fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels