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 # export DBAAS_SERVICE_HOST=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json __DBAAS_SERVICE_HOST__`
73 # export DBAAS_SERVICE_PORT=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json __DBAAS_SERVICE_PORT__`
75 if [ "$SIMULATOR_MODE" = "true" ]
78 python /mc/data_gen/dc_gen.py &
79 python /mc/data_gen/rrcx_gen.py &
87 VES_COLLECTOR=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json ves_collector_address`
89 VES_NAME=`echo $VES_COLLECTOR | awk 'BEGIN{FS=":"} {print $1}'`
90 VES_PORT=`echo $VES_COLLECTOR | awk 'BEGIN{FS=":"} {print $2}'`
91 VES_IP=`getent ahosts $VES_NAME | awk '{ print $1; exit }'`
93 echo "Clearing MC NIB namespace" >&2
94 /mc/gs-lite/bin/mc_clear >&2
96 echo "Storing MC NIB schemas" >&2
97 /mc/gs-lite/bin/mc_store_schema >&2
107 debug_q += "\t/mc/gs-lite/bin/gsprintconsole -e `cat gshub.log` default "+q+" window=$WINDOW &\n"
111 if [ "$DEBUG_MODE" = "true" ]
113 # invoke gsprintconsole for all the queries with debug in their name
122 # invoke gsprintconsole_ves gsmcnib for all non-debug queries
127 runall += " /mc/gs-lite/bin/gsprintconsole_ves -C $VES_IP:$VES_PORT -U /vescollector/eventListener/v7 -V 7 `cat gshub.log` default "+q+" window=$WINDOW &\n"
128 keys = nib[q]["keys"]
130 keys_str = ",".join(keys)
131 runall += " /mc/gs-lite/bin/gsmcnib -K "+keys_str+" `cat gshub.log` default "+q+" window=$WINDOW &\n"
133 runall += " /mc/gs-lite/bin/gsmcnib `cat gshub.log` default "+q+" window=$WINDOW &\n"
138 bash /mc/gs-lite/bin/start_processing
142 rflnm = options.querydir+"/runall"
143 rfl = open(rflnm, "w")
147 cmd = "chmod +x "+rflnm
148 sys.stderr.write("Executing "+cmd+"\n")
151 sys.stderr.write("Error executing "+cmd+"\n")