Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Adding dynamic network interfaces using HEAT template

HI - Request a help. I need to add dynamic number of network interfaces to an instance via HEAT template. As of now, I have a template which adds one network interface for an instance using OS::Neutron::Port as below.

    #Create a port on the external public network    
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

# Create a single signaling server
extServer:
    type: OS::Nova::Server
    depends_on: [ extPort ]
    properties:
        image: { get_param: image }
        flavor: { get_param: flavor }
        name:  { get_param: [ vmNames, get_param: index ] }

        networks:
            - port: { get_resource: extPort }

Now I have a requirement that based on the input via the environment file, I need to add that many number of same network interfaces. I have tried like this:

        environment file:
        # Network name is ext-public
        networklist: ext-public,ext-public,ext-public

        Template file:

        # Create a port on the external public network
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

        # Create a single signaling server
        extServer:
            type: OS::Nova::Server
            depends_on: [ extPort ]
            properties:
                image: { get_param: image }
                flavor: { get_param: flavor }

                networks:
                    repeat:
                        for_each:
                            <%port%>: { get_param: networklist }      
                        template:
                            port: { get_resource: <%port%> }

This code gives the following error:

ERROR: Failed to validate: Failed to validate: resources[0]: The specified reference "<%port%>" (in signalingServer.Properties.networks.repeat.template.port) is incorrect.

How can I make it work to achieve dynamic number of interfaces from a OS::Neutron::Port resource?

Thank You, Subeesh

Adding dynamic network interfaces using HEAT template

HI - Request a help. I need to add dynamic number of network interfaces to an instance via HEAT template. As of now, I have a template which adds one network interface for an instance using OS::Neutron::Port as below.

    #Create a port on the external public network    
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

# Create a single signaling server
extServer:
    type: OS::Nova::Server
    depends_on: [ extPort ]
    properties:
        image: { get_param: image }
        flavor: { get_param: flavor }
        name:  { get_param: [ vmNames, get_param: index ] }

        networks:
            - port: { get_resource: extPort }

Now I have a requirement that based on the input via the environment file, I need to add that many number of same network interfaces. I have tried like this:

        environment file:
        # Network name is ext-public
        networklist: ext-public,ext-public,ext-public

        Template file:

        # Create a port on the external public network
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

        # Create a single signaling server
        extServer:
            type: OS::Nova::Server
            depends_on: [ extPort ]
            properties:
                image: { get_param: image }
                flavor: { get_param: flavor }

                networks:
                    repeat:
                        for_each:
                            <%port%>: { get_param: networklist }      
                        template:
                            port: { get_resource: <%port%> }

This code gives the following error:

ERROR: Failed to validate: Failed to validate: resources[0]: The specified reference "<%port%>" (in signalingServer.Properties.networks.repeat.template.port) is incorrect.

How can I make it work to achieve dynamic number of interfaces from a OS::Neutron::Port resource?

Thank You, Subeesh

UPDATE: I have 2 more questions, related. Kindly help:

1) If I create dynamic number of networks, I have a requirement of making a JSON file and provide these interface details in the json and place it in the created instance via user data. Something like:

etho : ip1, eth1 : ip2, eth2 : ip3, .............

How can I do this? Do we have a "loop" in outputs section also? If yes, can I loop through the networks via get_attr and assign to dynamically created variables in the stack output?

2) My requirement is to create multiple interfaces. Among these, can I make 2 interfaces static. And rest of the networks creation based on the user input from environment file ?

Like , etho = ext-net1 (This is known in advance, and hence I can hard-code this)
eth1 = ext-net2 (This is known in advance, and hence I can hard-code this)
eth2 = To be configured based on the network provided by user in environment file
eth3 = To be configured based on the network provided by user in environment file
.....................................................................................................

Sorry for long questions. Any help/direction will be really helpful. Thank you.

Adding dynamic network interfaces using HEAT template

HI - Request a help. I need to add dynamic number of network interfaces to an instance via HEAT template. As of now, I have a template which adds one network interface for an instance using OS::Neutron::Port as below.

    #Create a port on the external public network    
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

# Create a single signaling server
extServer:
    type: OS::Nova::Server
    depends_on: [ extPort ]
    properties:
        image: { get_param: image }
        flavor: { get_param: flavor }
        name:  { get_param: [ vmNames, get_param: index ] }

        networks:
            - port: { get_resource: extPort }

Now I have a requirement that based on the input via the environment file, I need to add that many number of same network interfaces. I have tried like this:

        environment file:
        # Network name is ext-public
        networklist: ext-public,ext-public,ext-public

        Template file:

        # Create a port on the external public network
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

        # Create a single signaling server
        extServer:
            type: OS::Nova::Server
            depends_on: [ extPort ]
            properties:
                image: { get_param: image }
                flavor: { get_param: flavor }

                networks:
                    repeat:
                        for_each:
                            <%port%>: { get_param: networklist }      
                        template:
                            port: { get_resource: <%port%> }

This code gives the following error:

ERROR: Failed to validate: Failed to validate: resources[0]: The specified reference "<%port%>" (in signalingServer.Properties.networks.repeat.template.port) is incorrect.

How can I make it work to achieve dynamic number of interfaces from a OS::Neutron::Port resource?

Thank You, Subeesh

UPDATE: I have 2 more questions, related. Kindly help:

1) If I create dynamic number of networks, I have a requirement of making a JSON file and provide these interface details in the json and place it in the created instance via user data. Something like:

etho : ip1, eth1 : ip2, eth2 : ip3, .............

How can I do this? Do we have a "loop" in outputs section also? If yes, can I loop through the networks via get_attr and assign to dynamically created variables in the stack output?

2) My requirement is to create multiple interfaces. Among these, can I make 2 interfaces static. And rest of the networks creation based on the user input from environment file ?

Like , etho = ext-net1 (This is known in advance, and hence I can hard-code this)
eth1 = ext-net2 (This is known in advance, and hence I can hard-code this)
eth2 = To be configured based on the network provided by user in environment file
eth3 = To be configured based on the network provided by user in environment file
.....................................................................................................

Sorry for long questions. Any help/direction will be really helpful. Thank you.strong text

Adding dynamic network interfaces using HEAT template

HI - Request a help. I need to add dynamic number of network interfaces to an instance via HEAT template. As of now, I have a template which adds one network interface for an instance using OS::Neutron::Port as below.

    #Create a port on the external public network    
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

# Create a single signaling server
extServer:
    type: OS::Nova::Server
    depends_on: [ extPort ]
    properties:
        image: { get_param: image }
        flavor: { get_param: flavor }
        name:  { get_param: [ vmNames, get_param: index ] }

        networks:
            - port: { get_resource: extPort }

Now I have a requirement that based on the input via the environment file, I need to add that many number of same network interfaces. I have tried like this:

        environment file:
        # Network name is ext-public
        networklist: ext-public,ext-public,ext-public

        Template file:

        # Create a port on the external public network
        extPort:
            type: OS::Neutron::Port
            properties:
                network: { get_param: extPublicNetwork }
                port_security_enabled: false

        # Create a single signaling server
        extServer:
            type: OS::Nova::Server
            depends_on: [ extPort ]
            properties:
                image: { get_param: image }
                flavor: { get_param: flavor }

                networks:
                    repeat:
                        for_each:
                            <%port%>: { get_param: networklist }      
                        template:
                            port: { get_resource: <%port%> }

This code gives the following error:

ERROR: Failed to validate: Failed to validate: resources[0]: The specified reference "<%port%>" (in signalingServer.Properties.networks.repeat.template.port) is incorrect.

How can I make it work to achieve dynamic number of interfaces from a OS::Neutron::Port resource?

Thank You, Subeesh

UPDATE: I have 2 more questions, related. Kindly help:

1) If I create dynamic number of networks, I have a requirement of making a JSON file and provide these interface details in the json and place it in the created instance via user data. Something like:

etho : ip1, eth1 : ip2, eth2 : ip3, .............

How can I do this? Do we have a "loop" in outputs section also? If yes, can I loop through the networks via get_attr and assign to dynamically created variables in the stack output?

2) My requirement is to create multiple interfaces. Among these, can I make 2 interfaces static. And rest of the networks creation based on the user input from environment file ?

Like , etho = ext-net1 (This is known in advance, and hence I can hard-code this)
eth1 = ext-net2 (This is known in advance, and hence I can hard-code this)
eth2 = To be configured based on the network provided by user in environment file
eth3 = To be configured based on the network provided by user in environment file
.....................................................................................................

Sorry for long questions. Any help/direction will be really helpful. Thank you.strong text