Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach my $n (@node_list)
- {
- chomp ($n);
- foreach my $c (@cpes)
- {
- my @returned; #Interfaces to CPEs with MED settings
- my @creturned; #General Customer Interfaces
- my ($cust) = $c =~ /([a-zA-Z]+)[_-][a-zA-Z0-9]+/s;
- print "nttCustomer is $custn";
- chomp($c);
- $c = uc $c;
- my ($search) = $c;
- (@returned) = `cat /curr/$n | grep "$search"`;
- if (@returned)
- {
- my $cust_match = 'interface "' . $cust;
- (@creturned) = `cat /curr/$n | egrep -i "$cust_match" | grep -v "$search"`;
- }
- if (@creturned) #Have we found other CPEs on the same router
- {
- my ($nf) = $n =~ /([a-zA-Z0-9-]+).cfg/s;
- my (@interfaces) = map { /([A-Z0-9_]+)/s } @creturned;
- @interfaces = uniq(@interfaces);
- unshift (@interfaces, $c);
- push (@new_out, {$nf => {$cust => [@interfaces]}});
- }
- }
- $VAR1 = [
- {
- 'router-xx-xx' => {
- '50000' => [
- [
- 'THXXXXVF_NLXXXX40_1121_2',
- '10x.xx.x.50'
- ],
- [
- 'THXXXPVF_NLXXXX66_1121_1',
- '10x.xx.x.70'
- ],
- [
- 'THXXXXVF_NLXXXX67_1121_2',
- '10x.xx.x.78'
- ],
- }
- },
- foreach my $candidate (@nodes)
- {
- my %node = %{ $candidate };
- foreach my $n (keys %node)
- {
- print "nRouter is $nn";
- foreach my $cust (keys %{ $node{$n} })
- {
- print "Customer on $n is n" . Dumper $cust;
- my @intlist = @{$node{$n}{$cust}};
- my $med_cpe = $intlist[0]; #the CPE that was used to find node
- {truncated}
- my (@mlist) = grep {$_=~ / $rid /} @info;
- {truncated}
- push (@shared, [$cpe, $dip]);
- }
- push @master, {$n => {$rid => [@shared]}};;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment