# Map all ports by role and network to their equivalent
# deployed_<network.name_lower>.yaml template.
resource_registry:
  # Port assignments for the VIPs
  {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
  OS::TripleO::Network::Ports::{{network.name}}VipPort: ../network/ports/deployed_vip_{{network.name_lower|default(network.name.lower())}}.yaml
  {%- endfor %}

  {%- for role in roles %}
  {%-     if role.networks is mapping %}
  {%-         set _role_networks = [] %}
  {%-         for key, _ in role.networks.items() %}
  {%-             set _ = _role_networks.append(key) %}
  {%-         endfor %}
  {%-     else %}
  {%-         set _role_networks = role.networks %}
  {%-     endif %}
  # Port assignments for the {{role.name}}
  {%-     for network in networks %}
  {%-         if network.name in _role_networks and network.enabled|default(true) %}
  OS::TripleO::{{role.name}}::Ports::{{network.name}}Port: ../network/ports/deployed_{{network.name_lower|default(network.name.lower())}}.yaml
  {%-         endif %}
  {%-     endfor %}
  {%- endfor %}