Closed johnnysosa closed 4 years ago
In API you are getting internal id which are permanently assign to each entry. Terminal is doing some form of magic that gives ids based on filters you use in your print command, so the same entry can get different id each time you run your command.
I am answering as I happen to know it, but Terminal/API quirks are out of scope of this API client implementation.
Everything is working as intended.
I have the following situation:
I connect to the mikrotik device and when I use the following instruction in python 3.7.8:
list_address = api.get_resource('/ip/firewall/address-list') print (list_address.get(list='Allowed-Internet'))
It gives me the following result:
[{'id': 'F', 'list': 'Allowed-Internet', 'address': '192.168.10.0/24', 'creation-time': 'apr/03/2017 19:20:25', 'dynamic': 'false', 'disabled': 'false'}, {'id': '10', 'list': 'Allowed-Internet', 'address': '192.168.20.0/24', 'creation-time': 'apr/03/2017 19:22:14', 'dynamic': 'false', 'disabled': 'false'}, {'id': '11B', 'list': 'Allowed-Internet', 'address': '172.20.36.0/22', 'creation-time': 'aug/15/2019 09:44:22', 'dynamic': 'false', 'disabled': 'false'}, {'id': '364', 'list': 'Allowed-Internet', 'address': '172.20.36.165', 'creation-time': 'aug/17/2019 19:51:37', 'dynamic': 'false', 'disabled': 'false'}, {'id': '*54F', 'list': 'Allowed-Internet', 'address': '10.0.0.30', 'creation-time': 'jul/14/2020 20:12:18', 'dynamic': 'false', 'disabled': 'true'}]
And this is the result from the terminal of the Mikrotik:
[admin@MKRRB] > ip firewall address-list print Flags: X - disabled, D - dynamic LIST ADDRESS CREATION-TIME TIMEOUT
0 Allowed-Internet 192.168.10.0/24 apr/03/2017 19:20:25 1 Allowed-Internet 192.168.20.0/24 apr/03/2017 19:22:14 2 Allowed-Internet 172.20.36.0/22 aug/15/2019 09:44:22 3 Allowed-Internet 172.20.36.165 aug/17/2019 19:51:37 4 X Allowed-Internet 10.0.0.30 jul/14/2020 20:12:18
Observe the id, is that result correct?
id 0 -->> F id 1 -->> 10 id 2 -->> 11B id 3 -->> 364 id 4 -->> 54F
These tests were conducted in:
MikroTik RouterOS 6.47.1 RB2011UiAS-2HnD (mipsbe)