heat_template_version: pike

description: Configure hieradata for Cisco N1KV configuration

parameters:
  server:
    description: ID of the controller node to apply this config to
    type: string

  # Config specific parameters, to be provided via parameter_defaults
  N1000vVSMIP:
    type: string
    default: '192.168.24.50'
  N1000vVSMDomainID:
    type: number
    default: 100
  N1000vVSMIPV6:
    type: string
    default: '::1'
  N1000vVEMHostMgmtIntf:
    type: string
    default: 'br-ex'
  N1000vUplinkProfile:
    type: string
    default: '{eth1: system-uplink,}'
  N1000vVtepConfig:
    type: string
    default: '{}'
  N1000vVEMSource:
    type: string
    default: ''
  N1000vVEMVersion:
    type: string
    default: ''
  N1000vPortDB:
    type: string
    default: 'ovs'
  N1000vVtepsInSameSub:
    type: boolean
    default: false
  N1000vVEMFastpathFlood:
    type: string
    default: 'enable'
#VSM Puppet Parameter
  N1000vVSMSource:
    type: string
    default: ''
  N1000vVSMVersion:
    type: string
    default: 'latest'
  N1000vVSMHostMgmtIntf:
    type: string
    default: 'br-ex'
  N1000vVSMRole:
    type: string
    default: 'primary'
  N1000vVSMPassword:
    type: string
    default: 'Password'
  N1000vMgmtNetmask:
    type: string
    default: '255.255.255.0'
  N1000vMgmtGatewayIP:
    type: string
    default: '192.168.24.1'
  N1000vPacemakerControl:
    type: boolean
    default: true
  N1000vExistingBridge:
    type: boolean
    default: true
  N1000vVSMHostMgmtIntfVlan:
    type: number
    default: 0
#Plugin Parameters
  N1000vVSMUser:
    type: string
    default: 'admin'
  N1000vPollDuration:
    type: number
    default: 60
  N1000vHttpPoolSize:
    type: number
    default: 5
  N1000vHttpTimeout:
    type: number
    default: 15
  N1000vSyncInterval:
    type: number
    default: 300
  N1000vMaxVSMRetries:
    type: number
    default: 2

resources:
  CiscoN1kvConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: hiera
      config:
        datafiles:
          cisco_n1kv_data:
            mapped_data:
              #enable_cisco_n1kv: {get_input: EnableCiscoN1kv}
              # VEM Parameters
              n1kv_vem_source: {get_input: n1kv_vem_source}
              n1kv_vem_version: {get_input: n1kv_vem_version}
              neutron::agents::n1kv_vem::n1kv_vsm_ip: {get_input: n1kv_vsm_ip}
              neutron::agents::n1kv_vem::n1kv_vsm_domain_id: {get_input: n1kv_vsm_domain_id}
              neutron::agents::n1kv_vem::n1kv_vsm_ip_v6: {get_input: n1kv_vsm_ip_v6}
              neutron::agents::n1kv_vem::host_mgmt_intf: {get_input: n1kv_vem_host_mgmt_intf}
              neutron::agents::n1kv_vem::uplink_profile: {get_input: n1kv_vem_uplink_profile}
              neutron::agents::n1kv_vem::vtep_config: {get_input: n1kv_vem_vtep_config}
              neutron::agents::n1kv_vem::portdb: {get_input: n1kv_vem_portdb}
              neutron::agents::n1kv_vem::vteps_in_same_subnet: {get_input: n1kv_vem_vteps_in_same_subnet}
              neutron::agents::n1kv_vem::fastpath_flood: {get_input: n1kv_vem_fastpath_flood}
              #VSM Parameter
              n1kv_vsm_source: {get_input: n1kv_vsm_source}
              n1kv_vsm_version: {get_input: n1kv_vsm_version}
              n1k_vsm::phy_if_bridge: {get_input: n1kv_vsm_host_mgmt_intf}
              n1k_vsm::vsm_role: {get_input: n1kv_vsm_role}
              n1k_vsm::pacemaker_control: {get_input: n1kv_vsm_pacemaker_ctrl}
              n1k_vsm::existing_bridge: {get_input: n1kv_vsm_existing_br}
              n1k_vsm::vsm_admin_passwd: {get_input: n1kv_vsm_password}
              n1k_vsm::vsm_domain_id: {get_input: n1kv_vsm_domain_id}
              n1k_vsm::vsm_mgmt_ip: {get_input: n1kv_vsm_ip}
              n1k_vsm::vsm_mgmt_netmask: {get_input: n1kv_vsm_mgmt_netmask}
              n1k_vsm::vsm_mgmt_gateway: {get_input: n1kv_vsm_gateway_ip}
              n1k_vsm::phy_gateway: {get_input: n1kv_vsm_gateway_ip}
              n1k_vsm::phy_bridge_vlan: {get_input: n1kv_phy_brige_vlan}
              # Cisco N1KV driver Parameters
              neutron::plugins::ml2::cisco::nexus1000v::n1kv_vsm_ip: {get_input: n1kv_vsm_ip}
              neutron::plugins::ml2::cisco::nexus1000v::n1kv_vsm_username: {get_input: n1kv_vsm_username}
              neutron::plugins::ml2::cisco::nexus1000v::n1kv_vsm_password: {get_input: n1kv_vsm_password}
              neutron::plugins::ml2::cisco::nexus1000v::poll_duration: {get_input: n1kv_vsm_poll_duration}
              neutron::plugins::ml2::cisco::nexus1000v::http_pool_size: {get_input: n1kv_vsm_http_pool_size}
              neutron::plugins::ml2::cisco::nexus1000v::http_timeout: {get_input: n1kv_vsm_http_timeout}
              neutron::plugins::ml2::cisco::nexus1000v::n1kv_vsm_sync_interval: {get_input: n1kv_vsm_sync_interval}
              neutron::plugins::ml2::cisco::nexus1000v::max_vsm_retries: {get_input: n1kv_max_vsm_retries}

  CiscoN1kvDeployment:
    type: OS::Heat::StructuredDeployment
    properties:
      name: CiscoN1kvDeployment
      config: {get_resource: CiscoN1kvConfig}
      server: {get_param: server}
      input_values:
        n1kv_vsm_ip: {get_param: N1000vVSMIP}
        n1kv_vsm_domain_id: {get_param: N1000vVSMDomainID}
        n1kv_vsm_ip_v6: {get_param: N1000vVSMIPV6}
        n1kv_vem_host_mgmt_intf: {get_param: N1000vVEMHostMgmtIntf}
        n1kv_vem_uplink_profile: {get_param: N1000vUplinkProfile}
        n1kv_vem_vtep_config: {get_param: N1000vVtepConfig}
        n1kv_vem_source: {get_param: N1000vVEMSource}
        n1kv_vem_version: {get_param: N1000vVEMVersion}
        n1kv_vem_portdb: {get_param: N1000vPortDB}
        n1kv_vem_vteps_in_same_subnet: {get_param: N1000vVtepsInSameSub}
        n1kv_vem_fastpath_flood: {get_param: N1000vVEMFastpathFlood}
        n1kv_vsm_source: {get_param: N1000vVSMSource}
        n1kv_vsm_version: {get_param: N1000vVSMVersion}
        n1kv_vsm_host_mgmt_intf: {get_param: N1000vVSMHostMgmtIntf}
        n1kv_vsm_role: {get_param: N1000vVSMRole}
        n1kv_vsm_password: {get_param: N1000vVSMPassword}
        n1kv_vsm_mgmt_netmask: {get_param: N1000vMgmtNetmask}
        n1kv_vsm_gateway_ip: {get_param: N1000vMgmtGatewayIP}
        n1kv_phy_brige_vlan: {get_param: N1000vVSMHostMgmtIntfVlan}
        n1kv_vsm_pacemaker_ctrl: {get_param: N1000vPacemakerControl}
        n1kv_vsm_existing_br: {get_param: N1000vExistingBridge}
        n1kv_vsm_username: {get_param: N1000vVSMUser}
        n1kv_vsm_poll_duration: {get_param: N1000vPollDuration}
        n1kv_vsm_http_pool_size: {get_param: N1000vHttpPoolSize}
        n1kv_vsm_http_timeout: {get_param: N1000vHttpTimeout}
        n1kv_vsm_sync_interval: {get_param: N1000vSyncInterval}
        n1kv_max_vsm_retries: {get_param: N1000vMaxVSMRetries}

outputs:
  deploy_stdout:
    description: Deployment reference, used to trigger puppet apply on changes
    value: {get_attr: [CiscoN1kvDeployment, deploy_stdout]}
