# # Foundry Inc. Iron Server # # A class is simply a package. # So in order to create class handling new device configuration # we create new package with more or less self-descriptive semantic. package Devices::Routers::Foundry; # Most of devices directly derived from Device::NetCom. use base 'Devices::NetCom'; use strict 'vars'; use Common::OID; use Server::Edit; use snmpUtils; use Data::Dumper; use Common::Log; use Common::Util; # This hash may contain just enterprise number or entire OID of device. # It is used for device type autodescovery - it will be matched aginst sysObjectID value. $Devices::enterprises{2352} = __PACKAGE__; # Caption of device. our $cap = "Foundry Iron Server" # This function invoked when devices is newly added or reconfigured. sub cfg_impl { my ($self) = @_; # when cfg_impl called $self already has sysDescr, sysName, sysLocation and sysContact fetched from mib-2.system # it also has all paramter passed to it like ip, comunity, etc. my $snmp = "$$self{community}\@$$self{ip}"; my $devicesSubTree = "/Devices/Routers/Foundry/$$self{ip}"; # when devices is configured from shell with 'konfne' all output goes directly to the screen # Merlin configurator shows this output into it's console print ">>> Configuring Foundry Iron Server Device ... \n"; my $ldesc = $$self{sysDescr}; $ldesc .= "<BR>Contact: $$self{sysContact}" if $$self{sysContact}; $ldesc .= "<BR>Location: $$self{sysLocation}" if $$self{sysLocation}; # 'commit_target' places 'target' stanza into configuration database # it is exported by Server::Edit package # - default commit_target "$devicesSubTree/--default--" => { 'computer' => $$self{ip}, 'community' => $$self{community}, 'long-desc' => $ldesc }; # - protocols commit_target "$devicesSubTree/protos" => { 'short-desc' => 'Protocols', 'long-desc' => '%short-desc%', 'display-name' => 'Protocols', 'show-bandwidth' => 'false', 'target-type' => 'foundry-iron-protos' }; # add_link is method all devices have. It links specified target in /Devices/... subtree into device's view. $self->add_link("$devicesSubTree/protos"); # - basics commit_target "$devicesSubTree/basics" => { 'short-desc' => 'Basics', 'long-desc' => '%short-desc%', 'display-name' => 'Basics', 'show-bandwidth' => 'false', 'target-type' => 'foundry-iron-basics' }; $self->add_link("$devicesSubTree/basics"); # - interfaces print ">>> ... network interfaces ... \n"; # here we call for standare mib-2.interfaces configuration. # 'types' says to configure only interface with certain ifType # '6' is ethernet $self->config_interfaces_lw(types => [6]); print ">>> ... OK! ... \n"; return 1; } # This function shows list of parameters (tags) which may be passed to this device # Each tag once passed will be stored into configuration database and will be available # upon reconfiguration. # Types currently available: string, number, list, targetlist # In this case no additional tags. # #sub _tag_list { # my $self = shift; # my @result = $self->SUPER::_tag_list; # push @result, { name => 'parameter', desc => 'Additional parameter', type => 'string' } # push @result, { name => 'choice', desc => 'Additional parameter - selection', type => 'list', options => 'one,two,three' } # return @result; #) } 1; __DATA__ # # 'kompile' script traverse all Devices::... subtree of class and tries to deploy Defaults into # configuration before compilation starts. # When it encounters string like # Defaults-Section <path> # all consequent string will be writted into file <configurat root>/<path>/Defaults # up to another Defaults-Section or end of file. ### Defaults-Section Devices/Routers/Foundry ### # Foundry Iron Server Defaults # Target --default-- computer = %auto-target-name% snmp-host = %computer% target-type = undef normal-load = 85