Commit be59cc42 authored by Luciano Orsini's avatar Luciano Orsini
Browse files

references #155: support for findsrvs

parent a80aa895
......@@ -2,7 +2,7 @@ variables:
EXTERN_PACKAGES: "extern/oracle extern/dim extern/smi extern/yui extern/caen/a2818 extern/caen/a3818 extern/caen/CAENUSBdrvB extern/caen/caenvmelib extern/caen/caencomm extern/caen/caenbridgeupgrade extern/caen/caenupgrader"
WORKSUITE_PACKAGES: "xdaq2rc interface/evb interface/shared evb jobcontrol xpci/drv xpci hal/generic hal/utilities hal/busAdapter/dummy hal/busAdapter/caen hal/busAdapter/pci hal/PyHAL pheaps/drv/cmem_rcc pheaps jal/jtagChain jal/jtagController jal/jtagSVFSequencer ttc/utils ttc/monitoring ttc/ltc ttc/ttcci tts/ttsbase tts/atts tts/cpcibase tts/fmmtd tts/ipcutils tts/fmm tts/fmmcontroller tts/fmmdbi tts/fmmtester d2s/utils d2s/fedemulator d2s/gtpe d2s/gtpecontroller d2s/firmwareloader fedstreamer fedkit ferol ferol40 psx/sapi psx/mapi psx psx/watchdog sentinel sentinel/utils sentinel/probe sentinel/sentineld sentinel/tester sentinel/bridge2g sentinel/spotlight2g sentinel/spotlightocci sentinel/arc/utils sentinel/arc tstore/utils tstore/client tstore tstore/api xmas/admin xmas/heartbeat xmas/heartbeat/probe xmas/heartbeat/heartbeatd xmas/utils xmas/sensord xmas/probe xmas/tester xmas/bridge2g xmas/slash2g xmas/store2g xmas/smarthub ibvla pt/udapl pt/ibv gevb2g es/api es/xtreme es/xbeat elastic/api elastic/timestream amc13controller dipbridge"
RPM_REPO_DIR: "/tmp/$CI_PROJECT_NAME/$CI_JOB_NAME/repo"
DOCKER_IMAGE: "gitlab-registry.cern.ch/cmsos/docker/docker-image-cmsos-15-cc7-x86_64-worksuite:2.1.0.0"
DOCKER_IMAGE: "gitlab-registry.cern.ch/cmsos/docker/docker-image-cmsos-15-cc7-x86_64-worksuite:3.0.0.0"
ARTIFACT_PREREQUISITE_DIR: "$CI_PROJECT_DIR/prerequisites/"
ARTIFACT_DISTRIBUTED_DIR: "$CI_PROJECT_DIR/distributed/rpm/"
ARTIFACT_REQUIRED_DIR: "$CI_PROJECT_DIR/required/rpm/"
......
......@@ -93,6 +93,9 @@ namespace xmas
* returned. If className=NAME is provided, a server side filter on the class name is activated.
*/
void retrieveHeartbeatTable(xgi::Input * in, xgi::Output * out ) ;
// same as above but based on xdata::Table json serialization format
void findsrvs(xgi::Input * in, xgi::Output * out );
protected:
......
......@@ -17,10 +17,10 @@
// !!! Edit this line to reflect the latest package version !!!
#define WORKSUITE_XMASHEARTBEAT_VERSION_MAJOR 2
#define WORKSUITE_XMASHEARTBEAT_VERSION_MINOR 5
#define WORKSUITE_XMASHEARTBEAT_VERSION_MINOR 6
#define WORKSUITE_XMASHEARTBEAT_VERSION_PATCH 0
// If any previous versions available E.g. #define WORKSUITE_XMASHEARTBEAT_PREVIOUS_VERSIONS "3.8.0,3.8.1"
#undef WORKSUITE_XMASHEARTBEAT_PREVIOUS_VERSIONS
#define WORKSUITE_XMASHEARTBEAT_PREVIOUS_VERSIONS "2.5.0"
//
// Template macros
......
......@@ -45,6 +45,7 @@
#include "xdata/Table.h"
#include "xdata/TableAlgorithms.h"
#include "xdata/exdr/Serializer.h"
#include "xdata/json/Serializer.h"
#include "xdaq/ApplicationDescriptorImpl.h"
#include "toolbox/TimeVal.h"
......@@ -93,9 +94,10 @@ xmas::heartbeat::Application::Application (xdaq::ApplicationStub* s)
subscribeExpiration_ = "PT30S";
this->getApplicationInfoSpace()->fireItemAvailable("subscribeExpiration",&subscribeExpiration_);
LOG4CPLUS_INFO (this->getApplicationLogger(), "Bind HHTP callback functions");
LOG4CPLUS_INFO (this->getApplicationLogger(), "Bind HTTP callback functions");
// bind HTTP callback
xgi::bind(this, &xmas::heartbeat::Application::findsrvs, "findsrvs");
xgi::bind(this, &xmas::heartbeat::Application::retrieveHeartbeatTable, "retrieveHeartbeatTable");
xgi::bind(this, &xmas::heartbeat::Application::retrieveClassNames, "retrieveClassNames");
xgi::framework::deferredbind(this, this, &xmas::heartbeat::Application::Default, "Default");
......@@ -496,6 +498,107 @@ void xmas::heartbeat::Application::flexDisplay(xgi::Input * in, xgi::Output * ou
}
void xmas::heartbeat::Application::findsrvs(xgi::Input * in, xgi::Output * out )
{
try
{
cgicc::Cgicc cgi(in);
// Allow a filter on class
std::vector<cgicc::FormEntry> classname;
cgi.getElement("classname", classname);
std::string filterClassName = "";
if (classname.size() > 0)
{
filterClassName = classname.begin()->getValue();
}
std::string expired = "";
if (xgi::Utils::hasFormElement(cgi, "expired"))
{
expired = xgi::Utils::getFormElement(cgi, "expired")->getValue();
}
std::list<xdata::Properties> destinations;
if (expired == "true")
{
destinations = this->getDestinations(true);
}
else if (expired == "false")
{
destinations = this->getDestinations(false);
}
else
{
destinations = this->getDestinations();
}
std::list<xdata::Properties>::iterator i = destinations.begin();
xdata::Table t;
t.addColumn("context","string");
t.addColumn("uuid", "string");
t.addColumn("id", "string");
t.addColumn("class", "string");
t.addColumn("age", "float");
t.addColumn("expires", "time");
t.addColumn("updated", "time");
t.addColumn("group", "string");
t.addColumn("service", "string");
t.addColumn("icon", "string");
while (i != destinations.end())
{
if ((filterClassName.length() == 0) || (filterClassName == (*i).getProperty("urn:xdaq-application-descriptor:class")))
{
xdata::String s;
xdata::Table::iterator itt = t.append();
xdata::Table::Row& row = *itt;
s = (*i).getProperty("urn:xdaq-application-descriptor:context");
row.setField("context", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:uuid");
row.setField("uuid", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:id");
row.setField("id", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:class");
row.setField("class", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:group");
row.setField("group", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:service");
row.setField("service", s);
s = (*i).getProperty("urn:xdaq-application-descriptor:icon");
row.setField("icon", s);
xdata::Float a;
a.fromString((*i).getProperty("age"));
row.setField("age", a);
xdata::TimeVal e((*i).getProperty("expires"));
row.setField("expires", e);
xdata::TimeVal u((*i).getProperty("updated"));
row.setField("updated", u);
}
i++;
}
out->getHTTPResponseHeader().addHeader("Content-Type", "text/json");
out->getHTTPResponseHeader().addHeader("Cache-Control", "max-age=2"); //response will be cached in a client for 2s
xdata::json::Serializer serializer;
serializer.exportAll(&t,*out);
}
catch (xgi::exception::Exception& e)
{
; // just forward the exception
}
catch(std::exception & e)
{
XCEPT_RAISE(xgi::exception::Exception, e.what());
}
}
void xmas::heartbeat::Application::retrieveHeartbeatTable(xgi::Input * in, xgi::Output * out )
{
......@@ -700,7 +803,7 @@ void xmas::heartbeat::Application::addDestination(xdata::Properties & p)
hb.updated = now;
hb.expired = false;
LOG4CPLUS_INFO (this->getApplicationLogger(),
LOG4CPLUS_DEBUG (this->getApplicationLogger(),
"Created descriptor: " << p.getProperty("urn:xdaq-application-descriptor:uuid")
<< ", context: " << p.getProperty("urn:xdaq-application-descriptor:context")
<< ", lid: " << p.getProperty("urn:xdaq-application-descriptor:id")
......
......@@ -8,12 +8,15 @@
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libb2innub.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libi2outils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libexecutive.so</xp:Module>
<xp:Application class="pt::utcp::Application" id="20" instance="0" network="local" heartbeat="false" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:pt::utcp::Application" xsi:type="soapenc:Struct">
<maxClients xsi:type="xsd:unsignedInt">1024</maxClients>
<maxBlockSize xsi:type="xsd:unsignedInt">4096</maxBlockSize>
<committedPoolSize xsi:type="xsd:double">0x100000</committedPoolSize>
<committedPoolSize xsi:type="xsd:double">0x1400000</committedPoolSize>
<ioQueueSize xsi:type="xsd:unsignedInt">1024</ioQueueSize>
<eventQueueSize xsi:type="xsd:unsignedInt">10000</eventQueueSize>
<autoConnect xsi:type="xsd:boolean">false</autoConnect>
<protocol xsi:type="xsd:string">utcp</protocol>
<maxReceiveBuffers xsi:type="xsd:unsignedInt">4</maxReceiveBuffers>
......@@ -25,7 +28,7 @@
<properties xmlns="urn:xdaq-application:pt::http::PeerTransportHTTP" xsi:type="soapenc:Struct">
<documentRoot xsi:type="xsd:string">${XDAQ_DOCUMENT_ROOT}</documentRoot>
<aliasName xsi:type="xsd:string">/directory</aliasName>
<aliasPath xsi:type="xsd:string">/nfshome0/proberts/daq/xmas/heartbeat/</aliasPath>
<aliasPath xsi:type="xsd:string">${XDAQ_SETUP_ROOT}/${XDAQ_ZONE}</aliasPath>
<httpHeaderFields xsi:type="soapenc:Array" soapenc:arrayType="xsd:ur-type[3]">
<item xsi:type="soapenc:Struct" soapenc:position="[0]">
<name xsi:type="xsd:string">Access-Control-Allow-Origin</name>
......@@ -37,7 +40,7 @@
</item>
<item xsi:type="soapenc:Struct" soapenc:position="[2]">
<name xsi:type="xsd:string">Access-Control-Allow-Headers</name>
<value xsi:type="xsd:string">x-requested-with</value>
<value xsi:type="xsd:string">x-requested-with, soapaction</value>
</item>
</httpHeaderFields>
<expiresByType xsi:type="soapenc:Array" soapenc:arrayType="xsd:ur-type[5]">
......@@ -74,7 +77,7 @@
<xp:Application class="xmem::probe::Application" id="7" network="local" logpolicy="inherit"/>
<xp:Module>${XDAQ_ROOT}/lib/libxmemprobe.so</xp:Module>
<!-- XPlore requires the installation of Power Pack -->
<xp:Application heartbeat="false" class="xplore::Application" id="9" network="local" logpolicy="inherit">
<xp:Application heartbeat="false" class="xplore::Application" id="9" service="xplore" network="local" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:xplore::Application" xsi:type="soapenc:Struct">
<republishInterval xsi:type="xsd:string">60</republishInterval>
</properties>
......@@ -84,11 +87,58 @@
<xp:Module>${XDAQ_ROOT}/lib/libxploreutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libxplore.so</xp:Module>
<xp:Endpoint protocol="utcp" service="b2in" hostname="localhost" port="1911" maxport="1970" autoscan="true" network="localnet" smode="select" rmode="select" nonblock="true" sndTimeout="2000" rcvTimeout="2000"/>
<!-- include "module/access.module" -->
<xp:Endpoint protocol="utcp" service="b2in" subnet="10.176.0.0" port="1910" maxport="1950" publish="true" autoscan="true" network="slimnet" smode="select" rmode="select" nonblock="true" sndTimeout="2000" rcvTimeout="2000"/>
<xp:Application heartbeat="false" class="xmas::heartbeat::Application" id="39" network="slimnet" group="monitor,xmas" service="xmasheartbeat" publish="true" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:xmas::heartbeat::Application" xsi:type="soapenc:Struct">
<xp:Application class="eventing::core::Publisher" id="64" instance="0" network="localnet" bus="localbus" service="eventing-publisher" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:eventing::core::Publisher" xsi:type="soapenc:Struct">
<eventings xsi:type="soapenc:Array" soapenc:arrayType="xsd:ur-type[1]">
<item xsi:type="xsd:string" soapenc:position="[0]">utcp://localhost:2440</item>
</eventings>
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libeventingapi.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libeventingcore.so</xp:Module>
<!-- Sentinel Probe -->
<xp:Application heartbeat="true" class="sentinel::probe::Application" id="6" network="localnet" group="sentinel" service="sentinelprobe" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:sentinel::probe::Application" xsi:type="soapenc:Struct">
<outputBus xsi:type="xsd:string">localbus</outputBus>
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libb2inutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libsentinelutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libsentinelprobe.so</xp:Module>
<!-- Heartbeat Probe -->
<xp:Application heartbeat="true" class="xmas::heartbeat::probe::Application" id="4" network="localnet" group="sentinel" service="heartbeatprobe" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:xmas::heartbeat::probe::Application" xsi:type="soapenc:Struct">
<heartbeatWatchdog xsi:type="xsd:string">PT10S</heartbeatWatchdog>
<outputBus xsi:type="xsd:string">localbus</outputBus>
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libb2inutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libwsaddressing.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libxmasutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libeventingapi.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libxmasheartbeatprobe.so</xp:Module>
<!-- XMAS Probe -->
<xp:Application heartbeat="true" class="xmas::probe::Application" id="5" network="localnet" group="xmas" service="xmasprobe" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:xmas::probe::Application" xsi:type="soapenc:Struct">
<autoConfigure xsi:type="xsd:boolean">true</autoConfigure>
<autoConfSearchPath xsi:type="xsd:string">http://kvm-s3562-1-ip151-131.cms:9966/directory/sensor</autoConfSearchPath>
<maxReportMessageSize xsi:type="xsd:unsignedInt" >0x100000</maxReportMessageSize>
<elasticsearchClusterUrl xsi:type="xsd:string">http://cmsos-iaas-cdaq.cms:9200</elasticsearchClusterUrl>
<dynamicMetadata xsi:type="xsd:boolean">false</dynamicMetadata>
<tag xsi:type="xsd:string"></tag>
<autoTag xsi:type="xsd:string">production</autoTag>
<outputBus xsi:type="xsd:string">localbus</outputBus>
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libb2inutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libwsaddressing.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libxmasutils.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libjansson.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libelasticapi.so</xp:Module>
<xp:Module>${XDAQ_ROOT}/lib/libxmasprobe.so</xp:Module>
<xp:Application heartbeat="true" class="xmas::heartbeat::Application" id="39" network="slimnet" group="monitor,xmas" service="xmasheartbeat" publish="true" logpolicy="inherit">
<properties xmlns="urn:xdaq-application:xmas::heartbeat::Application" xsi:type="soapenc:Struct">
<subscribeGroup xsi:type="xsd:string">xmas</subscribeGroup>
<scanPeriod xsi:type="xsd:string">PT20S</scanPeriod>
<subscribeExpiration xsi:type="xsd:string">PT60S</subscribeExpiration>
......@@ -97,5 +147,5 @@
</properties>
</xp:Application>
<xp:Module>${XDAQ_ROOT}/lib/libb2inutils.so</xp:Module>
<xp:Module>/nfshome0/proberts/daq/xmas/heartbeat/lib/linux/x86_64_slc6/libxmasheartbeat.so</xp:Module>
<xp:Module>/nfshome0/lorsini/devel/localbus/worksuite/xmas/heartbeat/lib/linux/x86_64_centos7/libxmasheartbeat.so</xp:Module>
</xp:Profile>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment