Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#36 Switch changes are not commited to NVRAM

1.0
open
Back-End (61)
8
2006-04-03
2006-02-15
Max Baker
No

When netdisco makes a change to a port or device, such
as turns off the port or changes its VLAN the change is
not then commited to the NVRAM of the device.

Requires that SNMP::Info can issue the correct command
to tell the device to commit changes to NVRAM.

Some discussion and device support already done, need
to dig that up...

Discussion

  • Justin Hunter
    Justin Hunter
    2006-03-24

    Logged In: YES
    user_id=1368562

    I think it's the 'old' way, but you can set writeMem
    (1.3.6.1.4.1.9.2.1.54) to 1 to write mem, 0 to erase mem

    the 'new' way looks to piggyback on write net, in that it
    can do both. ccCopyEntry (1.3.6.1.4.1.9.9.96.1.1.1.1)

     
  • Bill Fenner
    Bill Fenner
    2006-03-30

    Logged In: YES
    user_id=109593

    Another place to investigate is CISCO-CONFIG-MAN-MIB - in
    particular it may be able to tell us if the config is
    modified but not saved, ccmHistoryRunningLastChanged vs.
    ccmHistoryRunningLastSaved.

    Looks like you can create a random row in ccCopyTable, with
    ccCopySourceFileType = runningConfig and ccCopyDestFileType
    = startupConfig, and ccCopyEntryRowStatus = createAndGo;
    then poll ccCopyState and/or ccCopyFailCause...

    I think this should all be abstracted, since we don't want
    it to only work for Ciscos - perhaps "does the config need
    to be saved?" and "do the save" operations with
    per-device-type operations behind the scenes.

    And I vote to bail on OLD-CISCO-SYS-MIB::writeMem until we
    find a device that can't use CISCO-CONFIG-COPY-MIB.

     
  • Justin Hunter
    Justin Hunter
    2006-03-31

    Logged In: YES
    user_id=1368562

    not sure where this should be added, but here's the Cisco
    way, tested by adding to C4000.pm
    ------
    add
    'CISCO-CONFIG-COPY-MIB' => 'ccCopyTable',
    to %MIBS

    add
    'config_protocol' => 'ccCopyProtocol',
    'config_source_type' =>
    'ccCopySourceFileType',
    'config_dest_type' => 'ccCopyDestFileType',
    'config_server_addr' =>
    'ccCopyServerAddress',
    'config_filename' => 'ccCopyFileName',
    'config_username' => 'ccCopyUserName',
    'config_password' => 'ccCopyUserPassword',
    'config_notify_complete' =>
    'ccCopyNotificationOnCompletion',
    'config_copy_state' => 'ccCopyState',
    'config_copy_start_time' => 'ccCopyTimeStarted',
    'config_copy_complete_time' =>
    'ccCopyTimeCompleted',
    'config_fail_cause' => 'ccCopyFailCause',
    'config_row_status' =>
    'ccCopyEntryRowStatus',
    to %FUNCS

    sub writeNet($$)
    {
    ## expecting an ip & config filename
    ## should probably regexp the $tftphost
    ## and convert it to ip if it's not
    my ($info, $tftphost, $tftpfile) = @_;

    srand(time() ^ ($$ + ($$ << 15)));
    my $rand = int(rand(1 << 24));

    $info->set_config_protocol(1, $rand);
    $info->set_config_source_type(4, $rand);
    $info->set_config_dest_type(1, $rand);
    $info->set_config_server_addr($tftphost, $rand);
    $info->set_config_filename($tftpfile, $rand);
    $info->set_config_row_status(1, $rand);
    }

    sub writeMem
    {
    my $info = shift;
    srand(time() ^ ($$ + ($$ << 15)));
    my $rand = int(rand(1 << 24));

    $info->set_config_source_type(4, $rand);
    $info->set_config_dest_type(3, $rand);
    $info->set_config_row_status(1, $rand);
    }

    obviously, you could do all 5 or 3 set_'s 'manually', but
    writeNet & writeMem methods do it all in one step.

     
  • Eric A. Miller
    Eric A. Miller
    2006-04-03

    Logged In: YES
    user_id=1135238

    Justin, this looks good. I'm going add a copy state check
    to validate the success and a return code for the
    subroutines as appropriate based upon the state check.
    Also, even though the the device should delete the row
    itself, we should delete it before leaving the subroutine.
    Thanks.

     
  • Eric A. Miller
    Eric A. Miller
    2006-04-03

    • assigned_to: nobody --> jeneric
     
  • Justin Hunter
    Justin Hunter
    2006-04-03

    Logged In: YES
    user_id=1368562

    I noticed that 'delete' issue after I posted this code. our
    1210 waps do not support this method. guess i'll have to
    write some deprecated writeMem & writeNet. should just put
    them in as %FUNCS and run set_'s on them

     
  • Justin Hunter
    Justin Hunter
    2006-04-03

    Logged In: YES
    user_id=1368562

    I take that back about our 1210's. it was just an issue with
    not deleting. I created a CiscoConfig.pm. So far, it's
    worked when including it like CiscoVTP, which I would assume
    is cisco-centric and other vendors have a *VTP.pm (or whatever)

    seems like a lot of legwork to add an additional module, but
    for something this specific, it looks like that is necessary.

    sadly (or luckily?), I only deal with Cisco eq (phasing out
    3com)

    since I cannot attach to this 'bug', it is available at
    http://www.public.asu.edu/~jdhunte/CiscoConfig.pm