[RADIATOR] Function get_attrs not behaving as expected.
Bruno Tiago Rodrigues
bruno.tiago.rodrigues at gmail.com
Fri Jul 7 16:24:21 UTC 2023
Hi everyone and greetings to the OSC team and all Radiator users.
Inside a hook, processing the reply packet, wasn't
get_attrs('Framed-Route') supposed to get an array of one or more values of
the given attribute?
>From AttrList.pm:
#####################################################################
# Decode the value from all instances of the requested the attribute
# Return an array of decoded values
# Requires the subclass to define decode()
sub get_attrs
{
my ($self, $attrnum, $vendornum) = @_;
$vendornum = 0 unless defined $vendornum;
my @ret;
foreach (@{$self->{Attributes}})
{
if ($_->[0] == $attrnum && $_->[1] == $vendornum)
{
# Want this one
push(@ret, $self->decode(@$_));
}
}
return @ret;
}
I'm getting a structure that holds all values of the reply packet instead
of just Framed-Route:
#!/usr/bin/perl
use Data::Dumper;
sub {
my $rp = ${$_[1]}; #this is the response object
my @attrs = $rp->get_attrs('Framed-Route');
print Dumper(@attrs);
}
Whenever two framed routes are returned, the variable holds this:
$VAR1 = {
'Framed-Route' => [
'10.10.212.20/29',
'10.10.211.20/29'
],
'Framed-Pool' => 'test.bu'
};
Whenever just one framed route is returned, the variable holds this:
$VAR1 = {
'Framed-Pool' => 'test.bu',
'Framed-Route' => '10.10.213.20/29'
};
The way I see it, the returning structure should be
$VAR1 = [
'10.10.212.20/29',
'10.10.211.20/29'
];
or
$VAR1 = [
'10.10.213.20/29'
]:
or even an empty array if no attributes are present.
Any ideas? Comments?
Thanks
Bruno Tiago Rodrigues
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.open.com.au/pipermail/radiator/attachments/20230707/650098ff/attachment.html>
More information about the radiator
mailing list