Update version number in container-tag for F Maintenance Release
[sim/a1-interface.git] / near-rt-ric-simulator / src / OSC_2.1.0 / main.py
index 48fbe91..18bc03b 100644 (file)
@@ -1,5 +1,5 @@
 #  ============LICENSE_START===============================================
 #  ============LICENSE_START===============================================
-#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  Copyright (C) 2021 Nordix Foundation. All rights reserved.
 #  ========================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
 #  ========================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import requests
 from pathlib import Path
 from flask import Flask, escape, request, Response, jsonify
 from jsonschema import validate
 from pathlib import Path
 from flask import Flask, escape, request, Response, jsonify
 from jsonschema import validate
-from var_declaration import policy_instances, policy_types, policy_status, policy_fingerprint, forced_settings, hosts_set
+from var_declaration import policy_instances, policy_types, policy_status, policy_fingerprint, forced_settings, hosts_set, app
 from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name
 from time import sleep
 
 from maincommon import check_apipath, apipath, get_supported_interfaces_response, extract_host_name
 from time import sleep
 
@@ -33,7 +33,9 @@ TEXT_PLAIN='text/plain'
 
 check_apipath()
 
 
 check_apipath()
 
-app = connexion.FlaskApp(__name__, specification_dir=apipath)
+# app is created in var_declarations
+
+import payload_logging   # app var need to be initialized
 
 #Check alive function
 @app.route('/', methods=['GET'])
 
 #Check alive function
 @app.route('/', methods=['GET'])
@@ -206,6 +208,8 @@ def getcounter(countername):
   elif (countername == "remote_hosts"):
     hosts=",".join(hosts_set)
     return str(hosts),200
   elif (countername == "remote_hosts"):
     hosts=",".join(hosts_set)
     return str(hosts),200
+  elif (countername == "datadelivery"):
+    return Response(str(0),200, mimetype=TEXT_PLAIN)
   else:
     return Response("Counter name: "+countername+" not found.",404, mimetype=TEXT_PLAIN)
 
   else:
     return Response("Counter name: "+countername+" not found.",404, mimetype=TEXT_PLAIN)