Skip to content
Snippets Groups Projects
Commit c98d03a8 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

BugID: 802

Added definition for the online- and offline controllers.
parent a15bb9c2
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,8 @@ enum { ...@@ -46,6 +46,8 @@ enum {
CNTLRTYPE_NO_TYPE = 0, // no type defined yet CNTLRTYPE_NO_TYPE = 0, // no type defined yet
CNTLRTYPE_SCHEDULERCTRL, // MACscheduler CNTLRTYPE_SCHEDULERCTRL, // MACscheduler
CNTLRTYPE_OBSERVATIONCTRL, // ObservationControl CNTLRTYPE_OBSERVATIONCTRL, // ObservationControl
CNTLRTYPE_ONLINECTRL, // OnlineControl
CNTLRTYPE_OFFLINECTRL, // OfflineControl
CNTLRTYPE_BEAMDIRECTIONCTRL, // BeamDirectionControl CNTLRTYPE_BEAMDIRECTIONCTRL, // BeamDirectionControl
CNTLRTYPE_GROUPCTRL, // RingControl CNTLRTYPE_GROUPCTRL, // RingControl
CNTLRTYPE_STATIONCTRL, // StationControl CNTLRTYPE_STATIONCTRL, // StationControl
......
...@@ -6,6 +6,7 @@ pkginclude_HEADERS = \ ...@@ -6,6 +6,7 @@ pkginclude_HEADERS = \
APL_Defines.h \ APL_Defines.h \
APLUtilities.h \ APLUtilities.h \
ControllerDefines.h \ ControllerDefines.h \
StationInfo.h \
PropertySetAnswer.h \ PropertySetAnswer.h \
PropertySetAnswerHandlerInterface.h \ PropertySetAnswerHandlerInterface.h \
CTState.h \ CTState.h \
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
//# Includes //# Includes
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <Deployment/StationInfo.h>
#include <APS/ParameterSet.h> #include <APS/ParameterSet.h>
#include <GCF/GCF_ServiceInfo.h> #include <GCF/GCF_ServiceInfo.h>
#include <GCF/Utils.h> #include <GCF/Utils.h>
#include <APL/APLCommon/APLUtilities.h> #include <APL/APLCommon/APLUtilities.h>
#include <APL/APLCommon/StationInfo.h>
#include <APL/APLCommon/ChildControl.h> #include <APL/APLCommon/ChildControl.h>
#include <Controller_Protocol.ph> #include <Controller_Protocol.ph>
#include <StartDaemon_Protocol.ph> #include <StartDaemon_Protocol.ph>
...@@ -178,9 +178,10 @@ bool ChildControl::startChild (const string& aName, ...@@ -178,9 +178,10 @@ bool ChildControl::startChild (const string& aName,
// Add some comment lines and some extra fields to the file // Add some comment lines and some extra fields to the file
cntlrSet.add("prefix", prefix+position+nodeName+"."); cntlrSet.add("prefix", prefix+position+nodeName+".");
cntlrSet.add("_instanceNr", lexical_cast<string>(instanceNr)); cntlrSet.add("_instanceNr", lexical_cast<string>(instanceNr));
cntlrSet.add("_moduleName", nodeName);
cntlrSet.add("_treeID", lexical_cast<string>(anObsID)); cntlrSet.add("_treeID", lexical_cast<string>(anObsID));
cntlrSet.add("# modulename", nodeName); cntlrSet.add("# moduleName", nodeName);
cntlrSet.add("# pathname", prefix+position+nodeName+"."); cntlrSet.add("# pathName", prefix+position+nodeName+".");
cntlrSet.add("# treeID", lexical_cast<string>(anObsID)); cntlrSet.add("# treeID", lexical_cast<string>(anObsID));
// Finally write to subset to the file. // Finally write to subset to the file.
cntlrSet.writeFile (cntlrSetName); cntlrSet.writeFile (cntlrSetName);
...@@ -441,7 +442,7 @@ void ChildControl::_processActionList() ...@@ -441,7 +442,7 @@ void ChildControl::_processActionList()
switch (action->requestedState) { switch (action->requestedState) {
case CTState::CONNECTED: // start program, wait for CONNECTED msgs of child case CTState::CONNECTED: // start program, wait for CONNECTED msgs of child
{ {
// first check if connection if StartDaemon is made // first check if connection with StartDaemon is made
SDiter startDaemon = itsStartDaemonMap.find(action->hostname); SDiter startDaemon = itsStartDaemonMap.find(action->hostname);
if (startDaemon == itsStartDaemonMap.end() || if (startDaemon == itsStartDaemonMap.end() ||
!startDaemon->second->isConnected()) { !startDaemon->second->isConnected()) {
...@@ -781,7 +782,8 @@ GCFEvent::TResult ChildControl::operational(GCFEvent& event, ...@@ -781,7 +782,8 @@ GCFEvent::TResult ChildControl::operational(GCFEvent& event,
case F_INIT: case F_INIT:
break; break;
case F_ENTRY: case F_ENTRY: // process actions that where queued during my startup.
_processActionList();
break; break;
case F_ACCEPT_REQ: { case F_ACCEPT_REQ: {
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
//# Includes //# Includes
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <Common/StringUtil.h> // rtrim #include <Common/StringUtil.h> // rtrim
#include <Deployment/StationInfo.h>
#include <GCF/Utils.h> // myHostname #include <GCF/Utils.h> // myHostname
#include <APS/ParameterSet.h> // indexValue #include <APS/ParameterSet.h> // indexValue
#include <APL/APLCommon/ControllerDefines.h> #include <APL/APLCommon/ControllerDefines.h>
#include <APL/APLCommon/StationInfo.h>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
...@@ -47,9 +47,13 @@ typedef struct cntlrDefinition { ...@@ -47,9 +47,13 @@ typedef struct cntlrDefinition {
} cntlrDefinition_t; } cntlrDefinition_t;
static cntlrDefinition_t controllerTable[] = { static cntlrDefinition_t controllerTable[] = {
// executable parsetNode shared
//----------------------------------------------------------
{ "", "", false }, { "", "", false },
{ "MACScheduler", "MACScheduler", false }, { "MACScheduler", "MACScheduler", false },
{ "ObservationControl", "ObsCtrl", false }, { "ObservationControl", "ObsCtrl", false },
{ "OnlineControl", "OnlineCtrl", false },
{ "OfflineControl", "OfflineCtrl", false },
{ "BeamDirectionControl", "BeamDirCtrl", true }, { "BeamDirectionControl", "BeamDirCtrl", true },
{ "RingControl", "RingCtrl", true }, { "RingControl", "RingCtrl", true },
{ "StationControl", "StationCtrl", false }, { "StationControl", "StationCtrl", false },
...@@ -134,6 +138,7 @@ int32 getControllerType (const string& controllerName) ...@@ -134,6 +138,7 @@ int32 getControllerType (const string& controllerName)
{ {
string cntlrName(controllerName); // destroyable copy string cntlrName(controllerName); // destroyable copy
rtrim(cntlrName, "[]{}0123456789"); // cut down to executable name rtrim(cntlrName, "[]{}0123456789"); // cut down to executable name
// first try on controllername
uint32 idx = CNTLRTYPE_NO_TYPE + 1; uint32 idx = CNTLRTYPE_NO_TYPE + 1;
while (idx < CNTLRTYPE_NR_TYPES) { while (idx < CNTLRTYPE_NR_TYPES) {
if (!strcmp (controllerTable[idx].cntlrName, cntlrName.c_str())) { if (!strcmp (controllerTable[idx].cntlrName, cntlrName.c_str())) {
...@@ -142,6 +147,15 @@ int32 getControllerType (const string& controllerName) ...@@ -142,6 +147,15 @@ int32 getControllerType (const string& controllerName)
idx++; idx++;
} }
// not found, may user passed parsetNodename
idx = CNTLRTYPE_NO_TYPE + 1;
while (idx < CNTLRTYPE_NR_TYPES) {
if (!strcmp (controllerTable[idx].parsetName, cntlrName.c_str())) {
return (idx);
}
idx++;
}
return (CNTLRTYPE_NO_TYPE); return (CNTLRTYPE_NO_TYPE);
} }
......
...@@ -15,6 +15,7 @@ libaplcommon_la_SOURCES = $(DOCHDRS) \ ...@@ -15,6 +15,7 @@ libaplcommon_la_SOURCES = $(DOCHDRS) \
Controller_Protocol.cc \ Controller_Protocol.cc \
APLUtilities.cc \ APLUtilities.cc \
ControllerDefines.cc \ ControllerDefines.cc \
StationInfo.cc \
PropertySetAnswer.cc \ PropertySetAnswer.cc \
CTState.cc \ CTState.cc \
ControllerAdmin.cc \ ControllerAdmin.cc \
......
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
//# Includes //# Includes
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <Deployment/StationInfo.h>
#include <APS/ParameterSet.h> #include <APS/ParameterSet.h>
#include <GCF/GCF_ServiceInfo.h> #include <GCF/GCF_ServiceInfo.h>
#include <GCF/Utils.h> #include <GCF/Utils.h>
#include <APL/APLCommon/APLUtilities.h> #include <APL/APLCommon/APLUtilities.h>
#include <APL/APLCommon/ParentControl.h> #include <APL/APLCommon/ParentControl.h>
#include <APL/APLCommon/StationInfo.h>
#include <Controller_Protocol.ph> #include <Controller_Protocol.ph>
#include <StartDaemon_Protocol.ph> #include <StartDaemon_Protocol.ph>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment