Add cluster_param in DHA file 21/59421/1
authorHarry Huang <huangxiangyu5@huawei.com>
Mon, 2 Jul 2018 07:28:51 +0000 (15:28 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Mon, 2 Jul 2018 07:28:51 +0000 (15:28 +0800)
JIRA: COMPASS-603

Users may need some extra parameters
to further customize the deployment.

Change-Id: I64f7f39a49f17350d159b3733f34ffd816849174
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
deploy/client.py
deploy/compass_conf/package_metadata/kubernetes.conf
deploy/compass_conf/package_metadata/openstack.conf
deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl
deploy/compass_conf/templates/ansible_installer/openstack_queens/vars/HA-ansible-multinodes.tmpl
deploy/config_parse.py
deploy/deploy_host.sh

index 891e632..e612160 100644 (file)
@@ -259,6 +259,9 @@ opts = [
     cfg.StrOpt('plugins',
                help='plugin dict',
                default='{}'),
+    cfg.StrOpt('cluster_param',
+               help='cluster dict',
+               default='{}'),
     cfg.StrOpt('offline_deployment',
                help='offline_deployment',
                default='Disable'),
@@ -803,11 +806,17 @@ class CompassClient(object):
         package_config['odl_l3_agent'] = "Enable" if CONF.odl_l3_agent == "Enable" else "Disable"   # noqa
         package_config['onos_sfc'] = "Enable" if CONF.onos_sfc == "Enable" else "Disable"   # noqa
         package_config['plugins'] = []
+        package_config['cluster_param'] = []
         if CONF.plugins:
             for item in CONF.plugins.split(','):
                 key, value = item.split(':')
                 package_config['plugins'].append({key: value})
 
+        if CONF.cluster_param:
+            for item in CONF.cluster_param.split(','):
+                key, value = item.split(':')
+                package_config['cluster_param'].append({key: value})
+
         status, resp = self.client.update_cluster_config(
             cluster_id, package_config=package_config)
         LOG.info(
index d5e9a50..c9853d1 100755 (executable)
@@ -129,6 +129,14 @@ METADATA = {
             'default_value': '[]'
         }
     },
+    'cluster_param': {
+        '_self': {
+            'mapping_to': 'cluster_param',
+            'field': 'general_list',
+            'is_required':False,
+            'default_value': '[]'
+        }
+    },
     'ha_network': {
         '_self': {
             'mapping_to': 'ha_network',
index 6027cb1..1a0545a 100755 (executable)
@@ -129,6 +129,14 @@ METADATA = {
             'default_value': '[]'
         }
     },
+    'cluster_param': {
+        '_self': {
+            'mapping_to': 'cluster_param',
+            'field': 'general_list',
+            'is_required':False,
+            'default_value': '[]'
+        }
+    },
     'ha_network': {
         '_self': {
             'mapping_to': 'ha_network',
index 669eaca..55ef7ae 100644 (file)
@@ -122,6 +122,14 @@ erlang.cookie: DJJVECFMCJPVYQTJTDWG
 $keys[0]: $values[0]
 #end for
 
+cluster_param:
+#set cluster_param = $getVar('cluster_param', [])
+#for item in cluster_param
+#set keys = $item.keys()
+#set values = $item.values()
+  $keys[0]: $values[0]
+#end for
+
 #set neutron_service_plugins=['router']
 
 #if $getVar('enable_fwaas', True)
index 8ae9bdb..0c9ec06 100755 (executable)
@@ -166,6 +166,14 @@ erlang.cookie: DJJVECFMCJPVYQTJTDWG
 $keys[0]: $values[0]
 #end for
 
+cluster_param:
+#set cluster_param = $getVar('cluster_param', [])
+#for item in cluster_param
+#set keys = $item.keys()
+#set values = $item.values()
+  $keys[0]: $values[0]
+#end for
+
 #set neutron_service_plugins=['router']
 #if $getVar('enable_fwaas', True)
 #neutron_service_plugins.append('firewall')
index ceaab0f..3ee0d86 100644 (file)
@@ -109,6 +109,13 @@ def export_dha_file(dha, dha_file, ofile):
             plugin_list.append(plugin_str)
         env.update({'plugins': ','.join(plugin_list)})
 
+    if 'cluster_param' in env:
+        plugin_list = []
+        for item in env.get('cluster_param'):
+            plugin_str = ':'.join([item.keys()[0], item.values()[0]])
+            plugin_list.append(plugin_str)
+        env.update({'cluster_param': ','.join(plugin_list)})
+
     env.update({'CLUSTER_NAME': dha.get('NAME', "opnfv")})
     env.update({'TYPE': dha.get('TYPE', "virtual")})
     env.update({'FLAVOR': dha.get('FLAVOR', "cluster")})
index 512386e..94abf76 100755 (executable)
@@ -48,8 +48,9 @@ function deploy_host(){
     --cluster_vip="${VIP}" --network_cfg="$NETWORK" --neutron_cfg="$NEUTRON" \
     --enable_secgroup="${ENABLE_SECGROUP}" --enable_fwaas="${ENABLE_FWAAS}" --expansion="${EXPANSION}" \
     --rsa_file="$rsa_file" --enable_vpnaas="${ENABLE_VPNAAS}" --odl_l3_agent="${odl_l3_agent}" \
-    --moon_cfg="${MOON_CFG}" --onos_sfc="${onos_sfc}" --plugins="$plugins" \
-    --offline_repo_port="${COMPASS_REPO_PORT}" --offline_deployment="${OFFLINE_DEPLOY}"
+    --moon_cfg="${MOON_CFG}" --onos_sfc="${onos_sfc}" --plugins="${plugins}" \
+    --cluster_param="${cluster_param}" --offline_repo_port="${COMPASS_REPO_PORT}" \
+    --offline_deployment="${OFFLINE_DEPLOY}"
 
     RET=$?
     sleep $((AYNC_TIMEOUT+5))