Example #1
0
/* ****************************************************************************
*
* StatusCode::render -
*/
std::string StatusCode::render(Format format, const std::string& indent, bool comma, bool showTag)
{
    std::string  out  = "";

    if (strstr(details.c_str(), "\"") != NULL)
    {
        int    len = details.length() * 2;
        char*  s2    = (char*) calloc(1, len + 1);

        strReplace(s2, len, details.c_str(), "\"", "\\\"");
        details = s2;
        free(s2);
    }

    if (code == SccNone)
    {
        fill(SccReceiverInternalError, "");
        details += " - ZERO code set to 500";
    }

    out += startTag(indent, tag, format, showTag);
    out += valueTag(indent + "  ", "code", code, format, true);
    out += valueTag(indent + "  ", "reasonPhrase", reasonPhrase, format, details != "");

    if (details != "")
    {
        out += valueTag(indent + "  ", "details", details, format, false);
    }

    out += endTag(indent, tag, format, comma);

    return out;
}
Example #2
0
/* ****************************************************************************
*
* OrionError::render - 
*/
std::string OrionError::render(Format format, const std::string& _indent)
{
  std::string out           = "";
  std::string tag           = "orionError";
  std::string initialIndent = _indent;
  std::string indent        = _indent;

  //
  // OrionError is NEVER part of any other payload, so the JSON start/end braces must be added here
  //

  if (format == JSON)
  {
    out     = initialIndent + "{\n";
    indent += "  ";
  }

  out += startTag(indent, tag, format);
  out += valueTag(indent + "  ", "code",          code,         format, true);
  out += valueTag(indent + "  ", "reasonPhrase",  reasonPhrase, format, details != "");

  if (details != "")
    out += valueTag(indent + "  ", "details",       details,      format);

  out += endTag(indent, tag, format);

  if (format == JSON)
    out += initialIndent + "}\n";

  return out;
}
/* ****************************************************************************
*
* render - 
*/
std::string UpdateContextAttributeRequest::render(Format format, std::string indent)
{
  std::string tag = "updateContextAttributeRequest";
  std::string out = "";
  std::string indent2 = indent + "  ";

  out += startTag(indent, tag, format, false);
  out += valueTag(indent2, "type", type, format, true);
  out += valueTag(indent2, "contextValue", contextValue, format, true);
  out += metadataVector.render(format, indent2);
  out += endTag(indent, tag, format);

  return out;
}
Example #4
0
/* ****************************************************************************
*
* Scope::render - 
*/
std::string Scope::render(Format format, std::string indent, bool notLastInVector)
{
  std::string out      = "";
  std::string tag      = "operationScope";
  const char* tTag     = (format == XML)? "scopeType" : "type";
  const char* vTag     = (format == XML)? "scopeValue" : "value";

  out += startTag(indent, tag, tag, format, false, false);
  out += valueTag(indent + "  ", tTag, type, format, true);
  out += valueTag(indent + "  ", vTag, value, format);
  out += endTag(indent, tag, format, notLastInVector);

  return out;
}
Example #5
0
/* ****************************************************************************
*
* Reference::render - 
*/
std::string Reference::render(Format format, std::string indent, bool comma)
{
  if (string == "")
    return "";

  return valueTag(indent, "reference", string, format, comma);
}
/* ****************************************************************************
*
* AttributeDomainName::render - 
*/
std::string AttributeDomainName::render(Format format, std::string indent, bool comma)
{
  if (string == "")
    return "";

  return valueTag(indent, "attributeDomainName", string, format, comma);
}
Example #7
0
/* ****************************************************************************
*
* Throttling::render - 
*/
std::string Throttling::render(Format format, const std::string& indent, bool comma)
{
  if (string == "")
    return "";

  return valueTag(indent, "throttling", string, format, comma);
}
/* ****************************************************************************
*
* SubscriptionId::toJsonV1 -
*/
std::string SubscriptionId::toJsonV1(RequestType container, bool comma)
{
  std::string xString = string;

  if (xString == "")
  {
    if ((container == RtSubscribeContextAvailabilityResponse)          ||
        (container == RtUpdateContextAvailabilitySubscriptionResponse) ||
        (container == RtUnsubscribeContextAvailabilityResponse)        ||
        (container == NotifyContextAvailability)                       ||
        (container == UpdateContextSubscription)                       ||
        (container == UnsubscribeContext)                              ||
        (container == RtUnsubscribeContextResponse)                    ||
        (container == NotifyContext)                                   ||
        (container == RtSubscribeResponse)                             ||
        (container == RtSubscribeError))
    {
      // subscriptionId is Mandatory
      xString = "000000000000000000000000";
    }
    else
    {
      return "";  // subscriptionId is Optional
    }
  }

  return valueTag("subscriptionId", xString, comma);
}
Example #9
0
/* ****************************************************************************
*
* valueTag - 
*/
TEST(commonTag, valueTag)
{
   std::string      tag                     = "TAG";
   std::string      indent                  = "  ";
   std::string      value                   = "tag";
   std::string      jsonComma               = "  \"TAG\" : \"tag\",\n";
   std::string      jsonNoComma             = "  \"TAG\" : \"tag\"\n";
   std::string      integerJsonNoComma      = "  \"TAG\" : \"8\"\n";
   std::string      stringJsonComma         = "  \"TAG\" : \"8\",\n";
   std::string      stringJsonNoComma       = "  \"TAG\" : \"8\"\n";
   std::string      out;

   out = valueTag1(indent, tag, value);
   EXPECT_EQ(jsonNoComma, out);

   out = valueTag1(indent, tag, value, true);
   EXPECT_EQ(jsonComma, out);   

   out = valueTag1(indent, tag, value);
   EXPECT_EQ(jsonNoComma, out);   

   out = valueTag(indent, tag, 8, false);
   EXPECT_EQ(integerJsonNoComma, out);

   out = valueTag2(indent, tag, "8", true);
   EXPECT_EQ(stringJsonComma, out);

   out = valueTag2(indent, tag, "8", false);
   EXPECT_EQ(stringJsonNoComma, out);
}
Example #10
0
/* ****************************************************************************
*
* UpdateActionType::render - 
*/
std::string UpdateActionType::render(Format format, const std::string& indent, bool comma)
{
  if (string == "")
    return "";

  return valueTag(indent, "updateAction", string, format, comma);
}
/* ****************************************************************************
*
* valueTag - 
*/
TEST(commonTag, valueTag)
{
   std::string      tag                     = "TAG";
   std::string      indent                  = "  ";
   std::string      value                   = "tag";
   std::string      xml                     = "  <TAG>tag</TAG>\n";
   std::string      jsonComma               = "  \"TAG\" : \"tag\",\n";
   std::string      jsonNoComma             = "  \"TAG\" : \"tag\"\n";
   std::string      jsonCommaAndAssociation = "  \"TAG\" : tag,\n";
   std::string      integerJsonNoComma      = "  \"TAG\" : \"8\"\n";
   std::string      stringJsonComma         = "  \"TAG\" : \"8\",\n";
   std::string      stringJsonNoComma       = "  \"TAG\" : \"8\"\n";
   std::string      out;

   out = valueTag(indent, tag, value, XML);
   EXPECT_EQ(xml, out);

   out = valueTag(indent, tag, value, JSON, true);
   EXPECT_EQ(jsonComma, out);   

   out = valueTag(indent, tag, value, JSON);
   EXPECT_EQ(jsonNoComma, out);   

   out = valueTag(indent, tag, value, JSON, true, true);
   EXPECT_EQ(jsonCommaAndAssociation, out);

   out = valueTag(indent, tag, 8, JSON, false);
   EXPECT_EQ(integerJsonNoComma, out);

   out = valueTag(indent, tag, tag, "8", JSON, true);
   EXPECT_EQ(stringJsonComma, out);

   out = valueTag(indent, tag, tag, "8", JSON, false);
   EXPECT_EQ(stringJsonNoComma, out);
}
/* ****************************************************************************
*
* RestrictionString::render -
*/
std::string RestrictionString::render(Format format, const std::string& indent, bool comma)
{
  if (string == "")
  {
    return "";
  }

  return valueTag(indent, "restriction", string, format, comma);
}
Example #13
0
QString GlobalDBStorage::GetWhereClause(MSqlBindings &bindings) const
{
    QString valueTag(":WHEREVALUE");
    QString clause("value = " + valueTag);

    bindings.insert(valueTag, settingname);

    return clause;
}
Example #14
0
QString GlobalDBStorage::whereClause(MSqlBindings &bindings)
{
    QString valueTag(":WHEREVALUE");
    QString clause("value = " + valueTag);

    bindings.insert(valueTag, setting->getName());

    return clause;
}
Example #15
0
/* ****************************************************************************
*
* Metadata::render - 
*/
std::string Metadata::render(Format format, std::string indent, bool comma)
{
  std::string out     = "";
  std::string tag  = "contextMetadata";
  std::string xValue  = value;

  out += startTag(indent, tag, tag, format, false, false);
  out += valueTag(indent + "  ", "name", name, format, true);
  out += valueTag(indent + "  ", "type", type, format, true);

  if (type == "Association")
    xValue = std::string("\n") + association.render(format, indent + "  ", false);

  out += valueTag(indent + "  ", "value", xValue, format, false, (type == "Association"));
  out += endTag(indent, tag, format, comma);

  return out;
}
Example #16
0
/* ****************************************************************************
*
* Originator::render -
*/
std::string Originator::render(Format format, const std::string& indent, bool comma)
{
  if (string == "")
  {
    return "";
  }

  return valueTag(indent, "originator", string, format, comma);
}
Example #17
0
QString GlobalDBStorage::GetSetClause(MSqlBindings &bindings) const
{
    QString valueTag(":SETVALUE");
    QString dataTag(":SETDATA");

    QString clause("value = " + valueTag + ", data = " + dataTag);

    bindings.insert(valueTag, settingname);
    bindings.insert(dataTag, user->GetDBValue());

    return clause;
}
Example #18
0
QString GlobalDBStorage::setClause(MSqlBindings &bindings)
{
    QString valueTag(":SETVALUE");
    QString dataTag(":SETDATA");

    QString clause("value = " + valueTag + ", data = " + dataTag);

    bindings.insert(valueTag, setting->getName());
    bindings.insert(dataTag, setting->getValue().utf8());

    return clause;
}
Example #19
0
/* ****************************************************************************
*
* OrionError::toJsonV1 -
*
*/
std::string OrionError::toJsonV1(void)
{
  std::string  out           = "{";

  //
  // OrionError is NEVER part of any other payload, so the JSON start/end braces must be added here
  //
  out += startTag("orionError", false);
  out += valueTag("code",          code,         true);
  out += valueTag("reasonPhrase",  reasonPhrase, details != "");

  if (details != "")
  {
    out += valueTag("details",       details);
  }

  out += endTag();

  out += "}";

  return out;
}
Example #20
0
QString HostDBStorage::GetSetClause(MSqlBindings &bindings) const
{
    QString valueTag(":SETVALUE");
    QString dataTag(":SETDATA");
    QString hostnameTag(":SETHOSTNAME");
    QString clause("value = " + valueTag + ", data = " + dataTag
                   + ", hostname = " + hostnameTag);

    bindings.insert(valueTag, settingname);
    bindings.insert(dataTag, user->GetDBValue());
    bindings.insert(hostnameTag, MythDB::getMythDB()->GetHostName());

    return clause;
}
Example #21
0
/* ****************************************************************************
*
* Duration::render -
*/
std::string Duration::render(Format format, const std::string& indent, bool comma)
{
  if (string == "")
  {
    return "";
  }

  if (valid == false)
  {
    return "";
  }

  return valueTag(indent, "duration", string, format, comma);
}
/* ****************************************************************************
*
* ContextRegistrationAttribute::render - 
*/
std::string ContextRegistrationAttribute::render(Format format, const std::string& indent, bool comma)
{
  std::string xmlTag   = "contextRegistrationAttribute";
  std::string jsonTag  = "registrationAttribute";
  std::string out      = "";

  metadataVector.tagSet("metadata");

  //
  // About JSON commas:
  // The field isDomain is mandatory, so all field before that will
  // have the comma set to true for the render methods.
  // The only doubt here is whether isDomain should have the comma or not,
  // that depends on whether the metadataVector is empty or not.
  out += startTag(indent, xmlTag, jsonTag, format, false, false);
  out += valueTag(indent + "  ", "name",     name, format, true);
  out += valueTag(indent + "  ", "type",     type, format, true);
  out += valueTag(indent + "  ", "isDomain", isDomain, format, metadataVector.size() != 0);
  out += metadataVector.render(format, indent + "  ");
  out += endTag(indent, xmlTag, format, comma);

  return out;
}
Example #23
0
QString HostDBStorage::setClause(MSqlBindings &bindings)
{
    QString valueTag(":SETVALUE");
    QString dataTag(":SETDATA");
    QString hostnameTag(":SETHOSTNAME");
    QString clause("value = " + valueTag + ", data = " + dataTag
                   + ", hostname = " + hostnameTag);

    bindings.insert(valueTag, setting->getName());
    bindings.insert(dataTag, setting->getValue().utf8());
    bindings.insert(hostnameTag, gContext->GetHostName());

    return clause;
}
Example #24
0
QString HostDBStorage::GetWhereClause(MSqlBindings &bindings) const
{
    /* Returns a where clause of the form:
     * "value = :VALUE AND hostname = :HOSTNAME"
     * The necessary bindings are added to the MSQLBindings&
     */
    QString valueTag(":WHEREVALUE");
    QString hostnameTag(":WHEREHOSTNAME");

    QString clause("value = " + valueTag + " AND hostname = " + hostnameTag);

    bindings.insert(valueTag, settingname);
    bindings.insert(hostnameTag, MythDB::getMythDB()->GetHostName());

    return clause;
}
/* ****************************************************************************
*
* RegistrationId::render -
*/
std::string RegistrationId::render(RequestType requestType, Format format, const std::string& indent, bool comma)
{
  if (string == "")
  {
    if (requestType == RegisterResponse)  // registrationId is MANDATORY for RegisterContextResponse
    {
      string = "000000000000000000000000";
      LM_I(("No registrationId - setting the registrationId to 24 zeroes"));
    }
    else
    {
      return "";
    }
  }

  return valueTag(indent, "registrationId", string, format, comma);
}
Example #26
0
/* ****************************************************************************
*
* render - 
*/
std::string AttributeList::render(Format format, const std::string& indent, bool comma)
{
  std::string  out = "";
  std::string  tag = "attributeList";

  if (attributeV.size() == 0)
    return "";

  out += startTag(indent, tag, format);

  for (unsigned int ix = 0; ix < attributeV.size(); ++ix)
    out += valueTag(indent + "  ", "attribute", attributeV[ix], format, ix != attributeV.size() - 1);

  out += endTag(indent, tag, format, comma);

  return out;
}
Example #27
0
/* ****************************************************************************
*
* SubscriptionId::render - 
*/
std::string SubscriptionId::render(RequestType container, Format format, const std::string& indent, bool comma)
{
  std::string xString = string;
  
  if (xString == "")
  {
    if ((container == RtSubscribeContextAvailabilityResponse)     || (container == RtUpdateContextAvailabilitySubscriptionResponse) ||
        (container == RtUnsubscribeContextAvailabilityResponse)   || (container == NotifyContextAvailability)                       ||
        (container == UpdateContextSubscription)                  || (container == UnsubscribeContext)                              ||
        (container == RtUnsubscribeContextResponse)               || (container == NotifyContext)                                   ||
        (container == RtSubscribeResponse)                        || (container == RtSubscribeError))
    {
      // subscriptionId is Mandatory
      xString = "000000000000000000000000";
    }
    else
      return ""; // subscriptionId is Optional
  }

  return valueTag(indent, "subscriptionId", xString, format, comma);
}
Example #28
0
/* ****************************************************************************
*
* versionTreat - 
*/
std::string versionTreat(ConnectionInfo* ciP, int components, std::vector<std::string>& compV, ParseData* parseDataP)
{
  std::string out     = "";
  std::string tag     = "orion";
  std::string indent  = "";

#ifdef UNIT_TEST
  std::string uptime = "0 d, 0 h, 0 m, 0 s";
#else
  std::string uptime = parsedUptime(getTimer()->getCurrentTime() - startTime);
#endif

  out += startTag(indent, tag, ciP->outFormat);
  out += valueTag(indent + "  ", "version",       versionString,   ciP->outFormat, true);
  out += valueTag(indent + "  ", "uptime",        uptime,          ciP->outFormat, true);
  out += valueTag(indent + "  ", "git_hash",      GIT_HASH,        ciP->outFormat, true);
  out += valueTag(indent + "  ", "compile_time",  COMPILE_TIME,    ciP->outFormat, true);
  out += valueTag(indent + "  ", "compiled_by",   COMPILED_BY,     ciP->outFormat, true);
  out += valueTag(indent + "  ", "compiled_in",   COMPILED_IN,     ciP->outFormat, false);
  out += endTag(indent, tag, ciP->outFormat);

  ciP->httpStatusCode = SccOk;
  return out;
}
/* ****************************************************************************
*
* statisticsTreat - 
*/
std::string statisticsTreat
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  std::string out     = "";
  std::string tag     = "orion";
  std::string indent  = "";
  std::string indent2 = (ciP->outFormat == JSON)? indent + "    " : indent + "  ";

  if (ciP->method == "DELETE")
  {
    noOfJsonRequests                                = -1;
    noOfXmlRequests                                 = -1;
    noOfRegistrations                               = -1;
    noOfRegistrationErrors                          = -1;
    noOfRegistrationUpdates                         = -1;
    noOfRegistrationUpdateErrors                    = -1;
    noOfDiscoveries                                 = -1;
    noOfDiscoveryErrors                             = -1;
    noOfAvailabilitySubscriptions                   = -1;
    noOfAvailabilitySubscriptionErrors              = -1;
    noOfAvailabilityUnsubscriptions                 = -1;
    noOfAvailabilityUnsubscriptionErrors            = -1;
    noOfAvailabilitySubscriptionUpdates             = -1;
    noOfAvailabilitySubscriptionUpdateErrors        = -1;
    noOfAvailabilityNotificationsReceived           = -1;
    noOfAvailabilityNotificationsSent               = -1;

    noOfQueries                                     = -1;
    noOfQueryErrors                                 = -1;
    noOfUpdates                                     = -1;
    noOfUpdateErrors                                = -1;
    noOfSubscriptions                               = -1;
    noOfSubscriptionErrors                          = -1;
    noOfSubscriptionUpdates                         = -1;
    noOfSubscriptionUpdateErrors                    = -1;
    noOfUnsubscriptions                             = -1;
    noOfUnsubscriptionErrors                        = -1;
    noOfNotificationsReceived                       = -1;
    noOfNotificationsSent                           = -1;
    noOfQueryContextResponses                       = -1;
    noOfUpdateContextResponses                      = -1;

    noOfContextEntitiesByEntityId                   = -1;
    noOfContextEntityAttributes                     = -1;
    noOfEntityByIdAttributeByName                   = -1;
    noOfContextEntityTypes                          = -1;
    noOfContextEntityTypeAttributeContainer         = -1;
    noOfContextEntityTypeAttribute                  = -1;

    noOfIndividualContextEntity                     = -1;
    noOfIndividualContextEntityAttributes           = -1;
    noOfIndividualContextEntityAttribute            = -1;
    noOfUpdateContextElement                        = -1;
    noOfAppendContextElement                        = -1;
    noOfUpdateContextAttribute                      = -1;

    noOfNgsi10ContextEntityTypes                    = -1;
    noOfNgsi10ContextEntityTypesAttributeContainer  = -1;
    noOfNgsi10ContextEntityTypesAttribute           = -1;
    noOfNgsi10SubscriptionsConvOp                   = -1;

    noOfAllContextEntitiesRequests                    = -1;
    noOfAllEntitiesWithTypeAndIdRequests              = -1;
    noOfIndividualContextEntityAttributeWithTypeAndId = -1;
    noOfAttributeValueInstanceWithTypeAndId           = -1;
    noOfContextEntitiesByEntityIdAndType              = -1;
    noOfEntityByIdAttributeByNameIdAndType            = -1;

    noOfLogRequests                                 = -1;
    noOfVersionRequests                             = -1;
    noOfExitRequests                                = -1;
    noOfLeakRequests                                = -1;
    noOfStatisticsRequests                          = -1;
    noOfInvalidRequests                             = -1;
    noOfRegisterResponses                           = -1;

    out += startTag(indent, tag, ciP->outFormat, true, true);
    out += valueTag(indent2, "message", "All statistics counter reset", ciP->outFormat);
    indent2 = (ciP->outFormat == JSON)? indent + "  " : indent;
    out += endTag(indent2, tag, ciP->outFormat, false, false, true, true);
    return out;
  }

  out += startTag(indent, tag, ciP->outFormat, true, true);

  if (noOfXmlRequests != -1)
  {
    out += TAG_ADD("xmlRequests", noOfXmlRequests);
  }

  if (noOfJsonRequests != -1)
  {
    out += TAG_ADD("jsonRequests", noOfJsonRequests);
  }

  if (noOfRegistrations != -1)
  {
    out += TAG_ADD("registrations", noOfRegistrations);
  }

  if (noOfRegistrationUpdates != -1)
  {
    out += TAG_ADD("registrationUpdates", noOfRegistrationUpdates);
  }

  if (noOfDiscoveries != -1)
  {
    out += TAG_ADD("discoveries", noOfDiscoveries);
  }

  if (noOfAvailabilitySubscriptions != -1)
  {
    out += TAG_ADD("availabilitySubscriptions", noOfAvailabilitySubscriptions);
  }

  if (noOfAvailabilitySubscriptionUpdates != -1)
  {
    out += TAG_ADD("availabilitySubscriptionUpdates", noOfAvailabilitySubscriptionUpdates);
  }

  if (noOfAvailabilityUnsubscriptions != -1)
  {
    out += TAG_ADD("availabilityUnsubscriptions", noOfAvailabilityUnsubscriptions);
  }

  if (noOfAvailabilityNotificationsReceived != -1)
  {
    out += TAG_ADD("availabilityNotificationsReceived", noOfAvailabilityNotificationsReceived);
  }

  if (noOfQueries != -1)
  {
    out += TAG_ADD("queries", noOfQueries);
  }

  if (noOfUpdates != -1)
  {
    out += TAG_ADD("updates", noOfUpdates);
  }

  if (noOfSubscriptions != -1)
  {
    out += TAG_ADD("subscriptions", noOfSubscriptions);
  }

  if (noOfSubscriptionUpdates != -1)
  {
    out += TAG_ADD("subscriptionUpdates", noOfSubscriptionUpdates);
  }

  if (noOfUnsubscriptions != -1)
  {
    out += TAG_ADD("unsubscriptions", noOfUnsubscriptions);
  }

  if (noOfNotificationsReceived != -1)
  {
    out += TAG_ADD("notificationsReceived", noOfNotificationsReceived);
  }

  if (noOfQueryContextResponses != -1)
  {
    out += TAG_ADD("queryResponsesReceived", noOfQueryContextResponses);
  }

  if (noOfUpdateContextResponses != -1)
  {
    out += TAG_ADD("updateResponsesReceived", noOfUpdateContextResponses);
  }

  if (noOfQueryContextResponses != -1)
  {
    out += TAG_ADD("queryResponsesReceived", noOfQueryContextResponses);
  }

  if (noOfUpdateContextResponses != -1)
  {
    out += TAG_ADD("updateResponsesReceived", noOfUpdateContextResponses);
  }

  if (noOfContextEntitiesByEntityId != -1)
  {
    out += TAG_ADD("contextEntitiesByEntityId", noOfContextEntitiesByEntityId);
  }

  if (noOfContextEntityAttributes != -1)
  {
    out += TAG_ADD("contextEntityAttributes", noOfContextEntityAttributes);
  }

  if (noOfEntityByIdAttributeByName != -1)
  {
    out += TAG_ADD("entityByIdAttributeByName", noOfEntityByIdAttributeByName);
  }

  if (noOfContextEntityTypes != -1)
  {
    out += TAG_ADD("contextEntityTypes", noOfContextEntityTypes);
  }

  if (noOfContextEntityTypeAttributeContainer != -1)
  {
    out += TAG_ADD("contextEntityTypeAttributeContainer", noOfContextEntityTypeAttributeContainer);
  }

  if (noOfContextEntityTypeAttribute != -1)
  {
    out += TAG_ADD("contextEntityTypeAttribute", noOfContextEntityTypeAttribute);
  }


  if (noOfIndividualContextEntity != -1)
  {
    out += TAG_ADD("individualContextEntity", noOfIndividualContextEntity);
  }

  if (noOfIndividualContextEntityAttributes != -1)
  {
    out += TAG_ADD("individualContextEntityAttributes", noOfIndividualContextEntityAttributes);
  }

  if (noOfIndividualContextEntityAttribute != -1)
  {
    out += TAG_ADD("individualContextEntityAttribute", noOfIndividualContextEntityAttribute);
  }

  if (noOfUpdateContextElement != -1)
  {
    out += TAG_ADD("updateContextElement", noOfUpdateContextElement);
  }

  if (noOfAppendContextElement != -1)
  {
    out += TAG_ADD("appendContextElement", noOfAppendContextElement);
  }

  if (noOfUpdateContextAttribute != -1)
  {
    out += TAG_ADD("updateContextAttribute", noOfUpdateContextAttribute);
  }


  if (noOfNgsi10ContextEntityTypes != -1)
  {
    out += TAG_ADD("contextEntityTypesNgsi10", noOfNgsi10ContextEntityTypes);
  }

  if (noOfNgsi10ContextEntityTypesAttributeContainer != -1)
  {
    out += TAG_ADD("contextEntityTypeAttributeContainerNgsi10", noOfNgsi10ContextEntityTypesAttributeContainer);
  }

  if (noOfNgsi10ContextEntityTypesAttribute != -1)
  {
    out += TAG_ADD("contextEntityTypeAttributeNgsi10", noOfNgsi10ContextEntityTypesAttribute);
  }

  if (noOfNgsi10SubscriptionsConvOp != -1)
  {
    out += TAG_ADD("subscriptionsNgsi10ConvOp", noOfNgsi10SubscriptionsConvOp);
  }


  if (noOfAllContextEntitiesRequests != -1)
  {
    out += TAG_ADD("allContextEntitiesRequests", noOfAllContextEntitiesRequests);
  }

  if (noOfAllEntitiesWithTypeAndIdRequests != -1)
  {
    out += TAG_ADD("allContextEntitiesWithTypeAndIdRequests", noOfAllEntitiesWithTypeAndIdRequests);
  }

  if (noOfIndividualContextEntityAttributeWithTypeAndId != -1)
  {
    out += TAG_ADD("individualContextEntityAttributeWithTypeAndId", noOfIndividualContextEntityAttributeWithTypeAndId);
  }

  if (noOfAttributeValueInstanceWithTypeAndId != -1)
  {
    out += TAG_ADD("attributeValueInstanceWithTypeAndId", noOfAttributeValueInstanceWithTypeAndId);
  }

  if (noOfContextEntitiesByEntityIdAndType != -1)
  {
    out += TAG_ADD("contextEntitiesByEntityIdAndType", noOfContextEntitiesByEntityIdAndType);
  }

  if (noOfEntityByIdAttributeByNameIdAndType != -1)
  {
    out += TAG_ADD("entityByIdAttributeByNameIdAndType", noOfEntityByIdAttributeByNameIdAndType);
  }

  if (noOfLogRequests != -1)
  {
    out += TAG_ADD("logRequests", noOfLogRequests);
  }

  if (noOfVersionRequests != -1)
  {
    out += TAG_ADD("versionRequests", noOfVersionRequests);
  }

  if (noOfExitRequests != -1)
  {
    out += TAG_ADD("exitRequests", noOfExitRequests);
  }

  if (noOfLeakRequests != -1)
  {
    out += TAG_ADD("leakRequests", noOfLeakRequests);
  }

  if (noOfStatisticsRequests != -1)
  {
    out += TAG_ADD("statisticsRequests", noOfStatisticsRequests);
  }

  if (noOfInvalidRequests != -1)
  {
    out += TAG_ADD("invalidRequests", noOfInvalidRequests);
  }

  if (noOfRegisterResponses != -1)
  {
    out += TAG_ADD("registerResponses", noOfRegisterResponses);
  }


  if (noOfRegistrationErrors != -1)
  {
    out += TAG_ADD("registrationErrors", noOfRegistrationErrors);
  }

  if (noOfRegistrationUpdateErrors != -1)
  {
    out += TAG_ADD("registrationUpdateErrors", noOfRegistrationUpdateErrors);
  }

  if (noOfDiscoveryErrors != -1)
  {
    out += TAG_ADD("discoveryErrors", noOfDiscoveryErrors);
  }

  int now = getCurrentTime();
  out += valueTag(indent2, "uptime_in_secs",             now - startTime,      ciP->outFormat, true);
  out += valueTag(indent2, "measuring_interval_in_secs", now - statisticsTime, ciP->outFormat, false);

  indent2 = (ciP->outFormat == JSON)? indent + "  " : indent;
  out += endTag(indent2, tag, ciP->outFormat, false, false, true, true);

  ciP->httpStatusCode = SccOk;
  return out;
}
/* ****************************************************************************
*
* render -
*/
std::string CompoundValueNode::render(ConnectionInfo* ciP, Format format, const std::string& indent)
{
  std::string  out       = "";
  bool         jsonComma = siblingNo < (int) container->childV.size() - 1;
  std::string  tagName   = (container->valueType == orion::ValueTypeVector)? "item" : name;

  if (ciP->apiVersion == "v2")
  {
    return toJson(true); // FIXME P8: The info on comma-after-or-not is not available here ...
  }

  if (valueType == orion::ValueTypeString)
  {
    LM_T(LmtCompoundValueRender, ("I am a String (%s)", name.c_str()));
    out = valueTag(indent, tagName, stringValue, format, jsonComma, container->valueType == orion::ValueTypeVector);
  }
  else if (valueType == orion::ValueTypeNumber)
  {
    LM_T(LmtCompoundValueRender, ("I am a number (%s)", name.c_str()));
    char num[32];
    snprintf(num, sizeof(num), "%f", numberValue);
    std::string effectiveValue = num;
    out = valueTag(indent, tagName, effectiveValue, format, jsonComma, container->valueType == orion::ValueTypeVector, true);
  }
  else if (valueType == orion::ValueTypeBoolean)
  {
    LM_T(LmtCompoundValueRender, ("I am a bool (%s)", name.c_str()));
    out = valueTag(indent, tagName, boolValue? "true" : "false", format, jsonComma, container->valueType == orion::ValueTypeVector, true);
  }
  else if ((valueType == orion::ValueTypeVector) && (container != this))
  {
    LM_T(LmtCompoundValueRender, ("I am a Vector (%s)", name.c_str()));
    out += startTag(indent, tagName, tagName, format, true, container->valueType == orion::ValueTypeObject, true);
    for (uint64_t ix = 0; ix < childV.size(); ++ix)
    {
      out += childV[ix]->render(ciP, format, indent + "  ");
    }

    out += endTag(indent, tagName, format, jsonComma, true, true);
  }
  else if ((valueType == orion::ValueTypeVector) && (container == this))
  {
    LM_T(LmtCompoundValueRender, ("I am a Vector (%s) and my container is TOPLEVEL", name.c_str()));
    for (uint64_t ix = 0; ix < childV.size(); ++ix)
    {
      out += childV[ix]->render(ciP, format, indent);
    }
  }
  else if ((valueType == orion::ValueTypeObject) && (container->valueType == orion::ValueTypeVector))
  {
    LM_T(LmtCompoundValueRender, ("I am an Object (%s) and my container is a Vector", name.c_str()));
    out += startTag(indent, "item", "", format, false, false);
    for (uint64_t ix = 0; ix < childV.size(); ++ix)
    {
      out += childV[ix]->render(ciP, format, indent + "  ");
    }

    out += endTag(indent, "item", format, jsonComma, false, true);
  }
  else if (valueType == orion::ValueTypeObject)
  {
    if (rootP != this)
    {
      LM_T(LmtCompoundValueRender, ("I am an Object (%s) and my container is NOT a Vector", name.c_str()));
      out += startTag(indent, tagName, tagName, format, false, true);

      for (uint64_t ix = 0; ix < childV.size(); ++ix)
      {
        out += childV[ix]->render(ciP, format, indent + "  ");
      }

      out += endTag(indent, tagName, format, jsonComma, false, true);
    }
    else
    {
      LM_T(LmtCompoundValueRender, ("I am the TREE ROOT (%s)", name.c_str()));
      for (uint64_t ix = 0; ix < childV.size(); ++ix)
      {
        out += childV[ix]->render(ciP, format, indent);
      }
    }
  }

  return out;
}