Update accelerator resource
[pti/o2.git] / o2ims / domain / ocloud.py
index a2047af..b7c82b5 100644 (file)
@@ -16,15 +16,14 @@ from __future__ import annotations
 import json
 
 from o2common.domain.base import AgRoot, Serializer
-from o2common.config import conf as CONF
+from o2common.config import config, conf as CONF
 # from dataclasses import dataclass
 # from datetime import date
 # from typing import Optional, List, Set
 from .resource_type import ResourceKindEnum, ResourceTypeEnum
-# from uuid import UUID
 
 
-DeploymentManagerProfileDefault = 'default'
+DeploymentManagerProfileDefault = 'native_k8sapi'
 DeploymentManagerProfileSOL018 = 'sol018'
 DeploymentManagerProfileSOL018HelmCLI = 'sol018_helmcli'
 
@@ -55,9 +54,13 @@ class DeploymentManager(AgRoot, Serializer):
             d['profile'] = json.loads(d['profile'])
         d['profileSupportList'] = [
             DeploymentManagerProfileDefault,
-            DeploymentManagerProfileSOL018,
-            DeploymentManagerProfileSOL018HelmCLI,
         ]
+        profiles = config.get_dms_support_profiles()
+        for profile in profiles:
+            if profile == DeploymentManagerProfileSOL018:
+                d['profileSupportList'].append(profile)
+            elif profile == DeploymentManagerProfileSOL018HelmCLI:
+                d['profileSupportList'].append(profile)
 
         return d
 
@@ -102,8 +105,10 @@ class ResourceType(AgRoot, Serializer):
     def serialize(self):
         d = Serializer.serialize(self)
 
-        d["alarmDictionary"] = CONF.alarm_dictionaries.get(
-            d['name']).serialize()
+        if CONF.alarm_dictionaries.get(d['name']) is not None:
+            d["alarmDictionary"] = CONF.alarm_dictionaries.get(
+                d['name']).serialize()
+
         return d
 
 
@@ -111,7 +116,7 @@ class Resource(AgRoot, Serializer):
     def __init__(self, resourceId: str, resourceTypeId: str,
                  resourcePoolId: str, name: str, parentId: str = '',
                  gAssetId: str = '', elements: str = '',
-                 description: str = '') -> None:
+                 description: str = '', extensions: str = '') -> None:
         super().__init__()
         self.resourceId = resourceId
         self.description = description
@@ -119,7 +124,7 @@ class Resource(AgRoot, Serializer):
         self.globalAssetId = gAssetId
         self.resourcePoolId = resourcePoolId
         self.elements = elements
-        self.extensions = []
+        self.extensions = extensions
 
         self.name = name
         self.parentId = parentId