Giter Club home page Giter Club logo

openstack4j's Introduction

OpenStack4j

Build Status License Maven Central javadoc Quality Gate Status

OpenStack4j is a fluent OpenStack client that allows provisioning and control of an OpenStack deployment. This includes support for Identity, Compute, Image, Network, Block Storage, Telemetry, Data Processing as well as many extensions (LBaaS, FWaaS, Quota-Sets, etc)

Documentation and Support

Bug Reports

Java version support

---- Java 8 Java 11 Java 17 Java 21
OpenStack4j ? ๐ŸŸข ๐ŸŸข ๐ŸŸข
HttpURL Connector ? ๐ŸŸข * *
HttpComponents-HttpClient Connector ? ๐ŸŸข ๐ŸŸข ๐ŸŸข
Jersey2 Connector ? ๐ŸŸข * *
OKHttp Connector ? ๐ŸŸข ๐ŸŸข ๐ŸŸข
RestEasy Connector ? ๐ŸŸข ๐ŸŸข ๐ŸŸข

*) Starting with Java 16, it is not possible to use HttpUrlConnection to perform PATH requests. Connectors depending on native JDK http stack will not work after Java 16.

Maven

Latest Release (Stable)

OpenStack4j version 2.0.0+ is now modular. One of the benefits to this is the ability to choose the connector that you would like to use in your environment.

Using OpenStack4j with the default Jersey2 Connector

<dependency>
    <groupId>com.github.openstack4j.core</groupId>
    <artifactId>openstack4j</artifactId>
    <version>...</version>
</dependency>

Using OpenStack4j with one of our connector modules

To configure OpenStack4j to use one of our supported connectors (Jersey 2, Resteasy, Apache HttpClient, OKHttp) see the usage guide

Current (Master Branch)

See notes above about connectors (same rules apply) to development branches.

<dependency>
    <groupId>com.github.openstack4j.core</groupId>
    <artifactId>openstack4j</artifactId>
    <version>...</version>
</dependency>

A note about referencing Snapshots without Source

Snapshots are deploys to sonatype. We automatically deploy snapshots on every merge into the master branch. Typically 5 - 10 snapshot releases before an official release.

You will need to add the repository to your POM or Settings file. Releases (above) are deployed to maven central and this step is not required.

Example POM based repository declaration to grab snapshots:

<repositories>
    <repository>
        <id>st-snapshots</id>
        <name>sonatype-snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

Contributing

If you would like to contribute please see our contributing guidelines

The OpenStack4j project is a work of Jeremy Unruh as the original project author and the community of contributors.

Quick Usage Guide

Below are some examples of the API usage. Please visit openstack4j.github.io for the full manual and getting started guides.

Authenticating

OpenStack4j 3.0.0+ supports Identity (Keystone) V3 and V2.

OpenStack4j 3.0.0 introduced some breaking changes. The legacy Identity V2 API now uses the class OSClientV2 in place of the class OSClient.

Using Identity V2 authentication:
// Identity V2 Authentication Example
OSClientV2 os = OSFactory.builderV2()
        .endpoint("http://127.0.0.1:5000/v2.0")
        .credentials("admin","sample")
        .tenantName("admin")
        .authenticate();
Using Identity V3 authentication

Creating and authenticating against OpenStack is extremely simple. Below is an example of authenticating which will result with the authorized OSClient. OSClient allows you to invoke Compute, Identity, Neutron operations fluently.

You can use either pass the users name or id and password in the following way

.credentials("username", "secret", Identifier.byId("domain id"))

or

.credentials("user id", "secret")

to provide credentials in each of the following cases.

Using Identity V3 authentication you basically have 4 options:

(1) authenticate with project-scope

OSClientV3 os = OSFactory.builderV3()
        .endpoint("http://<fqdn>:5000/v3")
        .credentials("admin", "secret", Identifier.byId("user domain id"))
        .scopeToProject(Identifier.byId("project id"))
        .authenticate();

(2) authenticate with domain-scope

OSClientV3 os = OSFactory.builderV3()
        .endpoint("http://<fqdn>:5000/v3")
        .credentials("admin", "secret", Identifier.byId("user domain id"))
        .scopeToDomain(Identifier.byId("domain id"))
        .authenticate();

(3) authenticate unscoped

OSClientV3 os = OSFactory.builderV3()
        .endpoint("http://<fqdn>:5000/v3")
        .credentials("user id", "secret")
        .authenticate();

(4) authenticate with a token

OSClientV3 os = OSFactory.builderV3()
        .endpoint("http://<fqdn>:5000/v3")
        .token("token id")
        .scopeToProject(Identifier.byId("project id"))
        .authenticate();

(5) authenticate using client certificate

openssl pkcs12 -export -out client-certificate-keystore.p12  -inkey key.pem -in cert.pem -certfile ca.pem
Enter Export Password:encrypt
Verifying - Enter Export Password:encrypt
String encrypt =  "encrypt";
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(new File("client-certificate-keystore.p12")), encrypt.toCharArray());
SSLContext sslContext = SSLContexts.custom()
        //ignore server verify
        .loadTrustMaterial(new TrustStrategy() {
            @Override
            public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                return true;
            }
        })
        .loadKeyMaterial(keyStore,encrypt.toCharArray())
        .build();
Config config = Config.newConfig();
config.withSSLContext(sslContext);
OSClient.OSClientV3 osClient = OSFactory.builderV3()
        .endpoint("https://<fqdn>:5000/v3")
        .withConfig(config)
        .scopeToProject(Identifier.byId("project id"))
        //.scopeToDomain(Identifier.byId("domain id"))
        .authenticate();

Identity Operations (Keystone) V3

After successful v3 - authentication you can invoke any Identity (Keystone) V3 directly from the OSClientV3.

Identity Services fully cover User, Role, Project, Domain, Group,.. service operations (in progess). The examples below are only a small fraction of the existing API so please refer to the API documentation for more details.

NOTE: The os used here is an instance of org.openstack4j.api.OSClient.OSClientV3.

User operations

// Create a User associated to the new Project
User user = os.identity().users().create(Builders.user()
	      .domainId("domain id")
	      .name("foobar")
	      .password("secret")
	      .email("[email protected]")
	      .enabled(true)
	      .build());
//or
User user = os.identity().users().create("domain id", "foobar", "secret", "[email protected]", true);

// Get detailed info on a user by id
User user = os.identity().users.get("user id");
//or by name and domain identifier
User user = os.identity().users.getByName("username", "domain id");

// Add a project based role to the user
os.identity().roles().grantProjectUserRole("project id","user id", "role id");

// Add a domain based role to the user
os.identity().roles().grantDomainUserRole("domain id","user id", "role id");

// Add a user to a group
os.identity().users().addUserToGroup("user id", "group id");

Role operations

// Get a list of all roles
os.identity().roles().list();

// Get a role by name
os.identity().roles().getByName("role name");

Project operations

// Create a project
os.identity().project().create(
    Builders.project().name("...").description("...").domainId("...").enabled(true).build()
);

Identity Operations (Keystone) V2

After successful v2 - authentication you can invoke any Identity (Keystone) V2 directly from the OSClientV2.

Identity V2 Services fully cover Tenants, Users, Roles, Services, Endpoints and Identity Extension listings. The examples below are only a small fraction of the existing API so please refer to the API documentation for more details.

NOTE: The os used here is an instance of org.openstack4j.api.OSClient.OSClientV2.

Create a Tenant, User and associate a Role

// Create a Tenant (could also be created fluent within user create)
Tenant tenant = os.identity().tenants().create(
    Builders.identityV2().tenant().name("MyNewTenant").build()
);

// Create a User associated to the new Tenant
User user = os.identity().users().create(
    Builders.identityV2().user().name("jack").password("sample").tenant(tenant).build()
);

// Add a Tenant based Role to the User
os.identity().roles().addUserRole(
    tenant.getId(),
    user.getId(),
    os.identity().roles().getByName("Member").getId()
);

Compute Operations (Nova)

OpenStack4j covers most the major common compute based operations. With the simplistic API approach you can fully manage Servers, Flavors, Images, Quota-Sets, Diagnostics, Tenant Usage and more. As the API evolves additional providers and extensions will be covered and documented within the API.

Create a Flavor and Boot a Server/VM

// Create a Flavor for a special customer base
Flavor flavor = os.compute().flavors().create(
    Builders.flavor().name("Gold").vcpus(4).disk(80).ram(2048).build()
);

// Create and Boot a new Server (minimal builder options shown in example)
Server server = os.compute().servers().boot(
    Builders.server().name("Ubuntu 2").flavor(flavor.getId()).image("imageId").build()
);

Create a new Server Snapshot

String imageId = os.compute().servers().createSnapshot(server.getId(), "Clean State Snapshot");

Server Diagnostics

Diagnostics are usage information about the server. Usage includes CPU, Memory and IO. Information is dependant on the hypervisor used by the OpenStack installation. As of right now there is no concrete diagnostic specification which is why the information is variable and in map form (key and value)

Map<String, ? extends Number> diagnostics = os.compute().servers().diagnostics("serverId");

Networks (Neutron)

Network Operations

// List the networks which the current authorized tenant has access to
List<? extends Network> networks = os.networking().network().list();

// Create a Network
Network network = os.networking().network().create(
    Builders.network().name("MyNewNet").tenantId(tenant.getId()).build()
);

Subnet Operations

// List all subnets which the current authorized tenant has access to
List<? extends Subnet> subnets = os.networking().subnet().list();

// Create a Subnet
Subnet subnet = os.networking().subnet().create(Builders.subnet()
        .name("MySubnet")
        .networkId("networkId")
        .tenantId("tenantId")
        .addPool("192.168.0.1", "192.168.0.254")
        .ipVersion(IPVersionType.V4)
        .cidr("192.168.0.0/24")
        .build()
);

Router Operations

// List all Routers
List<? extends Router> = os.networking().router().list();

// Create a Router
Router router = os.networking().router().create(
    Builders.router().name("ext_net").adminStateUp(true).externalGateway("networkId").build()
);

Image Operations (Glance)

Basic Operations

// List all Images
List<? extends Image> images = os.images().list();

// Get an Image by ID
Image image = os.images().get("imageId");

// Delete a Image
os.images().delete("imageId");

// Update a Image
Image image = os.images().get("imageId");

os.images().update(
   image.toBuilder().name("VM Image Name").minDisk(1024).property("personal-distro", "true")
);

Download the Image Data

InputStream is = os.images().getAsStream("imageId");

Create a Image

// (URL Payload in this example, File, InputStream are other payloads available)
Payload<URL> create = Payloads.create(new URL("https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"))
Image req = Builders.image().name("Cirros 0.3.0 x64").isPublic(true).containerFormat(ContainerFormat.BARE).diskFormat(DiskFormat.QCOW2).build()
Image image = c.images().create(req, create)

License

This software is licensed under the Apache 2 license, quoted below.

Copyright 2019 ContainX and OpenStack4j

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.

openstack4j's People

Contributors

allensap avatar auhlig avatar baseman79 avatar cherry522 avatar dependabot[bot] avatar dmitryintel avatar ekasitk avatar emjburns avatar flambeau4u avatar gondor avatar gonzolino avatar isartcanyameres avatar iviireczech avatar jyothisaroja avatar lion0406 avatar magixyu avatar maxrome avatar n-r-anderson avatar octupszhang avatar olivergondza avatar pavanvadavi avatar pdube avatar rakhmerov avatar rschollmeyer avatar shitalpatil-gslab avatar sohaninfo avatar test-1pro avatar tongh-qtl avatar vinodborole avatar zizhongwei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openstack4j's Issues

MigrationStatus lost

MigrationStatus enums in class org.openstack4j.model.storage.block.Volume is not complete, which losing :DELETING,ERROR,SUCCESS

fault is left null in certain cases

Dear all,
I'm using 3.3 and I noticed now that we are also using regions (I don't know if it could be of some relevance) that some server seem to have their fault at null even when an error is present.
Using the official command line python client I can clearly see a fault object in the returned json file
I tried polling to see if it could be a timing issue, but the result is the same my server.fault is sitll null
Have you already seen this ?
Thanks

Not possible to detach a volume from a server

Hi,

I am trying to use Block Storage API V3 in order to detach a volume from a server.
The API call for that is /v3/{project_id}/volumes/{volume_id}/action with body containing attachment_id (it also works with server_id). I am not able to perform this call through the openstack4j client because I cannot find a way to get the attachmentId. There is a property "attachment_id" in CinderVolumeAttachment class but there is no getter for it. How can I get the attachmentId? Client version: 3.4.

[Bug] Not Acceptable Header in list Requests Networks,Subnets and Ports

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.

Create a server inside a new project

Hello, I'm trying to create a project and add a server to the project, it creates the project but adds the machine inside the admin project, and not to the created project, can you help me? what am I doing wrong?

public class OpenStackConfig {

  public static OSClientV3 getOsClient() {

    return OSFactory.builderV3()
        .credentials("admin", "1234", Identifier.byId("default"))
        .endpoint("MY_IP")
        .authenticate();
  }

  public static OSClientV3 getOsClient(String user, String password, Project project) {
    return OSFactory.builderV3()
        .endpoint("MY_IP")
        .scopeToProject(Identifier.byId(project.getId()))
        .credentials(user, password)
        .authenticate();
  }
}
@RestController
@RequestMapping("/create")
public class createServerAndProject
OSClientV3 os  = getOsClient();

     final User user = os.identity().users().getByName("admin", "default");
    List<? extends Role> role = os.identity().roles().getByName("admin");
    final Domain domain = os.identity().domains().get("default");

    Project project = Builders.project().domain(domain).parentId(domain.getId())
        .name("test").enabled(true).build();

    project = getOsClient().identity().projects().create(project);

ActionResponse grantProjectRole = osClientV3.identity().roles().grantDomainUserRole(
        domain.getId(), user.getId(), role.get(0).getId());

    ActionResponse grantProjectRole2 = osClientV3.identity().roles().grantProjectUserRole(
        project.getId(), user.getId(), role.get(0).getId())



 ServerCreate myServer = Builders.server()
        .name("test")
        .flavor("1234)
        .networks("1234")
        .image("1234)
        .build();

    // Boot the Server
    Server server = os.compute().servers().bootAndWaitActive(myServer, 120000);

Support dynamic volume type quota-sets

authenticate() with proxy and required proxy authentication fails with: ClientResponseException{message=Proxy Authentication Required, status=407, status-code=PROXY_AUTH_REQUIRED}

Hi,

Description:
openstack authentication not working when behind a proxy with user and password authentication.
It fails with:

ClientResponseException{message=Proxy Authentication Required, status=407, status-code=PROXY_AUTH_REQUIRED}
	at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:38)
	at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
	at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:191)
	at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:74)
	at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:172)
	at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:129)

Reproduce with:
Use a proxy with required authentication
Version: openstack4j 3.4 (maven)
any java version

		OSClientV3 os=null; 
		V3 builder = OSFactory.builderV3()
				.endpoint(keystoneUrl)
				.credentials("user", "password", Identifier.byId("domainId"));
		builder=builder.withConfig(Config.newConfig().withProxy(ProxyHost.of("http://proxyHost", proxyPort, "proxyUser", "proxyPassword")));
		builder=builder.scopeToProject(Identifier.byName("project"),Identifier.byId("domainId"));
		os=builder.authenticate();

I debuged a bit and saw that in the method:
org.openstack4j.connectors.resteasy.executors.ApacheHttpClientEngine.create()
the proxy information is used but not username and password

Regards
Lukas

EndpointURLResolver chooses wrong service endpoint from catalog

After updating our application dependency from openstack4j 3.0.4 to openstack4j > 3.0.4 the DefaultEndpointURLResolver chooses a wrong service endpoint for ServiceType COMPUTE on one of the de.NBI Openstack cloud sites (see BiBiServ/bibigrid#235 for a description). In the current implementation the DefaultEndpointURLResolver selects a service endpoint for given service type when the type or the name matches. This behaviour is dangerous in the case of a partly misconfigured Openstack installation. In my opinion the type and the name should match the searched service type.

how to set httpClient keepAlive vaule

I want to ensure the availability of connections and clean up some timed out connections.
In this method org.openstack4j.connectors.httpclient.HttpClientFactory#buildClient๏ผŒcan set the KeepAliveStrategy of httpclient.
When I use openstack4j, how should I set it๏ผŸ

Setting Volume name and description fails with Cinder "Rocky"

BlockVolumeService.update(String volumeId, String name, String description) is used to set the name and description on a (Cinder) Volume.
This results in a JSON request being HTTP PUT to OpenStack containing the new name & description ... but it also includes os-vol-mig-status-attr:migstat = none with the rest of the JSON request, and the "Rocky" version of Cinder rejects that request:

ActionResponse{success=false, fault=Invalid input for field/attribute volume. Value: {u'description': u'...', u'display_name': u'...', u'name': u'...', u'os-vol-mig-status-attr:migstat': u'none', u'display_description': u'...'}. Additional properties are not allowed (u'os-vol-mig-status-attr:migstat' was unexpected), code=400}

i.e. the update method sets the name & display_name attributes to the String name it was given, and both the description & display_description attributes to the String description it was given, but it also tries to set attribute os-vol-mig-status-attr:migstat to none, which fails.

From what I've seen thus far, the underlying cause appears to be that CinderVolume.getMigrateStatus() does not return null if it has not been set; this then causes the JSON code to mistakenly believe it should be included in the outgoing request ... which causes Cinder to reject the (invalid) request.
According to the javadocs, this field's default value should be null, but the existing implementation returns a default value of MigrationStatus.NONE instead of null.

i.e. it's not working as documented & it isn't working; this is probably cause & effect.

Note: The "Pike" version of Cinder doesn't seem to care about this and does not reject the request, allowing this issue to remain undetected for so long; the "Rocky" version does care and does reject it; I don't know about the "Queen" version.
Note also: The openstack4j has had numerous similar bugs in the past. e.g. ContainX/openstack4j #932, #869, #823, #820, #682, #606, #573, #470.

Replace the deprecated code and optimize some code

replace : Class..newInstance() -> Class..getDeclaredConstructor().newInstance()

org.openstack4j.openstack.provider.DefaultAPIProvider
org.openstack4j.core.transport.HttpEntityHandler
org.openstack4j.openstack.compute.domain.actions.BasicActions

[Bug] Unkown Field in KeystoneProject

Why when trying to get the projects i am getting the following exception:
Error logs:

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
org.openstack4j.openstack.identity.v3.domain.KeystoneProject$Projects["projects"]->java.util.ArrayList[0]->org.openstack4j.openstack.identity.v3.domain.KeystoneProject["options"])

Tempurary solution could be:
Add "options" to Json Annotation in class org.openstack4j.openstack.identity.v3.domain.KeystoneProject

  • Origin:
@JsonIgnoreProperties(value = "options" , ignoreUnknown = true)
  • fix
@JsonIgnoreProperties(value = {"extra", "options"} , ignoreUnknown = true)

[Bug] List Networks does not work with Openstack Train

Openstack4j Version 3.4
Openstack Train

code:

try{
  OSFactory.enableHttpLoggingFilter(true)
  OSFactory.clientFromToken(currentToken).networking().network().list()
} catch (Exception e){
  e.printstackStrace()
}

Log

2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "HTTP/1.1 406 Not Acceptable[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "Content-Length: 173[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "Content-Type: application/json[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "X-Openstack-Request-Id: req-ca529317-c332-40ee-b7e7-dcf50aafe4b8[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "Date: Tue, 03 Mar 2020 13:55:31 GMT[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "Connection: keep-alive[\r][\n]"
2020/03/03 14:55:31:260 CET [DEBUG] wire - http-outgoing-4 << "[\r][\n]"
2020/03/03 14:55:31:260 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:261 CET [DEBUG] headers - http-outgoing-4 << HTTP/1.1 406 Not Acceptable
2020/03/03 14:55:31:261 CET [DEBUG] headers - http-outgoing-4 << Content-Length: 173
2020/03/03 14:55:31:261 CET [DEBUG] headers - http-outgoing-4 << Content-Type: application/json
2020/03/03 14:55:31:261 CET [DEBUG] headers - http-outgoing-4 << X-Openstack-Request-Id: req-ca529317-c332-40ee-b7e7-dcf50aafe4b8
2020/03/03 14:55:31:261 CET [DEBUG] headers - http-outgoing-4 << Date: Tue, 03 Mar 2020 13:55:31 GMT
2020/03/03 14:55:31:261 CET [DEBUG] headers - http-outgoing-4 << Connection: keep-alive
2020/03/03 14:55:31:261 CET [DEBUG] MainClientExec - Connection can be kept alive indefinitely
2020/03/03 14:55:31:261 CET [DEBUG] PoolingHttpClientConnectionManager - Connection [id: 4][route: {}->http://xxx.xxx.xxx.xxx:9696] can be kept alive indefinitely
2020/03/03 14:55:31:261 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.261 ERROR c.h.a.c.OSClusterConnector - Networks 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.262 DEBUG o.o.c.t.i.HttpExecutor - Executing Request: http://xxx.xxx.xxx.xxx:9696/v2.0 -> /networks
2020/03/03 14:55:31:263 CET [DEBUG] RequestAddCookies - CookieSpec selected: best-match
2020/03/03 14:55:31:263 CET [DEBUG] RequestAuthCache - Auth cache not set in the context
2020/03/03 14:55:31:263 CET [DEBUG] PoolingHttpClientConnectionManager - Connection request: [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:263 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:263 CET [DEBUG] MainClientExec - Stale connection check
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 << "[read] I/O error: Read timed out"
2020/03/03 14:55:31:264 CET [DEBUG] MainClientExec - Executing request GET /v2.0/networks?limit=500 HTTP/1.1
2020/03/03 14:55:31:264 CET [DEBUG] MainClientExec - Target auth state: UNCHALLENGED
2020/03/03 14:55:31:264 CET [DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> GET /v2.0/networks?limit=500 HTTP/1.1
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> Accept: application/json; charset=utf-8
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> User-Agent: OpenStack4j / OpenStack Client
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> Host: xxx.xxx.xxx.xxx:9696
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> Connection: Keep-Alive
2020/03/03 14:55:31:264 CET [DEBUG] headers - http-outgoing-4 >> Accept-Encoding: gzip,deflate
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 >> "GET /v2.0/networks?limit=500 HTTP/1.1[\r][\n]"
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 >> "Accept: application/json; charset=utf-8[\r][\n]"
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 >> "X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM[\r][\n]"
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 >> "User-Agent: OpenStack4j / OpenStack Client[\r][\n]"
2020/03/03 14:55:31:264 CET [DEBUG] wire - http-outgoing-4 >> "Host: xxx.xxx.xxx.xxx:9696[\r][\n]"
2020/03/03 14:55:31:265 CET [DEBUG] wire - http-outgoing-4 >> "Connection: Keep-Alive[\r][\n]"
2020/03/03 14:55:31:265 CET [DEBUG] wire - http-outgoing-4 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2020/03/03 14:55:31:265 CET [DEBUG] wire - http-outgoing-4 >> "[\r][\n]"

How to associate user with a machine

Hi,

I'm studying openstack and programming, and I'm trying to create a machine and add the user and password already created to that machine, could someone help me?

My Code

final ServerCreate server = Builders.server()
       .name('test-machine')
       .flavor('1234567')
       .networks(Collections.singletonList("aev124b-1234-234-a8cc-2187654"))
       .addSecurityGroup('my_security_group'))
       .image('my_image_id')
       .build();

       // Boot the Server
       final Server server = os.compute().servers().boot(server);
       return "server created =)";

Create user

User user = os.identity().users().create(Builders.user()
               .domainId(domain.getId())
               .name("user")
               .password("1234")
               .email("[email protected])
               .enabled(true)
               .defaultProjectId(project.getId())
               .build());

How do I add this user to my created machine?

I want to delete metadata of host-aggregates , but parameter lost after map serialization

I want to delete metadata of host-aggregates , but parameter lost after map serializationใ€‚

This is my code.

IClient client = clientService.getClient(controllerId);
Map<String, String> metadata = new HashMap<>();
metadata.put("pinned", null);
client.compute().hostAggregates().setMetadata(id, metadata);

This request must run this code.

String content = ObjectMapperSingleton.getContext(this.request.getEntity().getClass()).writer().writeValueAsString(this.request.getEntity());

There are the following parameters in class of org.openstack4j.core.transport.ObjectMapperSingleton:

mapper.setSerializationInclusion(Include.NON_NULL);

HOW CAN I CHANGE THIS CONFIG TO

mapper.setSerializationInclusion(Include.ALWAYS);

THANK YOU !!

Create Server - Error 500

I'm using the openstack4j lib to create a server, but i get a error 500 when i try to create a server, using a POST request for my endpoint

my stack:

Java11
Openstack4j 3.8
spring 3.2.1

my request:
POST my api /computers

My PayLoad:

{
  "domainID": "fdb4d2b73a4b4cacbc9dc80dd9e09eba",
  "flavorID": "1",
  "imageID": "53a9320d-45b9-450b-a7eb-5db06499bffb",
  "networkID": "1e91e20f-1f0d-4141-86c3-0ae8c18ba139",
  "projectID": "string",
  "serverName": "Test",
  "userID": "c0caf80a18334f5caeee8037887f13de"
}

My Method:

 @Api(value="Server Manager")
@RestController
@RequestMapping("/computers")
public class ComputerController {

    @ApiOperation(value = "Create Server")
    @PostMapping
    public String create(@RequestBody ServerRequestDTO serverRequestDTO) {
        OSClientV3 osClientV3 = getOsClientV3();

        User userLoaded = osClientV3.identity().users().get(serverRequestDTO.getUserID());

        Keypair keypair = osClientV3.compute().keypairs().get(userLoaded.getName());

        final ServerCreate serverCreate = osClientV3.compute().servers().serverBuilder()
                .image(serverRequestDTO.getImageID())
                .name(serverRequestDTO.getServerName())
                .flavor(serverRequestDTO.getFlavorID())
                .keypairName(keypair.getName())
                .addSecurityGroup("4f-security-group-cli")
                .networks(Collections.singletonList(serverRequestDTO.getNetworkID()
                ))
                .build();

        Server server = osClientV3.compute().servers().boot(serverCreate);

        return HttpStatus.OK.name();
    }
}

I received this error:

org.openstack4j.api.exceptions.ServerResponseException: Internal Server Error
        at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:86) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:96) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:92) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:51) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.connectors.resteasy.HttpResponseImpl.getEntity(HttpResponseImpl.java:64) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:215) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:205) ~[openstack4j-3.8-withdeps.jar:na]
        at org.openstack4j.openstack.compute.internal.ServerServiceImpl.boot(ServerServiceImpl.java:136) ~[openstack4j-3.8-withdeps.jar:na]
        at com.projeto.openstack.controller.ComputerController.create(ComputerController.java:50) ~[classes/:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) ~[tomcat-embed-core-9.0.37.jar:4.0.FR]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.37.jar:4.0.FR]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[na:na]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.37.jar:9.0.37]
        at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]

Can you help me?

Error - SDK Auth - 401 Unauthorized

Hi,

I'm using the Openstack4j SDK, and I'm having trouble authenticating myself. I tested all authentication modes, and always 401, can you help me?
I tested it via Curl, Python, and both work, but via SDK java does not work. Can you help me?

SDK Version: com.github.openstack4j.core 3.8

This is my Curl payload and it worked:

curl -X POST -H "Content-Type: application/json" \
  -d '
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": "admin",
          "domain": { "id": "default" },
          "password": "admin1234"
        }
      }
    }
  }
}' \
  "http://xxx.xxx.xxx.xx:5000/v3/auth/tokens" ; echo

and return 200 ok

{"token": {"methods": ["password"], "user": {"domain": {"id": "default", "name": "Default"}, "id": "aa0ae07d56a04b50
9b02270e991b50b6", "name": "admin", "password_expires_at": null}, "audit_ids": ["vHLMAERxRoWGgRUw_ho-0Q"], "expires_
at": "2020-10-06T17:19:28.000000Z", "issued_at": "2020-10-06T16:19:28.000000Z"}}

But My java code don't work, my java code:

public class OpenStackAuth {
  public static OSClientV3 getOsClientV3() {
    return OSFactory.builderV3()
      .endpoint("http://xxx.xxx.xxx.xx:5000/v3")
      .credentials("admin", "admin1234", Identifier.byId("default"))
      .scopeToDomain(Identifier.byId("default"))
      .authenticate();
  }
}

I also tried this and it didn't work:

public class OpenStackAuth {
public static OSClientV3 getOsClientV3() {
    Identifier identifier = Identifier.byName("Default");
    return OSFactory.builderV3()
        .endpoint("http://xxx.xxx.xxx.xx/5000/v3")
        .credentials("admin", "admin1234", identifier)
        .scopeToDomain(identifier)
        .authenticate();
  }
}
public class OpenStackAuth {
public static OSClientV3 getOsClientV3() {
    Identifier identifier = Identifier.byName("Default");
    return OSFactory.builderV3()
        .endpoint("http://xxx.xxx.xxx.xx/5000/v3")
        .credentials("admin", "admin1234")
        .scopeToDomain(identifier)
        .authenticate();
  }
}
public class OpenStackAuth {
public static OSClientV3 getOsClientV3() {
    Identifier identifier = Identifier.byId("default");
    return OSFactory.builderV3()
        .endpoint("http://xxx.xxx.xxx.xx/5000/v3")
        .credentials("admin", "admin1234")
        .scopeToDomain(identifier)
        .authenticate();
  }
}

User properties in my Openstack Dashboard:

Name: admin
ID: MY_ID
Domain Name: Default
Domain ID: default

Error:

`2020-10-06 14:22:59.564 ERROR 3872 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is AuthenticationException{message=Unauthorized, status=401, request=POST http://xxx.xxx.xxx.xx:5000/v3/auth/tokens}] with root cause

org.openstack4j.api.exceptions.AuthenticationException: Unauthorized
	at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:82) ~[openstack4j-3.8-withdeps.jar:na]
ResponseException.java:82
	at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:96) ~[openstack4j-3.8-withdeps.jar:na]
ResponseException.java:96
	at org.openstack4j.api.exceptions.ResponseException.mapException(ResponseException.java:92) ~[openstack4j-3.8-withdeps.jar:na]
ResponseException.java:92
	at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:194) ~[openstack4j-3.8-withdeps.jar:na]
OSAuthenticator.java:194
	at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:75) ~[openstack4j-3.8-withdeps.jar:na]
OSAuthenticator.java:75
	at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:172) ~[openstack4j-3.8-withdeps.jar:na]
OSClientBuilder.java:172
	at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:129) ~[openstack4j-3.8-withdeps.jar:na]
OSClientBuilder.java:129
	at com.project.openstack.util.OpenStackAuth.getOsClientV3(OpenStackAuth.java:16) ~[classes/:na]
OpenStackAuth.java:16`

In line 16 of my class contains the authenticated method: .authtenticate();

Can you help me please?

update default pool for loadbalancer listener

the openstack API supports update defaultPoolId while updating the listener:

neutron lbaas-listener-update  --description "test modify" --default-pool my-https-pool  my-lis-https

but the ListenerV2 didn't have the interface for such update option.
we're expecting to have such ability to update the defaultPoolId for a listener.

blockStorage().schedulerStatsPools().poolsDetail() - InvalidFormatException

Hello,

First off - thanks for forking the project. I appreciate the effort.

There's one bug related to deserialization - it seems like the model has wrong types.

CLI output:

[root@openstack ~(keystone_admin)]# cinder get-pools --detail
+-----------------------------+----------------------------------------------------------------+
| Property                    | Value                                                          |
+-----------------------------+----------------------------------------------------------------+
| QoS_support                 | False                                                          |
| allocated_capacity_gb       | 20                                                             |
| backend_state               | up                                                             |
| driver_version              | 3.0.0                                                          |
| filter_function             | None                                                           |
| free_capacity_gb            | 3.88                                                           |
| goodness_function           | None                                                           |
| location_info               | LVMVolumeDriver:openstack.s.local:cinder-volumes:thin:0 |
| max_over_subscription_ratio | 20.0                                                           |
| multiattach                 | True                                                           |
| name                        | openstack.s.local@lvm#lvm                               |
| pool_name                   | lvm                                                            |
| provisioned_capacity_gb     | 20.0                                                           |
| reserved_percentage         | 0                                                              |
| storage_protocol            | iSCSI                                                          |
| thick_provisioning_support  | False                                                          |
| thin_provisioning_support   | True                                                           |
| timestamp                   | 2020-03-06T09:33:44.665837                                     |
| total_capacity_gb           | 20.98                                                          |
| total_volumes               | 2                                                              |
| vendor_name                 | Open Source                                                    |
| volume_backend_name         | lvm                                                            |
+-----------------------------+----------------------------------------------------------------+
+-----------------------------+----------------------------------+
| Property                    | Value                            |
+-----------------------------+----------------------------------+
| QoS_support                 | False                            |
| allocated_capacity_gb       | 10                               |
| driver_version              | 1.4.0                            |
| filter_function             | None                             |
| free_capacity_gb            | 91.1171875                       |
| goodness_function           | None                             |
| max_over_subscription_ratio | 20.0                             |
| name                        | openstack.s.local@nfs#nfs |
| provisioned_capacity_gb     | 23.4                             |
| reserved_percentage         | 0                                |
| sparse_copy_volume          | True                             |
| storage_protocol            | nfs                              |
| thick_provisioning_support  | False                            |
| thin_provisioning_support   | True                             |
| timestamp                   | 2020-03-06T09:34:58.612620       |
| total_capacity_gb           | 107.165039062                    |
| vendor_name                 | Open Source                      |
| volume_backend_name         | nfs                              |
+-----------------------------+----------------------------------+
+-----------------------------+-----------------------------------------------------------------------------+
| Property                    | Value                                                                       |
+-----------------------------+-----------------------------------------------------------------------------+
| allocated_capacity_gb       | 17                                                                          |
| driver_version              | 1.2.0                                                                       |
| filter_function             | None                                                                        |
| free_capacity_gb            | 59.96                                                                       |
| goodness_function           | None                                                                        |
| location_info               | ceph:/etc/ceph/ceph.conf:cc3a4e9f-d2ca-4fec-805d-2c40605723b3:admin:volumes |
| max_over_subscription_ratio | 20.0                                                                        |
| multiattach                 | False                                                                       |
| name                        | openstack.s.local@rbd#rbd                                            |
| provisioned_capacity_gb     | 38.0                                                                        |
| replication_enabled         | False                                                                       |
| reserved_percentage         | 0                                                                           |
| storage_protocol            | ceph                                                                        |
| thin_provisioning_support   | True                                                                        |
| timestamp                   | 2020-03-06T09:34:19.702739                                                  |
| total_capacity_gb           | 65.61                                                                       |
| vendor_name                 | Open Source                                                                 |
| volume_backend_name         | rbd                                                                         |
+-----------------------------+-----------------------------------------------------------------------------+

and when I use the openstack4j API - blockStorage().schedulerStatsPools().poolsDetail() - I get:

com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.lang.Long from String value '20.0': not a valid Long value
 at [Source: org.apache.http.conn.EofSensorInputStream@479133c9; line: 1, column: 604] (through reference chain: org.openstack4j.openstack.storage.block.domain.VolumeBackendPools["pools"]->java.util.ArrayList[0]->org.openstack4j.openstack.storage.block.domain.CinderBackendStoragePool["capabilities"]->org.openstack4j.openstack.storage.block.domain.CinderCapabilities["max_over_subscription_ratio"])

use java.util.function.Function instead of guava's Function

class: org.openstack4j.core.transport.ExecutionOptions

com.google.common.base.Function

Inspection detects usages of Guava's functional primitives like FluentIterable, Optional, Function, Predicate and Supplier. May change semantic: some of lazy-evaluated guava's iterables could be transformed to eager-evaluated iterable.
This inspection only reports if the language level of the project or module is 8 or higher.

Introduce more powerfull assertion framework

Plain old testng leads to assertions with no defect localization:

assertTrue(getRequest.getPath().matches("/v[123]/\\p{XDigit}*/backups/"+id));
assertTrue(requestBody.contains("\"snapshot_id\" : \"b4b3258d-555a-4fce-8f53-69cc2ae96d3c\""));
assertTrue(session().useConfig(Config.DEFAULT).getEndpoint(ServiceType.COMPUTE).contains("/v2/"), "Endpoint was not version 2");

Hamcrest is my recommendation based on personal experience, but I am open to suggestions.

create a network with subnet pool

Hi,

I'm trying to create a network and pass/associate an existing subnet pool in my openstack, but I can't find the subnet_pool_id parameter and the cidr of that network, is this implemented in the SDK? Can you help me?

I've already tried:

//But dont work.
List<? extends Pool> Pools = os.networking().subnet().get("ID").getAllocationPools();

Network network = os.networking()
         .network()
        .create((Network) Builders.network()
        .name("My_network")
        .build());
Subnet subnet = os.networking().subnet().create(Builders.subnet()
        .name("my_subnet")
        .enableDHCP(true)
        .networkId(network.getId())
        ipVersion(IPVersionType.V4)
        .addDNSNameServer("xxx.xx")
        addDNSNameServer("xxx.xxx")
        .build());

[Bug] List Subnets does not work with Openstack Train

Openstack4j Version 3.4
Openstack Train

code:

try{
  OSFactory.enableHttpLoggingFilter(true)
  OSFactory.clientFromToken(currentToken).networking().subnet().list()
} catch (Exception e){
  e.printstackStrace()
}

Log

2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "HTTP/1.1 406 Not Acceptable[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "Content-Length: 173[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "Content-Type: application/json[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "X-Openstack-Request-Id: req-25d9d71e-3e0d-4fe9-99a9-2988b52561ab[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "Date: Tue, 03 Mar 2020 13:55:31 GMT[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "Connection: keep-alive[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "[\r][\n]"
2020/03/03 14:55:31:856 CET [DEBUG] wire - http-outgoing-5 << "{"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:856 CET [DEBUG] headers - http-outgoing-5 << HTTP/1.1 406 Not Acceptable
2020/03/03 14:55:31:856 CET [DEBUG] headers - http-outgoing-5 << Content-Length: 173
2020/03/03 14:55:31:856 CET [DEBUG] headers - http-outgoing-5 << Content-Type: application/json
2020/03/03 14:55:31:856 CET [DEBUG] headers - http-outgoing-5 << X-Openstack-Request-Id: req-25d9d71e-3e0d-4fe9-99a9-2988b52561ab
2020/03/03 14:55:31:856 CET [DEBUG] headers - http-outgoing-5 << Date: Tue, 03 Mar 2020 13:55:31 GMT
2020/03/03 14:55:31:856 CET [DEBUG] headers - http-outgoing-5 << Connection: keep-alive
2020/03/03 14:55:31:856 CET [DEBUG] MainClientExec - Connection can be kept alive indefinitely
2020/03/03 14:55:31:856 CET [DEBUG] PoolingHttpClientConnectionManager - Connection [id: 5][route: {}->http://xxx.xxx.xxx.xxx:9696] can be kept alive indefinitely
2020/03/03 14:55:31:857 CET [DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 5][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:857 CET [DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 5][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:857 CET [DEBUG] MainClientExec - Stale connection check
2020/03/03-14:55:31.857 ERROR c.h.a.c.OSClusterConnector - Subnets: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.857 DEBUG o.o.c.t.i.HttpExecutor - Executing Request: http://xxx.xxx.xxx.xxx:8774/v2.1/5a76302425664ada86fdb55d79acab6b -> /flavors/detail
2020/03/03 14:55:31:858 CET [DEBUG] RequestAddCookies - CookieSpec selected: best-match
2020/03/03 14:55:31:858 CET [DEBUG] RequestAuthCache - Auth cache not set in the context
2020/03/03 14:55:31:858 CET [DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {}->http://xxx.xxx.xxx.xxx:8774][total kept alive: 0; route allocated: 2 of 2; total allocated: 6 of 20]
2020/03/03 14:55:31:858 CET [DEBUG] wire - http-outgoing-5 << "[read] I/O error: Read timed out"
2020/03/03 14:55:31:858 CET [DEBUG] MainClientExec - Executing request GET /v2.0/subnets HTTP/1.1
2020/03/03 14:55:31:858 CET [DEBUG] MainClientExec - Target auth state: UNCHALLENGED
2020/03/03 14:55:31:858 CET [DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
2020/03/03 14:55:31:858 CET [DEBUG] headers - http-outgoing-5 >> GET /v2.0/subnets HTTP/1.1
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> Accept: application/json; charset=utf-8
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> User-Agent: OpenStack4j / OpenStack Client
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> Host: xxx.xxx.xxx.xxx:9696
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> Connection: Keep-Alive
2020/03/03 14:55:31:859 CET [DEBUG] headers - http-outgoing-5 >> Accept-Encoding: gzip,deflate
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "GET /v2.0/subnets HTTP/1.1[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "Accept: application/json; charset=utf-8[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "X-Auth-Token: gAAAAABeXmHP3l6TmtPIZLD06GC9oGN8hz2trURPmT-upqi5N6-YbU3bQg1C96DNrd2pc5XLBooPT9MrYCD6RiVQnSXBgbxFRr04wArXOCt7dFmXIdCfYadCEUjpLvylQ218cxmfrR_PFJTUtmOui9IBodKUVnQNC_LD1kvvy8IQFoLwiUe6pQM[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "User-Agent: OpenStack4j / OpenStack Client[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "Host: xxx.xxx.xxx.xxx:9696[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "Connection: Keep-Alive[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2020/03/03 14:55:31:859 CET [DEBUG] wire - http-outgoing-5 >> "[\r][\n]"

[Bug] List Ports does not work with Openstack Train

Openstack4j Version 3.4
Openstack Train

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

Report http diagnostics for failures

Report X-Openstack-Request-Id in case http response is transformed into exception. For requests failing with socket timeout, url and method would be valuable for investigation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.