1 # ------------------------------------------------
2 #Copyright 2020 AT&T Intellectual Property
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 # -------------------------------------------
16 import xml.etree.ElementTree as ET
18 from optparse import OptionParser
24 optparser = OptionParser(usage="usage: %prog [options] path_file [path_file*]")
25 optparser.add_option("-Q", "--querydir", dest="querydir",
26 default=".",help="directory with qtree.xml and output_spec.cfg" )
27 (options, args) = optparser.parse_args()
31 nibflnm = options.querydir+"/nib.json"
32 nibfl = open(nibflnm, "r")
33 nib = json.load(nibfl)
36 osflnm = options.querydir+"/output_spec.cfg"
37 osfl = open(osflnm, "r")
40 flds = line.split(",")
46 # -------------------------------------------------------------------------------
47 # Copyright (c) 2018-2019 AT&T Intellectual Property.
49 # Licensed under the Apache License, Version 2.0 (the "License");
50 # you may not use this file except in compliance with the License.
51 # You may obtain a copy of the License at
53 # http://www.apache.org/licenses/LICENSE-2.0
55 # Unless required by applicable law or agreed to in writing, software
56 # distributed under the License is distributed on an "AS IS" BASIS,
57 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58 # See the License for the specific language governing permissions and
59 # limitations under the License.
60 # -------------------------------------------------------------------------------
64 FIFO_DIR="/tmp/mcl/fifos"
66 SIMULATOR_MODE=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json simulator_mode`
68 DEBUG_MODE=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json debug_mode`
70 WINDOW=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json measurement_interval`
72 RMR_PORT=`python /mc/extract_rmr_port.py ${XAPP_DESCRIPTOR_PATH}/config-file.json rmr-data-out`
74 # export DBAAS_SERVICE_HOST=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json __DBAAS_SERVICE_HOST__`
75 # export DBAAS_SERVICE_PORT=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json __DBAAS_SERVICE_PORT__`
77 if [ "$SIMULATOR_MODE" = "true" ]
80 python /mc/data_gen/dc_gen.py &
81 python /mc/data_gen/rrcx_gen.py &
89 VES_COLLECTOR=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json ves_collector_address`
91 VES_NAME=`echo $VES_COLLECTOR | awk 'BEGIN{FS=":"} {print $1}'`
92 VES_PORT=`echo $VES_COLLECTOR | awk 'BEGIN{FS=":"} {print $2}'`
93 VES_IP=`getent ahosts $VES_NAME | awk '{ print $1; exit }'`
95 echo "Clearing MC NIB namespace" >&2
96 /mc/gs-lite/bin/mc_clear >&2
98 echo "Storing MC NIB schemas" >&2
99 /mc/gs-lite/bin/mc_store_schema >&2
109 debug_q += "\t/mc/gs-lite/bin/gsprintconsole -e `cat gshub.log` default "+q+" window=$WINDOW &\n"
113 if [ "$DEBUG_MODE" = "true" ]
115 # invoke gsprintconsole for all the queries with debug in their name
124 if [ "$RMR_PORT" != "" ]
126 RMR_OPTION="-R $RMR_PORT"
129 # invoke gsprintconsole_ves gsmcnib for all non-debug queries
134 runall += " /mc/gs-lite/bin/gsprintconsole_ves -C $VES_IP:$VES_PORT -U /vescollector/eventListener/v7 -V 7 $RMR_OPTION `cat gshub.log` default "+q+" window=$WINDOW &\n"
135 keys = nib[q]["keys"]
137 keys_str = ",".join(keys)
138 runall += " /mc/gs-lite/bin/gsmcnib -K "+keys_str+" `cat gshub.log` default "+q+" window=$WINDOW &\n"
140 runall += " /mc/gs-lite/bin/gsmcnib `cat gshub.log` default "+q+" window=$WINDOW &\n"
145 bash /mc/gs-lite/bin/start_processing
149 rflnm = options.querydir+"/runall"
150 rfl = open(rflnm, "w")
154 cmd = "chmod +x "+rflnm
155 sys.stderr.write("Executing "+cmd+"\n")
158 sys.stderr.write("Error executing "+cmd+"\n")