Ask Your Question
0

HEAT/YAML mixing explicit entries and for_each construct.

asked 2015-06-19 00:23:19 -0500

Murali G D gravatar image

Hi,

Please see following YAML Template

heat_template_version: 2015-04-30
description: Distributed Appliance
parameters:
  image:
    type: string
    description: Image used for servers
    default: 5d2ef44f-e2cb-4292-99cc-b282a0b5730f
  flavor:
    type: string
    description: flavor used by the servers
    default: DefaultFlavorTemplate
  user_data:
    type: string
    description: Server user_data
    default: HelloWorld
  mgmt_network:
    type: string
    description: Mgmt Network used by the server
    default: '67cbf03b-a8c9-4869-8a7c-ed0a52ee64a3'
  mgmt_fabric_network:
    type: string
    description: Fabric Mgmt Network used by the server
    default: '6f7f1f0e-dd98-4e24-aca3-824403feebdb'
  data_fabric_network:
    type: string
    description: Fabric Data Network used by the server
    default: '5d789666-7e58-40f4-bd35-885fc98f46f4'
  external_networks:
    type: string
    type: comma_delimited_list
    label: external networks
    default: 'fa0669c0-14b0-499a-bd53-735110ee40ca,3e393ce9-1526-4a1e-a654-efbd2779f438'

resources:
  server:
    type: OS::Nova::Server
    properties:
      flavor: {get_param: flavor}
      image: {get_param: image}
      user_data: {get_param: user_data}
      user_data_format: RAW

      networks: #Option1
       - network: {get_param: mgmt_network}
       - network: {get_param: mgmt_fabric_network}
       - network: {get_param: data_fabric_network}
       repeat:
        for_each:
         extnetwork%: {get_param: external_networks}
        template:
         network: extnetwork%

      networks: #Option2
       repeat:
        for_each:
         extnetwork%: {get_param: mgmt_network} {get_param: mgmt_fabric_network} {get_param: data_fabric_network} {get_param: external_networks}
        template:
         network: extnetwork%

      networks: #Option3
       repeat:
        for_each:
         extnetwork%: {list_join: [',' , [{get_param: mgmt_network} , {get_param: mgmt_fabric_network} , {get_param: data_fabric_network} , {get_param: external_networks} ]]}
        template:
         network: extnetwork%

outputs:
  server_ip:
    description: IP Address of the server.
    value: { get_attr: [server, first_address] }

Basically I want my Nova::Server to be connected to networks in order of - mgmt_network, mgmt_fabric_network, data_fabric_network and then a comma separated list of other external_networks as mentioned in parameters defaults. I am not able to achieve this. I have mentioned 3 options I tried under networks but none of them worked for me.

Please help.

OpenStack Version: Kilo. HEAT 0.3.0.

Regards, Murali G D

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-05 18:17:12 -0500

Steve Baker gravatar image

Options 1 and 2 are not valid YAML. Kilo is missing a str_split function, which would be needed to get option 3 working.

At this point my only practical suggestion would be passing all your networks in a single networks comma_delimited_list param.

edit flag offensive delete link more

Comments

Thank you for your reply. I've got a question. For example, I have two network lists: network_list1:{"node1": "192.168.1.1", "node2":"192.168.1.2"} network_list2:{"node1": "192.168.1.3", "node2":"192.168.1.4"}

The number of Key:Value pairs in network_list1 and network_list2 are not limited to 2.

Jeffrey Guan gravatar imageJeffrey Guan ( 2016-01-20 08:20:01 -0500 )edit

The number of Key:Value pairs depends the users input. Sometimes there are 3 Key:Value pairs or 4 Key:Value pairs. All in all, the number of Key:Value pairs are not a constant.

In this scenario, how can I pass network_list1 and network_list2 in a single networks comma_delimited_list param?

Jeffrey Guan gravatar imageJeffrey Guan ( 2016-01-20 08:22:27 -0500 )edit

Thank you very much

Jeffrey Guan gravatar imageJeffrey Guan ( 2016-01-20 08:22:35 -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

2 followers

Stats

Asked: 2015-06-19 00:23:19 -0500

Seen: 598 times

Last updated: Jul 05 '15