Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RouterOS6 compatibility #215

Open
easymoney322 opened this issue Dec 24, 2024 · 4 comments
Open

RouterOS6 compatibility #215

easymoney322 opened this issue Dec 24, 2024 · 4 comments

Comments

@easymoney322
Copy link

Hello,
I've tested your exporter with 951G-2HnD that runs 6.49.17, and it cant get some info due to different commands.

2024-12-24 11:26:40 Connection to router [email protected] has been established
Error getting CAPsMAN remote caps info from router [email protected]: ('Error "no such command prefix" executing command b\'/interface/wifi/capsman/remote-cap/print .tag=33\'', b'no such command prefix')
Error getting CAPsMAN registration table info from router [email protected]: ('Error "no such command prefix" executing command b\'/interface/wifi/registration-table/print .tag=35\'', b'no such command prefix')
Error getting routing stats sessions info from router [email protected]: Routing stats for legacy 6.x versions are not supported at the moment

Is it possible to add some kind of compatibility flag that could be overloaded on router-level to use appropriate commands?

/interface/wifi/registration-table/

RB951

[admin@RB951] /interface wireless registration-table> /interface/wifi/
expected command name (line 1 column 11)
[admin@RB951] /interface wireless registration-table> print
 # INTERFACE             RADIO-NAME       MAC-ADDRESS       AP  SIGNAL... TX-RATE

HAP AX3

[admin@HapAX3] /interface/wifi/registration-table> print 

[admin@HapAX3] /interface/wifi/registration-table> /interface/wireless  
bad command name wireless (line 1 column 12)

/interface/wifi/capsman/remote-cap/print

RB951

[admin@RB951] /caps-man remote-cap> print
 # ADDRESS                                              NAME   STATE       RADIOS
 0 192.168.5.1/48968                                    CAP... Run              1
[admin@RB951] /caps-man remote-cap> /interface/wifi/capsman
expected command name (line 1 column 11)

HAP AX3

[admin@HapAX3] /interface/wifi/registration-table> /interface/wifi/capsman/remote-
cap/ print

[admin@HapAX3] /interface/wifi/registration-table> /caps-man                      
bad command name caps-man (line 1 column 2)
@easymoney322
Copy link
Author

I think this can be achieved by wireless_type, but I'm not really sure what this is supposed to be.

On AX3 you have wifi-qcom(pre-installed), and you can also install wireless package, so they are both can be installed at the same time (even tho only one could be enabled at the same time). So the package being installed doesn't necessarily mean its being used.

You can also use both old and new capsman at the same time, if you enable wireless package (which is a non-zero chance due to lack of backward compatibility with non-ax AP).

@easymoney322
Copy link
Author

easymoney322 commented Dec 25, 2024

Does dual mean qcom+wireless or just wireless?
Because it sets to dual if it sees the wireless package installed.

            elif PackageMetricsDataSource.is_package_installed(router_entry, package_name = RouterEntryWirelessPackage.WIRELESS_PACKAGE):
              self._wireless_type = RouterEntryWirelessType.DUAL

and this line is only executed if there is no qcom or qcom-ac packages installed, which means its basically only checks for wireless package being installed.

But later on it checks if its dual OR wireless, which would never be wireless

    def registration_table_paths(router_entry):
        if router_entry.capsman_entry.wireless_type == RouterEntryWirelessType.DUAL:
            return ['/caps-man/registration-table', f'/interface/wifi/registration-table']
        elif router_entry.capsman_entry.wireless_type == RouterEntryWirelessType.WIRELESS:
            return ['/caps-man/registration-table']
        else:    
            wireless_package = WirelessMetricsDataSource.wireless_package(router_entry.capsman_entry)
            return [f'/interface/{wireless_package}/registration-table']

If it is in fact supposed to be dual, I can make a pull request fixing it.

@akpw
Copy link
Owner

akpw commented Dec 26, 2024

@easymoney322

I'm not really sure what this is supposed to be.

iirc the implementation there was largely based this table.
The updated latest version of that seems to now live here, feel free to check for potential inconsistencies / improvements.

regarding 6.x support, mktxp currently provides limited compatibility which might be discontinued in the near future. Specifically for routing stats, as you can see from the exception ( or the relevant code) there is already no 6.x support.

@easymoney322
Copy link
Author

easymoney322 commented Dec 26, 2024

I knew about this documents, just wasn't sure if the project's definition of dual is corresponding to mikrotiks definition due to wireless type detecting algorithm.

I've adjusted dual stack detection in PR #216 , and now it should correctly detect wireless-only systems (tested), and dual-stack systems (can't test at this moment). At this point I wonder if this elif logic should be replaces with switch-case statements, but this will force python version to >=3.10 UPD: I can't find an option that would allow me to rewrite this as a switch without hitting the performance.

regarding 6.x support, mktxp currently provides limited compatibility which might be discontinued in the near future. Specifically for routing stats, as you can see from the exception

This is actually a strange way to show deprecation information. If there is a network error and the program can't get routing data, this exception would be thrown. And it will continue to throw this (and other exceptions) with each scrapping, also leading to the constantly increasing log size. I'm not familiar with Python, but in other languages catching an exception is a costly operation.

I've found out that mktxp works (at least after the changes in PR) perfectly fine with 6.x routers. Except the routing stats thing, but it can be disabled by overriding config parameter on device level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants