
{% set compute = salt['grains.filter_by']({
    'Debian': {
        'pkgs': ['neutron-openvswitch-agent', 'openvswitch-switch', 'openvswitch-datapath-dkms', 'python-pycadf'],
        'services': ['neutron-openvswitch-agent'],
        'audit': {
          'enabled': false
        }
    },
    'RedHat': {
        'pkgs': ['openstack-neutron-openvswitch', 'openvswitch', 'python-pycadf'],
        'services': ['neutron-openvswitch-agent'],
        'audit': {
          'enabled': false
        }
    },
}, merge=pillar.neutron.get('compute', {})) %}

{% set gateway = salt['grains.filter_by']({
    'Debian': {
        'pkgs': ['neutron-dhcp-agent', 'neutron-openvswitch-agent', 'neutron-l3-agent', 'openvswitch-common', 'neutron-metadata-agent'],
        'services': ['neutron-openvswitch-agent', 'neutron-metadata-agent', 'neutron-l3-agent', 'neutron-dhcp-agent']
    },
    'RedHat': {
        'pkgs': ['openstack-neutron-openvswitch'],
        'services': ['neutron-openvswitch-agent', 'neutron-metadata-agent', 'neutron-l3-agent', 'neutron-dhcp-agent']
    },
}, merge=pillar.neutron.get('gateway', {})) %}

{% set server = salt['grains.filter_by']({
    'Debian': {
        'pkgs': ['neutron-server','neutron-lbaas-agent', 'gettext-base', 'python-pycadf'],
        'pkgs_ml2': ['neutron-plugin-ml2'],
        'services': ['neutron-server'],
        'notification': False,
        'audit': {
          'enabled': false
        }
    },
    'RedHat': {
        'pkgs_ml2': ['openstack-neutron-ml2', 'python-pycadf'],
        'pkgs': ['openstack-neutron'],
        'services': ['neutron-server'],
        'notification': False,
        'audit': {
          'enabled': false
        }
    },
}, merge=pillar.neutron.get('server', {})) %}

{%- if pillar.neutron.server is defined %}

{%- set tmp_server = pillar.neutron.server %}

{%- if not tmp_server.backend is defined %}

{%- if tmp_server.plugin == "contrail" %}

{%- from "opencontrail/map.jinja" import config with context %}

{%- set backend = {'engine': tmp_server.plugin, 'host': config.discovery.host, 'token': config.identity.token, 'user': config.identity.user, 'password': config.identity.password, 'tenant': config.identity.tenant} %}
{%- set tmp = server.update({'backend': backend}) %}

{%- endif %}

{%- endif %}

{%- endif %}
