Fixed the topology networkmaps, sometimes the relationships of agents showed bad

(cherry picked from commit c726c0f9bd)
This commit is contained in:
mdtrooper 2015-01-12 15:40:02 +01:00
parent f37c9ab4c4
commit e04f94cb02
1 changed files with 13 additions and 10 deletions

View File

@ -333,16 +333,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$node_ref[$agent['id_agente']] = $node_count;
// Save node parent information to define edges later
if ($agent['id_parent'] != "0" &&
array_key_exists($agent['id_parent'], $node_ref)) {
$parents[$node_count] = $node_ref[$agent['id_parent']];
}
else {
$orphans[$node_count] = 1;
}
$agent['id_node'] = $node_count;
$agent['type'] = 'agent';
@ -389,6 +379,19 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
}
}
// Addded the relationship of parents of agents
foreach ($agents as $agent) {
if ($agent['id_parent'] != "0" &&
array_key_exists($agent['id_parent'], $node_ref)) {
$parents[$node_ref[$agent['id_agente']]] = $node_ref[$agent['id_parent']];
}
else {
$orphans[$node_ref[$agent['id_agente']]] = 1;
}
}
// Drop the modules without a partner if l2_network is true
// and the snmp interfaces token is false
if ($l2_network) {