Skip to content

Commit

Permalink
Sandesh message nodes can have optional map attributes.
Browse files Browse the repository at this point in the history
When a node does have this map attribute, the type of key that the map uses is what is extracted.
When a node does not have this map attribute, the value of attribute is extracted, which is what is needed.
Added a check to make sure that the node's map attribute is not added to keymap.
Closes-Bug: #1545204

Change-Id: I2c9b54880fa74c9d2473489910f0827364fe0ce6
  • Loading branch information
arivantk-juniper committed Jul 27, 2016
1 parent 306d40e commit 84a5513
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/analytics/ruleeng.cc
Expand Up @@ -555,12 +555,14 @@ static size_t DomObjectWalk(const pugi::xml_node& parent, const VizMsg *rmsg,
std::map<std::string, std::string> keymap;
std::map<std::string, std::string>::iterator it;
const char *table;
const char *nodetype;
std::string rowkey;

for (pugi::xml_node node = parent.first_child(); node;
node = node.next_sibling()) {
table = node.attribute("key").value();
if (strcmp(table, "")) {
nodetype = node.attribute("type").value();
if (strcmp(table, "") && strcmp(nodetype, "")) { //check if Sandesh node has a map attribute; key type of map should not be extracted, only key value of attribute should be extracted
rowkey = std::string(node.child_value());
TXMLProtocol::unescapeXMLControlChars(rowkey);
it = keymap.find(table);
Expand Down Expand Up @@ -829,7 +831,6 @@ bool Ruleeng::rule_execute(const VizMsg *vmsgp, bool uveproc, DbHandler *db,
const SandeshXMLMessage *sxmsg =
static_cast<const SandeshXMLMessage *>(vmsgp->msg);
const pugi::xml_node &parent(sxmsg->GetMessageNode());

remove_identifier(parent);

handle_object_log(parent, vmsgp, db, header, db_cb);
Expand Down

0 comments on commit 84a5513

Please sign in to comment.