Add acumos adapter project
[dcaegen2/platform.git] / adapter / acumos / tests / fixtures / models / example-model-listofm / example_model.py
diff --git a/adapter/acumos/tests/fixtures/models/example-model-listofm/example_model.py b/adapter/acumos/tests/fixtures/models/example-model-listofm/example_model.py
new file mode 100644 (file)
index 0000000..cff1acb
--- /dev/null
@@ -0,0 +1,41 @@
+# ============LICENSE_START====================================================\r
+# org.onap.dcae\r
+# =============================================================================\r
+# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\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
+# ============LICENSE_END======================================================\r
+\r
+from acumos.session import AcumosSession\r
+from acumos.modeling import Model, List, NamedTuple\r
+\r
+\r
+class Args(NamedTuple):\r
+    x: int\r
+    y: int\r
+\r
+\r
+class ArgsList(NamedTuple):\r
+    args: List[Args]\r
+\r
+\r
+def sum(args: ArgsList) -> List[int]:\r
+    return [arg.x + arg.y for arg in args]\r
+\r
+\r
+if __name__ == '__main__':\r
+    '''Main'''\r
+    model = Model(sum=sum)\r
+\r
+    session = AcumosSession()\r
+    session.dump(model, 'example-model', '.')\r