update for change to etsicatalog
[modeling/etsicatalog.git] / genericparser / pub / utils / toscaparsers / sdmodel.py
diff --git a/genericparser/pub/utils/toscaparsers/sdmodel.py b/genericparser/pub/utils/toscaparsers/sdmodel.py
deleted file mode 100644 (file)
index 7635ab3..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright (c) 2019, CMCC Technologies. Co., Ltd.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import logging
-
-from genericparser.pub.utils.toscaparsers.basemodel import BaseInfoModel
-from genericparser.pub.utils.toscaparsers.servicemodel import SdcServiceModel
-
-logger = logging.getLogger(__name__)
-
-
-class SdInfoModel(BaseInfoModel):
-    def __init__(self, path, params):
-        super(SdInfoModel, self).__init__(path, params)
-
-    def parseModel(self, tosca):
-        self.metadata = self.buildMetadata(tosca)
-        self.inputs = self.build_inputs(tosca)
-
-        sdcModle = SdcServiceModel(tosca)
-        if sdcModle:
-            self.service = sdcModle.ns
-            if hasattr(tosca, 'nodetemplates'):
-                self.basepath = sdcModle.basepath
-                self.vnfs = sdcModle.vnfs
-                self.pnfs = sdcModle.pnfs
-                self.vls = sdcModle.vls
-                self.graph = sdcModle.graph
-
-    def build_inputs(self, tosca):
-        """ Get all the inputs for complex type"""
-        result_inputs = {}
-
-        if not tosca.inputs:
-            return {}
-
-        for input in tosca.inputs:
-            type = input.schema.type
-            if type.__eq__('list') or type.__eq__('map'):
-                complex_input = []
-                entry_schema = self.get_entry_schema(input.schema.schema['entry_schema'])
-                self.get_child_input_repeat(complex_input, entry_schema, input)
-                result_inputs[input.schema.name] = complex_input
-
-            else:
-                simple_input = {
-                    "type": input.schema.type,
-                    "description": input.schema.description,
-                    "required": input.schema.required,
-                }
-                result_inputs[input.schema.name] = simple_input
-        return result_inputs
-
-    def get_child_input_repeat(self, complex_input, entry_schema, input):
-        custom_defs = input.custom_defs
-        properties = custom_defs[entry_schema]['properties']
-        for key, value in properties.items():
-            if value['type'].__eq__('list'):
-                child_complex_input = []
-                child_entry_schema = self.get_entry_schema(value['entry_schema'])
-                self.get_child_input_repeat(child_complex_input, child_entry_schema, input)
-                complex_input.append({key: child_complex_input})
-            else:
-                if 'description' in list(value.keys()):
-                    simple_input = {
-                        key: "",
-                        "type": value['type'],
-                        "required": value['required'],
-                        "description": value['description'],
-                    }
-                else:
-                    simple_input = {
-                        key: "",
-                        "type": value['type'],
-                        "required": value['required'],
-                    }
-                complex_input.append(simple_input)
-
-    def get_entry_schema(self, entry_schema):
-        if isinstance(entry_schema, dict):
-            if 'type' in list(entry_schema.keys()):
-                entry_schema = entry_schema['type']
-        return entry_schema