(RADIATOR) can snmpget query NAS w/ Cisco-NAS-Port?

Hugh Irvine hugh at open.com.au
Sun Nov 18 17:07:13 CST 2001


Hello Dave -

On Monday 19 November 2001 07:26, Dave Kitabjian wrote:
> Oh, I see. You just mean renaming the attribute, but keeping its value
> the same:
>
> sub
> {
>     my $p = ${$_[0]};
>
>     my $nasport;
>
>     if ($nasport = $p->get_attr('Cisco-NAS-Port'))
>     {
>         &main::log($main::LOG_DEBUG,
>             "Cisco-NAS-Port = $nasport");
>         $p->change_attr('NAS-Port', $nasport);
> #       $p->delete_attr('Cisco-NAS-Port');
>     }
>     return;
> }
>
> That's fine with me, but will snmpget know what to do with as Nas-Port
> that looks like "Async5/94", "Serial7/0:21:17", or "Virtual-Access25"
> when it goes to see if the user is still online? That's my main
> concern...
>

I think you will need to look at what you actually get in the result to the 
SNMP query by running it manually and then decide what you will need to 
compare it to.

There is a second hook in "goodies/hooks.txt" (included below) which does 
fancier things with the encoded NAS-Port that you can optionally set in the 
Cisco configuration.

# cisco-nas-port.pl
# PreClientHook to extract NAS-Port information.
#
# Cisco encodes information in the NAS-Port attribute as follows:
#
# nl-rt-sh-vpn-aer11(config)#radius-server attribute nas-port format ?
#  a  Format is type, channel, port
#  b  Either interface(16) or isdn(16), async(16)
#  c  Data format(bits): shelf(2), slot(4), port(5), channel(5)
#  d  Data format(bits): slot(4), module(1), port(3), vpi(8), vci(16)
#
# This hook is written for Cisco format "d" above (ATM vpi/vci).
#
# The encoded information is extracted and the individual data elements
# are added to the request packet as pseudo-attributes.
#
# Hugh Irvine, Open System Consultants, 20010622
 
sub
{
        my $p = ${$_[0]};
 
        my $nasport = $p->get_attr('NAS-Port');
 
        if (defined($nasport))
        {
                my ($slot, $module, $port, $vpi, $vci);
                $vci = $nasport & 0xffff;
                $nasport = $nasport >> 16;
                $vpi = $nasport & 0xff;
                $nasport = $nasport >> 8;
                $port = $nasport & 0x7;
                $nasport = $nasport >> 3;
                $module = $nasport & 0x1;
                $nasport = $nasport >> 1;
                $slot = $nasport & 0xf;
                $p->add_attr('Cisco-NAS-Port-Vci', $vci)
                        if defined $vci;
                $p->add_attr('Cisco-NAS-Port-Vpi', $vpi)
                        if defined $vpi;
                $p->add_attr('Cisco-NAS-Port-Port', $port)
                        if defined $port;
                $p->add_attr('Cisco-NAS-Port-Module', $module)
                        if defined $module;
                $p->add_attr('Cisco-NAS-Port-Slot', $slot)
                        if defined $slot;
        }
}


regards

Hugh


-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list