adding operational state to the vim-list

Fixes bug 1225

Change-Id: Ia6ed5708d64480aafb6623b91cc2bd3c062d1479
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py
index 06d77e0..3ef81ac 100755
--- a/osmclient/scripts/osm.py
+++ b/osmclient/scripts/osm.py
@@ -2538,7 +2538,7 @@
     if long:
         table = PrettyTable(['vim name', 'uuid', 'project', 'operational state', 'error details'])
     else:
-        table = PrettyTable(['vim name', 'uuid'])
+        table = PrettyTable(['vim name', 'uuid', 'operational state'])
     for vim in resp:
         if long:
             vim_details = ctx.obj.vim.get(vim['uuid'])
@@ -2562,7 +2562,7 @@
             table.add_row([vim['name'], vim['uuid'], '{} ({})'.format(project_name, project_id),
                           vim_state, wrap_text(text=error_details, width=80)])
         else:
-            table.add_row([vim['name'], vim['uuid']])
+            table.add_row([vim['name'], vim['uuid'], vim['_admin'].get('operationalState', '-')])
     table.align = 'l'
     print(table)
 
diff --git a/osmclient/sol005/vim.py b/osmclient/sol005/vim.py
index 3441161..fa17dfc 100644
--- a/osmclient/sol005/vim.py
+++ b/osmclient/sol005/vim.py
@@ -228,10 +228,9 @@
         _, resp = self._http.get2_cmd('{}{}'.format(self._apiBase,filter_string))
         if not resp:
             return list()
-        vim_accounts = []
-        for datacenter in json.loads(resp):
-            vim_accounts.append({"name": datacenter['name'], "uuid": datacenter['_id']
-                        if '_id' in datacenter else None})
+        vim_accounts = json.loads(resp)
+        for datacenter in vim_accounts:
+            datacenter["uuid"] = datacenter.get('_id')  # backward compatibility?
         return vim_accounts
 
     def get(self, name):