Skip to content

Commit

Permalink
[ignore] modify conditions for loopback interface profile in aci_l3ou…
Browse files Browse the repository at this point in the history
…t_logical_node.
  • Loading branch information
gmicol committed Sep 13, 2023
1 parent f460ecc commit 4c75301
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
18 changes: 11 additions & 7 deletions plugins/modules/aci_l3out_logical_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
default: 'yes'
loopback_address:
description:
- loopback IP of the loopback interface profile.
- Loopback IP.
- to delete the existing loopback IP, pass an empty string.
state:
description:
- Use C(present) or C(absent) for adding or removing.
Expand Down Expand Up @@ -246,7 +247,7 @@ def main():
node_id=dict(type="int"),
router_id=dict(type="str"),
router_id_as_loopback=dict(type="str", default="yes", choices=["yes", "no"]),
loopback_address = dict(type="str"),
loopback_address=dict(type="str"),
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
)

Expand Down Expand Up @@ -275,12 +276,15 @@ def main():

aci = ACIModule(module)

child_classes = ["l3extLoopBackIfP"]

child_configs = []

if loopback_address is not None:
child_classes = ["l3extLoopBackIfP"]
child_configs = [dict(l3extLoopBackIfP=dict(attributes=dict(name="", descr="", addr=loopback_address)))]
else:
child_classes = []
child_configs = []
if loopback_address == "":
child_configs.extend([dict(l3extLoopBackIfP=dict(attributes=dict(addr="", status="deleted")))])
else:
child_configs.extend([dict(l3extLoopBackIfP=dict(attributes=dict(addr=loopback_address)))])

aci.construct_url(
root_class=dict(
Expand Down
14 changes: 11 additions & 3 deletions tests/integration/targets/aci_l3out_logical_node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
loopback_address: 11.11.11.12
register: add_loopback_ip

- name: Remove loopback address
aci_l3out_logical_node: &node_remove_loopback
<<: *node_add_loopback
loopback_address: ''
register: remove_loopback_ip

- name: Verify update_node
assert:
that:
Expand All @@ -120,7 +126,9 @@
- update_node.sent.l3extRsNodeL3OutAtt.attributes.rtrId == '11.11.11.11'
- add_loopback_ip is changed
- add_loopback_ip.previous != []
- add_loopback_ip.current.0.l3extRsNodeL3OutAtt.children.0.l3extLoopBackIfP.attributes.addr == "11.11.11.12"
- add_loopback_ip.current.0.l3extRsNodeL3OutAtt.children.0.l3extLoopBackIfP.attributes.addr == '11.11.11.12'
- remove_loopback_ip is changed
- remove_loopback_ip.previous != []

# ADD ANOTHER NODE
- name: Add another node
Expand All @@ -145,7 +153,7 @@
# QUERY A SPECIFIC NODE
- name: Query a specific node
aci_l3out_logical_node:
<<: *node_add_loopback
<<: *node_remove_loopback
state: query
register: query_spec_node

Expand All @@ -158,7 +166,7 @@
# REMOVE NODE
- name: Remove node
aci_l3out_logical_node:
<<: *node_add_loopback
<<: *node_remove_loopback
state: absent
register: remove_node

Expand Down

0 comments on commit 4c75301

Please sign in to comment.