[openstack-dev] [tripleo][tripleo-heat-template] how to get interface name from network name in service profile

Zenghui Shi zshi at redhat.com
Thu Jul 27 09:04:14 UTC 2017


Hi,

Could anyone shed some light on how to get the physical interface name (e.g
eth0) from network name (e.g PublicNetwork, ExternalNetwork) in
tripleo-heat-template service profile ?

for example:

I want to add a service profile under puppet/services/time/ptp.pp where it
uses 'PtpInterface' as a parameter to get physical interface name (please
refer to below piece of code), but I'd like to expose a more user friendly
parameter like NetworkName(e.g. provision network, external network etc)
instead of 'PtpInterface' and retrieve the actual physical interface name
from the NetworkName where the physical interface is connected to, is there
any possible way to do this ?

####
parameters:
[...]
  PtpInterface:      #  ---> change this parameter to PtpNetwork
    default: eth0
    description: PTP interfaces name.
    type: string

resources:
  RoleParametersValue
    type: OS::Heat::Value
    properties:
      type: json
      value:             # ---> add logic to get real interface name from
PtpNetwork
        map_replace:
          - map_replace:
            - tripleo::profile::base::time::ptp::ptp4l_interface:
PtpInterface
            - values: {get_param: [RoleParameters]}
          - values:
              PtpInterface: {get_param: PtpInterface}

outputs:
  role_data:
    description: Role ptp using commposable services.
    value:
      service_name: ptp
      config_settings:
        map_merge:
          - get_attr: [RoleParametersValue, value]
[...]
####

Thanks!
zenghui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170727/822e9fd6/attachment.html>


More information about the OpenStack-dev mailing list