Bug 1636632 - Allow list_of_routes to be [] in config
Summary: Allow list_of_routes to be [] in config
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: os-net-config
Version: 14.0 (Rocky)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: beta
: 14.0 (Rocky)
Assignee: Harald Jensås
QA Contact: Alexander Chuzhoy
URL:
Whiteboard:
Depends On:
Blocks: 1840659
TreeView+ depends on / blocked
 
Reported: 2018-10-06 01:27 UTC by Bob Fournier
Modified: 2020-05-27 12:09 UTC (History)
4 users (show)

Fixed In Version: os-net-config-9.2.1-0.20181008041835.bedb54a.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1840659 (view as bug list)
Environment:
Last Closed: 2019-01-11 11:53:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1792992 0 None None None 2018-10-06 01:29:21 UTC
OpenStack gerrit 608386 0 None MERGED Allow list_of_routes to be [] in config 2020-11-18 17:34:46 UTC
Red Hat Product Errata RHEA-2019:0045 0 None None None 2019-01-11 11:53:48 UTC

Description Bob Fournier 2018-10-06 01:27:58 UTC
Description of problem:

When support for routes was added to nic-config templates in Tripleo Heat templates the default is an empty list of routes. I.e []. Ref: https://review.openstack.org/#/c/580236/

os-net-config does not accept an empty list during schema validation. Schema validation fail with:

   items/oneOf/ovs_bridge/routes/minItems: [] is too short

[2018/09/17 04:42:37 PM] [WARNING] Config file failed schema validation at network_config/1:
    {'persist_mapping': False, 'addresses': [{'ip_netmask': '11.0.0.28/24'}], 'nic_mapping': None, 'routes': [], 'use_dhcp': False, 'type': 'interface', 'name': 'eth1'} is not valid under any of the given schemas
  Sub-schemas tested and not matching:
  - items/oneOf/interface/routes/minItems: [] is too short
Config file failed schema validation at network_config/3:
    {'persist_mapping': False, 'addresses': [{'ip_netmask': '12.0.0.34/24'}], 'nic_mapping': None, 'routes': [], 'use_dhcp': False, 'type': 'interface', 'name': 'eth3'} is not valid under any of the given schemas
  Sub-schemas tested and not matching:
  - items/oneOf/interface/routes/minItems: [] is too short

Comment 4 Alexander Chuzhoy 2018-10-26 22:44:15 UTC
Verified:
Environment:
os-net-config-9.2.1-0.20181008041835.bedb54a.el7ost.noarch

Successfulyl deploy overcloud while the compute yaml had 'routes: []' and looked like below:
(undercloud) [stack@undercloud-0 ~]$ cat virt/network/three-nics-vlans//compute.yaml
heat_template_version: ocata

description: >
  Software Config to drive os-net-config to configure multiple interfaces
  for the compute role.

parameters:
  ControlPlaneIp:
    default: ''
    description: IP address/subnet on the ctlplane network
    type: string
  ExternalIpSubnet:
    default: ''
    description: IP address/subnet on the external network
    type: string
  InternalApiIpSubnet:
    default: ''
    description: IP address/subnet on the internal API network
    type: string
  StorageIpSubnet:
    default: ''
    description: IP address/subnet on the storage network
    type: string
  StorageMgmtIpSubnet:
    default: ''
    description: IP address/subnet on the storage mgmt network
    type: string
  TenantIpSubnet:
    default: ''
    description: IP address/subnet on the tenant network
    type: string
  ManagementIpSubnet: # Only populated when including environments/network-management.yaml
    default: ''
    description: IP address/subnet on the management network
    type: string
  InternalApiNetworkVlanID:
    default: 20
    description: Vlan ID for the internal_api network traffic.
    type: number
  StorageNetworkVlanID:
    default: 30
    description: Vlan ID for the storage network traffic.
    type: number
  TenantNetworkVlanID:
    default: 50
    description: Vlan ID for the tenant network traffic.
    type: number
  ControlPlaneSubnetCidr: # Override this via parameter_defaults
    default: '24'
    description: The subnet CIDR of the control plane network.
    type: string
  ControlPlaneDefaultRoute: # Override this via parameter_defaults
    description: The subnet CIDR of the control plane network.
    type: string
  DnsServers: # Override this via parameter_defaults
    default: []
    description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
    type: json
  EC2MetadataIp: # Override this via parameter_defaults
    description: The IP address of the EC2 metadata server.
    type: string
  StorageInterfaceRoutes:
    default: []
    description: >
      Routes for the storage network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json
  StorageMgmtInterfaceRoutes:
    default: []
    description: >
      Routes for the storage_mgmt network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json
  InternalApiInterfaceRoutes:
    default: []
    description: >
      Routes for the internal_api network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json
  TenantInterfaceRoutes:
    default: []
    description: >
      Routes for the tenant network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json
  ExternalInterfaceRoutes:
    default: []
    description: >
      Routes for the external network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json
  ManagementInterfaceRoutes:
    default: []
    description: >
      Routes for the management network traffic.
      JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
      Unless the default is changed, the parameter is automatically resolved
      from the subnet host_routes attribute.
    type: json

resources:
  OsNetConfigImpl:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
          str_replace:
              template:
                  get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
              params:
                   $network_config:
                       network_config:
                        -
                          type: interface
                          name: nic1
                          use_dhcp: false
                          dns_servers:
                              get_param: DnsServers
                          addresses:
                            -
                              ip_netmask:
                                list_join:
                                  - '/'
                                  - - get_param: ControlPlaneIp
                                    - get_param: ControlPlaneSubnetCidr
                          routes:
                            -
                              ip_netmask: 0.0.0.0/0
                              next_hop:
                                  get_param: ControlPlaneDefaultRoute

                              # Optionally have this interface as default route
                              default: true
                            -
                              ip_netmask: 169.254.169.254/32
                              next_hop:
                                  get_param: EC2MetadataIp
                        -
                          type: ovs_bridge
                          name: br-isolated
                          use_dhcp: false
                          members:
                            -
                              type: interface
                              name: nic2
                              # force the MAC address of the bridge to this interface
                              primary: true
                            -
                              type: vlan
                              vlan_id:
                                  get_param: InternalApiNetworkVlanID
                              addresses:
                              -
                                ip_netmask:
                                    get_param: InternalApiIpSubnet
                              routes: []
                            -
                              type: vlan
                              vlan_id:
                                  get_param: StorageNetworkVlanID
                              addresses:
                              -
                                ip_netmask:
                                    get_param: StorageIpSubnet
                              routes: []
                            -
                              type: vlan
                              vlan_id:
                                  get_param: TenantNetworkVlanID
                              addresses:
                              -
                                ip_netmask:
                                    get_param: TenantIpSubnet
                              routes: []
                        -
                          type: interface
                          name: nic3
                          use_dhcp: false

outputs:
  OS::stack_id:
    description: The OsNetConfigImpl resource.
    value:
        get_resource: OsNetConfigImpl

Comment 6 errata-xmlrpc 2019-01-11 11:53:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:0045


Note You need to log in before you can comment on or make changes to this bug.