Closed bramwittendorp closed 1 week ago
Below an overview of all commands:
librouteros.exceptions.TrapError: no such command prefix
AttributeError: 'ROSDriver' object has no attribute 'get_bgp_neighbors_detail'
Could you paste output of bgp items (anomized of course) ? I don't have any working BGP peers to test.
Sure, I have identified that the first part is already where the main issue occurs. Currently the code is calling for menu's like:
/routing/bgp/peer/print
or /routing/bgp/instance/print
. These levels don't exist anymore in RouterOSv7.
For example you'll need the /routing/bgp/session/print
command to show an overview of the (established) BGP sessions. That's what I am using in the snippet below.
>>> from librouteros import connect
>>> from pprint import pprint
>>> api = connect(
... username='<<redacted>>',
... password='<<redacted>>',
... host='<<redacted>>',
... )
>>>
>>> for row in api('/routing/bgp/session/print'):
... pprint(row)
...
{'.id': '*2800001',
'ebgp': '',
'established': True,
'hold-time': '3m',
'input.procid': 20,
'keepalive-time': '1m',
'last-started': '2024-07-31 08:40:13',
'local.address': '2001:db8:1234:70::1',
'local.afi': 'ipv6',
'local.as': 65000,
'local.bytes': 546189,
'local.capabilities': 'mp,rr,gr,as4',
'local.eor': '',
'local.id': '172.16.0.254',
'local.messages': 28733,
'name': 'test-bgp-1',
'output.procid': 20,
'output.remove-private-as': True,
'prefix-count': 0,
'remote.address': '2001:db8:1234:70::253',
'remote.afi': 'ipv6',
'remote.as': 65200,
'remote.bytes': 545851,
'remote.capabilities': 'mp,rr,gr,as4',
'remote.eor': '',
'remote.id': '172.16.12.253',
'remote.messages': 28729,
'uptime': '2w5d22h50m25s190ms'}
I think the main question is: do we want to support both RouterOS v6 and RouterOS v7 in the same version of the driver? I can imagine creating a 2.X release that supports RouterOS 7 but lacks support for RouterOS 6 (which would require 1.X releases).
I am open to contributing to this issue myself, I am not an experienced developer. But I believe in contributing to the community and this might be a useful way to develop my python-skills.
Driver can support both versions. It's just a matter of executing different functions depending on version. tests/unit/mocked_data/test_get_bgp_neighbors/ipv4-only
This is a sample mocked data which well mocks real data on device. I can help you develop a patch for v7.x
The trick here is to mock data from v7.x and write code that extracts necessary info. You can put mocked data for v7.x into tests/unit/mocked_data/test_get_bgp_neighbors/v7.x/
and write code.
file names starting with _
represent command that would be run on mikrotik. _routing_bgp_peer_print.json
is equal to /routing/bgp/peer/print
in api.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Description of Issue/Question
The BGP syntax has changed between RouterOS v6 and RouterOS v7. The bgp-functionality in this driver is not working on RouterOS v7.
Setup
napalm-ros version
(Paste verbatim output from
pip freeze | grep napalm-ros
between quotes below)ROS version
(Paste verbatim output from
/system package print
between quotes below)librouteros version
(Paste verbatim output from
pip freeze | grep librouteros
between quotes below)python version
(paste output of python --version)
Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)