From 870ff702088b89549bc21631eb48443fff0bcd71 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Mon, 13 Mar 2023 11:00:21 +0000 Subject: Migrate mock applications from Orange GitLab Move from Orange repositories into ONAP one. Issue-ID: INT-2208 Signed-off-by: Michal Jagiello Change-Id: I6e165da5144c28a6ff151e02e32f5ae89ce124e3 --- mock-sdnc/Dockerfile | 11 +++++++++++ mock-sdnc/README.md | 2 ++ mock-sdnc/app.py | 35 +++++++++++++++++++++++++++++++++++ mock-sdnc/requirements.txt | 1 + mock-sdnc/resources/__init__.py | 16 ++++++++++++++++ mock-sdnc/resources/preload.py | 28 ++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+) create mode 100644 mock-sdnc/Dockerfile create mode 100644 mock-sdnc/README.md create mode 100644 mock-sdnc/app.py create mode 100644 mock-sdnc/requirements.txt create mode 100644 mock-sdnc/resources/__init__.py create mode 100644 mock-sdnc/resources/preload.py (limited to 'mock-sdnc') diff --git a/mock-sdnc/Dockerfile b/mock-sdnc/Dockerfile new file mode 100644 index 0000000..d558a0d --- /dev/null +++ b/mock-sdnc/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.8-alpine + +COPY . /app + +WORKDIR /app + +RUN pip install -r requirements.txt + +ENTRYPOINT ["python"] + +CMD ["app.py"] diff --git a/mock-sdnc/README.md b/mock-sdnc/README.md new file mode 100644 index 0000000..a2e32f0 --- /dev/null +++ b/mock-sdnc/README.md @@ -0,0 +1,2 @@ +# mock-sdnc + diff --git a/mock-sdnc/app.py b/mock-sdnc/app.py new file mode 100644 index 0000000..f5899e1 --- /dev/null +++ b/mock-sdnc/app.py @@ -0,0 +1,35 @@ +"""SDNC mock application.""" +""" + Copyright 2023 Deutsche Telekom AG, Orange + + 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 flask import Flask +from flask_restful import Api + +from resources.preload import Preload + + +app = Flask(__name__) +api = Api(app) + + +api.add_resource( + Preload, + "/restconf/operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation", + "/restconf/operations/GENERIC-RESOURCE-API:preload-network-topology-operation", +) + + +if __name__ == "__main__": + app.run(host="0.0.0.0", debug=True) diff --git a/mock-sdnc/requirements.txt b/mock-sdnc/requirements.txt new file mode 100644 index 0000000..8c695e4 --- /dev/null +++ b/mock-sdnc/requirements.txt @@ -0,0 +1 @@ +Flask-RESTful==0.3.8 diff --git a/mock-sdnc/resources/__init__.py b/mock-sdnc/resources/__init__.py new file mode 100644 index 0000000..56a522c --- /dev/null +++ b/mock-sdnc/resources/__init__.py @@ -0,0 +1,16 @@ +"""SDNC mock resources package.""" +""" + Copyright 2023 Deutsche Telekom AG, Orange + + 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. +""" diff --git a/mock-sdnc/resources/preload.py b/mock-sdnc/resources/preload.py new file mode 100644 index 0000000..9795e16 --- /dev/null +++ b/mock-sdnc/resources/preload.py @@ -0,0 +1,28 @@ +"""SDNC preload resource module.""" +""" + Copyright 2023 Deutsche Telekom AG, Orange + + 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 flask_restful import Resource + + +class Preload(Resource): + """Preload resource class.""" + + def post(self) -> None: + """Preload resource mock method. + + Do nothing. + + """ -- cgit 1.2.3-korg