Commit graph

75 commits

Author SHA1 Message Date
Felix Fontein
e5eff0b90e Fix order. 2023-04-16 18:16:19 +02:00
Sam Grimee - LX2SG
c1a6ae8658
Workaround prompt issues between ROS 6.49 and 7.1.5 (#62) (#161)
* Prompt support for ROS 6.49+ (#62)

* More precise version match (#62)

* Add changelog fragment and lint (#62)

* Update changelogs/fragments/161-workaround-prompt-with-space.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Vendor version package to support older ansible versions (#62)

* Update plugins/module_utils/routeros.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/module_utils/routeros.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* move PSF-2.0.txt to LICENSES folder

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-03-23 21:25:23 +01:00
Felix Fontein
4329928474
ip dhcp-client: dhcp-options can be removed with value '' (#154)
* dhcp-options can be removed with value ''.

* Fix handling of disabled keys on creation.

* Fix typo.
2023-03-19 13:14:55 +01:00
phox142
071f742100
Adapt SNMP support (#159)
* snmp support

* Add changelog fragment

* Update changelogs/fragments/159-snmp_community.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/159-snmp_community.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-03-11 18:17:26 +01:00
phox142
720debb323
Add support to disable ipv6 in API paths `ipv6 settings` (#158)
* add support to disable ipv6

* Add changelogs fragment

* Update changelogs/fragments/158-ipv6_settings-disable.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-03-11 18:16:43 +01:00
phox142
4d86ba1a7d
Correction and Bugfix for ip dhcp-server network (#156)
* API_DATA > ('ip', 'dhcp-server', 'network') > netmask
replace "automatically_computed_from" by 'can_disable=True, remove_value=0'
automatically_computed_from does not seem to be used at any place in the code
without 'can_disable=True, remove_value=0' task is marked as changed at each execution.

* API_DATA > ('ip', 'dhcp-server', 'network') > next-server
replace "default=''" by 'can_disable=True'
The default in routeros is "no value" and it was not possible to remove a configured next-server

* API_DATA > ('ip', 'dhcp-server', 'network') > gateway
replace "automatically_computed_from" by "default=''"
automatically_computed_from does not seem to be used

* API_DATA > ('ip', 'dhcp-server', 'network') > dns-none
replace "default=''" by "default=False"

* Add changelogs fragment

* Update changelogs/fragments/156-ip_dhcp-server_network.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-03-10 07:01:26 +01:00
phox142
ab87a27018
Add support for "ip firewall layer7-protocol" (#153)
* Add support for "ip firewall layer7-protocol"

* Add changelog fragment

* Add changelog fragment
2023-02-27 22:37:00 +01:00
Felix Fontein
622680fe3f
Remove unneccessary imports (#149)
* Remove unneccessary imports.

* Add noqas.
2023-02-06 07:42:39 +01:00
Tomas Herfert
f38b01d7bb
API update (#144)
* API update

Signed-off-by: Tomas Herfert <herfik>

* fix changelog fragment directory

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
2023-01-01 22:18:24 +01:00
Andrei Costescu
586edbc211
Add regexp field to ip dns static (#142)
* Add regexp field to "ip dns static"

* Change test_invalid_required_missing to use "ip dhcp-server"

"ip dns static" requires name or regexp so it cannot be used in this test.

* Add required_one_of attribute to APIData

Used by "ip dns static" which requires either "name" or "regexp.

* Add mutually_exclusive attribute to APIData

Used by "ip dns static" where only one of "name" or "regexp" can be used.

* Add changelog fragment
2022-12-29 08:51:40 +01:00
Andrei Costescu
62da7dd4e3
Add wireguard interface and peers (#143)
* Add wireguard interface and peers

* Add changelog fragment
2022-12-27 21:41:42 +01:00
Tomas Herfert
4376906ed0
Paths (#137)
* support for "interface ethernet poe" and "interface vrrp"

Signed-off-by: Tomas Herfert <herfik>

* support "interface gre6" path

Signed-off-by: Tomas Herfert <herfik>

* ip dhcp-server - fix

Signed-off-by: Tomas Herfert <herfik>

* docs & changelog

Signed-off-by: Tomas Herfert <herfik>

* support for "interface ethernet poe" and "interface vrrp"

Signed-off-by: Tomas Herfert <herfik>

* support "interface gre6" path

Signed-off-by: Tomas Herfert <herfik>

* ip dhcp-server - fix

Signed-off-by: Tomas Herfert <herfik>

* docs & changelog

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-29 13:06:02 +01:00
Tomas Herfert
309e2b1910
terminal regex udpate to match the terminal prompt in safe mode (#134)
* terminal regex udpate to match the terminal prompt in safe mode

Signed-off-by: Tomas Herfert <herfik>

* changelog

Signed-off-by: Tomas Herfert <herfik>

* yamllint fix

Signed-off-by: Tomas Herfert <herfik>

* Update changelogs/fragments/134-command-safemode.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-17 21:03:42 +01:00
Tomas Herfert
5af14a8940
support for new API paths and few updates (#133)
* support for new API paths and few updates

Signed-off-by: Tomas Herfert <herfik>

* changelog fix

Signed-off-by: Tomas Herfert <herfik>

* tests update

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
2022-11-17 20:14:07 +01:00
Tomas Herfert
23b3aa3beb
API update (#128)
* adding support for api fields that can be disabled and have default value at the same time

Signed-off-by: Tomas Herfert <herfik>

* api path support: interface gre

Signed-off-by: Tomas Herfert <herfik>

* docs

Signed-off-by: Tomas Herfert <herfik>

* unit test update & yamlling fix

Signed-off-by: Tomas Herfert <herfik>

* test fix

Signed-off-by: Tomas Herfert <herfik>

* sanity fix

Signed-off-by: Tomas Herfert <herfik>

* changelog

Signed-off-by: Tomas Herfert <herfik>

* Update per suggestion

Co-authored-by: Felix Fontein <felix@fontein.de>

* api path support: interface eoip

Signed-off-by: Tomas Herfert <herfik>

* docs

Signed-off-by: Tomas Herfert <herfik>

* apply suggestion from code review

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-17 12:48:50 +01:00
Tomas Herfert
b539ed6aa4
make api_modify to ignore builtin items (#130)
* make api_modify to ignore builtin items

Signed-off-by: Tomas Herfert <herfik>

* include_builtin parametr for api_info module

Signed-off-by: Tomas Herfert <herfik>

* api_info ignore_builtin changelog

Signed-off-by: Tomas Herfert <herfik>

* typo

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-16 22:31:49 +01:00
Tomas Herfert
4194ae9ba6
multiple api paths support and updates (#131)
* multiple api paths support and updates

Signed-off-by: Tomas Herfert <herfik>

* sanity fix

Signed-off-by: Tomas Herfert <herfik>

* another sanity fix

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-15 22:11:55 +01:00
Tomas Herfert
c48f4c74ce
support for multiple "ip ipsec *" API paths (#129)
Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
2022-11-13 21:14:45 +01:00
Tomas Herfert
29247faaa3
system logging API paths (#127)
* api path support: system logging action

Signed-off-by: Tomas Herfert <herfik>

* api path support: system logging

Signed-off-by: Tomas Herfert <herfik>

* docs & changelog

Signed-off-by: Tomas Herfert <herfik>

* typo fix

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
2022-11-13 10:02:29 +01:00
Tomas Herfert
60427fff5e
Capsman API paths (#126)
* api path support: caps-man datapath

Signed-off-by: Tomas Herfert <herfik>

* api path support: caps-man security

Signed-off-by: Tomas Herfert <herfik>

* api path support: caps-man configuration

Signed-off-by: Tomas Herfert <herfik>

* api path support: caps-man access-list

Signed-off-by: Tomas Herfert <herfik>

* api path support: caps-man manager

Signed-off-by: Tomas Herfert <herfik>

* api path support: caps-man provisioning

Signed-off-by: Tomas Herfert <herfik>

* docs & changelog

Signed-off-by: Tomas Herfert <herfik>

* yamllint fix

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
2022-11-12 16:09:34 +01:00
Tomas Herfert
ad9d7c3829
Support for additional API paths (#125)
* adding api path interface pppoe-client

Signed-off-by: Tomas Herfert <herfik>

* support for api path interface vlan

Signed-off-by: Tomas Herfert <herfik>

* support for api path interface bridge vlan

Signed-off-by: Tomas Herfert <herfik>

* PR ID update

Signed-off-by: Tomas Herfert <herfik>

* typo fix

Signed-off-by: Tomas Herfert <herfik>

* support for API path interface bridge and update of interface bridge port ingress-filtering to True

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestion per code review

Signed-off-by: Tomas Herfert <herfik>

* Update changelogs/fragments/125-api.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-12 16:08:25 +01:00
PhiBo
9567bbf292
Add new api option force_no_cert (#124)
* Add new option force_no_cert

Connect to a router without a certificate by using ADH ciphers.
This can be useful when setting up a device.

* Changelog

* Update plugins/doc_fragments/api.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/124-api.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-12 09:47:52 +01:00
Felix Fontein
9fc22be186
api_modify, api_info: support more fields in existing paths (#121)
* Support more paths.

* Forgot comma.

* Adjust tests.

* power-cycle-ping-address and power-cycle-ping-timeout can be unset

Co-authored-by: Tomas Herfert <68421396+therfert@users.noreply.github.com>

Co-authored-by: Tomas Herfert <68421396+therfert@users.noreply.github.com>
2022-11-10 21:10:24 +01:00
PhiBo
558eb501d2
Add support for ip route and ip route vrf (#123)
* Add support for ip route and ip route vrf

* Changelog
2022-11-10 21:09:58 +01:00
Tomas Herfert
1e36dfa2d0
adding "system ntp *" paths related to ROS7 (#122)
* adding "system ntp *" paths related to ROS7

Signed-off-by: Tomas Herfert <herfik>

* changelog

Signed-off-by: Tomas Herfert <herfik>

* docs

Signed-off-by: Tomas Herfert <herfik>

* typo

Signed-off-by: Tomas Herfert <herfik>

* sanity fix

Signed-off-by: Tomas Herfert <herfik>

* setting the correct defaults

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* typo

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-10 21:09:03 +01:00
Tomas Herfert
c2e58c3ae4
Interface list (#120)
* interface list & member

Signed-off-by: Tomas Herfert <herfik>

* adding changelog fragment

Signed-off-by: Tomas Herfert <herfik>

* changelog fix

Signed-off-by: Tomas Herfert <herfik>

* sanity fix

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-09 21:10:25 +01:00
Felix Fontein
835cec5e24
Use attributes to document module capabilities; warn about command module's check_mode support (#118)
* Improve formatting.

* Add 'api' action group attribute.

* Document attributes.

* Known issue: command module declares to support check mode.

* Compatibility with older ansible-core releases.

* Fix typo.

* Improve docs.

* Add shortcuts for common combinations.

* Update changelogs/fragments/command-check_mode.yml

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2022-11-06 20:58:06 +01:00
Felix Fontein
3c0ad57eb5
Extend API support. (#110) 2022-09-11 17:25:25 +02:00
TobsA
776b599ffe
Added timeout setting for api. (#109)
* Added timeout setting for api.

* Added changelog fragment

* Added "version_added" to api doc

* Added "," for better diff

* Fixed case and punctuation in changelog

Co-authored-by: Felix Fontein <felix@fontein.de>

* Fixed url in changelog fragment

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-09-07 21:10:11 +02:00
Felix Fontein
f797b4a231
Support absent values. Support absent value 'all' for 'server' in /ip dhcp-server lease. (#107) 2022-08-13 10:55:37 +02:00
Felix Fontein
a2ace3fb79
Add missing options for 'ip dhcp-server network'. (#106) 2022-08-13 10:54:48 +02:00
Felix Fontein
af6524a1fd
Fix docs. (#105) 2022-08-04 14:32:01 +02:00
Felix Fontein
2911710f1b
Add api_info and api_modify modules (#91)
* Add api_info and api_modify modules.

* Add documentation, and cross-references for the modules.

* Bump version added for new modules.

* Ignore dynamic entries. Allow _info module to return them.

* Document behavior for dynamic entries.

* Update license headers.

* Add disclaimer.

* Improve formulation.

* Auto-generate path list in DOCUMENTATION.

* Add test to make sure lists have been generated automatically.
2022-07-31 22:06:19 +02:00
Felix Fontein
7973f58661
Move licenses to LICENSES/, use SPDX-License-Identifier, mention all licenses in galaxy.yml, add missing license file (#101)
* Add SPDX license identifiers, mention all licenses in galaxy.yml.

* Add default copyright headers.

* Adjust remaining/missing entries.

* Fix/add more copyright statements.

* Add sanity test.

* Add changelog.

* Add missing license file.

* Remove colon after 'Copyright'.

* Avoid colon after 'Copyright' in lint script.
2022-07-18 23:16:54 +02:00
Felix Fontein
023f11f7e1
Add encoding option to API modules (#95)
* Set encoding to UTF-8.

* Add encoding parameter to API modules.

* librouteros is now patched.
2022-05-24 22:19:26 +02:00
Felix Fontein
ff66ba9289
Add api_find_and_modify module. (#93) 2022-05-24 18:23:44 +02:00
Nikolay Dachev
d57de117f5
update community.routeros.api query functionality (#63)
* update query to accept multiple librouteros ADN parameters

* update query for new yml strucutre

* add extended_query as separate function:(code in progress)

* extended_query main code is ready for review

* add changelog #63

* small fix for code indentation

* fix pep

* clear all pep issues

* extended_query ready for review (new yml structure)

* small doc fix for std query

* Update changelogs/fragments/63-add-extended_query.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/63-add-extended_query.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update argument spec.

* Other suggestions.

* Fix syntax errors ('is' and 'or' are keywords).

* Make everything work again.

* Add docs, simplify code.

* Add some first tests.

* Do not add fake message when there is no search result.

* Improve tests.

* Fix tests.

* update extened query docs and ros api module examples

* fix pep plugins/modules/api.py:154:1: W293: blank line contains whitespace

* fix extended query example intend

* Update plugins/modules/api.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/api.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix example docs

Co-authored-by: dako <dako@syslin.sof.dachev.lan>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-23 14:44:02 +03:00
Felix Fontein
3d80ccec5f
Add api_facts module (#88)
* Add API docs fragment.

* Improve documentation.

* Move API code to api module_utils.

* Improve docs.

* Add api_facts module.

Does not yet support 'config'. I'm not sure whether that's actually
possible with the API.

* Convert subnet to integer if possible.

* Cleanup.

* Linting and fix tests.

* Remove things that make no sense.

* Simplify code.

* Add basic tests.

* Lint.
2022-05-12 16:17:43 +02:00
Felix Fontein
a90c696589
Correctly handle \_ escape sequence. (#89) 2022-05-09 22:09:08 +02:00
Felix Fontein
02ecc0ca9d
Add filter documentation (#87)
* Add filter documentation.

* Update no-unwanted-files sanity check.
2022-04-30 16:40:59 +02:00
Nikolay Dachev
a46c7df15c
Fix query (#68)
* fix issues #67

* fix query id check

* add changelog fragment

* fix changelog fragment new line

* fix changelog fragment new line2

* Update changelogs/fragments/68-fix-query-id-check.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-10 07:53:08 +01:00
txt-file
e9fdf19253
fix typo (#64) 2022-01-22 08:26:53 +01:00
Felix Fontein
4ccd70cc8f
Fix sanity errors. (#55) 2021-10-19 13:04:30 +01:00
Felix Fontein
d73eb1c144
Add module_utils and filters for quoting and unquoting (#53)
* Move splitting code to own file.

* Move list to dictionary code to quoting as well.

* Add quoting functionality.

* Add quoting filters.

* Add integration tests to CI.

* Fix bugs, increase coverage.

* Make parsing more strict.

* Extract function parse_argument_value from split_routeros_command to make proper parsing of WHERE possible.

* Adjust expected error message in integration tests.

* Simplify code and improve coverage.

* Add changelog fragment for WHERE strictness in api module.

* Add documenation.

* Fix typo.

* Add documentation references.

* Add example to api module which uses quote_argument_value.

* Fix bug, and add tests which prevent this in the future.

* Add more escape sequence tests.

* Make sure all control characters are quoted.
2021-10-12 00:44:40 +03:00
Felix Fontein
f9d246cd7a
Make command always return changed=true. (#50) 2021-10-09 13:36:14 +02:00
Akim Lindberg
5042905471
fix(api): fixed a bug when splitting the argument string (#45)
* fix(api): fixed a bug when splitting the argument string

* fix(api): added the shlex module for splitting

* fix(api): added the shlex module for splitting

* fix(api): moved shlex.split to self method split_params

* Fix indentation.

* Implement custom splitting algorithm.

* Raise AssertionError in case of internal error.

* Update plugins/modules/api.py

this is correct thanks !

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
2021-09-29 15:02:28 +02:00
Felix Fontein
48c7920072
Improve split handling. (#47) 2021-09-09 23:19:57 +03:00
Felix Fontein
a88f4c804b
Fix sanity failures (#43)
* Fix sanity failures.

* Add changelog fragment.
2021-08-12 08:53:21 +02:00
Felix Fontein
69682054e1
Allow api module to fail (#39)
* Allow api module to fail.

* Improve error handling.

* Fix api unit tests.

* Add very basic tests of return values.

* Update api.py

fix ignoring the Fail task if we get TrapError

* Do not mangle fail result, and adjust tests.

* Improve changelog fragment.

* Reclassify changelog fragment as minor_changes, improve text.

* Mark changelog as 'breaking change'.

Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
2021-07-11 15:53:22 +02:00
Felix Fontein
75b4b966a6
Add options to control certificate validation for api module (#37)
* Add options to control certificate validation for api module.

* Linting.

* Extend documentation.

* Fix validate_cert_hostname=true.

* Add documentation on setting up certificates on a RouterOS device.
2021-06-28 20:33:37 +02:00