Camel Components

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.

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.

URI Format

openstack-neutron://hosturl[?options]

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, *.yaml files, 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

lazyStartProducer (producer)

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

autowiredEnabled (advanced)

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

host (producer)

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

apiVersion (producer)

The version of the OpenStack Identity API to authenticate with: V3 or V2.

Enum values:

  • V2

  • V3

V3

String

config (producer)

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

domain (producer)

The name of the domain the user belongs to, used to authenticate with Identity API V3 (not used with V2).

default

String

operation (producer)

The operation to perform: create, get, getAll or delete; ports and routers also support update, and routers attachInterface and detachInterface.

String

password (producer)

Required The password of the OpenStack user.

String

project (producer)

Required The ID of the project to scope the authentication to (the tenant ID with Identity API V2).

String

subsystem (producer)

Required The kind of Neutron resource to manage: networks, subnets, ports or routers.

Enum values:

  • networks

  • subnets

  • ports

  • routers

String

username (producer)

Required The name of the OpenStack user to authenticate as.

String

lazyStartProducer (producer (advanced))

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: TENANT_ID

The ID of the tenant (project) that owns the network, port or router.

String

CamelOpenstackNeutronNetworkId (subnet port)

Constant: NETWORK_ID

The ID of the network, such as the network of the subnet or port.

String

CamelOpenstackNeutronAdminStateUp (network)

Constant: ADMIN_STATE_UP

The administrative state of the network: true for up, false for down.

Boolean

CamelOpenstackNeutronNetworkType (network)

Constant: NETWORK_TYPE

The provider network type, such as FLAT, VLAN, VXLAN or GRE.

Enum values:

  • LOCAL

  • FLAT

  • VLAN

  • VXLAN

  • GRE

  • GENEVE

NetworkType

CamelOpenstackNeutronPhysicalNetwork (network)

Constant: PHYSICAL_NETWORK

The name of the physical network of the provider network.

String

CamelOpenstackNeutronSegmentId (network)

Constant: SEGMENT_ID

The segmentation ID of the provider network, such as the VLAN ID.

String

CamelOpenstackNeutronIsShared (network)

Constant: IS_SHARED

Whether the network is shared among all projects.

Boolean

CamelOpenstackNeutronIsRouterExternal (network)

Constant: IS_ROUTER_EXTERNAL

Whether the network is an external network.

Boolean

CamelOpenstackNeutronEnableDhcp (subnet)

Constant: ENABLE_DHCP

Whether DHCP is enabled on the subnet.

Boolean

CamelOpenstackNeutronGateway (subnet)

Constant: GATEWAY

The gateway IP address of the subnet.

String

CamelOpenstackNeutronIpVersion (subnet)

Constant: IP_VERSION

The IP version of the subnet: V4 or V6.

Enum values:

  • V4

  • V6

IPVersionType

CamelOpenstackNeutronCidr (subnet)

Constant: CIDR

The IP range of the subnet in CIDR notation, such as 10.0.0.0/24.

String

CamelOpenstackNeutronSubnetPools (subnet)

Constant: SUBNET_POOL

The allocation pool of the subnet: the start and end IP addresses to allocate from.

NeutronPool

CamelOpenstackNeutronDeviceId (port)

Constant: DEVICE_ID

The ID of the device that uses the port, such as a server.

String

CamelOpenstackNeutronMacAddress (port)

Constant: MAC_ADDRESS

The MAC address of the port.

String

CamelOpenstackNeutronRouterId (router)

Constant: ROUTER_ID

The ID of the router.

String

CamelOpenstackNeutronSubnetId (router subnet)

Constant: SUBNET_ID

The ID of the subnet.

String

CamelOpenstackNeutronPortId (port router)

Constant: PORT_ID

The ID of the port.

String

CamelOpenstackNeutronInterfaceType (router)

Constant: ITERFACE_TYPE

The type of the interface to attach to the router: SUBNET or PORT.

Enum values:

  • PORT

  • SUBNET

AttachInterfaceType

CamelOpenstackOperation (producer)

Constant: OPERATION

The operation to perform.

String

CamelOpenstackId (producer)

Constant: ID

The ID of the resource to act on.

String

CamelOpenstackName (producer)

Constant: NAME

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

any

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

pojo, list, null or unchanged

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.

  • With operation=create: pojo

  • With operation=get: pojo or null

  • With operation=getAll: list

  • With operation=update: pojo

  • With operation=delete: unchanged

  • With operation=attachInterface: pojo (org.openstack4j.model.network.RouterInterface)

  • With operation=detachInterface: pojo (org.openstack4j.model.network.RouterInterface)

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

Create a new network.

get

Get the network.

getAll

Get all networks.

delete

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

Create new subnet.

get

Get the subnet.

getAll

Get all subnets.

delete

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.

Ports

Operations you can perform with the Port producer

Operation Description

create

Create a new port.

get

Get the port.

getAll

Get all ports.

update

Update the port.

delete

Delete the port.

Routers

Operations you can perform with the Router producer

Operation Description

create

Create a new router.

get

Get the router.

getAll

Get all routers.

update

Update the router.

delete

Delete the router.

attachInterface

Attach an interface.

detachInterface

Detach an interface.

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}"