diff --git a/DeviceMatrix.txt b/DeviceMatrix.txt index 368f4a36..60963a18 100644 --- a/DeviceMatrix.txt +++ b/DeviceMatrix.txt @@ -15,14 +15,12 @@ device-vendor: Asante device-family: Hubs device: 1012 -vendor: asante macsuck: no # Bay device-vendor: Bay Networks device-family: BayStack -vendor: bay macsuck: yes cdp: proprietary note: SNMP interface does not respond after 2+ months of uptime. Reboot to fix. diff --git a/t/make_dev_matrix.pl b/t/make_dev_matrix.pl index d13adc9f..8cac5049 100755 --- a/t/make_dev_matrix.pl +++ b/t/make_dev_matrix.pl @@ -5,7 +5,7 @@ $DevMatrix = '../DeviceMatrix.txt'; $DevHTML = 'DeviceMatrix.html'; $DevPNG = 'DeviceMatrix.png'; -$Tab = 2; +$Attributes= {}; # Parse Data File $matrix = parse_data($DevMatrix); @@ -20,29 +20,61 @@ if ($@ or 1) { } open (HTML, "> $DevHTML") or die "Can't open $DevHTML. $!\n"; - +$old_fh = select(HTML); +&html_head; +print_vendors($matrix); foreach my $vendor (sort sort_nocase keys %$matrix){ - print "$vendor\n"; + print "$vendor\n"; + print "
\n"; - my $defaults = $matrix->{$vendor}->{defaults}; - print_defaults($defaults,1); + my $vendor_defaults = $matrix->{$vendor}->{defaults}; + print_notes($vendor_defaults,1); my $families = $matrix->{$vendor}->{families}; foreach my $family (sort sort_nocase keys %$families ) { - print " $family\n"; + print "
$family Family\n"; - my $defaults = $families->{$family}->{defaults}; - print_defaults($defaults,2); + my $family_defaults = $families->{$family}->{defaults}; + print_notes($family_defaults,2); my $models = $families->{$family}->{models}; foreach my $model (sort sort_nocase keys %$models ){ - print " $model\n"; - my $defaults = $models->{$model}->{defaults}; - print_defaults($defaults,3); + my $model_defaults = $models->{$model}->{defaults}; + print "
$model\n"; + print "
\n"; + print_notes($model_defaults,3); + + print "
\n"; + print_headers(); + print "\n"; + foreach my $a (sort sort_nocase keys %$Attributes) { + my $val; + next if $a eq 'note'; + $val = ['-']; + $class = 'none'; + if (defined $model_defaults->{$a}) { + $val = $model_defaults->{$a}; + $class = 'model'; + } elsif (defined $family_defaults->{$a}){ + $val = $family_defaults->{$a}; + $class = 'family'; + } elsif (defined $vendor_defaults->{$a}){ + $val = $vendor_defaults->{$a}; + $class = 'vendor'; + } + print " \n"; + } + print "
",join("
\n",@$val),"
\n"; + print "
\n"; } } + print "
\n"; } + +&html_tail; + +select ($old_fh); close (HTML) or die "Can't write $DevHTML. $!\n"; # Data Structures @@ -98,6 +130,7 @@ sub parse_data { $family = $model = undef; $Matrix->{$vendor} = {} unless defined $Matrix->{$vendor}; $class = $Matrix->{$vendor}; + $class->{defaults}->{type}='vendor'; next; } @@ -108,6 +141,7 @@ sub parse_data { $Matrix->{$vendor}->{families}->{$family} = {} unless defined $Matrix->{$vendor}->{families}->{$family}; $class = $Matrix->{$vendor}->{families}->{$family}; + $class->{defaults}->{type}='family'; next; } @@ -118,11 +152,13 @@ sub parse_data { $Matrix->{$vendor}->{families}->{$family}->{models}->{$model} = {} unless defined $Matrix->{$vendor}->{families}->{$family}->{models}->{$model}; $class = $Matrix->{$vendor}->{families}->{$family}->{models}->{$model}; + $class->{defaults}->{type}='device'; next; } # Store attribute push (@{$class->{defaults}->{$cmd}} , $value); + $Attributes->{$cmd}++; } return $Matrix; @@ -132,13 +168,116 @@ sub sort_nocase { return lc($a) cmp lc($b); } -sub print_defaults { +sub print_notes { my $defaults = shift; my $level = shift; - foreach my $d (sort sort_nocase keys %$defaults) { - foreach my $val (sort sort_nocase @{$defaults->{$d}}) { - print ' ' x ($Tab*$level); - print "$d : $val\n"; + my $notes = $defaults->{note} || []; + foreach my $note (@$notes){ + if ($note =~ s/^!//){ + $note = '' . $note . ''; } } + if (scalar @$notes){ + print "
\n"; + my $print_note = join("\n
  • ",@$notes); + print "\n"; + } +} + +sub print_vendors { + my $matrix=shift; + print "

    Device Vendors

    \n"; + foreach my $vendor (sort sort_nocase keys %$matrix){ + print "[$vendor]\n"; + } + print "
    \n"; +} + +sub html_head { + print <<"end_head"; + + +SNMP::Info - Device Compatibility Matrix + + + +

    SNMP::Info - Device Compatibility Matrix

    +

    +end_head +} + +sub html_tail { + print <<'end_tail'; +


    +

    Color Key

    +[Model Attribute] +[Family Attribute] +[Vendor Attribute] +

    Attribute Key

    + + + + + + + + + + + + + + + + + + + + + +
    ArpnipAbility to collect ARP tables for MAC to IP translation.
    CDPCisco Discovery Protocol usable. +
      +
    • Yes - Has CDP information through CISCO-CDP-MIB +
    • Proprietary means the device has its own L2 Discovery Protocol. +
    +
    DuplexAbility to cull duplex settings from device.
    +
      +
    • no - Can't recover current or admin setting. +
    • link - Can get current setting only. +
    • both - Can get admin and link setting. +
    +
    MacsuckAbility to get CAM tables for MAC to switch port mapping.
    +
      +
    • no - Have not found an SNMP method to get data yet. +
    • yes - Can get through normal SWITCH-MIB method. +
    • vlan - Have to re-connect to each VLAN and then fetch with normal + method. +
    +
    PortmacWhether the device will list the MAC address of the switch port on each + switch port when doing a Macsuck. +
    + + +end_tail + +} + +sub print_headers { + print "\n"; + foreach my $a (sort sort_nocase keys %$Attributes) { + next if $a eq 'note'; + print " $a\n"; + } + print "\n"; }