Rambler's Top100














DOCSIS

perl , DOCSIS . DOCSIS (Data Over Cable Service Interface Specifications) , 98 . 42/38 / ( ) 10/9 / ( ).

DOCSIS . 1.


.1

:

1. ( ), , , ( DOCSIS: , .., ). .

2. , , ( ). IP . IP , , ( ACL PCF) , . - ".cm".

3. TFTP .

DOCSIS:

  • HFC
  • , , /, dhcp
  • dhcpd IP , IP ( tftp, log server, time server)
  • , IP
  • - ".cm" tftp ,

  • , dhcp failover, tftp ( tftp ).

    perl :



    #!/usr/bin/perl -w

    use DBI;

    $prefix="/chroot/rsyncd";

    `/usr/bin/mkdir -p ${prefix}/var/cm`;

    $dbh=DBI->connect("DBI:mysql:dbname=billing;host=127.0.0.1","billing", "billing") or die "Couldn't connect to database: ".DBI->errstr;

    if (defined $ARGV[0]) {
       $sth=$dbh->prepare("SELECT vg_id, str_value from vgroups_addons_vals join vgroups using(vg_id) where login = '$ARGV[0]' and name = 'modem_mac'");
    }
      else { die "LOGIN IS NOT VALID\n";
    }
    $sth->execute() or die "Cannot execute: ".$sth->errstr();

    #$s = int(rand 10000) + 1;
    #$config=`mktemp ${prefix}/var/tmp/docsis-$s-XXXX`;
    $config=`/usr/bin/mktemp`;
    chomp $config;

    while(@row=$sth->fetchrow_array) {
        $speed = 2048000;
        $string = "
    Main {
        NetworkAccess 1;

        ClassOfService {
            ClassID         1;
            MaxRateDown     $speed;
            MaxRateUp       $speed;
            PriorityUp      3 ;
            GuaranteedUp    3000;
            PrivacyEnable   0;
        }
    ";

        $string = $string . "

        SnmpMibObject enterprises.1166.1.19.3.1.25.0     Integer 2;

        SnmpMibObject docsDevFilterIpControl.1           Integer 2;
        SnmpMibObject docsDevFilterIpProtocol.1          Integer 1;
        SnmpMibObject docsDevFilterIpStatus.1            Integer 4;
        SnmpMibObject docsDevFilterIpControl.2            Integer 2;
        SnmpMibObject docsDevFilterIpProtocol.2          Integer 47;
        SnmpMibObject docsDevFilterIpStatus.2            Integer 4;
        SnmpMibObject docsDevFilterIpControl.3            Integer 2;
        SnmpMibObject docsDevFilterIpProtocol.3          Integer 50;
        SnmpMibObject docsDevFilterIpStatus.3            Integer 4;
        SnmpMibObject docsDevFilterIpControl.4            Integer 2 ;
        SnmpMibObject docsDevFilterIpDaddr.4              IPAddress 255.255.255.255 ;
        SnmpMibObject docsDevFilterIpDmask.4             IPAddress 255.255.255.255 ;
        SnmpMibObject docsDevFilterIpProtocol.4          Integer 17 ;
        SnmpMibObject docsDevFilterIpDestPortLow.4       Integer 67 ;
        SnmpMibObject docsDevFilterIpDestPortHigh.4      Integer 68 ;
        SnmpMibObject docsDevFilterIpStatus.4           Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.5           Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.5      Integer 445;
        SnmpMibObject docsDevFilterIpDestPortHigh.5      Integer 445;
        SnmpMibObject docsDevFilterIpStatus.5           Integer 4;
        SnmpMibObject docsDevFilterIpControl.6          Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.6       Integer 135;
        SnmpMibObject docsDevFilterIpDestPortHigh.6      Integer 139;
        SnmpMibObject docsDevFilterIpStatus.6           Integer 4;
        SnmpMibObject docsDevFilterIpControl.7           Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.7      Integer 2745;
        SnmpMibObject docsDevFilterIpDestPortHigh.7     Integer 2745;
        SnmpMibObject docsDevFilterIpStatus.7           Integer 4;
        SnmpMibObject docsDevFilterIpControl.8           Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.8       Integer 3127;
        SnmpMibObject docsDevFilterIpDestPortHigh.8        Integer 3127;
        SnmpMibObject docsDevFilterIpStatus.8            Integer 4;
        SnmpMibObject docsDevFilterIpControl.9           Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.9       Integer 1439;
        SnmpMibObject docsDevFilterIpDestPortHigh.9       Integer 1439;
        SnmpMibObject docsDevFilterIpStatus.9          Integer 4;
        SnmpMibObject docsDevFilterIpControl.10          Integer 1;
        SnmpMibObject docsDevFilterIpDestPortLow.10       Integer 6129;
        SnmpMibObject docsDevFilterIpDestPortHigh.10       Integer 6129;
        SnmpMibObject docsDevFilterIpStatus.10          Integer 4;
        SnmpMibObject docsDevFilterIpControl.11        Integer 1;
        SnmpMibObject docsDevFilterIpDaddr.11           IPAddress 239.255.255.250 ;
        SnmpMibObject docsDevFilterIpDmask.11         IPAddress 239.255.255.250 ;
        SnmpMibObject docsDevFilterIpProtocol.11       Integer 17 ;
        SnmpMibObject docsDevFilterIpDestPortLow.11     Integer 1900;
        SnmpMibObject docsDevFilterIpDestPortHigh.11    Integer 1900;
        SnmpMibObject docsDevFilterIpStatus.11            Integer 4;
        SnmpMibObject docsDevFilterIpControl.12             Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.12               IPAddress 255.255.255.255 ;
        SnmpMibObject docsDevFilterIpDmask.12              IPAddress 255.255.255.255 ;
        SnmpMibObject docsDevFilterIpStatus.12              Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.13             Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.13               IPAddress 192.168.0.0 ;
        SnmpMibObject docsDevFilterIpDmask.13               IPAddress 255.255.0.0 ;
        SnmpMibObject docsDevFilterIpStatus.13              Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.14            Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.14               IPAddress 192.0.2.0 ;
        SnmpMibObject docsDevFilterIpDmask.14               IPAddress 255.255.255.0 ;
        SnmpMibObject docsDevFilterIpStatus.14            Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.15             Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.15              IPAddress 192.0.2.0 ;
        SnmpMibObject docsDevFilterIpDmask.15               IPAddress 255.255.255.0 ;
        SnmpMibObject docsDevFilterIpStatus.15             Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.16           Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.16              IPAddress 127.0.0.0 ;
        SnmpMibObject docsDevFilterIpDmask.16               IPAddress 255.0.0.0 ;
        SnmpMibObject docsDevFilterIpStatus.16             Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.17            Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.17              IPAddress 1.0.0.0 ;
        SnmpMibObject docsDevFilterIpDmask.17              IPAddress 255.0.0.0 ;
        SnmpMibObject docsDevFilterIpStatus.17            Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.18             Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.18               IPAddress 169.254.0.0 ;
        SnmpMibObject docsDevFilterIpDmask.18               IPAddress 255.255.0.0 ;
        SnmpMibObject docsDevFilterIpStatus.18             Integer 4 ;
        SnmpMibObject docsDevFilterIpControl.19            Integer 1 ;
        SnmpMibObject docsDevFilterIpDaddr.19              IPAddress 204.152.64.0 ;
        SnmpMibObject docsDevFilterIpDmask.19              IPAddress 255.255.254.0 ;
        SnmpMibObject docsDevFilterIpStatus.19            Integer 4 ;    
    ";

    $sth1=$dbh->prepare("select inet_ntoa(segment) from staff where vg_id=$row[0]");
        $sth1->execute() or die "Cannot execute: ".$sth1->errstr();

        $cpe = "    SnmpMibObject mib-2.69.1.7.1.0                   Integer 1 ;          /* doscDevCpeEnroll */";
        $n=0;
        while(@row1=$sth1->fetchrow_array) {

            $cpe = $cpe . "
        SnmpMibObject mib-2.69.1.7.3.1.3.$row1[0]         Integer 4;           /* docsDevCpeStatus */
    ";
            $n++;
        }
        $cpe = "SnmpMibObject mib-2.69.1.7.2.0                   Integer $n ;          /* docsDevCpeIpMax */
    " . $cpe;
        $string=$string.$cpe."}";

        open(F,">$config") or die "Can not open file:".$config;
        print F $string;

        $row[1] =~ s/://g;


        `/usr/local/bin/docsis -e $config /var/tmp/keyfile ${prefix}/var/cm/$row[1].cm`;

        close(F);

        print "$row[1] **\n";

    }

    #`rm ${prefix}/var/tmp/docsis-$s*`;
    `rm /tmp/tmp.*`;

    $sth->finish();

    $dbh->disconnect;



    LANBilling 1.9, :

    vg.create, vg.edit ( , "DBI->connect" ).
    Netflow, , 'modem_mac', MAC- .
    IP- , , 32.

    ,




    ""