OS::Neutron::RouterInterface needs "port_id" property

Bug #1223733 reported by Mitsuru Kanabuchi
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
JunJie Nan

Bug Description

I tried to create subnet resource and connect multiple routers through heat template.
However it is failed, because "OS::Neutron::RouterInterface" doesn't have "port_id" property.

In my understand, when use "subnet_id" for to connect subnet, neutron acquire "gateway_ip" automatically.
The "gateway_ip" is only one property of each subnets.
It means, multiple routers can't connect same subnet in this method.

I think, it can resolve to add "port_id" property to "OS::Neutron::RouterInterface".

The command line example that used neutron is:
========================================================================
$ neutron router-create router1
Created a new router:
+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| admin_state_up | True |
| external_gateway_info | |
| id | ae478782-53c0-4434-ab16-49900c88016c |
| name | router1 |
| status | ACTIVE |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+-----------------------+--------------------------------------+
$ neutron router-create router2
Created a new router:
+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| admin_state_up | True |
| external_gateway_info | |
| id | a47942c5-9f8f-46d0-a6c4-84624272af11 |
| name | router2 |
| status | ACTIVE |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+-----------------------+--------------------------------------+
$ neutron net-create net
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| id | 918d2f8c-8c4f-4cc2-acdd-434b68ce6661 |
| name | net |
| provider:network_type | vlan |
| provider:physical_network | default |
| provider:segmentation_id | 1000 |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+---------------------------+--------------------------------------+
$ neutron subnet-create net 192.168.0.0/24
Created a new subnet:
+------------------+--------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------+
| allocation_pools | {"start": "192.168.0.2", "end": "192.168.0.254"} |
| cidr | 192.168.0.0/24 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 192.168.0.1 |
| host_routes | |
| id | d6b6108e-0f67-4f48-8cdc-16610d3415b9 |
| ip_version | 4 |
| name | |
| network_id | 918d2f8c-8c4f-4cc2-acdd-434b68ce6661 |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+------------------+--------------------------------------------------+
$ neutron port-create net
Created a new port:
+----------------------+------------------------------------------------------------------------------------+
| Field | Value |
+----------------------+------------------------------------------------------------------------------------+
| admin_state_up | True |
| binding:capabilities | {"port_filter": false} |
| binding:host_id | |
| binding:vif_type | bridge |
| device_id | |
| device_owner | |
| fixed_ips | {"subnet_id": "d6b6108e-0f67-4f48-8cdc-16610d3415b9", "ip_address": "192.168.0.2"} |
| id | e7183085-2f48-4bb7-ae73-8d3e7915cad5 |
| mac_address | fa:16:3e:c0:20:44 |
| name | |
| network_id | 918d2f8c-8c4f-4cc2-acdd-434b68ce6661 |
| status | DOWN |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+----------------------+------------------------------------------------------------------------------------+
$ neutron port-create net
Created a new port:
+----------------------+------------------------------------------------------------------------------------+
| Field | Value |
+----------------------+------------------------------------------------------------------------------------+
| admin_state_up | True |
| binding:capabilities | {"port_filter": false} |
| binding:host_id | |
| binding:vif_type | bridge |
| device_id | |
| device_owner | |
| fixed_ips | {"subnet_id": "d6b6108e-0f67-4f48-8cdc-16610d3415b9", "ip_address": "192.168.0.4"} |
| id | 9577cafd-8e98-4059-a2e6-8a771b4d318e |
| mac_address | fa:16:3e:47:b6:fe |
| name | |
| network_id | 918d2f8c-8c4f-4cc2-acdd-434b68ce6661 |
| status | DOWN |
| tenant_id | 616ffbe0c00d4cfc8ce6bc5e15de9337 |
+----------------------+------------------------------------------------------------------------------------+
$ neutron router-interface-add router1 port=e7183085-2f48-4bb7-ae73-8d3e7915cad5
Added interface e7183085-2f48-4bb7-ae73-8d3e7915cad5 to router router1.
$ neutron router-interface-add router2 port=9577cafd-8e98-4059-a2e6-8a771b4d318e
Added interface 9577cafd-8e98-4059-a2e6-8a771b4d318e to router router2.
========================================================================

From my personal point of view, "port_id" is essential property for general use cases.
Example for, the vm should be connect both Internet and maintainance network via different subnets.

Revision history for this message
JunJie Nan (nanjj) wrote :

Could you post your heat template to show the usage further?

JunJie Nan (nanjj)
Changed in heat:
assignee: nobody → Jun Jie Nan (nanjj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/50820

Changed in heat:
status: New → In Progress
Revision history for this message
Mitsuru Kanabuchi (kanabuchi) wrote :
Download full text (4.2 KiB)

Sorry for the delay.

I want to create virtual networks like follows:

==============================
{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Resources" : {
    "external": {
      "Type": "OS::Neutron::Net",
      "Properties": {
        "name": "external",
        "admin_state_up": true,
        "value_specs": {
          "provider:network_type": "vlan",
          "provider:physical_network": "default",
          "provider:segmentation_id": 1,
          "router:external": true
        }
      }
    },
    "external-sub": {
      "Type": "OS::Neutron::Subnet",
      "Properties": {
        "name": "external-sub",
        "network_id": { "Ref" : "external" },
        "ip_version": 4,
        "cidr": "172.16.0.0/24",
        "gateway_ip": "172.16.0.254",
        "enable_dhcp": false
      }
    },
    "internal": {
      "Type": "OS::Neutron::Net",
      "Properties": {
        "name": "internal",
        "admin_state_up": true,
        "value_specs": {
          "provider:network_type": "vlan",
          "provider:physical_network": "default",
          "provider:segmentation_id": 2,
          "router:external": false
        }
      }
    },
    "internal-sub": {
      "Type": "OS::Neutron::Subnet",
      "Properties": {
        "name": "internal-sub",
        "network_id": { "Ref" : "internal" },
        "ip_version": 4,
        "cidr": "10.0.0.0/24",
        "gateway_ip": "10.0.0.1",
        "enable_dhcp": false
      }
    },
    "tenant": {
      "Type": "OS::Neutron::Net",
      "Properties": {
        "name": "tenant",
        "admin_state_up": true,
        "value_specs": {
          "provider:network_type": "vlan",
          "provider:physical_network": "default",
          "provider:segmentation_id": 100,
          "router:external": false
        }
      }
    },
    "tenant-sub": {
      "Type": "OS::Neutron::Subnet",
      "Properties": {
        "name": "tenant-sub",
        "network_id": { "Ref" : "tenant" },
        "ip_version": 4,
        "cidr": "192.168.0.0/24",
        "gateway_ip": "192.168.0.1",
        "enable_dhcp": true,
        "value_specs": {
          "host_routes": [
            {
              "destination": "10.0.0.0/24",
              "nexthop": "192.168.0.254"
            }
          ]
        }
      }
    },
    "external-router": {
      "Type": "OS::Neutron::Router",
      "Properties": {
        "name": "external-router"
      }
    },
    "external-router-gateway": {
      "Type": "OS::Neutron::RouterGateway",
      "Properties": {
        "router_id": { "Ref" : "external-router" },
        "network_id": { "Ref" : "external" }
      }
    },
    "external-router-interface": {
      "Type": "OS::Neutron::RouterInterface",
      "Properties": {
        "router_id": { "Ref" : "external-router" },
        "subnet_id": { "Ref" : "tenant-sub" }
      }
    },
    "internal-router": {
      "Type": "OS::Neutron::Router",
      "Properties": {
        "name": "internal-router"
      }
    },
    "internal-router-interface-outer": {
      "Type": "OS::Neutron::RouterInterface",
      "Properties": {
        "router_id": { "Ref" : "internal-router" },
        "subnet_id": { "Ref" : "internal-sub" }
   ...

Read more...

Steven Hardy (shardy)
Changed in heat:
milestone: none → icehouse-1
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/50820
Committed: http://github.com/openstack/heat/commit/54d709d7501340c3fac9d42aa94b9fdf3d54e728
Submitter: Jenkins
Branch: master

commit 54d709d7501340c3fac9d42aa94b9fdf3d54e728
Author: JUN JIE NAN <email address hidden>
Date: Thu Oct 10 13:05:21 2013 +0800

    Add property port_id to RouterInterface

    Since neutron router-interface-add api supports subnet_id and and
    port_id so we should support it in heat resource RouterInterface.

    Fixes bug #1223733

    Change-Id: Ib0d7ffa3c478747a91b70beab4a78eadf7c9dfcb

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.