Open mawendong opened 1 month ago
list_queues = api.get_resource('/ip/address')
result = list_queues.get(interface="pppoe-out60")
print(result)
Print results
[{'id': '*27C', 'address': '111.111.11.192/32', 'network': '11.110.10.71', 'interface': 'pppoe-out60', 'actual-interface': 'pppoe-out60', 'invalid': 'false', 'dynamic': 'true', 'disabled': 'false'}]
*list_queues.set(id="27C", disabled="true")** Execute this line of code and report an error
The purpose of the above line of code is to execute a command similar to this: /interface pppoe-client set [ find name=pppoe-out60 ] disabled=no
How to solve it?
Report an error:
RouterOsApiCommunicationError
('Error "failure: can not change dynamic address" executing command b\'/ip/address/set =.id=*27C =disabled=true .tag=5\'', b'failure: can not change dynamic address')
Resolved list_queues = api.get_resource('/interface/pppoe-client') list_queues.call('set', {'disabled': 'false', ".id": '*27C'})
Please tell me how to implement the following command using API. I tried many times and failed.
Query the IP address of the specified interface
/ip address print where interface="pppoe-out51"
Disable the specified interface
/interface pppoe-client set [ find name=pppoe-out51 ] disabled=yes
Enable the specified interface
/interface pppoe-client set [ find name=pppoe-out51 ] disabled=no