-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add api_info and api_modify modules #91
Add api_info and api_modify modules #91
Conversation
Codecov Report
@@ Coverage Diff @@
## main #91 +/- ##
==========================================
+ Coverage 83.78% 86.48% +2.70%
==========================================
Files 25 29 +4
Lines 2491 3507 +1016
Branches 432 656 +224
==========================================
+ Hits 2087 3033 +946
- Misses 315 348 +33
- Partials 89 126 +37
Continue to review full report at Codecov.
|
Example: - community.routeros.api_modify:
path: ip dns static
data:
- address: 192.168.88.1
name: router
- address: 192.168.88.2
name: server1
- address: 192.168.88.3
name: server2
handle_absent_entries: remove
handle_entries_content: remove
ensure_order: true This will ensure that |
edf4b84
to
59b7b9f
Compare
67b6e07
to
067003f
Compare
I'm not sure why |
As general I absolutely like it :D More questions This NAT to WAN example .. make no sense to me, Also I get error for The example from this PR make more sense (about DNS static entries ) From code prospective I think is ok |
It should have been
I have a one note here. Please test it with RouterOS 7 ! Some paths are changed Also if this affect " /interface/wireless" for example with routeros pkg wifiwave2 (if is installed) this path is changed to '/interface/wifiwave2' It is not a big issue just for information Overall I think we can merge this request ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look ok to be merged in main
note: Probably rebase will be needed today I merge "extended-query" |
0fa1438
to
4c2ef41
Compare
Things this PR is still missing:
|
2443a48
to
cf7876b
Compare
For firewall order (not directly related) from ros prospective Let say we have
If you want to change rule number 1 to action=drop set can be used
result
@felixfontein Not sure if this example can help, probably if you provide me more info ... ? or with api module cmd
|
For " Having better data, like some options only work when other options have certain values, etc. Might also be related to the above point." I guess you know some routeros paths haves sub path, so is normal some attributes to depend on other (specially with sub paths) .. if I understand correctly the problem ? |
No, I meant more that for some values in one path some attributes only make sense in some case, like in |
"Also there are quite some paths that aren't fully implemented yet due to me not knowing how to correctly support them, how exactly they work, etc." Let's clear the problems her first on ROS level then we can see what we can do with API, let me know if you have a issues with something specific, probably I can help Yes ROS7 don't have long term support version yet, we cannot predict every change so simple "disclaimer" in doc's will do the job for now , for the rest we can relay on module users feedback ! |
I think I understand the problem, unfortunately no clear solution,
note: I think rebase is needed .. |
cf7876b
to
84d9a48
Compare
@felixfontein let me know if you need a help with something here |
33f232a
to
cc296e4
Compare
I was looking at how to automatically export information on the API structure from RouterOS recently (like which fields are supported for which path etc.), but I couldn't really find anything. Some information seems to be available from the HTTP interface, like https://192.168.88.1/webfig/roteros.jg (base system) or https://192.168.88.1/webfig/wlan6.jg (there seems to be one such file per package that can be installed). This is unfortunately not JSON, but something a JavaScript interpreter understands, and I suspect it contains some information needed to render the web UI. But it doesn't seem to be everything, it probably works together with other internal data. That's probably the most important thing left... |
Ros7 have REST api support, if you need something specific probably can look it with postman, I guess rest and routeros api are similar . Not sure if api structure can be dump in both cases |
9f8ff6e
to
9ca249d
Compare
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
@NikolayDachev I haven't been able to really work on this, but I also don't see how to actually solve the remaining problems. What do you think of simply declaring this as "finished" for now and merging it and releasing it, so folks can start trying it out and maybe even extending/improving/... it for the use cases they have? |
No problems, just we should mark somehow what is working and what not in doc. |
I'll update the docs and mark this as ready once I've pushed that. Might not happen today, but very soon :) |
@NikolayDachev what do you think of the formulation I pushed? |
I will try to find a time during the weekend |
Looking good, just check my suggestion in code review .. I don't think is something really special. |
@NikolayDachev in case you had a suggestion, you didn't add it to the review :) |
sorry was in pending state |
f783df2
to
6353f21
Compare
Ok, ready for another round of review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look good to go
Then let's do this! Thanks a lot for reviewing and testing this, @NikolayDachev! |
SUMMARY
This adds two new modules,
api_info
andapi_modify
, which support querying and modifying certain paths.The modules provide a high-level interface and only support some paths. The API information included is based on what I gathered from RouterOS 6.49. I'd like to have a better way to gather this data, but haven't been able to look into that yet.
The
api_modify
module should be able to at least solve some of the problems mentioned in #33.ISSUE TYPE
COMPONENT NAME
api_info
api_modify