Convert file endlines to Unix (LF)
[pti/o2.git] / o2dms / domain / dms.py
index 2a8c144..d3d908e 100644 (file)
@@ -1,93 +1,93 @@
-# Copyright (C) 2021 Wind River Systems, Inc.\r
-#\r
-#  Licensed under the Apache License, Version 2.0 (the "License");\r
-#  you may not use this file except in compliance with the License.\r
-#  You may obtain a copy of the License at\r
-#\r
-#      http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-#  Unless required by applicable law or agreed to in writing, software\r
-#  distributed under the License is distributed on an "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-#  See the License for the specific language governing permissions and\r
-#  limitations under the License.\r
-\r
-from __future__ import annotations\r
-# from os import stat\r
-import json\r
-from o2dms.domain import events\r
-from o2dms.domain.states import NfDeploymentState\r
-\r
-from o2common.domain.base import AgRoot, Serializer\r
-\r
-\r
-class NfDeploymentDesc(AgRoot, Serializer):\r
-    def __init__(self, id: str, name: str, dmsId: str, description: str = '',\r
-                 inputParams: str = '', outputParams: str = '',\r
-                 artifactRepoUrl: str = '', artifactName: str = '') -> None:\r
-        super().__init__()\r
-        self.id = id\r
-        self.version_number = 0\r
-        self.deploymentManagerId = dmsId\r
-        self.name = name\r
-        self.description = description\r
-        self.artifactRepoUrl = artifactRepoUrl\r
-        self.artifactName = artifactName\r
-        self.status = 0\r
-\r
-        if type(inputParams) is str:\r
-            inputParams = json.loads(inputParams)\r
-        self.inputParams = json.dumps(inputParams)\r
-\r
-        if type(outputParams) is str:\r
-            outputParams = json.loads(outputParams)\r
-        self.outputParams = json.dumps(outputParams)\r
-\r
-        # self.extensions = []\r
-\r
-\r
-class NfDeployment(AgRoot, Serializer):\r
-    def __init__(self, id: str, name: str, dmsId: str, description: str = '',\r
-                 descriptorId: str = '', parentId: str = '',) -> None:\r
-        super().__init__()\r
-        self.id = id\r
-        self.version_number = 0\r
-        self.deploymentManagerId = dmsId\r
-        self.name = name\r
-        self.description = description\r
-        self.descriptorId = descriptorId\r
-        self.parentDeploymentId = parentId\r
-        self.status = NfDeploymentState.Initial\r
-\r
-    def transit_state(self, state: NfDeploymentState):\r
-        if (self.status != state):\r
-            self._append_event(self.status, state)\r
-            # self.status = state\r
-\r
-    def set_state(self, state: NfDeploymentState):\r
-        if (self.status != state):\r
-            self.status = state\r
-\r
-    def _append_event(self, fromState, toState):\r
-        if not hasattr(self, "events"):\r
-            self.events = []\r
-        self.events.append(\r
-            events.NfDeploymentStateChanged(\r
-                NfDeploymentId=self.id, FromState=fromState, ToState=toState))\r
-\r
-\r
-class NfOCloudVResource(AgRoot, Serializer):\r
-    def __init__(self, id: str, name: str, dmsId: str, description: str = '',\r
-                 descriptorId: str = '', nfDeploymentId: str = '',\r
-                 vresourceType: int = 0,) -> None:\r
-        super().__init__()\r
-        self.id = id\r
-        self.version_number = 0\r
-        self.deploymentManagerId = dmsId\r
-        self.name = name\r
-        self.description = description\r
-        self.descriptorId = descriptorId\r
-        self.nfDeploymentId = nfDeploymentId\r
-        self.vresourceType = vresourceType\r
-        self.status = 0\r
-        self.metadata = []\r
+# Copyright (C) 2021 Wind River Systems, Inc.
+#
+#  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.
+
+from __future__ import annotations
+# from os import stat
+import json
+from o2dms.domain import events
+from o2dms.domain.states import NfDeploymentState
+
+from o2common.domain.base import AgRoot, Serializer
+
+
+class NfDeploymentDesc(AgRoot, Serializer):
+    def __init__(self, id: str, name: str, dmsId: str, description: str = '',
+                 inputParams: str = '', outputParams: str = '',
+                 artifactRepoUrl: str = '', artifactName: str = '') -> None:
+        super().__init__()
+        self.id = id
+        self.version_number = 0
+        self.deploymentManagerId = dmsId
+        self.name = name
+        self.description = description
+        self.artifactRepoUrl = artifactRepoUrl
+        self.artifactName = artifactName
+        self.status = 0
+
+        if type(inputParams) is str:
+            inputParams = json.loads(inputParams)
+        self.inputParams = json.dumps(inputParams)
+
+        if type(outputParams) is str:
+            outputParams = json.loads(outputParams)
+        self.outputParams = json.dumps(outputParams)
+
+        # self.extensions = []
+
+
+class NfDeployment(AgRoot, Serializer):
+    def __init__(self, id: str, name: str, dmsId: str, description: str = '',
+                 descriptorId: str = '', parentId: str = '',) -> None:
+        super().__init__()
+        self.id = id
+        self.version_number = 0
+        self.deploymentManagerId = dmsId
+        self.name = name
+        self.description = description
+        self.descriptorId = descriptorId
+        self.parentDeploymentId = parentId
+        self.status = NfDeploymentState.Initial
+
+    def transit_state(self, state: NfDeploymentState):
+        if (self.status != state):
+            self._append_event(self.status, state)
+            # self.status = state
+
+    def set_state(self, state: NfDeploymentState):
+        if (self.status != state):
+            self.status = state
+
+    def _append_event(self, fromState, toState):
+        if not hasattr(self, "events"):
+            self.events = []
+        self.events.append(
+            events.NfDeploymentStateChanged(
+                NfDeploymentId=self.id, FromState=fromState, ToState=toState))
+
+
+class NfOCloudVResource(AgRoot, Serializer):
+    def __init__(self, id: str, name: str, dmsId: str, description: str = '',
+                 descriptorId: str = '', nfDeploymentId: str = '',
+                 vresourceType: int = 0,) -> None:
+        super().__init__()
+        self.id = id
+        self.version_number = 0
+        self.deploymentManagerId = dmsId
+        self.name = name
+        self.description = description
+        self.descriptorId = descriptorId
+        self.nfDeploymentId = nfDeploymentId
+        self.vresourceType = vresourceType
+        self.status = 0
+        self.metadata = []