Changeset 167 for trunk


Ignore:
Timestamp:
02/22/05 14:25:58 (19 years ago)
Author:
Kris Deugau
Message:

/trunk

New feature: Different "default" CustIDs depending on the allocation type
consistency-check.pl also updated to check this information.

Location:
trunk/cgi-bin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r157 r167  
    2222@ISA            = qw(Exporter);
    2323@EXPORT_OK    = qw(
    24         %disp_alloctypes %list_alloctypes @citylist @poplist @masterblocks
     24        %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks
    2525        %allocated %free %routed %bigfree
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
     
    3030@EXPORT         = (); # Export nothing by default.
    3131%EXPORT_TAGS    = ( ALL => [qw(
    32                 %disp_alloctypes %list_alloctypes @citylist @poplist @masterblocks
    33                 %allocated %free %routed %bigfree
     32                %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist
     33                @masterblocks %allocated %free %routed %bigfree
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    3535                &deleteBlock &mailNotify
     
    4242our %disp_alloctypes;
    4343our %list_alloctypes;
     44our %def_custids;
    4445our @citylist;
    4546our @poplist;
     
    5859
    5960  # Initialize alloctypes hashes
    60   $sth = $dbh->prepare("select type,listname,dispname,listorder from alloctypes order by listorder");
     61  $sth = $dbh->prepare("select type,listname,dispname,listorder,def_custid from alloctypes order by listorder");
    6162  $sth->execute;
    6263  while (my @data = $sth->fetchrow_array) {
    6364    $disp_alloctypes{$data[0]} = $data[2];
     65    $def_custids{$data[0]} = $data[4];
    6466    if ($data[3] < 900) {
    6567      $list_alloctypes{$data[0]} = $data[1];
  • trunk/cgi-bin/consistency-check.pl

    r142 r167  
    1616($dbh,$errstr) = connectDB_My;
    1717
    18 # Schlep up the masters
    19 $sth = $dbh->prepare("select * from masterblocks order by cidr");
    20 $sth->execute;
    21 for ($i=0; @data = $sth->fetchrow_array; $i++) {
    22   $masterblocks[$i] = new NetAddr::IP $data[0];
    23 }
     18# May as well.  We need a number of globals.
     19initIPDBGlobals($dbh);
    2420
    2521print "First check:  All blocks must be within one of the master blocks\n";
     
    5551# Next:  free blocks
    5652print "Checking freeblocks: ";
    57 $sth = $dbh->prepare("select cidr from freeblocks");
     53$sth = $dbh->prepare("select cidr from freeblocks order by cidr");
    5854$sth->execute;
    5955FREEBLOCK: while (@data = $sth->fetchrow_array) {
     
    139135  print "done $master.\n";
    140136}
     137
     138print "Done checking block alignment.\n\nChecking for correctness on 'defined' CustIDs:\n";
     139# New check:  Make sure "defined" CustIDs are correct.
     140$sth = $dbh->prepare("select cidr,type,custid from allocations where not type='cn' order by cidr");
     141$sth->execute;
     142while (@data = $sth->fetchrow_array) {
     143  print "$data[0] ($disp_alloctypes{$data[1]}) has incorrect CustID $data[2]\n"
     144        if $data[2] ne $def_custids{$data[1]};
     145}
     146
     147print "Done CustID correctness check.\n";
  • trunk/cgi-bin/main.cgi

    r166 r167  
    998998    print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
    999999  } else {
    1000     # All non-customer allocations MUST be entered with "our" customer ID.
    1001     # I have Defined this as 6750400 for consistency.
    1002     $webvar{custid} = "6750400";
     1000    # New!  Improved!  And now Loaded From The Database!!
     1001    $webvar{custid} = $def_custids{$webvar{alloctype}};
    10031002  }
    10041003
Note: See TracChangeset for help on using the changeset viewer.