Chapter 17. Creating custom virtual routers with router flavors

Important

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:

  1. 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”.

  2. The administrator creates the router flavor.

    See Section 17.2, “Creating a router flavor”.

  3. The user creates a custom router by using one of the router flavors.

    See Section 17.3, “Creating a custom virtual router”.

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.

Note

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

  1. On one of the Controller nodes, open the file, /var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf.
  2. In the service_plugins list, change ovn-routers to ovn-router-flavors-ha:

    [DEFAULT]
    service_plugins = qos,ovn-router-flavors-ha,trunk,segments,port_forwarding,log
  3. 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.

    Note

    Retain this class name and its path. You need it later when you create the router flavor.

  4. Restart the Networking service (neutron):

    $ sudo podman restart neutron_api
  5. 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:

  1. Create a service profile for the router flavor.
  2. Create the router flavor.
  3. Add the service profile to the router flavor.

Prerequisites

Procedure

  1. Source your overcloud credentials file that assigns you the admin role.
  2. 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                                                                 |
    +-------------+----------------------------------------------------------------------+

  3. 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                                           |
    +---------------------+---------------------------------------------------------+

  4. 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

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

  1. Source your credentials file.
  2. 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    |
    +--------------------------------------+-------------------------------+

  3. 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 for user-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, the openstack router create command creates a default OVN router.

  4. 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 |
    +--------------------------------------+------------------------+--------+------+