Ask Your Question

Heat and get_attr function

asked 2013-11-20 10:09:40 -0500

AJ gravatar image

Hello there. I've got a two node Openstack installation running Havana and LBaaS. I'm trying to figure out how to map a loadbalancer vip with a floating ip, within a Heat template. In order to do this, I believe I need to extract the "port_id" for the vip. First off, here's my LB pool definition:

    type: OS::Neutron::Pool
      name: magpool
      protocol: HTTP
      subnet_id: cb34b090-5efa-4661-afac-fcbdd7b0287d
      lb_method: ROUND_ROBIN
      monitors: [ { get_resource: monitor } ]
      vip: {"address":, "protocol_port": 80}

If I execute the following within the template, I get the entire listing of attributes:

{ get_attr: [ magpool, vip ] }

results in:

  "status": "ACTIVE", 
  "protocol_port": 80, 
  "protocol": "HTTP", 
  "description": "", 
  "admin_state_up": true, 
  "subnet_id": "cb34b090-5efa-4661-afac-fcbdd7b0287d", 
  "tenant_id": "1fac7f9bd4404e018f9f6cc4794656bb", 
  "connection_limit": -1, 
  "pool_id": "42a0fc62-913c-4a15-8d1a-05f4c5acb14e", 
  "address": "", 
  "status_description": null, 
  "port_id": "f8109af8-7528-4d42-b0ed-fc4ac28059e1", 
  "id": "9a2e7827-e337-4c5f-af43-49aa0d7ffca6", 
  "name": ""

Is there a way to extract only one of these attributes (i.e. "port_id") using the get_attr function? I've tried things similar to "{ get_attr: [ magpool, vip:port_id ] }" but I always end up with errors.

Thank you Tony

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-21 15:10:20 -0500

zaneb gravatar image

updated 2014-02-18 10:18:40 -0500

Yes, the Fn::Select function (we haven't come up with HOT-style syntax for this yet) will allow you to extract keys out of that dictionary. e.g.

{ Fn::Select: [ port_id, { get_attr: [ magpool, vip ] } ]

From the Icehouse release onwards, this will be available directly in get_attr:

{ get_attr: [magpool, vip, port_id] }
edit flag offensive delete link more


Thank you very much zaneb !!

AJ gravatar imageAJ ( 2013-11-22 11:40:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2013-11-20 10:09:40 -0500

Seen: 2,174 times

Last updated: Feb 18 '14