heat_template_version: 2015-04-30

description: >
  External network. Public traffic, Neutron l3router for floating IPs/SNAT, etc.

parameters:
  # the defaults here work for static IP assignment (IPAM) only
  ExternalNetCidr:
    # OpenStack uses the EUI-64 address format, which requires a /64 prefix
    default: '2001:db8:fd00:1000::/64'
    description: Cidr for the external network.
    type: string
  ExternalNetValueSpecs:
    default: {'provider:physical_network': 'external', 'provider:network_type': 'flat'}
    description: Value specs for the external network.
    type: json
  ExternalNetAdminStateUp:
    default: false
    description: This admin state of of the network.
    type: boolean
  ExternalNetShared:
    default: false
    description: Whether this network is shared across all tenants.
    type: boolean
  ExternalNetName:
    default: external
    description: The name of the external network.
    type: string
  ExternalSubnetName:
    default: external_subnet
    description: The name of the external subnet in Neutron.
    type: string
  ExternalAllocationPools:
    default: [{'start': '2001:db8:fd00:1000::10', 'end': '2001:db8:fd00:1000:ffff:ffff:ffff:fffe'}]
    description: Ip allocation pool range for the external network.
    type: json
  IPv6AddressMode:
    default: dhcpv6-stateful
    description: Neutron subnet IPv6 address mode
    type: string
  IPv6RAMode:
    default: dhcpv6-stateful
    description: Neutron subnet IPv6 router advertisement mode
    type: string
  ExternalInterfaceDefaultRoute:
    default: '2001:db8:fd00:1000::1'
    description: default route for the external network
    type: string

resources:
  ExternalNetwork:
    type: OS::Neutron::Net
    properties:
      admin_state_up: {get_param: ExternalNetAdminStateUp}
      name: {get_param: ExternalNetName}
      shared: {get_param: ExternalNetShared}
      value_specs: {get_param: ExternalNetValueSpecs}

  ExternalSubnet:
    type: OS::Neutron::Subnet
    properties:
      ip_version: 6
      ipv6_address_mode: {get_param: IPv6AddressMode}
      ipv6_ra_mode: {get_param: IPv6RAMode}
      cidr: {get_param: ExternalNetCidr}
      name: {get_param: ExternalSubnetName}
      network: {get_resource: ExternalNetwork}
      allocation_pools: {get_param: ExternalAllocationPools}
      gateway_ip: {get_param: ExternalInterfaceDefaultRoute}

outputs:
  OS::stack_id:
    description: Neutron external network
    value: {get_resource: ExternalNetwork}
