Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
898c364
[minor_change] add aci_vrf_leak_internal_subnet module
abrahammughal Jun 8, 2023
1962f6b
added child configs
abrahammughal Jun 13, 2023
dc74611
Added leakInternalSubnet module
abrahammughal Jun 19, 2023
b17f5ac
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
87aa99c
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
6685f42
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
0eb7890
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
b2bf0e5
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
643f285
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
786bc99
Fixed documentation for leak_internal_subnet
abrahammughal Jun 19, 2023
be473e5
Added tests
abrahammughal Jun 22, 2023
bdae6a4
[ignore] fix creation when parent leakRoute object doesn't work in ac…
abrahammughal Jun 23, 2023
a560eec
[ignore] made formatting consistent for leak_internal_subnet
abrahammughal Jun 23, 2023
0ab893a
[ignore] Fixed trailing whitespace for leak_internal_subnet
abrahammughal Jun 26, 2023
e94d153
[ignore] added tests for leak_internal_subnet
abrahammughal Jun 26, 2023
dd256f9
[ignore] small fix for leak_internal_subnet
abrahammughal Jun 27, 2023
1de3d75
[ignore] fixed documentation and query test for leak_internal_subnet
abrahammughal Jun 29, 2023
ebde3ae
[ignore] added test asserts for leak_internal_subnet
abrahammughal Jun 30, 2023
be1d841
[ignore] formatting for leak_internal_subnet
abrahammughal Jun 30, 2023
37658ce
[ignore] added documentation for leak internal subnet
abrahammughal Jul 5, 2023
012b2c1
[ignore] fixed trailing whitespace for leak internal subnet
abrahammughal Jul 5, 2023
bace790
[ignore] added documentation for leak_internal_subnet
abrahammughal Jul 5, 2023
37fe7c2
[ignore] fixed documentation for leak_internal_subnet
abrahammughal Jul 5, 2023
8047b6e
[ignore] fixed documentation for leak internal subnet
abrahammughal Jul 7, 2023
687b5f0
[ignore] fixed documentation for leak internal subnet
abrahammughal Jul 7, 2023
5afb821
[ignore] fixed documentation for leak internal subnet
abrahammughal Jul 7, 2023
a8d5059
[ignore] fixed documentation for leak internal subnet
abrahammughal Jul 7, 2023
d011f40
[ignore] fixed tests for leak internal subnet
abrahammughal Jul 8, 2023
caa1511
[ignore] fixed documentation for leak internal subnet
abrahammughal Jul 13, 2023
3b44897
[ignore] added test for leak internal subnet
abrahammughal Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions plugins/module_utils/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def __init__(self, module):
self.obj_filter = None
self.method = None
self.path = None
self.parent_path = None
self.response = None
self.status = None
self.url = None
Expand Down Expand Up @@ -921,6 +922,7 @@ def _construct_url_1(self, obj, config_only=True):
if self.module.params.get("state") in ("absent", "present"):
# State is absent or present
self.path = "api/mo/uni/{0}.json".format(obj_rn)
self.parent_path = "api/mo/uni.json"
if config_only:
self.update_qs({"rsp-prop-include": "config-only"})
self.obj_filter = obj_filter
Expand All @@ -947,6 +949,7 @@ def _construct_url_2(self, parent, obj, config_only=True):
if self.module.params.get("state") in ("absent", "present"):
# State is absent or present
self.path = "api/mo/uni/{0}/{1}.json".format(parent_rn, obj_rn)
self.parent_path = "api/mo/uni/{0}.json".format(parent_rn)
if config_only:
self.update_qs({"rsp-prop-include": "config-only"})
self.obj_filter = obj_filter
Expand Down Expand Up @@ -984,6 +987,7 @@ def _construct_url_3(self, root, parent, obj, config_only=True):
if self.module.params.get("state") in ("absent", "present"):
# State is absent or present
self.path = "api/mo/uni/{0}/{1}/{2}.json".format(root_rn, parent_rn, obj_rn)
self.parent_path = "api/mo/uni/{0}/{1}.json".format(root_rn, parent_rn)
if config_only:
self.update_qs({"rsp-prop-include": "config-only"})
self.obj_filter = obj_filter
Expand Down Expand Up @@ -1053,6 +1057,7 @@ def _construct_url_4(self, root, sec, parent, obj, config_only=True):
if self.module.params.get("state") in ("absent", "present"):
# State is absent or present
self.path = "api/mo/uni/{0}/{1}/{2}/{3}.json".format(root_rn, sec_rn, parent_rn, obj_rn)
self.parent_path = "api/mo/uni/{0}/{1}/{2}.json".format(root_rn, sec_rn, parent_rn)
if config_only:
self.update_qs({"rsp-prop-include": "config-only"})
self.obj_filter = obj_filter
Expand Down Expand Up @@ -1108,6 +1113,7 @@ def _construct_url_5(self, root, ter, sec, parent, obj, config_only=True):
if self.module.params.get("state") in ("absent", "present"):
# State is absent or present
self.path = "api/mo/uni/{0}/{1}/{2}/{3}/{4}.json".format(root_rn, ter_rn, sec_rn, parent_rn, obj_rn)
self.parent_path = "api/mo/uni/{0}/{1}/{2}/{3}.json".format(root_rn, ter_rn, sec_rn, parent_rn)
if config_only:
self.update_qs({"rsp-prop-include": "config-only"})
self.obj_filter = obj_filter
Expand Down Expand Up @@ -1517,7 +1523,7 @@ def payload(self, aci_class, class_config, child_configs=None):
if children:
self.proposed[aci_class].update(dict(children=children))

def post_config(self):
def post_config(self, parent_class=None):
"""
This method is used to handle the logic when the modules state is equal to present. The method only pushes a change if
the object has differences than what exists on the APIC, and if check_mode is False. A successful change will mark the
Expand All @@ -1527,12 +1533,19 @@ def post_config(self):
return
elif not self.module.check_mode:
# Sign and encode request as to APIC's wishes
url = self.url
if parent_class is not None:
if self.params.get("port") is not None:
url = "{protocol}://{host}:{port}/{path}".format(path=self.parent_path, **self.module.params)
else:
url = "{protocol}://{host}/{path}".format(path=self.parent_path, **self.module.params)
self.config = {parent_class: {"attributes": {}, "children": [self.config]}}
if self.params.get("private_key"):
self.cert_auth(method="POST", payload=json.dumps(self.config))

resp, info = fetch_url(
self.module,
self.url,
url,
data=json.dumps(self.config),
headers=self.headers,
method="POST",
Expand Down
2 changes: 2 additions & 0 deletions plugins/module_utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
NODE_TYPE_MAPPING = {"tier_2": "tier-2-leaf", "remote": "remote-leaf-wan", "virtual": "virtual", "unspecified": "unspecified"}

SPAN_DIRECTION_MAP = {"incoming": "in", "outgoing": "out", "both": "both"}

MATCH_TYPE_MAPPING = {"all": "All", "at_least_one": "AtleastOne", "at_most_one": "AtmostOne", "none": "None"}
Loading