Skip to content

Commit

Permalink
Merge pull request #32 from CaptTrews/ansible/collections-sync-master
Browse files Browse the repository at this point in the history
Updated from network content collector

Reviewed-by: https://github.com/apps/ansible-zuul
  • Loading branch information
ansible-zuul[bot] authored Oct 4, 2019
2 parents ab4d1e9 + d1491cf commit b730792
Show file tree
Hide file tree
Showing 16 changed files with 320 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def set_state(self, want, have):
"""
commands = []
state = self._module.params["state"]
if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands = self._state_overridden(want, have)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def set_state(self, want, have):
commands = []

state = self._module.params["state"]

if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands = self._state_overridden(want, have, self._module)
elif state == "deleted":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ def set_state(self, want, have):
commands = []

state = self._module.params["state"]

if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands = self._state_overridden(want, have, self._module)
elif state == "deleted":
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/network/iosxr/config/lacp/lacp.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def set_state(self, want, have):
to the desired configuration
"""
state = self._module.params["state"]
if state in ("merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "deleted":
commands = self._state_deleted(want, have)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ def set_state(self, want, have):
commands = []
state = self._module.params["state"]

if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands.extend(Lacp_interfaces._state_overridden(want, have))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def set_state(self, want, have):
state = self._module.params["state"]
commands = []

if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands.extend(self._state_overridden(want, have))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def set_state(self, want, have):
to the desired configuration
"""
state = self._module.params["state"]
if state in ("merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "deleted":
commands = self._state_deleted(want, have)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def set_state(self, want, have):
"""
state = self._module.params["state"]
commands = []
if state in ("overridden", "merged", "replaced") and not want:
self._module.fail_json(
msg="value of config parameter must not be empty for state {0}".format(
state
)
)

if state == "overridden":
commands.extend(self._state_overridden(want, have))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_l2_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_l2_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_l2_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_l2_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_l3_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_l3_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_l3_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'
25 changes: 25 additions & 0 deletions tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- debug:
msg: "START iosxr_lacp empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_lacp:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_lacp:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_lacp_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_lacp_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_lacp_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_lacp_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_lag_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_lag_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_lag_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- debug:
msg: "START iosxr_lldp_global empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_lldp_global:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_lldp_global:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- debug:
msg: "START iosxr_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }}"

- name: Merged with empty config should give appropriate error message
cisco.iosxr.iosxr_lldp_interfaces:
config:
state: merged
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state merged'

- name: Replaced with empty config should give appropriate error message
cisco.iosxr.iosxr_lldp_interfaces:
config:
state: replaced
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'

- name: Overridden with empty config should give appropriate error message
cisco.iosxr.iosxr_lldp_interfaces:
config:
state: overridden
register: result
ignore_errors: True

- assert:
that:
- result.msg == 'value of config parameter must not be empty for state overridden'

0 comments on commit b730792

Please sign in to comment.