From 561d54a8a8513eb67fb835edf9ab92691cf2de56 Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Fri, 23 May 2008 13:11:44 +0000 Subject: [PATCH] Bug 1175: PIC and PermSW are now stored in PIC tree in OTDB. --- MAC/Deployment/configure.in | 1 + MAC/Deployment/data/OTDB/LOFAR.comp | 4 +- MAC/Deployment/data/OTDB/PIC.base | 2 +- MAC/Deployment/data/OTDB/createPICfile | 94 +++++++++++++------ MAC/Deployment/data/OTDB/loadPICtree | 2 +- MAC/Deployment/data/PVSS/Clusters.list | 7 +- MAC/Deployment/data/PVSS/PVSSDataPoints.base | 2 + .../data/StaticMetaData/ControlInfo | 2 +- MAC/Deployment/data/bin/PVSS2SAS.cc | 5 +- 9 files changed, 78 insertions(+), 41 deletions(-) diff --git a/MAC/Deployment/configure.in b/MAC/Deployment/configure.in index ada911a9d97..14187d147f8 100644 --- a/MAC/Deployment/configure.in +++ b/MAC/Deployment/configure.in @@ -53,6 +53,7 @@ dnl lofar_GENERAL lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,) lofar_INTERNAL(SAS/OTDB,OTDB,,1,OTDB/OTDBtypes.h,,) +lofar_INTERNAL(APL/APLCommon,APLCommon,,1,APL/APLCommon/StationInfo.h,,) lofar_EXTERNAL(boost,1,boost/date_time/date.hpp, boost_date_time) lofar_EXTERNAL(pqxx,2.5.5,pqxx/pqxx, pqxx) lofar_EXTERNAL(pq,,libpq-fe.h, pq, /usr/local/pgsql) diff --git a/MAC/Deployment/data/OTDB/LOFAR.comp b/MAC/Deployment/data/OTDB/LOFAR.comp index c42a9fd032b..6b5fcf45793 100644 --- a/MAC/Deployment/data/OTDB/LOFAR.comp +++ b/MAC/Deployment/data/OTDB/LOFAR.comp @@ -5,8 +5,8 @@ # name vers qual constr. descr. #-------------------------------------------------------------------------------------------------------- node LOFAR 1.0.2 development 'node constraint' "LOFAR Main" -uses PermSW 1.0.0 development 1 "Permanent Software" +#uses PermSW 1.0.0 development 1 "Permanent Software" uses ObsSW 1.0.2 development 1 "Observation Software" -uses PIC 1.0.1 development 1 "Physical Instrument Components" +#uses PIC 1.0.1 development 1 "Physical Instrument Components" uses Clock160 1.0.0 development 1 "160MHz System Clock" uses Clock200 1.0.0 development 1 "200MHz System Clock" diff --git a/MAC/Deployment/data/OTDB/PIC.base b/MAC/Deployment/data/OTDB/PIC.base index 751fbdb6a17..638afa44be2 100644 --- a/MAC/Deployment/data/OTDB/PIC.base +++ b/MAC/Deployment/data/OTDB/PIC.base @@ -6,5 +6,5 @@ #-------------------------------------------------------------------------------------------------------- node PIC 1.0.1 development 'node constraint' "Physical Instrument Component" uses @ring@ 1.0.0 development 'node constraint' "One of the four ring-areas" -uses Connection 1.0.1 development 'node constraint' "Connections between nodes" +#uses Connection 1.0.1 development 'node constraint' "Connections between nodes" uses Cluster 1.0.1 development 'node constraint' "The central clusters" diff --git a/MAC/Deployment/data/OTDB/createPICfile b/MAC/Deployment/data/OTDB/createPICfile index 9499acea4df..84cc390c739 100755 --- a/MAC/Deployment/data/OTDB/createPICfile +++ b/MAC/Deployment/data/OTDB/createPICfile @@ -4,6 +4,7 @@ # # Syntax: createFiles ( -a | stationname [stationame ...]) # +# Makea a file with PVSS(!) datapoints that must be monitored in SAS. import re, sys def expandRCUMarker(dataPoint, nrRSP): @@ -14,8 +15,7 @@ def expandRCUMarker(dataPoint, nrRSP): rsp = rcu / 8 subrack = rsp / 4 cabinet = rsp / 8 - print >> outputFile, \ - "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ + print "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ .replace("@subrack@","Subrack"+str(subrack)) \ .replace("@RSPBoard@", "RSPBoard"+str(rsp)) \ .replace("@rcu@", "RCU"+str(rcu))+".state" @@ -27,8 +27,7 @@ def expandRSPBoardMarker(dataPoint, nrRSP): for rsp in range(0, nrRSP): subrack = rsp / 4 cabinet = rsp / 8 - print >> outputFile, \ - "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ + print "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ .replace("@subrack@","Subrack"+str(subrack)) \ .replace("@RSPBoard@", "RSPBoard"+str(rsp))+".state" @@ -39,8 +38,7 @@ def expandTBBoardMarker(dataPoint, nrTBB): for tbb in range(0, nrTBB): subrack = tbb / 2 cabinet = tbb / 4 - print >> outputFile, \ - "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ + print "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ .replace("@subrack@","Subrack"+str(subrack)) \ .replace("@TBBoard@", "TBBoard"+str(tbb))+".state" @@ -52,8 +50,7 @@ def expandSubrackMarker(dataPoint, nrRSP): if nrRSP % 4: nrSubracks += 1 for subrack in range(0, nrSubracks): cabinet = subrack / 2 - print >> outputFile, \ - "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ + print "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet)) \ .replace("@subrack@","Subrack"+str(subrack))+".state" def expandCabinetMarker(dataPoint, nrRSP): @@ -63,8 +60,7 @@ def expandCabinetMarker(dataPoint, nrRSP): nrCabinets = nrRSP / 8 if nrRSP % 8: nrCabinets += 1 for cabinet in range(0, nrCabinets): - print >> outputFile, \ - "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet))+".state" + print "21 "+dataPoint.replace("@cabinet@","Cabinet"+str(cabinet))+".state" @@ -72,15 +68,16 @@ def expandCabinetMarker(dataPoint, nrRSP): # all the files we are uisng PVSSbasefile= "../PVSS/PVSSDataPoints.base" StationFile = "../StaticMetaData/StationInfo" +ControlFile = "../StaticMetaData/ControlInfo" RingFile = "../PVSS/Rings.list" -ResultFile = "./OTDBDatapoints.out" +ClusterFile = "../PVSS/Clusters.list" filledLine = re.compile("^[^#].*", re.MULTILINE) # construct a dictionary from the rings file: key is first character, value is ringname ringDict = {} for line in filledLine.findall(open(RingFile).read()): ringDict[line[0]] = line -print "ringDict =", ringDict +#print "ringDict =", ringDict # construct a list with all ring_station combinations ringStations = [] @@ -90,15 +87,29 @@ for line in filledLine.findall(open(StationFile).read()): nrRSP, nrTBB, nrLBA, nrHBA, HBAsplit, LBAcal ) = line.split() ringStations.append(ringDict[stnType]+"_"+name) stations.append(name) -print "ringStations =", ringStations -print "stations =", stations +#print "ringStations =", ringStations +#print "stations =", stations +# construct a dictionary for the clusters +clusterDict = {} +for line in filledLine.findall(open(ClusterFile).read()): + (mnemonic, prefix, count) = line.split() + clusterDict[mnemonic] = (prefix, count) +#print "clusterDict =", clusterDict + +# construct a list for the control-machines +controlList = [] +for line in filledLine.findall(open(ControlFile).read()): + (name, ipaddr, macaddr) = line.split() + controlList.append(name) +#print "controlList =", controlList + # open outputfile and write top-node of PIC -outputFile = open(ResultFile, "w") -print >> outputFile, "21 LOFAR_PIC.state" -print >> outputFile, "21 LOFAR_PermSW.state" +print "21 LOFAR.state" +print "21 LOFAR_PIC.state" +print "21 LOFAR_PermSW.state" -# construct the rings and the stations from the central database +# construct the rings with stations and the clusters with their nodes # ??? ??? C P ???_PIC_@???@ ringStationMask="" central=re.compile("^\w+[ \t]+[^ \t]+[ \t]+C[ \t]+P[ \t]([A-Za-z_]+_(?:PIC|PermSW)_@.*)", \ @@ -106,15 +117,42 @@ central=re.compile("^\w+[ \t]+[^ \t]+[ \t]+C[ \t]+P[ \t]([A-Za-z_]+_(?:PIC|PermS for line in central.findall(open(PVSSbasefile).read()): if line.find("@station@") >= 0: ringStationMask=line.replace("LOFAR_","") - for RS in stations: - print >> outputFile, \ - "21 "+line.replace("@ring@_@station@", RS)+".state" + for RS in ringStations: + print "21 "+line.replace("@ring@_@station@", RS)+".state" + # --- elif line.find("@ring@") >= 0: + # for all rings for ring in ringDict.keys(): - print >> outputFile, \ - "21 "+line.replace("@ring@", ringDict[ring])+".state" + print "21 "+line.replace("@ring@", ringDict[ring])+".state" + # --- + elif line.find("@node@") >= 0: + # for all nodes in each cluster + for cluster in clusterDict.keys(): + (name, count) = clusterDict[cluster] + for nodeNr in range(1, int(count)+1): + nodename = "%s%03d" % (name, nodeNr) + print "21 "+line.replace("@cluster@_@node@", cluster+"_"+nodename)+".state" + # for all nodes + # for all clusters + # also add the control 'cluster' at this place + for node in controlList: + print "21 "+line.replace("@cluster@_@node@", "Control_"+node)+".state" + # --- + elif line.find("@cluster@") >= 0: + # for all clusters + for cluster in clusterDict.keys(): + print "21 "+line.replace("@cluster@", cluster)+".state" + # and the control-section + print "21 "+line.replace("@cluster@", "Control")+".state" + # for all expandable lines +# Permanent software on MCU +software=re.compile("^\w+[ \t]+[^ \t]+[ \t]+C[ \t]+P[ \t]([A-Za-z_]+_PermSW_[^@].*)", \ + re.IGNORECASE | re.MULTILINE) +for line in software.findall(open(PVSSbasefile).read()): + print "21 MCU001:%s.state" % line + # generate the hardware on each station for line in filledLine.findall(open(StationFile).read()): (name, stationID, stnType, long, lat, height, \ @@ -139,18 +177,12 @@ for line in filledLine.findall(open(StationFile).read()): expandCabinetMarker(prefix+line, int(nrRSP)) # for all expandable lines + # Permanent software on the stations software=re.compile("^\w+[ \t]+[^ \t]+[ \t]+S[ \t]+P[ \t]([A-Za-z_]+_PermSW_.*)", \ re.IGNORECASE | re.MULTILINE) for line in software.findall(open(PVSSbasefile).read()): - print >> outputFile, \ - "21 %s:%s.state" % (name, line) + print "21 %s:%s.state" % (name, line) #for all stations - - - - - -outputFile.close() diff --git a/MAC/Deployment/data/OTDB/loadPICtree b/MAC/Deployment/data/OTDB/loadPICtree index 1f5a1ccba4b..f9eb8509997 100755 --- a/MAC/Deployment/data/OTDB/loadPICtree +++ b/MAC/Deployment/data/OTDB/loadPICtree @@ -52,5 +52,5 @@ RESULTFILE=OTDBDatapoints.out rm -f ${RESULTFILE} echo "Creating PIC file..." -./createPICfile +./createPICfile | ../../build/gnu_debug/data/bin/PVSS2SAS >${RESULTFILE} ../../build/gnu_debug/data/bin/load_PICtree $1 ${RESULTFILE} diff --git a/MAC/Deployment/data/PVSS/Clusters.list b/MAC/Deployment/data/PVSS/Clusters.list index 9ff7c0aaf0a..0f685c386af 100644 --- a/MAC/Deployment/data/PVSS/Clusters.list +++ b/MAC/Deployment/data/PVSS/Clusters.list @@ -1,4 +1,3 @@ -BGL BGLFE 8 -Storage LIST 12 -Imaging LIMG 0 -Auxilary LIAUX 19 +BGL bglfen 4 +Storage lifs 12 +Offline lioff 32 diff --git a/MAC/Deployment/data/PVSS/PVSSDataPoints.base b/MAC/Deployment/data/PVSS/PVSSDataPoints.base index ec5ac97e3a6..d23ce0bf34b 100644 --- a/MAC/Deployment/data/PVSS/PVSSDataPoints.base +++ b/MAC/Deployment/data/PVSS/PVSSDataPoints.base @@ -25,6 +25,8 @@ PermSW - C P LOFAR_PermSW MACScheduler MS C P LOFAR_PermSW_MACScheduler Ring - C P LOFAR_PermSW_@ring@ Station - C P LOFAR_PermSW_@ring@_@station@ +Cluster - C P LOFAR_PermSW_@cluster@ +Node - C P LOFAR_PermSW_@cluster@_@node@ ObsSW - C P LOFAR_ObsSW Observation OBS C O LOFAR_ObsSW_@observation@ ObsCtrl OBSCTRL C O LOFAR_ObsSW_@observation@_ObsCtrl diff --git a/MAC/Deployment/data/StaticMetaData/ControlInfo b/MAC/Deployment/data/StaticMetaData/ControlInfo index 79ec417b14d..b7b919a1b3a 100644 --- a/MAC/Deployment/data/StaticMetaData/ControlInfo +++ b/MAC/Deployment/data/StaticMetaData/ControlInfo @@ -4,7 +4,7 @@ # $Id: $ # # name IPaddress MACaddress -#-------------------------------------------------------------------------------------------------------------- +#------------------------------------------ MCU001 10.230.10.1 00:30:48:2d:00:f6 SAS001 10.230.20.1 00:30:48:79:1c:f4 SHM001 10.230.30.1 00:30:48:2d:22:bc diff --git a/MAC/Deployment/data/bin/PVSS2SAS.cc b/MAC/Deployment/data/bin/PVSS2SAS.cc index 1da4f1a57a9..34af34a1da8 100644 --- a/MAC/Deployment/data/bin/PVSS2SAS.cc +++ b/MAC/Deployment/data/bin/PVSS2SAS.cc @@ -32,7 +32,10 @@ using namespace std; using namespace LOFAR::Deployment; int main (int argc, char* argv[]) { - cout << PVSS2SASname(argv[1]) << endl; + string input; + while(getline(cin, input)) { + cout << PVSS2SASname(input) << endl; + } return (0); } -- GitLab