mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-08 04:05:19 +02:00
Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
|
19363bb424 | ||
|
8aed0204cf | ||
|
317fca8502 | ||
|
5f21f8f7c6 | ||
|
90780b9cd0 | ||
|
3a5b1175ff | ||
|
c5f1fb50d7 | ||
|
f8f86f6ec0 | ||
|
8eab877140 | ||
|
353027cb5c | ||
|
b0453b2e47 | ||
|
3af2968316 |
29 changed files with 383 additions and 558 deletions
33
.github/workflows/ansible-test.yml
vendored
33
.github/workflows/ansible-test.yml
vendored
|
@ -37,15 +37,7 @@ jobs:
|
||||||
- stable-2.17
|
- stable-2.17
|
||||||
- stable-2.18
|
- stable-2.18
|
||||||
- devel
|
- devel
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
runs-on: ubuntu-latest
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["stable-2.9", "stable-2.10", "stable-2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Perform sanity testing
|
- name: Perform sanity testing
|
||||||
uses: felixfontein/ansible-test-gh-action@main
|
uses: felixfontein/ansible-test-gh-action@main
|
||||||
|
@ -58,17 +50,10 @@ jobs:
|
||||||
pre-test-cmd: |-
|
pre-test-cmd: |-
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
||||||
|
|
||||||
units:
|
units:
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
runs-on: ubuntu-latest
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["stable-2.9", "stable-2.10", "stable-2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
name: Units (Ⓐ${{ matrix.ansible }})
|
name: Units (Ⓐ${{ matrix.ansible }})
|
||||||
strategy:
|
strategy:
|
||||||
# As soon as the first unit test fails, cancel the others to free up the CI queue
|
# As soon as the first unit test fails, cancel the others to free up the CI queue
|
||||||
|
@ -101,17 +86,10 @@ jobs:
|
||||||
pre-test-cmd: |-
|
pre-test-cmd: |-
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
runs-on: ubuntu-latest
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["stable-2.9", "stable-2.10", "stable-2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -175,5 +153,6 @@ jobs:
|
||||||
pre-test-cmd: |-
|
pre-test-cmd: |-
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
||||||
target-python-version: ${{ matrix.python }}
|
target-python-version: ${{ matrix.python }}
|
||||||
testing-type: integration
|
testing-type: integration
|
||||||
|
|
3
.github/workflows/ee.yml
vendored
3
.github/workflows/ee.yml
vendored
|
@ -68,6 +68,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
path: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
|
@ -101,7 +102,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create files for building execution environment
|
- name: Create files for building execution environment
|
||||||
run: |
|
run: |
|
||||||
COLLECTION_FILENAME="$(ls "${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}"-*.tar.gz)"
|
COLLECTION_FILENAME="$(ls "${NAMESPACE}-${COLLECTION_NAME}"-*.tar.gz)"
|
||||||
|
|
||||||
# EE config
|
# EE config
|
||||||
cat > execution-environment.yml <<EOF
|
cat > execution-environment.yml <<EOF
|
||||||
|
|
1
.github/workflows/extra-tests.yml
vendored
1
.github/workflows/extra-tests.yml
vendored
|
@ -29,6 +29,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
|
|
10
.github/workflows/reuse.yml
vendored
10
.github/workflows/reuse.yml
vendored
|
@ -7,9 +7,13 @@ name: Verify REUSE
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
|
- stable-*
|
||||||
# Run CI once per day (at 05:15 UTC)
|
# Run CI once per day (at 05:15 UTC)
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '15 5 * * *'
|
- cron: '15 5 * * *'
|
||||||
|
@ -22,6 +26,8 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: REUSE Compliance Check
|
- name: REUSE Compliance Check
|
||||||
uses: fsfe/reuse-action@v4
|
uses: fsfe/reuse-action@v4
|
||||||
|
|
142
CHANGELOG.md
142
CHANGELOG.md
|
@ -2,128 +2,142 @@
|
||||||
|
|
||||||
**Topics**
|
**Topics**
|
||||||
|
|
||||||
- <a href="#v2-20-0">v2\.20\.0</a>
|
- <a href="#v2-20-1">v2\.20\.1</a>
|
||||||
- <a href="#release-summary">Release Summary</a>
|
- <a href="#release-summary">Release Summary</a>
|
||||||
|
- <a href="#v2-20-0">v2\.20\.0</a>
|
||||||
|
- <a href="#release-summary-1">Release Summary</a>
|
||||||
- <a href="#minor-changes">Minor Changes</a>
|
- <a href="#minor-changes">Minor Changes</a>
|
||||||
- <a href="#v2-19-0">v2\.19\.0</a>
|
- <a href="#v2-19-0">v2\.19\.0</a>
|
||||||
- <a href="#release-summary-1">Release Summary</a>
|
- <a href="#release-summary-2">Release Summary</a>
|
||||||
- <a href="#minor-changes-1">Minor Changes</a>
|
- <a href="#minor-changes-1">Minor Changes</a>
|
||||||
- <a href="#v2-18-0">v2\.18\.0</a>
|
- <a href="#v2-18-0">v2\.18\.0</a>
|
||||||
- <a href="#release-summary-2">Release Summary</a>
|
- <a href="#release-summary-3">Release Summary</a>
|
||||||
- <a href="#minor-changes-2">Minor Changes</a>
|
- <a href="#minor-changes-2">Minor Changes</a>
|
||||||
- <a href="#deprecated-features">Deprecated Features</a>
|
- <a href="#deprecated-features">Deprecated Features</a>
|
||||||
- <a href="#bugfixes">Bugfixes</a>
|
- <a href="#bugfixes">Bugfixes</a>
|
||||||
- <a href="#v2-17-0">v2\.17\.0</a>
|
- <a href="#v2-17-0">v2\.17\.0</a>
|
||||||
- <a href="#release-summary-3">Release Summary</a>
|
- <a href="#release-summary-4">Release Summary</a>
|
||||||
- <a href="#minor-changes-3">Minor Changes</a>
|
- <a href="#minor-changes-3">Minor Changes</a>
|
||||||
- <a href="#v2-16-0">v2\.16\.0</a>
|
- <a href="#v2-16-0">v2\.16\.0</a>
|
||||||
- <a href="#release-summary-4">Release Summary</a>
|
- <a href="#release-summary-5">Release Summary</a>
|
||||||
- <a href="#minor-changes-4">Minor Changes</a>
|
- <a href="#minor-changes-4">Minor Changes</a>
|
||||||
- <a href="#v2-15-0">v2\.15\.0</a>
|
- <a href="#v2-15-0">v2\.15\.0</a>
|
||||||
- <a href="#release-summary-5">Release Summary</a>
|
- <a href="#release-summary-6">Release Summary</a>
|
||||||
- <a href="#minor-changes-5">Minor Changes</a>
|
- <a href="#minor-changes-5">Minor Changes</a>
|
||||||
- <a href="#v2-14-0">v2\.14\.0</a>
|
- <a href="#v2-14-0">v2\.14\.0</a>
|
||||||
- <a href="#release-summary-6">Release Summary</a>
|
- <a href="#release-summary-7">Release Summary</a>
|
||||||
- <a href="#minor-changes-6">Minor Changes</a>
|
- <a href="#minor-changes-6">Minor Changes</a>
|
||||||
- <a href="#v2-13-0">v2\.13\.0</a>
|
- <a href="#v2-13-0">v2\.13\.0</a>
|
||||||
- <a href="#release-summary-7">Release Summary</a>
|
- <a href="#release-summary-8">Release Summary</a>
|
||||||
- <a href="#minor-changes-7">Minor Changes</a>
|
- <a href="#minor-changes-7">Minor Changes</a>
|
||||||
- <a href="#bugfixes-1">Bugfixes</a>
|
- <a href="#bugfixes-1">Bugfixes</a>
|
||||||
- <a href="#v2-12-0">v2\.12\.0</a>
|
- <a href="#v2-12-0">v2\.12\.0</a>
|
||||||
- <a href="#release-summary-8">Release Summary</a>
|
- <a href="#release-summary-9">Release Summary</a>
|
||||||
- <a href="#minor-changes-8">Minor Changes</a>
|
- <a href="#minor-changes-8">Minor Changes</a>
|
||||||
- <a href="#v2-11-0">v2\.11\.0</a>
|
- <a href="#v2-11-0">v2\.11\.0</a>
|
||||||
- <a href="#release-summary-9">Release Summary</a>
|
- <a href="#release-summary-10">Release Summary</a>
|
||||||
- <a href="#minor-changes-9">Minor Changes</a>
|
- <a href="#minor-changes-9">Minor Changes</a>
|
||||||
- <a href="#v2-10-0">v2\.10\.0</a>
|
- <a href="#v2-10-0">v2\.10\.0</a>
|
||||||
- <a href="#release-summary-10">Release Summary</a>
|
- <a href="#release-summary-11">Release Summary</a>
|
||||||
- <a href="#minor-changes-10">Minor Changes</a>
|
- <a href="#minor-changes-10">Minor Changes</a>
|
||||||
- <a href="#bugfixes-2">Bugfixes</a>
|
- <a href="#bugfixes-2">Bugfixes</a>
|
||||||
- <a href="#v2-9-0">v2\.9\.0</a>
|
- <a href="#v2-9-0">v2\.9\.0</a>
|
||||||
- <a href="#release-summary-11">Release Summary</a>
|
- <a href="#release-summary-12">Release Summary</a>
|
||||||
- <a href="#minor-changes-11">Minor Changes</a>
|
- <a href="#minor-changes-11">Minor Changes</a>
|
||||||
- <a href="#bugfixes-3">Bugfixes</a>
|
- <a href="#bugfixes-3">Bugfixes</a>
|
||||||
- <a href="#v2-8-3">v2\.8\.3</a>
|
- <a href="#v2-8-3">v2\.8\.3</a>
|
||||||
- <a href="#release-summary-12">Release Summary</a>
|
- <a href="#release-summary-13">Release Summary</a>
|
||||||
- <a href="#known-issues">Known Issues</a>
|
- <a href="#known-issues">Known Issues</a>
|
||||||
- <a href="#v2-8-2">v2\.8\.2</a>
|
- <a href="#v2-8-2">v2\.8\.2</a>
|
||||||
- <a href="#release-summary-13">Release Summary</a>
|
- <a href="#release-summary-14">Release Summary</a>
|
||||||
- <a href="#bugfixes-4">Bugfixes</a>
|
- <a href="#bugfixes-4">Bugfixes</a>
|
||||||
- <a href="#v2-8-1">v2\.8\.1</a>
|
- <a href="#v2-8-1">v2\.8\.1</a>
|
||||||
- <a href="#release-summary-14">Release Summary</a>
|
- <a href="#release-summary-15">Release Summary</a>
|
||||||
- <a href="#bugfixes-5">Bugfixes</a>
|
- <a href="#bugfixes-5">Bugfixes</a>
|
||||||
- <a href="#v2-8-0">v2\.8\.0</a>
|
- <a href="#v2-8-0">v2\.8\.0</a>
|
||||||
- <a href="#release-summary-15">Release Summary</a>
|
- <a href="#release-summary-16">Release Summary</a>
|
||||||
- <a href="#minor-changes-12">Minor Changes</a>
|
- <a href="#minor-changes-12">Minor Changes</a>
|
||||||
- <a href="#bugfixes-6">Bugfixes</a>
|
- <a href="#bugfixes-6">Bugfixes</a>
|
||||||
- <a href="#v2-7-0">v2\.7\.0</a>
|
- <a href="#v2-7-0">v2\.7\.0</a>
|
||||||
- <a href="#release-summary-16">Release Summary</a>
|
- <a href="#release-summary-17">Release Summary</a>
|
||||||
- <a href="#minor-changes-13">Minor Changes</a>
|
- <a href="#minor-changes-13">Minor Changes</a>
|
||||||
- <a href="#bugfixes-7">Bugfixes</a>
|
- <a href="#bugfixes-7">Bugfixes</a>
|
||||||
- <a href="#v2-6-0">v2\.6\.0</a>
|
- <a href="#v2-6-0">v2\.6\.0</a>
|
||||||
- <a href="#release-summary-17">Release Summary</a>
|
- <a href="#release-summary-18">Release Summary</a>
|
||||||
- <a href="#minor-changes-14">Minor Changes</a>
|
- <a href="#minor-changes-14">Minor Changes</a>
|
||||||
- <a href="#bugfixes-8">Bugfixes</a>
|
- <a href="#bugfixes-8">Bugfixes</a>
|
||||||
- <a href="#v2-5-0">v2\.5\.0</a>
|
- <a href="#v2-5-0">v2\.5\.0</a>
|
||||||
- <a href="#release-summary-18">Release Summary</a>
|
- <a href="#release-summary-19">Release Summary</a>
|
||||||
- <a href="#minor-changes-15">Minor Changes</a>
|
- <a href="#minor-changes-15">Minor Changes</a>
|
||||||
- <a href="#bugfixes-9">Bugfixes</a>
|
- <a href="#bugfixes-9">Bugfixes</a>
|
||||||
- <a href="#v2-4-0">v2\.4\.0</a>
|
- <a href="#v2-4-0">v2\.4\.0</a>
|
||||||
- <a href="#release-summary-19">Release Summary</a>
|
- <a href="#release-summary-20">Release Summary</a>
|
||||||
- <a href="#minor-changes-16">Minor Changes</a>
|
- <a href="#minor-changes-16">Minor Changes</a>
|
||||||
- <a href="#bugfixes-10">Bugfixes</a>
|
- <a href="#bugfixes-10">Bugfixes</a>
|
||||||
- <a href="#known-issues-1">Known Issues</a>
|
- <a href="#known-issues-1">Known Issues</a>
|
||||||
- <a href="#v2-3-1">v2\.3\.1</a>
|
- <a href="#v2-3-1">v2\.3\.1</a>
|
||||||
- <a href="#release-summary-20">Release Summary</a>
|
- <a href="#release-summary-21">Release Summary</a>
|
||||||
- <a href="#known-issues-2">Known Issues</a>
|
- <a href="#known-issues-2">Known Issues</a>
|
||||||
- <a href="#v2-3-0">v2\.3\.0</a>
|
- <a href="#v2-3-0">v2\.3\.0</a>
|
||||||
- <a href="#release-summary-21">Release Summary</a>
|
- <a href="#release-summary-22">Release Summary</a>
|
||||||
- <a href="#minor-changes-17">Minor Changes</a>
|
- <a href="#minor-changes-17">Minor Changes</a>
|
||||||
- <a href="#bugfixes-11">Bugfixes</a>
|
- <a href="#bugfixes-11">Bugfixes</a>
|
||||||
- <a href="#v2-2-1">v2\.2\.1</a>
|
- <a href="#v2-2-1">v2\.2\.1</a>
|
||||||
- <a href="#release-summary-22">Release Summary</a>
|
- <a href="#release-summary-23">Release Summary</a>
|
||||||
- <a href="#bugfixes-12">Bugfixes</a>
|
- <a href="#bugfixes-12">Bugfixes</a>
|
||||||
- <a href="#v2-2-0">v2\.2\.0</a>
|
- <a href="#v2-2-0">v2\.2\.0</a>
|
||||||
- <a href="#release-summary-23">Release Summary</a>
|
- <a href="#release-summary-24">Release Summary</a>
|
||||||
- <a href="#minor-changes-18">Minor Changes</a>
|
- <a href="#minor-changes-18">Minor Changes</a>
|
||||||
- <a href="#bugfixes-13">Bugfixes</a>
|
- <a href="#bugfixes-13">Bugfixes</a>
|
||||||
- <a href="#new-modules">New Modules</a>
|
- <a href="#new-modules">New Modules</a>
|
||||||
- <a href="#v2-1-0">v2\.1\.0</a>
|
- <a href="#v2-1-0">v2\.1\.0</a>
|
||||||
- <a href="#release-summary-24">Release Summary</a>
|
- <a href="#release-summary-25">Release Summary</a>
|
||||||
- <a href="#minor-changes-19">Minor Changes</a>
|
- <a href="#minor-changes-19">Minor Changes</a>
|
||||||
- <a href="#bugfixes-14">Bugfixes</a>
|
- <a href="#bugfixes-14">Bugfixes</a>
|
||||||
- <a href="#new-modules-1">New Modules</a>
|
- <a href="#new-modules-1">New Modules</a>
|
||||||
- <a href="#v2-0-0">v2\.0\.0</a>
|
- <a href="#v2-0-0">v2\.0\.0</a>
|
||||||
- <a href="#release-summary-25">Release Summary</a>
|
- <a href="#release-summary-26">Release Summary</a>
|
||||||
- <a href="#minor-changes-20">Minor Changes</a>
|
- <a href="#minor-changes-20">Minor Changes</a>
|
||||||
- <a href="#breaking-changes--porting-guide">Breaking Changes / Porting Guide</a>
|
- <a href="#breaking-changes--porting-guide">Breaking Changes / Porting Guide</a>
|
||||||
- <a href="#bugfixes-15">Bugfixes</a>
|
- <a href="#bugfixes-15">Bugfixes</a>
|
||||||
- <a href="#new-plugins">New Plugins</a>
|
- <a href="#new-plugins">New Plugins</a>
|
||||||
- <a href="#filter">Filter</a>
|
- <a href="#filter">Filter</a>
|
||||||
- <a href="#v1-2-0">v1\.2\.0</a>
|
- <a href="#v1-2-0">v1\.2\.0</a>
|
||||||
- <a href="#release-summary-26">Release Summary</a>
|
- <a href="#release-summary-27">Release Summary</a>
|
||||||
- <a href="#minor-changes-21">Minor Changes</a>
|
- <a href="#minor-changes-21">Minor Changes</a>
|
||||||
- <a href="#bugfixes-16">Bugfixes</a>
|
- <a href="#bugfixes-16">Bugfixes</a>
|
||||||
- <a href="#v1-1-0">v1\.1\.0</a>
|
- <a href="#v1-1-0">v1\.1\.0</a>
|
||||||
- <a href="#release-summary-27">Release Summary</a>
|
- <a href="#release-summary-28">Release Summary</a>
|
||||||
- <a href="#minor-changes-22">Minor Changes</a>
|
- <a href="#minor-changes-22">Minor Changes</a>
|
||||||
- <a href="#v1-0-1">v1\.0\.1</a>
|
- <a href="#v1-0-1">v1\.0\.1</a>
|
||||||
- <a href="#release-summary-28">Release Summary</a>
|
- <a href="#release-summary-29">Release Summary</a>
|
||||||
- <a href="#bugfixes-17">Bugfixes</a>
|
- <a href="#bugfixes-17">Bugfixes</a>
|
||||||
- <a href="#v1-0-0">v1\.0\.0</a>
|
- <a href="#v1-0-0">v1\.0\.0</a>
|
||||||
- <a href="#release-summary-29">Release Summary</a>
|
- <a href="#release-summary-30">Release Summary</a>
|
||||||
- <a href="#bugfixes-18">Bugfixes</a>
|
- <a href="#bugfixes-18">Bugfixes</a>
|
||||||
- <a href="#v0-1-1">v0\.1\.1</a>
|
- <a href="#v0-1-1">v0\.1\.1</a>
|
||||||
- <a href="#release-summary-30">Release Summary</a>
|
- <a href="#release-summary-31">Release Summary</a>
|
||||||
- <a href="#bugfixes-19">Bugfixes</a>
|
- <a href="#bugfixes-19">Bugfixes</a>
|
||||||
- <a href="#v0-1-0">v0\.1\.0</a>
|
- <a href="#v0-1-0">v0\.1\.0</a>
|
||||||
- <a href="#release-summary-31">Release Summary</a>
|
- <a href="#release-summary-32">Release Summary</a>
|
||||||
- <a href="#minor-changes-23">Minor Changes</a>
|
- <a href="#minor-changes-23">Minor Changes</a>
|
||||||
|
|
||||||
|
<a id="v2-20-1"></a>
|
||||||
|
## v2\.20\.1
|
||||||
|
|
||||||
|
<a id="release-summary"></a>
|
||||||
|
### Release Summary
|
||||||
|
|
||||||
|
This is the final community\.routeros 2\.x\.y release\.
|
||||||
|
|
||||||
|
Please upgrade to community\.routeros 3\.x\.y as soon as possible to receive further bugfixes\.
|
||||||
|
|
||||||
|
Thanks to everyone who contributed to community\.routeros 2\.x\.y releases\!
|
||||||
|
|
||||||
<a id="v2-20-0"></a>
|
<a id="v2-20-0"></a>
|
||||||
## v2\.20\.0
|
## v2\.20\.0
|
||||||
|
|
||||||
<a id="release-summary"></a>
|
<a id="release-summary-1"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -139,7 +153,7 @@ Feature release\.
|
||||||
<a id="v2-19-0"></a>
|
<a id="v2-19-0"></a>
|
||||||
## v2\.19\.0
|
## v2\.19\.0
|
||||||
|
|
||||||
<a id="release-summary-1"></a>
|
<a id="release-summary-2"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -156,7 +170,7 @@ Feature release\.
|
||||||
<a id="v2-18-0"></a>
|
<a id="v2-18-0"></a>
|
||||||
## v2\.18\.0
|
## v2\.18\.0
|
||||||
|
|
||||||
<a id="release-summary-2"></a>
|
<a id="release-summary-3"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -185,7 +199,7 @@ Feature release\.
|
||||||
<a id="v2-17-0"></a>
|
<a id="v2-17-0"></a>
|
||||||
## v2\.17\.0
|
## v2\.17\.0
|
||||||
|
|
||||||
<a id="release-summary-3"></a>
|
<a id="release-summary-4"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -200,7 +214,7 @@ Feature release\.
|
||||||
<a id="v2-16-0"></a>
|
<a id="v2-16-0"></a>
|
||||||
## v2\.16\.0
|
## v2\.16\.0
|
||||||
|
|
||||||
<a id="release-summary-4"></a>
|
<a id="release-summary-5"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -214,7 +228,7 @@ Feature release\.
|
||||||
<a id="v2-15-0"></a>
|
<a id="v2-15-0"></a>
|
||||||
## v2\.15\.0
|
## v2\.15\.0
|
||||||
|
|
||||||
<a id="release-summary-5"></a>
|
<a id="release-summary-6"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -236,7 +250,7 @@ Feature release\.
|
||||||
<a id="v2-14-0"></a>
|
<a id="v2-14-0"></a>
|
||||||
## v2\.14\.0
|
## v2\.14\.0
|
||||||
|
|
||||||
<a id="release-summary-6"></a>
|
<a id="release-summary-7"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -251,7 +265,7 @@ Feature release\.
|
||||||
<a id="v2-13-0"></a>
|
<a id="v2-13-0"></a>
|
||||||
## v2\.13\.0
|
## v2\.13\.0
|
||||||
|
|
||||||
<a id="release-summary-7"></a>
|
<a id="release-summary-8"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -270,7 +284,7 @@ Bugfix and feature release\.
|
||||||
<a id="v2-12-0"></a>
|
<a id="v2-12-0"></a>
|
||||||
## v2\.12\.0
|
## v2\.12\.0
|
||||||
|
|
||||||
<a id="release-summary-8"></a>
|
<a id="release-summary-9"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release\.
|
Feature release\.
|
||||||
|
@ -289,7 +303,7 @@ Feature release\.
|
||||||
<a id="v2-11-0"></a>
|
<a id="v2-11-0"></a>
|
||||||
## v2\.11\.0
|
## v2\.11\.0
|
||||||
|
|
||||||
<a id="release-summary-9"></a>
|
<a id="release-summary-10"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature and bugfix release\.
|
Feature and bugfix release\.
|
||||||
|
@ -309,7 +323,7 @@ Feature and bugfix release\.
|
||||||
<a id="v2-10-0"></a>
|
<a id="v2-10-0"></a>
|
||||||
## v2\.10\.0
|
## v2\.10\.0
|
||||||
|
|
||||||
<a id="release-summary-10"></a>
|
<a id="release-summary-11"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -346,7 +360,7 @@ Bugfix and feature release\.
|
||||||
<a id="v2-9-0"></a>
|
<a id="v2-9-0"></a>
|
||||||
## v2\.9\.0
|
## v2\.9\.0
|
||||||
|
|
||||||
<a id="release-summary-11"></a>
|
<a id="release-summary-12"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -365,7 +379,7 @@ Bugfix and feature release\.
|
||||||
<a id="v2-8-3"></a>
|
<a id="v2-8-3"></a>
|
||||||
## v2\.8\.3
|
## v2\.8\.3
|
||||||
|
|
||||||
<a id="release-summary-12"></a>
|
<a id="release-summary-13"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Maintenance release with updated documentation\.
|
Maintenance release with updated documentation\.
|
||||||
|
@ -386,7 +400,7 @@ for the rendered HTML version of the documentation of the latest release\.
|
||||||
<a id="v2-8-2"></a>
|
<a id="v2-8-2"></a>
|
||||||
## v2\.8\.2
|
## v2\.8\.2
|
||||||
|
|
||||||
<a id="release-summary-13"></a>
|
<a id="release-summary-14"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix release\.
|
Bugfix release\.
|
||||||
|
@ -399,7 +413,7 @@ Bugfix release\.
|
||||||
<a id="v2-8-1"></a>
|
<a id="v2-8-1"></a>
|
||||||
## v2\.8\.1
|
## v2\.8\.1
|
||||||
|
|
||||||
<a id="release-summary-14"></a>
|
<a id="release-summary-15"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix release\.
|
Bugfix release\.
|
||||||
|
@ -412,7 +426,7 @@ Bugfix release\.
|
||||||
<a id="v2-8-0"></a>
|
<a id="v2-8-0"></a>
|
||||||
## v2\.8\.0
|
## v2\.8\.0
|
||||||
|
|
||||||
<a id="release-summary-15"></a>
|
<a id="release-summary-16"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -437,7 +451,7 @@ Bugfix and feature release\.
|
||||||
<a id="v2-7-0"></a>
|
<a id="v2-7-0"></a>
|
||||||
## v2\.7\.0
|
## v2\.7\.0
|
||||||
|
|
||||||
<a id="release-summary-16"></a>
|
<a id="release-summary-17"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -455,7 +469,7 @@ Bugfix and feature release\.
|
||||||
<a id="v2-6-0"></a>
|
<a id="v2-6-0"></a>
|
||||||
## v2\.6\.0
|
## v2\.6\.0
|
||||||
|
|
||||||
<a id="release-summary-17"></a>
|
<a id="release-summary-18"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Regular bugfix and feature release\.
|
Regular bugfix and feature release\.
|
||||||
|
@ -475,7 +489,7 @@ Regular bugfix and feature release\.
|
||||||
<a id="v2-5-0"></a>
|
<a id="v2-5-0"></a>
|
||||||
## v2\.5\.0
|
## v2\.5\.0
|
||||||
|
|
||||||
<a id="release-summary-18"></a>
|
<a id="release-summary-19"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature and bugfix release\.
|
Feature and bugfix release\.
|
||||||
|
@ -493,7 +507,7 @@ Feature and bugfix release\.
|
||||||
<a id="v2-4-0"></a>
|
<a id="v2-4-0"></a>
|
||||||
## v2\.4\.0
|
## v2\.4\.0
|
||||||
|
|
||||||
<a id="release-summary-19"></a>
|
<a id="release-summary-20"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature release improving the <code>api\*</code> modules\.
|
Feature release improving the <code>api\*</code> modules\.
|
||||||
|
@ -537,7 +551,7 @@ Feature release improving the <code>api\*</code> modules\.
|
||||||
<a id="v2-3-1"></a>
|
<a id="v2-3-1"></a>
|
||||||
## v2\.3\.1
|
## v2\.3\.1
|
||||||
|
|
||||||
<a id="release-summary-20"></a>
|
<a id="release-summary-21"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Maintenance release with improved documentation\.
|
Maintenance release with improved documentation\.
|
||||||
|
@ -550,7 +564,7 @@ Maintenance release with improved documentation\.
|
||||||
<a id="v2-3-0"></a>
|
<a id="v2-3-0"></a>
|
||||||
## v2\.3\.0
|
## v2\.3\.0
|
||||||
|
|
||||||
<a id="release-summary-21"></a>
|
<a id="release-summary-22"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature and bugfix release\.
|
Feature and bugfix release\.
|
||||||
|
@ -570,7 +584,7 @@ Feature and bugfix release\.
|
||||||
<a id="v2-2-1"></a>
|
<a id="v2-2-1"></a>
|
||||||
## v2\.2\.1
|
## v2\.2\.1
|
||||||
|
|
||||||
<a id="release-summary-22"></a>
|
<a id="release-summary-23"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix release\.
|
Bugfix release\.
|
||||||
|
@ -584,7 +598,7 @@ Bugfix release\.
|
||||||
<a id="v2-2-0"></a>
|
<a id="v2-2-0"></a>
|
||||||
## v2\.2\.0
|
## v2\.2\.0
|
||||||
|
|
||||||
<a id="release-summary-23"></a>
|
<a id="release-summary-24"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
New feature release\.
|
New feature release\.
|
||||||
|
@ -608,7 +622,7 @@ New feature release\.
|
||||||
<a id="v2-1-0"></a>
|
<a id="v2-1-0"></a>
|
||||||
## v2\.1\.0
|
## v2\.1\.0
|
||||||
|
|
||||||
<a id="release-summary-24"></a>
|
<a id="release-summary-25"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Feature and bugfix release with new modules\.
|
Feature and bugfix release with new modules\.
|
||||||
|
@ -637,7 +651,7 @@ Feature and bugfix release with new modules\.
|
||||||
<a id="v2-0-0"></a>
|
<a id="v2-0-0"></a>
|
||||||
## v2\.0\.0
|
## v2\.0\.0
|
||||||
|
|
||||||
<a id="release-summary-25"></a>
|
<a id="release-summary-26"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
A new major release with breaking changes in the behavior of <code>community\.routeros\.api</code> and <code>community\.routeros\.command</code>\.
|
A new major release with breaking changes in the behavior of <code>community\.routeros\.api</code> and <code>community\.routeros\.command</code>\.
|
||||||
|
@ -678,7 +692,7 @@ A new major release with breaking changes in the behavior of <code>community\.ro
|
||||||
<a id="v1-2-0"></a>
|
<a id="v1-2-0"></a>
|
||||||
## v1\.2\.0
|
## v1\.2\.0
|
||||||
|
|
||||||
<a id="release-summary-26"></a>
|
<a id="release-summary-27"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Bugfix and feature release\.
|
Bugfix and feature release\.
|
||||||
|
@ -699,7 +713,7 @@ Bugfix and feature release\.
|
||||||
<a id="v1-1-0"></a>
|
<a id="v1-1-0"></a>
|
||||||
## v1\.1\.0
|
## v1\.1\.0
|
||||||
|
|
||||||
<a id="release-summary-27"></a>
|
<a id="release-summary-28"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
This release allow dashes in usernames for SSH\-based modules\.
|
This release allow dashes in usernames for SSH\-based modules\.
|
||||||
|
@ -713,7 +727,7 @@ This release allow dashes in usernames for SSH\-based modules\.
|
||||||
<a id="v1-0-1"></a>
|
<a id="v1-0-1"></a>
|
||||||
## v1\.0\.1
|
## v1\.0\.1
|
||||||
|
|
||||||
<a id="release-summary-28"></a>
|
<a id="release-summary-29"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Maintenance release with a bugfix for <code>api</code>\.
|
Maintenance release with a bugfix for <code>api</code>\.
|
||||||
|
@ -726,7 +740,7 @@ Maintenance release with a bugfix for <code>api</code>\.
|
||||||
<a id="v1-0-0"></a>
|
<a id="v1-0-0"></a>
|
||||||
## v1\.0\.0
|
## v1\.0\.0
|
||||||
|
|
||||||
<a id="release-summary-29"></a>
|
<a id="release-summary-30"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
This is the first production \(non\-prerelease\) release of <code>community\.routeros</code>\.
|
This is the first production \(non\-prerelease\) release of <code>community\.routeros</code>\.
|
||||||
|
@ -739,7 +753,7 @@ This is the first production \(non\-prerelease\) release of <code>community\.rou
|
||||||
<a id="v0-1-1"></a>
|
<a id="v0-1-1"></a>
|
||||||
## v0\.1\.1
|
## v0\.1\.1
|
||||||
|
|
||||||
<a id="release-summary-30"></a>
|
<a id="release-summary-31"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
Small improvements and bugfixes over the initial release\.
|
Small improvements and bugfixes over the initial release\.
|
||||||
|
@ -752,7 +766,7 @@ Small improvements and bugfixes over the initial release\.
|
||||||
<a id="v0-1-0"></a>
|
<a id="v0-1-0"></a>
|
||||||
## v0\.1\.0
|
## v0\.1\.0
|
||||||
|
|
||||||
<a id="release-summary-31"></a>
|
<a id="release-summary-32"></a>
|
||||||
### Release Summary
|
### Release Summary
|
||||||
|
|
||||||
The <code>community\.routeros</code> continues the work on the Ansible RouterOS modules from their state in <code>community\.network</code> 1\.2\.0\. The changes listed here are thus relative to the modules <code>community\.network\.routeros\_\*</code>\.
|
The <code>community\.routeros</code> continues the work on the Ansible RouterOS modules from their state in <code>community\.network</code> 1\.2\.0\. The changes listed here are thus relative to the modules <code>community\.network\.routeros\_\*</code>\.
|
||||||
|
|
|
@ -4,6 +4,18 @@ Community RouterOS Release Notes
|
||||||
|
|
||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
v2.20.1
|
||||||
|
=======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This is the final community.routeros 2.x.y release.
|
||||||
|
|
||||||
|
Please upgrade to community.routeros 3.x.y as soon as possible to receive further bugfixes.
|
||||||
|
|
||||||
|
Thanks to everyone who contributed to community.routeros 2.x.y releases!
|
||||||
|
|
||||||
v2.20.0
|
v2.20.0
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
11
README.md
11
README.md
|
@ -5,7 +5,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# Community RouterOS Collection
|
# Community RouterOS Collection
|
||||||
[](https://github.com/ansible-collections/community.routeros/actions)
|
[](https://docs.ansible.com/ansible/latest/collections/community/routeros/)
|
||||||
|
[](https://github.com/ansible-collections/community.routeros/actions)
|
||||||
[](https://codecov.io/gh/ansible-collections/community.routeros)
|
[](https://codecov.io/gh/ansible-collections/community.routeros)
|
||||||
[](https://api.reuse.software/info/github.com/ansible-collections/community.routeros)
|
[](https://api.reuse.software/info/github.com/ansible-collections/community.routeros)
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ Browsing the [**latest** collection documentation](https://docs.ansible.com/ansi
|
||||||
|
|
||||||
Browsing the [**devel** collection documentation](https://docs.ansible.com/ansible/devel/collections/community/routeros) shows docs for the _latest version released on Galaxy_.
|
Browsing the [**devel** collection documentation](https://docs.ansible.com/ansible/devel/collections/community/routeros) shows docs for the _latest version released on Galaxy_.
|
||||||
|
|
||||||
We also separately publish [**latest commit** collection documentation](https://ansible-collections.github.io/community.routeros/branch/main/) which shows docs for the _latest commit in the `main` branch_.
|
We also separately publish [**latest commit** collection documentation](https://ansible-collections.github.io/community.routeros/branch/stable-2/) which shows docs for the _latest commit in the `stable-2` branch_.
|
||||||
|
|
||||||
If you use the Ansible package and do not update collections independently, use **latest**. If you install or update this collection directly from Galaxy, use **devel**. If you are looking to contribute, use **latest commit**.
|
If you use the Ansible package and do not update collections independently, use **latest**. If you install or update this collection directly from Galaxy, use **devel**. If you are looking to contribute, use **latest commit**.
|
||||||
|
|
||||||
|
@ -183,7 +184,7 @@ See [Ansible's dev guide](https://docs.ansible.com/ansible/devel/dev_guide/devel
|
||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
|
|
||||||
See the [collection's changelog](https://github.com/ansible-collections/community.routeros/blob/main/CHANGELOG.md).
|
See the [collection's changelog](https://github.com/ansible-collections/community.routeros/blob/stable-2/CHANGELOG.md).
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
|
@ -203,8 +204,8 @@ We plan to regularly release minor and patch versions, whenever new features are
|
||||||
|
|
||||||
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
||||||
|
|
||||||
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.routeros/blob/main/COPYING) for the full text.
|
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.routeros/blob/stable-2/COPYING) for the full text.
|
||||||
|
|
||||||
Parts of the collection are licensed under the [BSD 2-Clause license](https://github.com/ansible-collections/community.routeros/blob/main/LICENSES/BSD-2-Clause.txt).
|
Parts of the collection are licensed under the [BSD 2-Clause license](https://github.com/ansible-collections/community.routeros/blob/stable-2/LICENSES/BSD-2-Clause.txt).
|
||||||
|
|
||||||
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `.reuse/dep5`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `.reuse/dep5`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
||||||
|
|
|
@ -795,3 +795,18 @@ releases:
|
||||||
- 322-add-l2tp-client-interface-configuration.yml
|
- 322-add-l2tp-client-interface-configuration.yml
|
||||||
- 323-add-ros-7.16-parameters.yml
|
- 323-add-ros-7.16-parameters.yml
|
||||||
release_date: '2024-10-17'
|
release_date: '2024-10-17'
|
||||||
|
2.20.1:
|
||||||
|
changes:
|
||||||
|
release_summary: 'This is the final community.routeros 2.x.y release.
|
||||||
|
|
||||||
|
|
||||||
|
Please upgrade to community.routeros 3.x.y as soon as possible to receive
|
||||||
|
further bugfixes.
|
||||||
|
|
||||||
|
|
||||||
|
Thanks to everyone who contributed to community.routeros 2.x.y releases!
|
||||||
|
|
||||||
|
'
|
||||||
|
fragments:
|
||||||
|
- 2.20.1.yml
|
||||||
|
release_date: '2025-04-19'
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace: community
|
namespace: community
|
||||||
name: routeros
|
name: routeros
|
||||||
version: 2.20.0
|
version: 2.20.1
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Egor Zaitsev (github.com/heuels)
|
- Egor Zaitsev (github.com/heuels)
|
||||||
|
|
|
@ -5142,7 +5142,7 @@ PATHS = {
|
||||||
'protocol': KeyInfo(default='all'),
|
'protocol': KeyInfo(default='all'),
|
||||||
'src-address': KeyInfo(),
|
'src-address': KeyInfo(),
|
||||||
'src-port': KeyInfo(default='any'),
|
'src-port': KeyInfo(default='any'),
|
||||||
# The template field can't really be changed once the item is
|
# The template field ca not really be changed once the item is
|
||||||
# created. This config captures the behavior best as it can
|
# created. This config captures the behavior best as it can
|
||||||
# i.e. template=yes is shown, template=no is hidden.
|
# i.e. template=yes is shown, template=no is hidden.
|
||||||
'template': KeyInfo(can_disable=True, remove_value=False),
|
'template': KeyInfo(can_disable=True, remove_value=False),
|
||||||
|
|
|
@ -77,7 +77,7 @@ def _ros_api_connect(module, username, password, host, port, use_tls, force_no_c
|
||||||
elif not validate_cert_hostname:
|
elif not validate_cert_hostname:
|
||||||
ctx.check_hostname = False
|
ctx.check_hostname = False
|
||||||
else:
|
else:
|
||||||
# Since librouteros doesn't pass server_hostname,
|
# Since librouteros does not pass server_hostname,
|
||||||
# we have to do this ourselves:
|
# we have to do this ourselves:
|
||||||
def wrap_context(*args, **kwargs):
|
def wrap_context(*args, **kwargs):
|
||||||
kwargs.pop('server_hostname', None)
|
kwargs.pop('server_hostname', None)
|
||||||
|
|
|
@ -65,7 +65,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
query:
|
query:
|
||||||
description:
|
description:
|
||||||
- Query given path for selected query attributes from RouterOS aip.
|
- Query given path for selected query attributes from RouterOS API.
|
||||||
- WHERE is key word which extend query. WHERE format is key operator value - with spaces.
|
- WHERE is key word which extend query. WHERE format is key operator value - with spaces.
|
||||||
- WHERE valid operators are V(==) or V(eq), V(!=) or V(not), V(>) or V(more), V(<) or V(less).
|
- WHERE valid operators are V(==) or V(eq), V(!=) or V(not), V(>) or V(more), V(<) or V(less).
|
||||||
- Example path V(ip address) and query V(.id address) will return only C(.id) and C(address) for all items in V(ip address) path.
|
- Example path V(ip address) and query V(.id address) will return only C(.id) and C(address) for all items in V(ip address) path.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- >-
|
- >-
|
||||||
result.msg == "Unexpected end of string during escaped parameter"
|
"Unexpected end of string during escaped parameter" in result.msg
|
||||||
|
|
||||||
- name: "Test quote_argument filter"
|
- name: "Test quote_argument filter"
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
update-docs.py shebang
|
update-docs.py shebang
|
||||||
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
update-docs.py shebang
|
update-docs.py shebang
|
||||||
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
update-docs.py shebang
|
update-docs.py shebang
|
||||||
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
#
|
|
||||||
# Compat for python2.7
|
|
||||||
#
|
|
||||||
|
|
||||||
# One unittest needs to import builtins via __import__() so we need to have
|
|
||||||
# the string that represents it
|
|
||||||
try:
|
|
||||||
import __builtin__ # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
BUILTINS = 'builtins'
|
|
||||||
else:
|
|
||||||
BUILTINS = '__builtin__'
|
|
|
@ -1,109 +0,0 @@
|
||||||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
'''
|
|
||||||
Compat module for Python3.x's unittest.mock module
|
|
||||||
'''
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Python 2.7
|
|
||||||
|
|
||||||
# Note: Could use the pypi mock library on python3.x as well as python2.x. It
|
|
||||||
# is the same as the python3 stdlib mock library
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Allow wildcard import because we really do want to import all of mock's
|
|
||||||
# symbols into this compat shim
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
from unittest.mock import * # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
# Python 2
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
try:
|
|
||||||
from mock import * # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
print('You need the mock library installed on python2.x to run tests')
|
|
||||||
|
|
||||||
|
|
||||||
# Prior to 3.4.4, mock_open cannot handle binary read_data
|
|
||||||
if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
|
|
||||||
file_spec = None
|
|
||||||
|
|
||||||
def _iterate_read_data(read_data):
|
|
||||||
# Helper for mock_open:
|
|
||||||
# Retrieve lines from read_data via a generator so that separate calls to
|
|
||||||
# readline, read, and readlines are properly interleaved
|
|
||||||
sep = b'\n' if isinstance(read_data, bytes) else '\n'
|
|
||||||
data_as_list = [l + sep for l in read_data.split(sep)]
|
|
||||||
|
|
||||||
if data_as_list[-1] == sep:
|
|
||||||
# If the last line ended in a newline, the list comprehension will have an
|
|
||||||
# extra entry that's just a newline. Remove this.
|
|
||||||
data_as_list = data_as_list[:-1]
|
|
||||||
else:
|
|
||||||
# If there wasn't an extra newline by itself, then the file being
|
|
||||||
# emulated doesn't have a newline to end the last line remove the
|
|
||||||
# newline that our naive format() added
|
|
||||||
data_as_list[-1] = data_as_list[-1][:-1]
|
|
||||||
|
|
||||||
for line in data_as_list:
|
|
||||||
yield line
|
|
||||||
|
|
||||||
def mock_open(mock=None, read_data=''):
|
|
||||||
"""
|
|
||||||
A helper function to create a mock to replace the use of `open`. It works
|
|
||||||
for `open` called directly or used as a context manager.
|
|
||||||
|
|
||||||
The `mock` argument is the mock object to configure. If `None` (the
|
|
||||||
default) then a `MagicMock` will be created for you, with the API limited
|
|
||||||
to methods or attributes available on standard file handles.
|
|
||||||
|
|
||||||
`read_data` is a string for the `read` methoddline`, and `readlines` of the
|
|
||||||
file handle to return. This is an empty string by default.
|
|
||||||
"""
|
|
||||||
def _readlines_side_effect(*args, **kwargs):
|
|
||||||
if handle.readlines.return_value is not None:
|
|
||||||
return handle.readlines.return_value
|
|
||||||
return list(_data)
|
|
||||||
|
|
||||||
def _read_side_effect(*args, **kwargs):
|
|
||||||
if handle.read.return_value is not None:
|
|
||||||
return handle.read.return_value
|
|
||||||
return type(read_data)().join(_data)
|
|
||||||
|
|
||||||
def _readline_side_effect():
|
|
||||||
if handle.readline.return_value is not None:
|
|
||||||
while True:
|
|
||||||
yield handle.readline.return_value
|
|
||||||
for line in _data:
|
|
||||||
yield line
|
|
||||||
|
|
||||||
global file_spec
|
|
||||||
if file_spec is None:
|
|
||||||
import _io
|
|
||||||
file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
|
|
||||||
|
|
||||||
if mock is None:
|
|
||||||
mock = MagicMock(name='open', spec=open)
|
|
||||||
|
|
||||||
handle = MagicMock(spec=file_spec)
|
|
||||||
handle.__enter__.return_value = handle
|
|
||||||
|
|
||||||
_data = _iterate_read_data(read_data)
|
|
||||||
|
|
||||||
handle.write.return_value = None
|
|
||||||
handle.read.return_value = None
|
|
||||||
handle.readline.return_value = None
|
|
||||||
handle.readlines.return_value = None
|
|
||||||
|
|
||||||
handle.read.side_effect = _read_side_effect
|
|
||||||
handle.readline.side_effect = _readline_side_effect()
|
|
||||||
handle.readlines.side_effect = _readlines_side_effect
|
|
||||||
|
|
||||||
mock.return_value = handle
|
|
||||||
return mock
|
|
|
@ -1,25 +0,0 @@
|
||||||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
'''
|
|
||||||
Compat module for Python2.7's unittest module
|
|
||||||
'''
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Allow wildcard import because we really do want to import all of
|
|
||||||
# unittests's symbols into this compat shim
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
if sys.version_info < (2, 7):
|
|
||||||
try:
|
|
||||||
# Need unittest2 on python2.6
|
|
||||||
from unittest2 import * # noqa: F401, pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
print('You need unittest2 installed on python2.6.x to run tests')
|
|
||||||
else:
|
|
||||||
from unittest import * # noqa: F401, pylint: disable=unused-import
|
|
|
@ -9,7 +9,7 @@ __metaclass__ = type
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
|
|
||||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch, MagicMock
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch, MagicMock
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import FakeLibRouterosError, Key, Or, fake_ros_api
|
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import FakeLibRouterosError, Key, Or, fake_ros_api
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import api
|
from ansible_collections.community.routeros.plugins.modules import api
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_module_fail_when_required_args_missing(self):
|
def test_module_fail_when_required_args_missing(self):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
set_module_args({})
|
with set_module_args({}):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -43,7 +44,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
@patch('ansible_collections.community.routeros.plugins.modules.api.ROS_api_module.api_add_path', new=fake_ros_api.path)
|
@patch('ansible_collections.community.routeros.plugins.modules.api.ROS_api_module.api_add_path', new=fake_ros_api.path)
|
||||||
def test_api_path(self):
|
def test_api_path(self):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
set_module_args(self.config_module_args.copy())
|
with set_module_args(self.config_module_args.copy()):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -54,7 +55,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['add'] = "name=unit_test_brige"
|
module_args['add'] = "name=unit_test_brige"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -65,7 +66,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['add'] = "name=unit_test_brige_exist"
|
module_args['add'] = "name=unit_test_brige_exist"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -77,7 +78,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['remove'] = "*A1"
|
module_args['remove'] = "*A1"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -88,7 +89,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['remove'] = "*A2"
|
module_args['remove'] = "*A2"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -100,7 +101,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['cmd'] = "add name=unit_test_brige_arbitrary"
|
module_args['cmd'] = "add name=unit_test_brige_arbitrary"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -111,7 +112,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['cmd'] = "add NONE_EXIST=unit_test_brige_arbitrary"
|
module_args['cmd'] = "add NONE_EXIST=unit_test_brige_arbitrary"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -123,7 +124,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['update'] = ".id=*A1 name=unit_test_brige"
|
module_args['update'] = ".id=*A1 name=unit_test_brige"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -134,7 +135,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['update'] = ".id=*A2 name=unit_test_brige"
|
module_args['update'] = ".id=*A2 name=unit_test_brige"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -146,7 +147,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['query'] = ".id name"
|
module_args['query'] = ".id name"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -162,7 +163,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['query'] = ".id other"
|
module_args['query'] = ".id other"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -174,7 +175,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['query'] = ".id name WHERE name == dummy_bridge_A2"
|
module_args['query'] = ".id name WHERE name == dummy_bridge_A2"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -188,7 +189,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['query'] = ".id name WHERE name != dummy_bridge_A2"
|
module_args['query'] = ".id name WHERE name != dummy_bridge_A2"
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -204,7 +205,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
module_args['extended_query'] = {
|
module_args['extended_query'] = {
|
||||||
'attributes': ['.id', 'name'],
|
'attributes': ['.id', 'name'],
|
||||||
}
|
}
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -222,7 +223,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
module_args['extended_query'] = {
|
module_args['extended_query'] = {
|
||||||
'attributes': ['.id', 'other'],
|
'attributes': ['.id', 'other'],
|
||||||
}
|
}
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -243,7 +244,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -266,7 +267,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -298,7 +299,7 @@ class TestRouterosApiModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch, MagicMock
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch, MagicMock
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import FakeLibRouterosError, Key, fake_ros_api
|
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import FakeLibRouterosError, Key, fake_ros_api
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import api_facts
|
from ansible_collections.community.routeros.plugins.modules import api_facts
|
||||||
|
|
||||||
|
|
||||||
|
@ -437,7 +438,7 @@ class TestRouterosApiFactsModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_module_fail_when_required_args_missing(self):
|
def test_module_fail_when_required_args_missing(self):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
set_module_args({})
|
with set_module_args({}):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -447,7 +448,7 @@ class TestRouterosApiFactsModule(ModuleTestCase):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
module_args = self.config_module_args.copy()
|
module_args = self.config_module_args.copy()
|
||||||
module_args['gather_subset'] = ['!foobar']
|
module_args['gather_subset'] = ['!foobar']
|
||||||
set_module_args(module_args)
|
with set_module_args(module_args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -456,7 +457,7 @@ class TestRouterosApiFactsModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_full_run(self):
|
def test_full_run(self):
|
||||||
with self.assertRaises(AnsibleExitJson) as exc:
|
with self.assertRaises(AnsibleExitJson) as exc:
|
||||||
set_module_args(self.config_module_args.copy())
|
with set_module_args(self.config_module_args.copy()):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch, MagicMock
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch, MagicMock
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
||||||
FakeLibRouterosError, fake_ros_api, massage_expected_result_data, create_fake_path,
|
FakeLibRouterosError, fake_ros_api, massage_expected_result_data, create_fake_path,
|
||||||
)
|
)
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import api_find_and_modify
|
from ansible_collections.community.routeros.plugins.modules import api_find_and_modify
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_module_fail_when_required_args_missing(self):
|
def test_module_fail_when_required_args_missing(self):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
set_module_args({})
|
with set_module_args({}):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -136,7 +137,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'comment': 'bar',
|
'comment': 'bar',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -155,7 +156,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'comment': 'bar',
|
'comment': 'bar',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -173,7 +174,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'!comment': None,
|
'!comment': None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -190,7 +191,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'!comment': 'gone',
|
'!comment': 'gone',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -212,7 +213,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
'require_matches_min': 10,
|
'require_matches_min': 10,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -234,7 +235,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
'require_matches_min': 10,
|
'require_matches_min': 10,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -256,7 +257,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
'require_matches_max': 1,
|
'require_matches_max': 1,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -277,7 +278,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'name': 'bam',
|
'name': 'bam',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -303,7 +304,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'require_matches_min': 2,
|
'require_matches_min': 2,
|
||||||
'allow_no_matches': True,
|
'allow_no_matches': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -325,7 +326,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'values': {
|
'values': {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -349,7 +350,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'comment': None,
|
'comment': None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -374,7 +375,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
'_ansible_diff': True,
|
'_ansible_diff': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -450,7 +451,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'comment': None,
|
'comment': None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -502,7 +503,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'comment': '',
|
'comment': '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -553,7 +554,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'!comment': None,
|
'!comment': None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -606,7 +607,7 @@ class TestRouterosApiFindAndModifyModule(ModuleTestCase):
|
||||||
'!connection-state': None,
|
'!connection-state': None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch, MagicMock
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch, MagicMock
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
||||||
FAKE_ROS_VERSION, FakeLibRouterosError, Key, fake_ros_api,
|
FAKE_ROS_VERSION, FakeLibRouterosError, Key, fake_ros_api,
|
||||||
)
|
)
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import api_info
|
from ansible_collections.community.routeros.plugins.modules import api_info
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_module_fail_when_required_args_missing(self):
|
def test_module_fail_when_required_args_missing(self):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
set_module_args({})
|
with set_module_args({}):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -53,7 +54,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
args.update({
|
args.update({
|
||||||
'path': 'something invalid'
|
'path': 'something invalid'
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -68,7 +69,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
args.update({
|
args.update({
|
||||||
'path': 'ip dns static'
|
'path': 'ip dns static'
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -93,7 +94,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
args.update({
|
args.update({
|
||||||
'path': 'caps-man aaa',
|
'path': 'caps-man aaa',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -122,7 +123,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'caps-man aaa',
|
'path': 'caps-man aaa',
|
||||||
'hide_defaults': False,
|
'hide_defaults': False,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -155,7 +156,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'caps-man aaa',
|
'path': 'caps-man aaa',
|
||||||
'unfiltered': True,
|
'unfiltered': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -189,7 +190,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'ip firewall filter',
|
'path': 'ip firewall filter',
|
||||||
'handle_disabled': 'exclamation',
|
'handle_disabled': 'exclamation',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -278,7 +279,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'ip firewall filter',
|
'path': 'ip firewall filter',
|
||||||
'handle_disabled': 'null-value',
|
'handle_disabled': 'null-value',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -367,7 +368,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'ip firewall filter',
|
'path': 'ip firewall filter',
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -402,7 +403,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
'include_dynamic': True,
|
'include_dynamic': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -460,7 +461,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'interface list',
|
'path': 'interface list',
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -513,7 +514,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
'include_builtin': True,
|
'include_builtin': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -605,7 +606,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'path': 'ip dhcp-server lease',
|
'path': 'ip dhcp-server lease',
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -688,7 +689,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
args.update({
|
args.update({
|
||||||
'path': 'interface gre',
|
'path': 'interface gre',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -776,7 +777,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
'hide_defaults': False,
|
'hide_defaults': False,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -847,7 +848,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'handle_disabled': 'omit',
|
'handle_disabled': 'omit',
|
||||||
'restrict': [],
|
'restrict': [],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -899,7 +900,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
'values': ['forward'],
|
'values': ['forward'],
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -970,7 +971,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch, MagicMock
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch, MagicMock
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
from ansible_collections.community.routeros.tests.unit.plugins.modules.fake_api import (
|
||||||
FAKE_ROS_VERSION, FakeLibRouterosError, fake_ros_api, massage_expected_result_data, create_fake_path,
|
FAKE_ROS_VERSION, FakeLibRouterosError, fake_ros_api, massage_expected_result_data, create_fake_path,
|
||||||
)
|
)
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import api_modify
|
from ansible_collections.community.routeros.plugins.modules import api_modify
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,7 +319,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
|
|
||||||
def test_module_fail_when_required_args_missing(self):
|
def test_module_fail_when_required_args_missing(self):
|
||||||
with self.assertRaises(AnsibleFailJson) as exc:
|
with self.assertRaises(AnsibleFailJson) as exc:
|
||||||
set_module_args({})
|
with set_module_args({}):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -331,7 +332,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'path': 'something invalid',
|
'path': 'something invalid',
|
||||||
'data': [],
|
'data': [],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -348,7 +349,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'foo': 'bar',
|
'foo': 'bar',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -366,7 +367,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'!comment': None,
|
'!comment': None,
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -383,7 +384,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'!disabled': None,
|
'!disabled': None,
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -400,7 +401,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'!comment': 'foo',
|
'!comment': 'foo',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -416,7 +417,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'name': None,
|
'name': None,
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -432,7 +433,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'interface': 'eth0',
|
'interface': 'eth0',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -448,7 +449,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'address': '192.168.88.1',
|
'address': '192.168.88.1',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -466,7 +467,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'address': '192.168.88.1',
|
'address': '192.168.88.1',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -498,7 +499,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -533,7 +534,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -556,7 +557,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -591,7 +592,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -656,7 +657,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -722,7 +723,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
],
|
],
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -785,7 +786,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -844,7 +845,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -903,7 +904,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -963,7 +964,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1017,7 +1018,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1077,7 +1078,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1128,7 +1129,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1164,7 +1165,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1212,7 +1213,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1285,7 +1286,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1340,7 +1341,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1363,7 +1364,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
],
|
],
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1386,7 +1387,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1426,7 +1427,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
],
|
],
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1466,7 +1467,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
],
|
],
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1507,7 +1508,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1551,7 +1552,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1587,7 +1588,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1621,7 +1622,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1676,7 +1677,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1729,7 +1730,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1785,7 +1786,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
'_ansible_check_mode': True,
|
'_ansible_check_mode': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1847,7 +1848,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1879,7 +1880,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1911,7 +1912,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_entries_content': 'remove',
|
'handle_entries_content': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -1969,7 +1970,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
@ -2005,7 +2006,7 @@ class TestRouterosApiModifyModule(ModuleTestCase):
|
||||||
'handle_absent_entries': 'remove',
|
'handle_absent_entries': 'remove',
|
||||||
'ensure_order': True,
|
'ensure_order': True,
|
||||||
})
|
})
|
||||||
set_module_args(args)
|
with set_module_args(args):
|
||||||
self.module.main()
|
self.module.main()
|
||||||
|
|
||||||
result = exc.exception.args[0]
|
result = exc.exception.args[0]
|
||||||
|
|
|
@ -8,9 +8,10 @@ __metaclass__ = type
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args
|
||||||
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import command
|
from ansible_collections.community.routeros.plugins.modules import command
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args
|
|
||||||
from .routeros_module import TestRouterosModule, load_fixture
|
from .routeros_module import TestRouterosModule, load_fixture
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,54 +48,54 @@ class TestRouterosCommandModule(TestRouterosModule):
|
||||||
self.run_commands.side_effect = load_from_file
|
self.run_commands.side_effect = load_from_file
|
||||||
|
|
||||||
def test_command_simple(self):
|
def test_command_simple(self):
|
||||||
set_module_args(dict(commands=['/system resource print']))
|
with set_module_args(dict(commands=['/system resource print'])):
|
||||||
result = self.execute_module(changed=True)
|
result = self.execute_module(changed=True)
|
||||||
self.assertEqual(len(result['stdout']), 1)
|
self.assertEqual(len(result['stdout']), 1)
|
||||||
self.assertTrue('platform: "MikroTik"' in result['stdout'][0])
|
self.assertTrue('platform: "MikroTik"' in result['stdout'][0])
|
||||||
|
|
||||||
def test_command_multiple(self):
|
def test_command_multiple(self):
|
||||||
set_module_args(dict(commands=['/system resource print', '/system resource print']))
|
with set_module_args(dict(commands=['/system resource print', '/system resource print'])):
|
||||||
result = self.execute_module(changed=True)
|
result = self.execute_module(changed=True)
|
||||||
self.assertEqual(len(result['stdout']), 2)
|
self.assertEqual(len(result['stdout']), 2)
|
||||||
self.assertTrue('platform: "MikroTik"' in result['stdout'][0])
|
self.assertTrue('platform: "MikroTik"' in result['stdout'][0])
|
||||||
|
|
||||||
def test_command_wait_for(self):
|
def test_command_wait_for(self):
|
||||||
wait_for = 'result[0] contains "MikroTik"'
|
wait_for = 'result[0] contains "MikroTik"'
|
||||||
set_module_args(dict(commands=['/system resource print'], wait_for=wait_for))
|
with set_module_args(dict(commands=['/system resource print'], wait_for=wait_for)):
|
||||||
self.execute_module(changed=True)
|
self.execute_module(changed=True)
|
||||||
|
|
||||||
def test_command_wait_for_fails(self):
|
def test_command_wait_for_fails(self):
|
||||||
wait_for = 'result[0] contains "test string"'
|
wait_for = 'result[0] contains "test string"'
|
||||||
set_module_args(dict(commands=['/system resource print'], wait_for=wait_for))
|
with set_module_args(dict(commands=['/system resource print'], wait_for=wait_for)):
|
||||||
self.execute_module(failed=True)
|
self.execute_module(failed=True)
|
||||||
self.assertEqual(self.run_commands.call_count, 10)
|
self.assertEqual(self.run_commands.call_count, 10)
|
||||||
|
|
||||||
def test_command_retries(self):
|
def test_command_retries(self):
|
||||||
wait_for = 'result[0] contains "test string"'
|
wait_for = 'result[0] contains "test string"'
|
||||||
set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, retries=2))
|
with set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, retries=2)):
|
||||||
self.execute_module(failed=True)
|
self.execute_module(failed=True)
|
||||||
self.assertEqual(self.run_commands.call_count, 2)
|
self.assertEqual(self.run_commands.call_count, 2)
|
||||||
|
|
||||||
def test_command_match_any(self):
|
def test_command_match_any(self):
|
||||||
wait_for = ['result[0] contains "MikroTik"',
|
wait_for = ['result[0] contains "MikroTik"',
|
||||||
'result[0] contains "test string"']
|
'result[0] contains "test string"']
|
||||||
set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, match='any'))
|
with set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, match='any')):
|
||||||
self.execute_module(changed=True)
|
self.execute_module(changed=True)
|
||||||
|
|
||||||
def test_command_match_all(self):
|
def test_command_match_all(self):
|
||||||
wait_for = ['result[0] contains "MikroTik"',
|
wait_for = ['result[0] contains "MikroTik"',
|
||||||
'result[0] contains "RB1100"']
|
'result[0] contains "RB1100"']
|
||||||
set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, match='all'))
|
with set_module_args(dict(commands=['/system resource print'], wait_for=wait_for, match='all')):
|
||||||
self.execute_module(changed=True)
|
self.execute_module(changed=True)
|
||||||
|
|
||||||
def test_command_match_all_failure(self):
|
def test_command_match_all_failure(self):
|
||||||
wait_for = ['result[0] contains "MikroTik"',
|
wait_for = ['result[0] contains "MikroTik"',
|
||||||
'result[0] contains "test string"']
|
'result[0] contains "test string"']
|
||||||
commands = ['/system resource print', '/system resource print']
|
commands = ['/system resource print', '/system resource print']
|
||||||
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
|
with set_module_args(dict(commands=commands, wait_for=wait_for, match='all')):
|
||||||
self.execute_module(failed=True)
|
self.execute_module(failed=True)
|
||||||
|
|
||||||
def test_command_wait_for_2(self):
|
def test_command_wait_for_2(self):
|
||||||
wait_for = 'result[0] contains "wireless"'
|
wait_for = 'result[0] contains "wireless"'
|
||||||
set_module_args(dict(commands=['/system package print'], wait_for=wait_for))
|
with set_module_args(dict(commands=['/system package print'], wait_for=wait_for)):
|
||||||
self.execute_module(changed=True)
|
self.execute_module(changed=True)
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch
|
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import patch
|
||||||
|
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args
|
||||||
|
|
||||||
from ansible_collections.community.routeros.plugins.modules import facts
|
from ansible_collections.community.routeros.plugins.modules import facts
|
||||||
from ansible_collections.community.routeros.tests.unit.plugins.modules.utils import set_module_args
|
|
||||||
from .routeros_module import TestRouterosModule, load_fixture
|
from .routeros_module import TestRouterosModule, load_fixture
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ class TestRouterosFactsModule(TestRouterosModule):
|
||||||
self.run_commands.side_effect = load_from_file
|
self.run_commands.side_effect = load_from_file
|
||||||
|
|
||||||
def test_facts_default(self):
|
def test_facts_default(self):
|
||||||
set_module_args(dict(gather_subset='default'))
|
with set_module_args(dict(gather_subset='default')):
|
||||||
result = self.execute_module()
|
result = self.execute_module()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result['ansible_facts']['ansible_net_hostname'], 'MikroTik'
|
result['ansible_facts']['ansible_net_hostname'], 'MikroTik'
|
||||||
|
@ -61,7 +62,7 @@ class TestRouterosFactsModule(TestRouterosModule):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_facts_hardware(self):
|
def test_facts_hardware(self):
|
||||||
set_module_args(dict(gather_subset='hardware'))
|
with set_module_args(dict(gather_subset='hardware')):
|
||||||
result = self.execute_module()
|
result = self.execute_module()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result['ansible_facts']['ansible_net_spacefree_mb'], 64921.6
|
result['ansible_facts']['ansible_net_spacefree_mb'], 64921.6
|
||||||
|
@ -77,7 +78,7 @@ class TestRouterosFactsModule(TestRouterosModule):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_facts_config(self):
|
def test_facts_config(self):
|
||||||
set_module_args(dict(gather_subset='config'))
|
with set_module_args(dict(gather_subset='config')):
|
||||||
result = self.execute_module()
|
result = self.execute_module()
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
result['ansible_facts']['ansible_net_config'], str
|
result['ansible_facts']['ansible_net_config'], str
|
||||||
|
@ -88,7 +89,7 @@ class TestRouterosFactsModule(TestRouterosModule):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_facts_interfaces(self):
|
def test_facts_interfaces(self):
|
||||||
set_module_args(dict(gather_subset='interfaces'))
|
with set_module_args(dict(gather_subset='interfaces')):
|
||||||
result = self.execute_module()
|
result = self.execute_module()
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
result['ansible_facts']['ansible_net_all_ipv4_addresses'][0], ['10.37.129.3', '10.37.0.0', '192.168.88.1']
|
result['ansible_facts']['ansible_net_all_ipv4_addresses'][0], ['10.37.129.3', '10.37.0.0', '192.168.88.1']
|
||||||
|
@ -118,7 +119,7 @@ class TestRouterosFactsModule(TestRouterosModule):
|
||||||
self.assertEqual(result, None)
|
self.assertEqual(result, None)
|
||||||
|
|
||||||
def test_facts_routing(self):
|
def test_facts_routing(self):
|
||||||
set_module_args(dict(gather_subset='routing'))
|
with set_module_args(dict(gather_subset='routing')):
|
||||||
result = self.execute_module()
|
result = self.execute_module()
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
result['ansible_facts']['ansible_net_bgp_peer']['iBGP_BRAS.TYRMA']['name'], ['iBGP_BRAS.TYRMA']
|
result['ansible_facts']['ansible_net_bgp_peer']['iBGP_BRAS.TYRMA']['name'], ['iBGP_BRAS.TYRMA']
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat import unittest
|
|
||||||
from ansible_collections.community.routeros.tests.unit.compat.mock import patch
|
|
||||||
from ansible.module_utils import basic
|
|
||||||
from ansible.module_utils.common.text.converters import to_bytes
|
|
||||||
|
|
||||||
|
|
||||||
def set_module_args(args):
|
|
||||||
if '_ansible_remote_tmp' not in args:
|
|
||||||
args['_ansible_remote_tmp'] = '/tmp'
|
|
||||||
if '_ansible_keep_remote_files' not in args:
|
|
||||||
args['_ansible_keep_remote_files'] = False
|
|
||||||
|
|
||||||
args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
|
|
||||||
basic._ANSIBLE_ARGS = to_bytes(args)
|
|
||||||
|
|
||||||
|
|
||||||
class AnsibleExitJson(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class AnsibleFailJson(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def exit_json(*args, **kwargs):
|
|
||||||
if 'changed' not in kwargs:
|
|
||||||
kwargs['changed'] = False
|
|
||||||
raise AnsibleExitJson(kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def fail_json(*args, **kwargs):
|
|
||||||
kwargs['failed'] = True
|
|
||||||
raise AnsibleFailJson(kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleTestCase(unittest.TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.mock_module = patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
|
||||||
self.mock_module.start()
|
|
||||||
self.mock_sleep = patch('time.sleep')
|
|
||||||
self.mock_sleep.start()
|
|
||||||
set_module_args({})
|
|
||||||
self.addCleanup(self.mock_module.stop)
|
|
||||||
self.addCleanup(self.mock_sleep.stop)
|
|
Loading…
Add table
Add a link
Reference in a new issue