update vim config
authorMike Marchetti <mmarchetti@sandvine.com>
Mon, 13 Nov 2017 15:51:42 +0000 (10:51 -0500)
committerMike Marchetti <mmarchetti@sandvine.com>
Tue, 14 Nov 2017 22:00:27 +0000 (17:00 -0500)
- use yaml for vim config
Change-Id: I3e449b101cca01239472863e1a425b243c33659a
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
osmclient/scripts/osm.py
osmclient/v1/vim.py

index 23f6889..3c73510 100755 (executable)
@@ -407,10 +407,6 @@ def config_agent_add(ctx, name, account_type, server, user, secret):
 @click.option('--tenant',
               prompt=True,
               help='tenant name')
-@click.option('--floating_ip_pool',
-              default=None)
-@click.option('--keypair',
-              default=None)
 @click.option('--config',
               default=None,
               help='VIM specific config parameters')
@@ -426,8 +422,6 @@ def vim_create(ctx,
                password,
                auth_url,
                tenant,
-               floating_ip_pool,
-               keypair,
                config,
                account_type,
                description):
@@ -436,8 +430,6 @@ def vim_create(ctx,
     vim['vim-password'] = password
     vim['vim-url'] = auth_url
     vim['vim-tenant-name'] = tenant
-    vim['floating_ip_pool'] = floating_ip_pool
-    vim['keypair'] = keypair
     vim['config'] = config
     vim['vim-type'] = account_type
     vim['description'] = description
index b0033a1..dd6a5e0 100644 (file)
@@ -20,7 +20,7 @@ OSM vim API handling
 
 from osmclient.common.exceptions import ClientException
 from osmclient.common.exceptions import NotFound
-import json
+import yaml 
 import time
 
 
@@ -65,17 +65,8 @@ class Vim(object):
         vim_account['datacenter']['type'] = vim_access['vim-type']
 
         vim_config = {}
-        vim_config['use_floating_ip'] = False
-
-        if ('floating_ip_pool' in vim_access and
-           vim_access['floating_ip_pool'] is not None):
-            vim_config['use_floating_ip'] = True
-
-        if 'keypair' in vim_access and vim_access['keypair'] is not None:
-            vim_config['keypair'] = vim_access['keypair']
-        elif 'config' in vim_access and vim_access['config'] is not None:
-            if any(var in vim_access['config'] for var in ["admin_password","admin_username","orgname","nsx_user","nsx_password","nsx_manager","vcenter_ip","vcenter_port","vcenter_user","vcenter_password"]):
-                vim_config = json.loads(vim_access['config'])
+        if 'config' in vim_access and vim_access['config'] is not None:
+           vim_config = yaml.load(vim_access['config'])
 
         vim_account['datacenter']['config'] = vim_config