fixed_ips list order in OS::Neutron::Port

Bug #2006103 reported by Yi Song
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Heat Translator
New
Undecided
Unassigned

Bug Description

In heat template, fixed_ips property of OS::Neutron::Port resource is defined as a List value.
But we found the items in the List does NOT keep the order as Port created, but sort as dictionary order.

As the following heat template example, we created 2 ports, and each port has 2 ip_addresses. Note, for both ports, we put IPV4 as the first item in fixed_ips, and IPV6 as the second item. And the template will output both ports ip addresses.

=====================
# cat dual_stack.yaml
heat_template_version: 2015-04-30
resources:
  port1:
    type: OS::Neutron::Port
    properties:
      network: INTNET
      security_groups:
        - default
      fixed_ips:
        -
          subnet: e2cb995a-af24-466f-8500-8bf785d7f1cd
          ip_address: 192.168.1.66
        -
          subnet: d2a2979f-45a2-4aa3-99ab-47a746d76e13
          ip_address: 2001:db9::66
  port2:
    type: OS::Neutron::Port
    properties:
      network: INTNET6
      security_groups:
        - default
      fixed_ips:
        -
          subnet: 9d645e62-c473-4628-9307-f40c937c707d
          ip_address: 192.168.6.66
        -
          subnet: 0a9d5467-0371-40d1-a812-e942bb473d71
          ip_address: 1001:db8::66
outputs:
  data:
    value:
      port1_addresses:
        firstIP: { get_attr: [ port1, fixed_ips, 0, ip_address ]}
        secondIP: { get_attr: [ port1, fixed_ips, 1, ip_address ]}
      port2_addresses:
        firstIP: { get_attr: [ port2, fixed_ips, 0, ip_address ]}
        secondIP: { get_attr: [ port2, fixed_ips, 1, ip_address ]}
===================

Then, create the stack, and check stack output.

===================
# openstack stack create --template dual_stack.yaml dual_stack
# openstack stack show dual_stack
| outputs | - description: No description given |
| | output_key: data |
| | output_value: |
| | port1_addresses: |
| | firstIP: 192.168.1.66 |
| | secondIP: 2001:db9::66 |
| | port2_addresses: |
| | firstIP: 1001:db8::66 |
| | secondIP: 192.168.6.66
================

As you see, port1 shows the same IP order as template, but port2 does NOT.
And it looks the IPs are sorted by dictionary order.

Revision history for this message
Yi Song (songyi2k) wrote :

Sorry, just recognized this bug should be reported to heat, just created new one as below.
Please close this one.
https://storyboard.openstack.org/#!/story/2010568

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.