Render isolated network templates using jinja2
[apex-tripleo-heat-templates.git] / network / ports / port.network.j2.yaml
1 heat_template_version: pike
2
3 description: >
4   Creates a port on the {{network.name}} network. The IP address will be chosen
5   automatically if FixedIPs is empty.
6
7 parameters:
8   {{network.name}}NetName:
9     description: Name of the {{network.name_lower}} neutron network
10     default: {{network.name_lower|default(network.name|lower)}}
11     type: string
12   PortName:
13     description: Name of the port
14     default: ''
15     type: string
16   ControlPlaneIP: # Here for compatibility with noop.yaml
17     description: IP address on the control plane
18     default: ''
19     type: string
20   ControlPlaneNetwork: # Here for compatibility with ctlplane_vip.yaml
21     description: The name of the undercloud Neutron control plane
22     default: ctlplane
23     type: string
24   FixedIPs:
25     description: >
26         Control the IP allocation for the VIP port. E.g.
27         [{'ip_address':'1.2.3.4'}]
28     default: []
29     type: json
30   IPPool: # Here for compatibility with from_pool.yaml
31     default: {}
32     type: json
33   NodeIndex: # Here for compatibility with from_pool.yaml
34     default: 0
35     type: number
36
37 resources:
38
39   {{network.name}}Port:
40     type: OS::Neutron::Port
41     properties:
42       network: {get_param: {{network.name}}NetName}
43       name: {get_param: PortName}
44       fixed_ips: {get_param: FixedIPs}
45       replacement_policy: AUTO
46
47 outputs:
48   ip_address:
49     description: {{network.name}} network IP
50     value: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
51   ip_address_uri:
52 {%- if network.ipv6  %}
53     description: {{network.name}} network IP (with brackets for IPv6 URLs)
54     value:
55           list_join:
56           - ''
57           - - '['
58             - {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
59             - ']'
60 {%- else %}
61     description: {{network.name}} network IP (for compatibility with IPv6 URLs)
62     value: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
63 {%-  endif %}
64   ip_subnet:
65     description: IP/Subnet CIDR for the {{network.name}} network IP
66     value:
67           list_join:
68             - ''
69             - - {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
70               - '/'
71               - {str_split: ['/', {get_attr: [{{network.name}}Port, subnets, 0, cidr]}, 1]}
72