We are actually trying to add a link between midnode and second (which is left and right below).
(gdb) p left->name_
"attr(default-domain:admin:6060,default-domain:admin:6060)" <<<< note the 2 strings inside the (). they are the same.
(gdb) p right->name_
"default-domain:admin:6060"
But, we use IsLess() and so it returns the link between first and midnode i.e. the left_node_ and right_node_ in the link.
(gdb) p link->left_node_->name_
"default-domain:admin:6060"
(gdb) p link->right_node_->name_
"attr(default-domain:admin:6060,default-domain:admin:6060)"
1.
(gdb) p link->left_node_->table_->name_
"__ifmap__.virtual_network.0"
2.
(gdb) p link->right_node_->table_->name_
"__ifmap__.virtual_network_network_ipam.0"
3.
(gdb) p left->table_->name_
"__ifmap__.virtual_network_network_ipam.0"
4.
(gdb) p right->table_->name_
"__ifmap__.network_ipam.0"
So, #1 and #4 belong to different tables.
But, they have the same name and we use IsLess() to decide on the sequence of the string. Thats the problem.
We will have to change this function to include the node's table name too i.e. use node->ToString() instead of name().
std::string IFMapLinkTable: :LinkKey( const string &metadata,
IFMapNode *left, IFMapNode *right) { IsLess( *right) ) {
ostringstream oss;
if (left->
oss << metadata << "," << left->name() << "," << right->name();
} else {
oss << metadata << "," << right->name() << "," << left->name();
}
return oss.str();
}
EG:
We are actually trying to add a link between midnode and second (which is left and right below).
(gdb) p left->name_ domain: admin:6060, default- domain: admin:6060) " <<<< note the 2 strings inside the (). they are the same. domain: admin:6060"
"attr(default-
(gdb) p right->name_
"default-
But, we use IsLess() and so it returns the link between first and midnode i.e. the left_node_ and right_node_ in the link.
(gdb) p link->left_ node_-> name_ domain: admin:6060" node_-> name_ domain: admin:6060, default- domain: admin:6060) "
"default-
(gdb) p link->right_
"attr(default-
1. node_-> table_- >name_ _.virtual_ network. 0" node_-> table_- >name_ _.virtual_ network_ network_ ipam.0" _.virtual_ network_ network_ ipam.0" table_- >name_ _.network_ ipam.0"
(gdb) p link->left_
"__ifmap_
2.
(gdb) p link->right_
"__ifmap_
3.
(gdb) p left->table_->name_
"__ifmap_
4.
(gdb) p right->
"__ifmap_
So, #1 and #4 belong to different tables.
But, they have the same name and we use IsLess() to decide on the sequence of the string. Thats the problem.