Chapter 17. Creating custom virtual routers with router flavors
The content in this section is available in this release as a Technology Preview, and therefore is not fully supported by Red Hat. It should only be used for testing, and should not be deployed in a production environment. For more information, see Technology Preview.
You can use router flavors to deploy custom virtual routers in your Red Hat OpenStack Platform (RHOSP) ML2/OVN environments. After the RHOSP administrator enables the router flavor feature and creates the router flavor, users can create custom routers by using the router flavor.
Within a RHOSP deployment you can combine virtual custom routers that are based on router flavors with routers of the default OVN type.
Using router flavors does not affect the operation of the default OVN router. When router flavors are used, the default OVN router is treated as the default router flavor, with no impact on its configuration or operation.
To set up router flavors and create custom routers, perform the following general steps:
The administrator loads the necessary RHOSP Networking service (neutron) plug-in and specifies the service provider.
See Section 17.1, “Enabling router flavors and creating service providers”.
The administrator creates the router flavor.
The user creates a custom router by using one of the router flavors.
17.1. Enabling router flavors and creating service providers
Before a Red Hat OpenStack Platform (RHOSP) administrator can create a router flavor, the administrator must first load the necessary RHOSP Networking service (neutron) plug-in and specify the service provider.
The administrator must deploy the service provider code in a module in the Networking service directories. Red Hat recommends the neutron.services.ovn_l3.service_providers.user_defined
module.
You can find a sample service provider named UserDefined
in the neutron.services.ovn_l3.service_providers.user_defined
module.
The following procedure involves direct editing of .conf
files on the Controller nodes. Red Hat is developing heat template methods and OpenStack commands to replace this direct editing method.
Prerequisites
- Your Networking service mechanism driver must be ML2/OVN.
- You have a router flavor service provider created for your deployment.
- You have access to the RHOSP Controller nodes and permission to update configuration files.
Procedure
-
On one of the Controller nodes, open the file,
/var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf
. In the
service_plugins
list, changeovn-routers
toovn-router-flavors-ha
:[DEFAULT] service_plugins = qos,ovn-router-flavors-ha,trunk,segments,port_forwarding,log
Create a
service_providers
section and add a service provider definition for each router flavor that you plan to use.Example
In this example, a service provider,
user_defined_1
, is added:... [service_providers] service_provider = L3_ROUTER_NAT:user_defined_1:neutron.services.ovn_l3.service_providers.user_defined.UserDefined1
A router flavor service provider definition has the following elements:
- Service provider constant
- L3_ROUTER_NAT
- Name
Name of the service provider, which is a descriptive string between two colon characters.
For example,
:user_defined_1:
. The name must be unique within the environment.- Path
-
Red Hat recommends using this path:
neutron.services.ovn_l3.service_providers.user_defined
- Class
A python class name for the service provider.
Each provider has its own class. For example,
UserDefined1
.NoteRetain this class name and its path. You need it later when you create the router flavor.
Restart the Networking service (neutron):
$ sudo podman restart neutron_api
- Perform steps 1 - 4 on the remaining RHOSP Controller nodes.
Verification
Verify that the Networking service has loaded your user defined service provider:
$ openstack network service provider list
If the procedure was successful the new service appears in the list.
Sample output
+-------------------------+-------+---------+ | Service Type | Name | Default | +---------------+-----------------+---------+ | L3_ROUTER_NAT | user_defined_1 | False | | L3_ROUTER_NAT | ovn | True | +---------------+-----------------+---------+
17.2. Creating a router flavor
The Red Hat OpenStack Platform (RHOSP) administrator can create router flavors that users must specify when they create custom virtual routers in their RHOSP ML2/OVN environment. After the administrator has loaded the Networking service (neutron) ovn-router-flavors-ha
plug-in and specified the service provider, the remaining steps for creating a router flavor are:
- Create a service profile for the router flavor.
- Create the router flavor.
- Add the service profile to the router flavor.
Prerequisites
- Your Networking service mechanism driver must be ML2/OVN.
-
You must be a RHOSP user with the
admin
role. -
The Networking service has the
ovn-router-flavors-ha
plug-in loaded. The router flavor service provider has been created and you know the name and path of its class.
For more information, see Section 17.1, “Enabling router flavors and creating service providers”.
Procedure
-
Source your overcloud credentials file that assigns you the
admin
role. Using the service provider class and its path, create a service profile for the router flavor.
Retain the profile ID, as you need it in a later step.
Example
In this example, the driver class name is
UserDefined1
, and its path is,neutron.services.ovn_l3.service_providers.user_defined
:$ openstack network flavor profile create \ --description "User-defined router flavor profile" \ --enable --driver \ neutron.services.ovn_l3.service_providers.user_defined.UserDefined1
Sample output
+-------------+----------------------------------------------------------------------+ | Field | Value | +-------------+----------------------------------------------------------------------+ | description | User-defined router flavor profile | | driver | neutron.services.ovn_l3.service_providers.user_defined.UserDefined1 | | enabled | True | | id | a717c92c-63f7-47e8-9efb-6ad0d61c4875 | | meta_info | | | project_id | None | +-------------+----------------------------------------------------------------------+
Create the router flavor:
$ openstack network flavor create \ --service-type L3_ROUTER_NAT \ --description "User-defined flavor for routers" \ user-defined-router-flavor
Sample output
+---------------------+---------------------------------------------------------+ | Field | Value | +---------------------+---------------------------------------------------------+ | description | User-defined flavor for routers | | enabled | True | | id | e47c1c5c-629b-4c48-b49a-78abe6ac7696 | | name | user-defined-router-flavor | | service_profile_ids | [] | | service_type | L3_ROUTER_NAT | +---------------------+---------------------------------------------------------+
Add the service profile to the router flavor, using the profile ID from an earlier step.
Example
$ openstack network flavor add profile user-defined-router-flavor \ a717c92c-63f7-47e8-9efb-6ad0d61c4875
Additional resources
17.3. Creating a custom virtual router
You can create a custom virtual router in your Red Hat OpenStack Platform (RHOSP) environment by using a router flavor provided by your RHOSP administrator.
Prerequisites
- The RHOSP administrator has created a router flavor.
- Your Networking service (neutron) mechanism driver must be ML2/OVN.
Procedure
- Source your credentials file.
Get the ID for the router flavor to use to create your custom router:
$ openstack network flavor list -c ID -c Name
Sample output
+--------------------------------------+-------------------------------+ | ID | Name | +--------------------------------------+-------------------------------+ | 4b37f895-e78e-49df-a96b-1916550f9116 | user-defined-router-flavor | +--------------------------------------+-------------------------------+
Using the router flavor ID, create a custom router:
Example
In this example, a custom router,
user-defined-router
is created using the flavor ID foruser-defined-router-flavor
:$ openstack router create \ --flavor-id 4b37f895-e78e-49df-a96b-1916550f9116 user-defined-router
If you do not use the
--flavor-id
argument, theopenstack router create
command creates a default OVN router.List your deployment’s routers to verify the router creation:
$ openstack router list -c ID -c Name -c Status -c HA
Sample output
+--------------------------------------+------------------------+--------+------+ | ID | Name | Status | HA | +--------------------------------------+------------------------+--------+------+ | 9f5fec56-1829-4bad-abe5-7b4221649c8e | router1 | ACTIVE | True | | e9f25566-ff73-4a76-aeb4-969c819f9c47 | user-defined-router | ACTIVE | True | +--------------------------------------+------------------------+--------+------+