[#51] Collect nsIfMngIp when getting IP interfaces in L3::Netscreen
This commit is contained in:
		| @@ -6,6 +6,9 @@ version 3.11 | ||||
|  | ||||
|     * Modify cdp_cap() to handle devices which return space delimited strings | ||||
|       for cdpCacheCapabilities rather than hex strings | ||||
|     * [#51] Netdisco shows broken topology for devices with no alias entry | ||||
|       for primary IP - Collect nsIfMngIp when getting IP interfaces in | ||||
|       L3::Netscreen | ||||
|  | ||||
| version 3.10 (2013-12-16) | ||||
|  | ||||
|   | ||||
| @@ -345,30 +345,47 @@ sub _mac_map { | ||||
|     return \%mac_map; | ||||
| } | ||||
|  | ||||
| # Interfaces can have two addresses, we want to capture both the network | ||||
| # address and the management address | ||||
| sub ip_index { | ||||
|     my $netscreen = shift; | ||||
|  | ||||
|     my $ns_ip = $netscreen->ns_ip_table() || {}; | ||||
|     my $ns_ip     = $netscreen->ns_ip_table() || {}; | ||||
|     my $if_mng_ip = $netscreen->nsIfMngIp()   || {}; | ||||
|  | ||||
|     my %ip_index = (); | ||||
|     foreach my $iid ( keys %$ns_ip ) { | ||||
|         $ip_index{ $ns_ip->{$iid} } = $iid if $ns_ip->{$iid} ne "0.0.0.0"; | ||||
|     } | ||||
|     foreach my $iid ( keys %$if_mng_ip ) { | ||||
|         $ip_index{ $if_mng_ip->{$iid} } = $iid | ||||
|             if $if_mng_ip->{$iid} ne "0.0.0.0"; | ||||
|     } | ||||
|     return \%ip_index; | ||||
| } | ||||
|  | ||||
| sub ip_table { | ||||
|     my $netscreen = shift; | ||||
|  | ||||
|     my $ip_index = $netscreen->ip_index() || {}; | ||||
|     my $ip_index  = $netscreen->ip_index()  || {}; | ||||
|     my $if_mng_ip = $netscreen->nsIfMngIp() || {}; | ||||
|  | ||||
|     my %ip_table = (); | ||||
|     foreach my $iid ( keys %$ip_index ) { | ||||
|         $ip_table{$iid} = $iid; | ||||
|         my $mgmt_ip = $if_mng_ip->{$iid}; | ||||
|  | ||||
|         if ( defined $mgmt_ip && $mgmt_ip ne '0.0.0.0' ) { | ||||
|             $ip_table{$iid} = $mgmt_ip; | ||||
|         } | ||||
|         else { | ||||
|             $ip_table{$iid} = $iid; | ||||
|         } | ||||
|     } | ||||
|     return \%ip_table; | ||||
| } | ||||
|  | ||||
| # There is only one netmask for the interface both network and management | ||||
| # addresses should have the same netmask | ||||
| sub ip_netmask { | ||||
|     my $netscreen = shift; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user