make sure device_port is updated when manual_topo is set
This commit is contained in:
		| @@ -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", | ||||
|                 }); | ||||
|             }); | ||||
|         }; | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user