Commit graph

132 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
937aa0dbfa
Replace ansible.module_utils._text by ansible.module_utils.common.text.converters (#38)
* Replace ansible.module_utils._text by ansible.module_utils.common.text.converters.

* One more.
2021-06-27 09:53:45 +02:00
Renato Almeida de Oliveira
e5ad772703
Change to_text for to_native (#5) 2020-10-29 00:57:17 +03:00
Felix Fontein
6ccc2eab79 Add boilerplate (#108)
* Add boilerplate to doc_fragments and module_utils.

* Add boilerplate to unit tests.

* Add boilerplate to modules.
2020-10-26 15:18:40 +01:00
Renato Almeida de Oliveira
3634150468 routeros: Bug fix: Exception catching (#27)
* Bug fix: Exception catching

The function get_capabilities was failing to catch connections exceptions, what make an ugly output

OUTPUT BEFORE CHANGES:

The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_comle>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_comallz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routeros_com_module
    runpy.run_module(mod_name='ansible.modules.network.routeros.command', init_globals=None, run_name='__main__', a
  File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/modules/network/routeros/r7, in <module>
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/modules/network/routeros/r7, in main
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/routein run_commands
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/routen get_connection
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/routen get_capabilities
  File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/connection.py
ansible.module_utils.connection.ConnectionError: Failed to authenticate: Authentication failed.
fatal: [MK]: FAILED! => changed=false
  module_stderr: |-
    Traceback (most recent call last):
      File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosmodule>
        _ansiballz_main()
      File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosnsiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/root/.ansible/tmp/ansible-local-20843l7aphwz5/ansible-tmp-1588555470.4121525-264386939405924/AnsiballZ_routerosvoke_module
        runpy.run_module(mod_name='ansible.modules.network.routeros.command', init_globals=None, run_name='__main__
      File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
        fname, loader, pkg_name)
      File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
        mod_name, mod_fname, mod_loader, pkg_name)
      File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/modules/network/routere 187, in <module>
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/modules/network/routere 157, in main
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/r25, in run_commands
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/r5, in get_connection
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/network/r9, in get_capabilities
      File "/tmp/ansible_command_payload_XbsRY1/ansible_command_payload.zip/ansible/module_utils/connectio
    ansible.module_utils.connection.ConnectionError: Failed to authenticate: Authentication failed.
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

OUTPUT AFTER CHANGES

fatal: [MK]: FAILED! => changed=false
  msg: 'Failed to authenticate: Authentication failed.'

* Lint Fix

* changelog fragment

* changelog update

* to_text refactoring
2020-10-26 15:18:40 +01:00
John R Barker
bcfea39ddc Add networking (#1)
Initial commit of network content that was previously in community.general
2020-10-26 15:18:40 +01:00