From e148ac870b4058d70822ac3df4d1fe512cd44303 Mon Sep 17 00:00:00 2001 From: Dan Sneddon Date: Tue, 15 Aug 2017 11:39:53 -0700 Subject: Render IP map and host maps according to network_data.yaml This change renders the network IP maps and hostname maps for all networks defined in network_data.yaml. This should make it possible to create custom networks that will be rendered for all applicable roles. Note that at this time all networks will be rendered whether they are enabled or not. All networks will be present in all roles, but ports will be associated with noop.yaml in roles that do not use the network. This is in accordance with previous behavior, although we may wish to change this in the future to limit the size of the role definitions and reduce the number of placeholder resources in deployments with many networks. Note that this patch is a replacement for original patch https://review.openstack.org/#/c/486280, which I was having trouble rebasing to current. Change-Id: I445b008fc1240af57c2b76a5dbb6c751a05b7a2a Depends-on: I662e8d0b3737c7807d18c8917bfce1e25baa3d8a Partially-implements: blueprint composable-networks --- network/ports/net_ip_map.j2.yaml | 81 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 network/ports/net_ip_map.j2.yaml (limited to 'network/ports/net_ip_map.j2.yaml') diff --git a/network/ports/net_ip_map.j2.yaml b/network/ports/net_ip_map.j2.yaml new file mode 100644 index 00000000..f01d624a --- /dev/null +++ b/network/ports/net_ip_map.j2.yaml @@ -0,0 +1,81 @@ +heat_template_version: pike + +parameters: + ControlPlaneIp: + default: '' + type: string + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string +{%- for network in networks %} + {{network.name}}Ip: + default: '' + type: string + {{network.name}}IpSubnet: + description: 'IP address/subnet on the {{network.name_lower}} network' + default: '' + type: string + {{network.name}}IpUri: + default: '' + type: string + description: IP address with brackets in case of IPv6 +{%- endfor %} + +{%- for network in networks %} + {{network.name}}NetName: + default: {{network.name_lower}} + description: The name of the {{network.name_lower}} network. + type: string +{%- endfor %} + +resources: + + NetIpMapValue: + type: OS::Heat::Value + properties: + type: json + value: + map_replace: + - ctlplane: {get_param: ControlPlaneIp} +{%- for network in networks %} + {{network.name_lower}}: {get_param: {{network.name}}Ip} +{%- endfor %} + ctlplane_subnet: + list_join: + - '' + - - {get_param: ControlPlaneIp} + - '/' + - {get_param: ControlPlaneSubnetCidr} +{%- for network in networks %} + {{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet} +{%- endfor %} + ctlplane_uri: {get_param: ControlPlaneIp} +{%- for network in networks %} + {{network.name_lower}}_uri: {get_param: {{network.name}}IpUri} +{%- endfor %} + - keys: +{%- for network in networks %} + {{network.name_lower}}: {get_param: {{network.name}}NetName} +{%- endfor %} +{%- for network in networks %} + {{network.name_lower}}_subnet: + str_replace: + template: NAME_subnet + params: + NAME: {get_param: {{network.name}}NetName} +{%- endfor %} +{%- for network in networks %} + {{network.name_lower}}_uri: + str_replace: + template: NAME_uri + params: + NAME: {get_param: {{network.name}}NetName} +{%- endfor %} + +outputs: + net_ip_map: + description: > + A Hash containing a mapping of network names to assigned IPs + for a specific machine. + value: {get_attr: [NetIpMapValue, value]} -- cgit 1.2.3-korg