napalm-automation-community / napalm-ros

MikroTik RouterOS NAPALM driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_config does not work correctly.

burrem opened this issue · comments

commented

Description of Issue/Question

get_config does not return mikrotik config

Setup

napalm-ros version

(Paste verbatim output from pip freeze | grep napalm-ros between quotes below)

napalm-ros==1.2.0

ROS version

(Paste verbatim output from /system package print between quotes below)

Flags: X - disabled 
 #   NAME                                                               VERSION                                                               SCHEDULED              
 0   routeros-mipsbe                                                    6.46.4                                                                                       
 1   system                                                             6.46.4                                                                                       
 2 X ipv6                                                               6.46.4                                                                                       
 3   wireless                                                           6.46.4                                                                                       
 4   hotspot                                                            6.46.4                                                                                       
 5   mpls                                                               6.46.4                                                                                       
 6   routing                                                            6.46.4                                                                                       
 7   ppp                                                                6.46.4                                                                                       
 8   dhcp                                                               6.46.4                                                                                       
 9   security                                                           6.46.4                                                                                       
10   advanced-tools                                                     6.46.4      

librouteros version

(Paste verbatim output from pip freeze | grep librouteros between quotes below)

librouteros==3.2.1

python version

(paste output of python --version)

Python 3.9.13

Steps to Reproduce the Issue

Run command: napalm --debug --user <user> --vendor napalm_ros <Router IP> call get_config

Error Traceback

(Paste the complete traceback of the exception between quotes below)

2022-09-23 13:41:19,434 - napalm - DEBUG - get_config - Response
{
    "running": "expected end of command (line 1 column 14)\n",
    "candidate": "",
    "startup": ""
}

Solution

By default, the configuration request command looks like this:
export terse show-sensitive
The problem is that there is no such sequence of commands on Mikrotik. There is only:
export terse hide-sensitive
Therefore, I suggest rewriting the ros.py code like this for proper work:

         if sanitized:
             command = command + "hide-sensitive"

By default, the configuration request command looks like this:
export terse show-sensitive

Nope https://github.com/napalm-automation-community/napalm-ros/blob/1.2.0/napalm_ros/ros.py#L362

The problem is that there is no such sequence of commands on Mikrotik. There is only:
export terse hide-sensitive

There is not such param as hide-sensitive

I think this is because of changes in ROS7
In ROS 6 defaut export command was "show-sensitive"
In ROS7 - "hide-sensitive" so arguments are opposite

I have 7.4.1 which has show-sensitive

I have 7.4.1 which has show-sensitive

Yep it has show-sensitive because by default it hides secrets
In ROS 6.X by default export shows secrets and you need to add hide-sensitive

It's one of changes in ROS7

Ok. Now I understand.