add support for config generation

Change-Id: I59caa739a6e1b13e42a1a0faab9a0a33a910e589
diff --git a/metadata/service/control/container.yml b/metadata/service/control/container.yml
new file mode 100644
index 0000000..76931da
--- /dev/null
+++ b/metadata/service/control/container.yml
@@ -0,0 +1,44 @@
+parameters:
+  kubernetes:
+    control:
+      configmap:
+        neutron-server:
+          grains:
+            os_family: Debian
+          pillar:
+            neutron:
+              server:
+                enabled: true
+                dns_domain: novalocal
+                version: ${_param:neutron_version}
+                bind:
+                  address: 0.0.0.0
+                  port: 9696
+                database:
+                  engine: mysql
+                  host: ${_param:mysql_service_host}
+                  port: 3306
+                  name: neutron
+                  user: neutron
+                  password: ${_param:mysql_neutron_password}
+                identity:
+                  engine: keystone
+                  region: RegionOne
+                  host: ${_param:keystone_service_host}
+                  port: 35357
+                  user: neutron
+                  password: ${_param:keystone_neutron_password}
+                  tenant: service
+                message_queue:
+                  engine: rabbitmq
+                  host: ${_param:rabbitmq_service_host}
+                  port: 5672
+                  user: openstack
+                  password: ${_param:rabbitmq_openstack_password}
+                  virtual_host: '/openstack'
+                compute:
+                  host: ${_param:nova_service_host}
+                  region: RegionOne
+                  user: nova
+                  password: ${_param:keystone_nova_password}
+                  tenant: service
\ No newline at end of file
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 4950f3c..2dce565 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -9,3 +9,5 @@
         enabled: true
       sphinx:
         enabled: true
+      config:
+        enabled: true
\ No newline at end of file
diff --git a/neutron/files/mitaka/neutron-server.conf.Debian b/neutron/files/mitaka/neutron-server.conf.Debian
index 104851c..78406d4 100644
--- a/neutron/files/mitaka/neutron-server.conf.Debian
+++ b/neutron/files/mitaka/neutron-server.conf.Debian
@@ -25,8 +25,9 @@
 # extensions:/path/to/more/exts:/even/more/exts. The __path__ of
 # neutron.extensions is appended to this, so if your extensions are in there
 # you don't need to specify them here. (string value)
-#api_extensions_path =
-api_extensions_path = extensions:/usr/lib/python2.7/dist-packages/neutron_plugin_contrail/extensions:/usr/lib/python2.7/dist-packages/neutron_lbaas/extensions
+# TEMPORARY - until neutron v2 contrail package would be supported
+#api_extensions_path = extensions:/usr/lib/python2.7/dist-packages/neutron_plugin_contrail/extensions:/usr/lib/python2.7/dist-packages/neutron_lbaas/extensions
+api_extensions_path = extensions:/usr/lib/python2.7/dist-packages/neutron_plugin_contrail/extensions
 
 # The type of authentication to use (string value)
 #auth_strategy = keystone
@@ -37,8 +38,8 @@
 
 
 # The service plugins Neutron will use (list value)
-#service_plugins =
-service_plugins = neutron_plugin_contrail.plugins.opencontrail.loadbalancer.plugin.LoadBalancerPlugin
+# TEMPORARY - until neutron v2 contrail package would be supported
+#service_plugins = neutron_plugin_contrail.plugins.opencontrail.loadbalancer.v2.plugin.LoadBalancerPluginV2
 # The base MAC address Neutron will use for VIFs. The first 3 octets will
 # remain unchanged. If the 4th octet is not 00, it will also be used. The
 # others will be randomly generated. (string value)
@@ -149,7 +150,7 @@
 # Send notification to nova when port data (fixed_ips/floatingip) changes so
 # nova can update its cache. (boolean value)
 #notify_nova_on_port_data_changes = true
-notify_nova_on_port_data_changes = False
+notify_nova_on_port_data_changes = True
 
 # Number of seconds between sending events to nova if there are any events to
 # send. (integer value)
@@ -780,8 +781,15 @@
 
 [keystone_authtoken]
 auth_region={{ server.identity.region }}
+auth_protocol=http
 revocation_cache_time = 10
 auth_type = password
+auth_host = {{ server.identity.host }}
+auth_port = 35357
+admin_token = {{ server.backend.token }}
+admin_user={{ server.backend.user }}
+admin_password={{ server.backend.password }}
+admin_tenant_name={{ server.backend.tenant }}
 user_domain_id = {{ server.identity.get('domain', 'default') }}
 project_domain_id = {{ server.identity.get('domain', 'default') }}
 project_name = {{ server.identity.tenant }}
diff --git a/neutron/map.jinja b/neutron/map.jinja
index 7047a58..12c8882 100644
--- a/neutron/map.jinja
+++ b/neutron/map.jinja
@@ -8,7 +8,7 @@
         'pkgs': ['openstack-neutron-openvswitch', 'openvswitch', 'fuel-utils'],
         'services': ['openvswitch', 'neutron-openvswitch-agent']
     },
-}, merge=salt['pillar.get']('neutron:compute')) %}
+}, merge=pillar.neutron.get('compute', {})) %}
 
 {% set bridge = salt['grains.filter_by']({
     'Debian': {
@@ -23,7 +23,7 @@
         'migration_pkgs': ['fuel-utils',],
         'services': ['neutron-openvswitch-agent', 'neutron-metadata-agent', 'neutron-l3-agent', 'neutron-dhcp-agent']
     },
-}, merge=salt['pillar.get']('neutron:bridge')) %}
+}, merge=pillar.neutron.get('brigde', {})) %}
 
 {% set server = salt['grains.filter_by']({
     'Debian': {
@@ -38,7 +38,7 @@
         'services': ['neutron-server'],
         'notification': False
     },
-}, merge=salt['pillar.get']('neutron:server')) %}
+}, merge=pillar.neutron.get('server', {})) %}
 
 {%- if pillar.neutron.server.enabled %}
 
diff --git a/neutron/meta/config.yml b/neutron/meta/config.yml
new file mode 100644
index 0000000..50d419e
--- /dev/null
+++ b/neutron/meta/config.yml
@@ -0,0 +1,8 @@
+
+config:
+  {%- if pillar.neutron.server is defined %}
+  {%- from "neutron/map.jinja" import server with context %}
+  neutron.conf:
+    source: "salt://neutron/files/{{ server.version }}/neutron-server.conf.{{ grains.os_family|default('Debian') }}"
+    template: jinja
+  {%- endif %}
\ No newline at end of file