OpenStack Neutron
| Deprecated: This openstack-neutron is deprecated and may be removed in a future release. |
Since Camel 2.19
Only producer is supported
The Openstack Neutron component allows messages to be sent to an OpenStack network services.
Dependencies
Maven users will need to add the following dependency to their pom.xml.
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-openstack</artifactId>
<version>${camel-version}</version>
</dependency> where ${camel-version} must be replaced by the actual version of Camel.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The OpenStack Neutron component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The OpenStack Neutron endpoint is configured using URI syntax:
openstack-neutron:host
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The URL of the OpenStack Identity service (Keystone) to authenticate with, for example http://controller:5000/v3. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The version of the OpenStack Identity API to authenticate with: V3 or V2. Enum values:
| V3 | String | |
The openstack4j client configuration (org.openstack4j.core.transport.Config), for example to set connection and read timeouts, an SSLContext or a proxy. When not set, the openstack4j defaults are used. | Config | ||
The name of the domain the user belongs to, used to authenticate with Identity API V3 (not used with V2). | default | String | |
The operation to perform: create, get, getAll or delete; ports and routers also support update, and routers attachInterface and detachInterface. | String | ||
Required The password of the OpenStack user. | String | ||
Required The ID of the project to scope the authentication to (the tenant ID with Identity API V2). | String | ||
Required The kind of Neutron resource to manage: networks, subnets, ports or routers. Enum values:
| String | ||
Required The name of the OpenStack user to authenticate as. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean |
Message Headers
The OpenStack Neutron component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelOpenstackNeutronTenantId (network port router) Constant: | The ID of the tenant (project) that owns the network, port or router. | String | |
CamelOpenstackNeutronNetworkId (subnet port) Constant: | The ID of the network, such as the network of the subnet or port. | String | |
CamelOpenstackNeutronAdminStateUp (network) Constant: | The administrative state of the network: true for up, false for down. | Boolean | |
CamelOpenstackNeutronNetworkType (network) Constant: | The provider network type, such as FLAT, VLAN, VXLAN or GRE. Enum values:
| NetworkType | |
CamelOpenstackNeutronPhysicalNetwork (network) Constant: | The name of the physical network of the provider network. | String | |
CamelOpenstackNeutronSegmentId (network) Constant: | The segmentation ID of the provider network, such as the VLAN ID. | String | |
CamelOpenstackNeutronIsShared (network) Constant: | Whether the network is shared among all projects. | Boolean | |
CamelOpenstackNeutronIsRouterExternal (network) Constant: | Whether the network is an external network. | Boolean | |
CamelOpenstackNeutronEnableDhcp (subnet) Constant: | Whether DHCP is enabled on the subnet. | Boolean | |
CamelOpenstackNeutronGateway (subnet) Constant: | The gateway IP address of the subnet. | String | |
CamelOpenstackNeutronIpVersion (subnet) Constant: | The IP version of the subnet: V4 or V6. Enum values:
| IPVersionType | |
CamelOpenstackNeutronCidr (subnet) Constant: | The IP range of the subnet in CIDR notation, such as 10.0.0.0/24. | String | |
CamelOpenstackNeutronSubnetPools (subnet) Constant: | The allocation pool of the subnet: the start and end IP addresses to allocate from. | NeutronPool | |
CamelOpenstackNeutronDeviceId (port) Constant: | The ID of the device that uses the port, such as a server. | String | |
CamelOpenstackNeutronMacAddress (port) Constant: | The MAC address of the port. | String | |
CamelOpenstackNeutronRouterId (router) Constant: | The ID of the router. | String | |
CamelOpenstackNeutronSubnetId (router subnet) Constant: | The ID of the subnet. | String | |
CamelOpenstackNeutronPortId (port router) Constant: | The ID of the port. | String | |
CamelOpenstackNeutronInterfaceType (router) Constant: | The type of the interface to attach to the router: SUBNET or PORT. Enum values:
| AttachInterfaceType | |
CamelOpenstackOperation (producer) Constant: | The operation to perform. | String | |
| Constant: | The ID of the resource to act on. | String | |
| Constant: | The name of the resource, such as the volume, image or server to create, or the key pair or container to act on. | String |
Message Body
The message body at each side of the OpenStack Neutron component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Producer input |
| Read by create and update only: a Network, Subnet, Port or Router of openstack4j, or else the fields from headers such as CamelOpenstackName. The other operations take the ids from headers. |
Producer output |
| The Network, Subnet, Port or Router of openstack4j created, read or updated (null when get finds none), a List of them for getAll, the RouterInterface for attachInterface and detachInterface; delete keeps the body.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Usage
You can use the following settings for each subsystem:
Networks
Operations you can perform with the Network producer
| Operation | Description |
|---|---|
| Create a new network. |
| Get the network. |
| Get all networks. |
| Delete the network. |
If you need more precise network settings, you can create a new object of the type org.openstack4j.model.network.Network and send in the message body.
Subnets
Operations you can perform with the Subnet producer
| Operation | Description |
|---|---|
| Create new subnet. |
| Get the subnet. |
| Get all subnets. |
| Delete the subnet. |
If you need more precise subnet settings, you can create a new object of the type org.openstack4j.model.network.Subnet and send in the message body.
Example
The following route creates a network and logs its id. The endpoint is the address of the identity service (Keystone), and the credentials are property placeholders:
- route:
from:
uri: direct:createNetwork
steps:
- setHeader:
name: CamelOpenstackName
expression:
constant:
expression: "orders-net"
- to:
uri: openstack-neutron:http://controller:5000/v3
parameters:
username: "{{openstack.username}}"
password: "{{openstack.password}}"
project: "{{openstack.project}}"
subsystem: networks
operation: create
- log:
message: "Created network ${body.id}"