Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display of logical multicable topology #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion nextbox_ui_plugin/static/nextbox_ui_plugin/next_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@
showHideLogicalMultiCableLinks = function() {
topologyData['links'].forEach(function(link){
if (link['isLogicalMultiCable']) {
topo.getLink(link['id']).visible(displayLogicalMultiCableLinks);
if (topo.getLink(link['id'])) {
topo.getLink(link['id']).visible(displayLogicalMultiCableLinks);
};
};
});
displayLogicalMultiCableLinks = !displayLogicalMultiCableLinks
Expand Down
17 changes: 9 additions & 8 deletions nextbox_ui_plugin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,19 +455,20 @@ def get_topology(nb_devices_qs):
# identify segmented cable paths between end-devices
if len(cable_path) < 2:
continue
if isinstance(cable_path[0][0], Interface) and isinstance(cable_path[-1][2], Interface):
if set([c[1] for c in cable_path]) in [set([c[1] for c in x]) for x in multi_cable_connections]:
continue
multi_cable_connections.append(cable_path)
if len(cable_path[0][0]) > 0 and len(cable_path[-1][2]) > 0:
if isinstance(cable_path[0][0][0], Interface) and isinstance(cable_path[-1][2][0], Interface):
if set([c[1][0] for c in cable_path]) in [set([c[1][0] for c in x]) for x in multi_cable_connections]:
continue
multi_cable_connections.append(cable_path)
for cable_path in multi_cable_connections:
link_id = max(link_ids) + 1 # dummy ID for a logical link
link_ids.add(link_id)
topology_dict['links'].append({
'id': link_id,
'source': cable_path[0][0].device.id,
'target': cable_path[-1][2].device.id,
"srcIfName": if_shortname(cable_path[0][0].name),
"tgtIfName": if_shortname(cable_path[-1][2].name),
'source': cable_path[0][0][0].device.id,
'target': cable_path[-1][2][0].device.id,
"srcIfName": if_shortname(cable_path[0][0][0].name),
"tgtIfName": if_shortname(cable_path[-1][2][0].name),
"isLogicalMultiCable": True,
})
return topology_dict, device_roles, multi_cable_connections, all_device_tags
Expand Down