Merge "Added VIO metrics collector for vROPs"
authorlavado <glavado@whitestack.com>
Sat, 2 Mar 2019 02:48:04 +0000 (03:48 +0100)
committerGerrit Code Review <root@osm.etsi.org>
Sat, 2 Mar 2019 02:48:04 +0000 (03:48 +0100)
1  2 
osm_mon/core/database.py

diff --combined osm_mon/core/database.py
@@@ -25,6 -25,7 +25,7 @@@
  import logging
  import os
  import uuid
+ import json
  
  from peewee import CharField, TextField, FloatField, Model, AutoField, Proxy
  from peewee_migrate import Router
@@@ -53,7 -54,7 +54,7 @@@ class VimCredentials(BaseModel)
      user = CharField()
      password = CharField()
      tenant_name = CharField()
 -    config = TextField(default='{}')
 +    config = TextField()
  
  
  class Alarm(BaseModel):
@@@ -126,5 -127,11 +127,11 @@@ class DatabaseManager
  
      def get_vim_type(self, vim_account_id) -> str:
          """Get the vim type that is required by the message."""
+         vim_type = None
          credentials = self.get_credentials(vim_account_id)
-         return str(credentials.type)
+         config = json.loads(credentials.config)
+         if 'vim_type' in config:
+             vim_type = config['vim_type']
+             return str(vim_type.lower())
+         else:
+             return str(credentials.type)