From 83d5491f7cc44e0119ae88ff5e4500fba1ff08f3 Mon Sep 17 00:00:00 2001 From: sjana Date: Wed, 27 May 2020 11:56:38 -0400 Subject: [PATCH] Changed xapp-descriptor and parsing Issue-ID: RICAPP-110 Signed-off-by: sjana Change-Id: Ib3fcbaa233617fd704e3eeae9fb570089f4911f5 --- container-tag.yaml | 2 +- docs/release-notes.rst | 2 +- init/config-file.json | 131 ++++++++++++++++++------------------------------- init/init_script.py | 21 +++++--- 4 files changed, 65 insertions(+), 91 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index 8ea858b..d99f50d 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # this is used by CI jobs to apply a tag when it builds the image --- -tag: '1.0.0' +tag: '1.0.1' diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 685a99c..a5c1671 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -21,7 +21,7 @@ Version history | **Date** | **Ver.** | **Author** | **Comment** | | | | | | +--------------------+--------------------+--------------------+--------------------+ -| 2020-21-05 | 1.0.0 | Shraboni Jana | First draft | +| 2020-21-05 | 1.0.1 | Shraboni Jana | Second draft | | | | | | +--------------------+--------------------+--------------------+--------------------+ diff --git a/init/config-file.json b/init/config-file.json index d4db879..0326319 100644 --- a/init/config-file.json +++ b/init/config-file.json @@ -1,83 +1,48 @@ -{ - "config-file.json": { - "xapp_name": "hwxapp", - "version": "1.0.0", - "containers": [ - { - "name": "hwxapp", - "image": { - "registry": "nexus3.o-ran-sc.org:10002", - "name": "o-ran-sc/ric-app-hw", - "tag": "0.0.1" - }, - "command": "python3 init.py config-file.json" - } - ], - "livenessProbe": { - "exec": { - "command": [ - "/usr/local/bin/health_ck" - ] - }, - "initialDelaySeconds": 5, - "periodSeconds": 15 - }, - "messaging": { - "ports": [ - { - "name": "rmr-data", - "container": "hwxapp", - "port": 4560, - "rxMessages": [ - "RIC_SUB_RESP", - "RIC_SUB_FAILURE", - "RIC_SUB_DEL_RESP", "RIC_SUB_DEL_FAILURE", "RIC_INDICATION", "RIC_CONTROL_ACK", "RIC_CONTROL_FAILURE", "A1_POLICY_REQ", "RIC_HEALTH_CHECK_REQ" - ], - "txMessages": [ "RIC_SUB_REQ", "RIC_SUB_DEL_REQ", "RIC_CONTROL_REQ", "A1_POLICY_RESP", "A1_POLICY_QUERY", "RIC_HEALTH_CHECK_RESP" ], - "policies": [1], - "description": "rmr receive data port for HWxapp" - }, - { - "name": "rmr-route", - "container": "hwxapp", - "port": 4561, - "description": "rmr route port for hwxapp" - } - ] - }, - "controls": { - "ves_collector_address": "xapp-sandbox2.research.att.com:8888" - }, - "rmr": { - "protPort": "tcp:4560", - "maxSize": 2072, - "numWorkers": 1, - "txMessages": [ - "RIC_SUB_REQ", "RIC_SUB_DEL_REQ", "RIC_CONTROL_REQ", "A1_POLICY_RESP", "A1_POLICY_QUERY", "RIC_HEALTH_CHECK_RESP" - ], - "rxMessages": [ - "RIC_SUB_RESP", - "RIC_SUB_FAILURE", - "RIC_SUB_DEL_RESP", "RIC_SUB_DEL_FAILURE", "RIC_INDICATION", "RIC_CONTROL_ACK", "RIC_CONTROL_FAILURE", "A1_POLICY_REQ", "RIC_HEALTH_CHECK_REQ" - ] - } - }, - "controls-schema.json": { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "#/controls", - "type": "object", - "title": "Controls Section Schema", - "required": [], - "properties": { - "ves_collector_address": { - "$id": "#/controls/ves_collector_address", - "type": "string", - "title": "ves_collector_address", - "default": "localhost:8080", - "examples": [ - "localhost:8080" - ] - } - } - } -} \ No newline at end of file + { + "xapp_name": "hwxapp", + "version": "1.0.0", + "containers": [ + { + "name": "hwxapp", + "image": { + "registry": "nexus3.o-ran-sc.org:10002", + "name": "o-ran-sc/ric-app-hw", + "tag": "1.0.1" + } + } + ], + "messaging": { + "ports": [ + { + "name": "rmr-data", + "container": "hwxapp", + "port": 4560, + "rxMessages": [ + "RIC_SUB_RESP", + "A1_POLICY_REQ", "RIC_HEALTH_CHECK_REQ" + ], + "txMessages": [ "RIC_SUB_REQ", "A1_POLICY_RESP", "A1_POLICY_QUERY", "RIC_HEALTH_CHECK_RESP" ], + "policies": [1], + "description": "rmr receive data port for HWxapp" + }, + { + "name": "rmr-route", + "container": "hwxapp", + "port": 4561, + "description": "rmr route port for hwxapp" + } + ] + }, + "rmr": { + "protPort": "tcp:4560", + "maxSize": 2072, + "numWorkers": 1, + "txMessages": [ + "RIC_SUB_REQ", "A1_POLICY_RESP", "A1_POLICY_QUERY", "RIC_HEALTH_CHECK_RESP" + ], + "rxMessages": [ + "RIC_SUB_RESP", + "A1_POLICY_REQ", "RIC_HEALTH_CHECK_REQ" + ] + } + } diff --git a/init/init_script.py b/init/init_script.py index 85f00d1..c6a2b40 100644 --- a/init/init_script.py +++ b/init/init_script.py @@ -30,7 +30,7 @@ import sys; import os; import signal; import time; - +import ast; def signal_handler(signum, frame): print("Received signal {0}\n".format(signum)); @@ -42,14 +42,21 @@ def signal_handler(signum, frame): def parseConfigJson(config): + for k1 in config.keys(): - for k2 in config[k1].keys(): - #print(k2); - if k2 in ParseSection: - result = ParseSection[k2](config[k1]); - if result == False: + if k1 in ParseSection: + result = ParseSection[k1](config); + if result == False: return False; + +# for k2 in config[k1].keys(): + #print(k2); +# if k2 in ParseSection: +# result = ParseSection[k2](config[k1]); +# if result == False: +# return False; + def getMessagingInfo(config): @@ -70,7 +77,9 @@ def getXappName(config): if myKey not in config.keys(): print(("Error ! No information found for {0} in config\n".format(myKey))); return False; + xapp_name = config[myKey]; + print("Xapp Name is: " + xapp_name); os.environ["XAPP_NAME"] = xapp_name; default_routing_file = "/tmp/routeinfo/routes.txt"; -- 2.16.6