diff --git a/Netdisco/lib/App/Netdisco/Core/Discover.pm b/Netdisco/lib/App/Netdisco/Core/Discover.pm index e2695a0b..6d86d1e0 100644 --- a/Netdisco/lib/App/Netdisco/Core/Discover.pm +++ b/Netdisco/lib/App/Netdisco/Core/Discover.pm @@ -714,6 +714,8 @@ sub store_neighbors { remote_port => $remote_port, remote_type => $remote_type, remote_id => $remote_id, + is_uplink => \"true", + manual_topo => \"false", }); } @@ -748,7 +750,10 @@ sub _set_manual_topology { ->update({ remote_ip => $right->ip, remote_port => $link->port2, - manual_topo => \'true', + remote_type => undef, + remote_id => undef, + is_uplink => \"true", + manual_topo => \"true", }); $right->ports @@ -756,7 +761,10 @@ sub _set_manual_topology { ->update({ remote_ip => $left->ip, remote_port => $link->port1, - manual_topo => \'true', + remote_type => undef, + remote_id => undef, + is_uplink => \"true", + manual_topo => \"true", }); }); }; diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm index f18e0579..97284f65 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm @@ -37,6 +37,41 @@ ajax '/ajax/control/admin/topology/add' => sub { dev2 => param('dev2'), port2 => param('port2'), }); + + # re-set remote device details in affected ports + # could fail for bad device or port names + try { + schema('netdisco')->txn_do(sub { + # only work on root_ips + my $left = get_device(param('dev1')); + my $right = get_device(param('dev2')); + + # skip bad entries + return unless ($left->in_storage and $right->in_storage); + + $left->ports + ->single({port => param('port1')}, {for => 'update'}) + ->update({ + remote_ip => param('dev2'), + remote_port => param('port2'), + remote_type => undef, + remote_id => undef, + is_uplink => \"true", + manual_topo => \"true", + }); + + $right->ports + ->single({port => param('port2')}, {for => 'update'}) + ->update({ + remote_ip => param('dev1'), + remote_port => param('port1'), + remote_type => undef, + remote_id => undef, + is_uplink => \"true", + manual_topo => \"true", + }); + }); + }; }; ajax '/ajax/control/admin/topology/del' => sub {