Skip to Content.

rare-dev - Re: [rare-dev] Broken SNMP in latest forwarder code

Subject: Rare project developers

List archive


Re: [rare-dev] Broken SNMP in latest forwarder code


Chronological Thread 
  • From: Alexander Gall <>
  • To: Frédéric LOUI <>
  • Cc: mc36 <>, "" <>
  • Subject: Re: [rare-dev] Broken SNMP in latest forwarder code
  • Date: Mon, 21 Feb 2022 15:08:48 +0100

Hi Frédéric

On Fri, 18 Feb 2022 18:33:17 +0100, Frédéric LOUI <>
said:

> I corrected the issue you reported in 95739f.
> It was actually a side effect of « bf_forwarder.py modularisation »

> It should be OK now with this commit:
> https://bitbucket.software.geant.org/projects/RARE/repos/rare/commits/041558e19e9042402015b1abe572c0641c87aa2b

Unfortunately, there are still other issues. The first is that most of
the calls to entry_get() in rare/bf_snmp_client/__init__.py are
missing the `p4name` parameter, which leads to runtime errors. BTW,
I'd recommend to use a wrapper around those raw bfrt calls to avoid
having to write things like "self.bfrc.target" and
"p4_name=self.bfgc.p4_name" every time to avoid this kind of bug :)

The second issue is that addSnmpPort() is completely broken. It's
defined as

def addSnmpPort(self, port_id, port_speed):

but it's actually called as

for port in self.active_ports.keys():
if port not in self.snmp_ports:
self.addSnmpPort(port, self.active_ports[port])

I.e. the last argument is really the name of the port (as
"port/channel"), not the port speed. addSnmpPort() then reads the
entry for the port from the $PORT table to get the name which it
already knows. That's clearly a left-over from the pre-modularisation
code. The way it's written now it seems like addSnmpPort() should get
the port speed from the table instead. However, that speed is encoded
as a string like "BF_SPEED_100G" that would need to be translated
first, so I'm not sure what the intent here really is.

It would be great if you could test your code on a system that has
SNMP enabled :)

--
Alex


> Have a good week end,
> Frederic


>> Le 11 févr. 2022 à 18:09, Alexander Gall <> a écrit :
>>
>> Hi Frederic
>>
>> SNMP in the latest code (95739f) is broken:
>>
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: BfIfSnmpClient - main
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: bf_switchd started with
>> SNMP export
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: Generic table clearing:
>> (Order not matters)
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: Exception in thread
>> bf_snmp:
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: Traceback (most recent
>> call last):
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: File
>> "/nix/store/bvz1i8rik3ynd1rpb8gczwqfayxv4dfz-bf_forwarder-22.02.11/lib/python3.8/site-packages/rare/bf_snmp_client/__init__.py",
>> line 35, in run
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: self.active_subifs =
>> self.getAllActiveSubInterfaces()
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: File
>> "/nix/store/bvz1i8rik3ynd1rpb8gczwqfayxv4dfz-bf_forwarder-22.02.11/lib/python3.8/site-packages/rare/bf_snmp_client/__init__.py",
>> line 297, in getAllActiveSubInterfaces
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: tbl_global_path =
>> "%s.ig_ctl" % self.pipe_name
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: AttributeError:
>> 'BfIfSnmpClient' object has no attribute 'pipe_name'
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: During handling of the
>> above exception, another exception occurred:
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: Traceback (most recent
>> call last):
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: File
>> "/nix/store/v72cj06nk69cynckz2s12rhar25k1h7v-python3-3.8.5/lib/python3.8/threading.py",
>> line 932, in _bootstrap_inner
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: self.run()
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: File
>> "/nix/store/bvz1i8rik3ynd1rpb8gczwqfayxv4dfz-bf_forwarder-22.02.11/lib/python3.8/site-packages/rare/bf_snmp_client/__init__.py",
>> line 80, in run
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: "%s - exited with
>> code [%s]" % (self.class_name, _Exception())
>> Feb 11 17:52:11 spare-PB1 start_bffwd.sh[12143]: NameError: name
>> '_Exception' is not defined
>>
>> Speaking of SNMP, can you please explain (again) the problem that
>> occured with NMaaS and SNMP queries?
>>
>> @csaba: If freerouter now has SNMP support built in (that was news to
>> me), how exactly does it work?
>>
>> --
>> Alex



Archive powered by MHonArc 2.6.19.

Top of Page