xapp-bs-connector --> xapp-sm-connector

This commit is contained in:
Leonardo Bonati
2021-12-22 13:33:15 -05:00
parent 6210e621ba
commit 185e97c221
427 changed files with 13 additions and 13 deletions

View File

@@ -0,0 +1,49 @@
{
"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.6"
}
}
],
"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"
],
"policies": [1]
}
}

View File

@@ -0,0 +1,140 @@
#==================================================================================
# Copyright (c) 2018-2019 AT&T Intellectual Property.
#
# 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.
#==================================================================================
#
# Author : Ashwin Sridharan
# Date : Feb 2019
#
# This initialization script reads in a json from the specified config map path
# to set up the initializations (route config map, variables etc) for the main
# xapp process
import json;
import sys;
import os;
import signal;
import time;
import ast;
def signal_handler(signum, frame):
print("Received signal {0}\n".format(signum));
if(xapp_subprocess == None or xapp_pid == None):
print("No xapp running. Quiting without sending signal to xapp\n");
else:
print("Sending signal {0} to xapp ...".format(signum));
xapp_subprocess.send_signal(signum);
def parseConfigJson(config):
for k1 in config.keys():
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):
if 'messaging' in config.keys() and 'ports' in config['messaging'].keys():
port_list = config['messaging']['ports']
for portdesc in port_list :
if 'port' in portdesc.keys() and 'name' in portdesc.keys() and portdesc['name'] == 'rmr-data':
lport = portdesc['port']
# Set the environment variable
os.environ["HW_PORT"] = str(lport)
return True;
if lport == 0:
print("Error! No valid listening port");
return False;
def getXappName(config):
myKey = "xapp_name";
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";
lport = 0;
ParseSection = {};
ParseSection["xapp_name"] = getXappName;
ParseSection["messaging"] = getMessagingInfo;
#================================================================
if __name__ == "__main__":
import subprocess;
# cmd = ["../src/hw_xapp_main"];
cmd = ["/usr/local/bin/hw_xapp_main"];
if len(sys.argv) > 1:
config_file = sys.argv[1];
else:
print("Error! No configuration file specified\n");
sys.exit(1);
if len(sys.argv) > 2:
cmd[0] = sys.argv[2];
with open(config_file, 'r') as f:
try:
config = json.load(f);
except Exception as e:
print(("Error loading json file from {0}. Reason = {1}\n".format(config_file, e)));
sys.exit(1);
result = parseConfigJson(config);
time.sleep(10);
if result == False:
print("Error parsing json. Not executing xAPP");
sys.exit(1);
else:
# Register signal handlers
signal.signal(signal.SIGINT, signal_handler);
signal.signal(signal.SIGTERM, signal_handler);
# Start the xAPP
#print("Executing xAPP ....");
xapp_subprocess = subprocess.Popen(cmd, shell = False, stdin=None, stdout=None, stderr = None);
xapp_pid = xapp_subprocess.pid;
# Periodically poll the process every 5 seconds to check if still alive
while(1):
xapp_status = xapp_subprocess.poll();
if xapp_status == None:
time.sleep(5);
else:
print("XaPP terminated via signal {0}\n".format(-1 * xapp_status));
break;

View File

@@ -0,0 +1,6 @@
newrt|start
rte|20011|service-ricplt-a1mediator-rmr.ricplt:4562
rte|20012|service-ricplt-a1mediator-rmr.ricplt:4562
rte|12010|10.0.2.10:38000
rte|12040|10.0.2.10:38000
newrt|end

View File

@@ -0,0 +1,229 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"service_ports",
"rmr",
"envs"
],
"properties": {
"service_ports": {
"$id": "#/properties/service_ports",
"type": "object",
"title": "The Service_ports Schema",
"required": [
"xapp_port",
"rmr_port"
],
"properties": {
"xapp_port": {
"$id": "#/properties/service_ports/properties/xapp_port",
"type": "integer",
"title": "The Xapp_port Schema",
"default": 0,
"examples": [
4560
]
},
"rmr_port": {
"$id": "#/properties/service_ports/properties/rmr_port",
"type": "integer",
"title": "The Rmr_port Schema",
"default": 0,
"examples": [
4561
]
}
}
},
"rmr": {
"$id": "#/properties/rmr",
"type": "object",
"title": "The Rmr Schema",
"required": [
"protPort",
"maxSize",
"numWorkers",
"txMessages",
"rxMessages",
"file_path",
"contents"
],
"properties": {
"protPort": {
"$id": "#/properties/rmr/properties/protPort",
"type": "string",
"title": "The Protport Schema",
"default": "",
"examples": [
"tcp:4560"
],
"pattern": "^(.*)$"
},
"maxSize": {
"$id": "#/properties/rmr/properties/maxSize",
"type": "integer",
"title": "The Maxsize Schema",
"default": 0,
"examples": [
2072
]
},
"numWorkers": {
"$id": "#/properties/rmr/properties/numWorkers",
"type": "integer",
"title": "The Numworkers Schema",
"default": 0,
"examples": [
1
]
},
"txMessages": {
"$id": "#/properties/rmr/properties/txMessages",
"type": "array",
"title": "The Txmessages Schema",
"items": {
"$id": "#/properties/rmr/properties/txMessages/items",
"type": "string",
"title": "The Items Schema",
"default": "",
"examples": [
"RIC_SUB_REQ",
"RIC_SUB_DEL_REQ"
],
"pattern": "^(.*)$"
}
},
"rxMessages": {
"$id": "#/properties/rmr/properties/rxMessages",
"type": "array",
"title": "The Rxmessages Schema",
"items": {
"$id": "#/properties/rmr/properties/rxMessages/items",
"type": "string",
"title": "The Items Schema",
"default": "",
"examples": [
"RIC_SUB_RESP",
"RIC_SUB_FAILURE",
"RIC_SUB_DEL_RESP",
"RIC_SUB_DEL_FAILURE",
"RIC_INDICATION"
],
"pattern": "^(.*)$"
}
},
"file_path": {
"$id": "#/properties/rmr/properties/file_path",
"type": "string",
"title": "The File_path Schema",
"default": "",
"examples": [
"/tmp/routeinfo/routes.txt"
],
"pattern": "^(.*)$"
},
"contents": {
"$id": "#/properties/rmr/properties/contents",
"type": "string",
"title": "The Contents Schema",
"default": "",
"examples": [
"newrt|start\nrte|0|localhost:4560\nrte|2|localhost:4591\nrte|10002|localhost:4560\nrte|10005|localhost:4560\nrte|10003|localhost:4591\nrte|12010|localhost:4591\nrte|12020|localhost:4591\nrte|12011|localhost:4560\nrte|12012|localhost:4560\nrte|12021|localhost:4560\nrte|12022|localhost:4560\nrte|20000|localhost:4560\nrte|20001|localhost:4566\nnewrt|end "
],
"pattern": "^(.*)$"
}
}
},
"envs": {
"$id": "#/properties/envs",
"type": "object",
"title": "The Envs Schema",
"required": [
"gNodeB",
"THREADS",
"A1_SCHEMA_FILE",
"VES_SCHEMA_FILE",
"SAMPLE_FILE",
"VES_COLLECTOR_URL",
"VES_MEAUSUREMENT_INTERVAL"
],
"properties": {
"gNodeB": {
"$id": "#/properties/envs/properties/gNodeB",
"type": "string",
"title": "The Gnodeb Schema",
"default": "",
"examples": [
"NYC123"
],
"pattern": "^(.*)$"
},
"THREADS": {
"$id": "#/properties/envs/properties/THREADS",
"type": "string",
"title": "The Threads Schema",
"default": "",
"examples": [
"1"
],
"pattern": "^(.*)$"
},
"A1_SCHEMA_FILE": {
"$id": "#/properties/envs/properties/A1_SCHEMA_FILE",
"type": "string",
"title": "The A1_schema_file Schema",
"default": "",
"examples": [
"/etc/xapp/adm-ctrl-xapp-schema.json"
],
"pattern": "^(.*)$"
},
"VES_SCHEMA_FILE": {
"$id": "#/properties/envs/properties/VES_SCHEMA_FILE",
"type": "string",
"title": "The Ves_schema_file Schema",
"default": "",
"examples": [
"/etc/xapp/ves_schema.json"
],
"pattern": "^(.*)$"
},
"SAMPLE_FILE": {
"$id": "#/properties/envs/properties/SAMPLE_FILE",
"type": "string",
"title": "The Sample_file Schema",
"default": "",
"examples": [
"/etc/xapp/samples.json"
],
"pattern": "^(.*)$"
},
"VES_COLLECTOR_URL": {
"$id": "#/properties/envs/properties/VES_COLLECTOR_URL",
"type": "string",
"title": "The Ves_collector_url Schema",
"default": "",
"examples": [
"127.0.0.1:6350"
],
"pattern": "^(.*)$"
},
"VES_MEAUSUREMENT_INTERVAL": {
"$id": "#/properties/envs/properties/VES_MEAUSUREMENT_INTERVAL",
"type": "string",
"title": "The Ves_meausurement_interval Schema",
"default": "",
"examples": [
"10"
],
"pattern": "^(.*)$"
}
}
}
}
}