Skip to content

Commit e85a9be

Browse files
Changes to support dynamic selection of rest modules
1 parent 1d7c0a0 commit e85a9be

31 files changed

+297
-53
lines changed

plugins/action/dtc/fabric_check_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run(self, tmp=None, task_vars=None):
4141
fabric = self._task.args["fabric"]
4242

4343
ndfc_response = self._execute_module(
44-
module_name="cisco.nd.nd_rest",
44+
module_name=task_vars['ansible_network_os_rest'],
4545
module_args={
4646
"method": "GET",
4747
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{fabric}/inventory/switchesByFabric",

plugins/action/dtc/fabrics_config_save.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run(self, tmp=None, task_vars=None):
4343
for fabric in fabrics:
4444
display.display(f"Executing config-save on Fabric: {fabric}")
4545
ndfc_config_save = self._execute_module(
46-
module_name="cisco.nd.nd_rest",
46+
module_name=task_vars['ansible_network_os_rest'],
4747
module_args={
4848
"method": "POST",
4949
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{fabric}/config-save",

plugins/action/dtc/fabrics_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run(self, tmp=None, task_vars=None):
4343
for fabric in fabrics:
4444
display.display(f"Executing config-deploy on Fabric: {fabric}")
4545
ndfc_deploy = self._execute_module(
46-
module_name="cisco.nd.nd_rest",
46+
module_name=task_vars['ansible_network_os_rest'],
4747
module_args={
4848
"method": "POST",
4949
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{fabric}/config-deploy?forceShowRun=false",

plugins/action/dtc/get_poap_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def refresh(self) -> None:
149149
self.refresh_message = None
150150

151151
data = self.execute_module(
152-
module_name="cisco.nd.nd_rest",
152+
module_name=task_vars['ansible_network_os_rest'],
153153
module_args={
154154
"method": self.poap_get_method,
155155
"path": self.poap_get_path

plugins/action/dtc/manage_child_fabric_networks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def run(self, tmp=None, task_vars=None):
130130
# return results
131131

132132
ndfc_net = self._execute_module(
133-
module_name="cisco.nd.nd_rest",
133+
module_name=task_vars['ansible_network_os_rest'],
134134
module_args={
135135
"method": "GET",
136136
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/networks/{network['name']}",
@@ -184,7 +184,7 @@ def run(self, tmp=None, task_vars=None):
184184
rendered_to_nice_json = templar.environment.filters['to_nice_json'](rendered_content)
185185

186186
ndfc_net_update = self._execute_module(
187-
module_name="cisco.nd.nd_rest",
187+
module_name=task_vars['ansible_network_os_rest'],
188188
module_args={
189189
"method": "PUT",
190190
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/networks/{network['name']}",

plugins/action/dtc/manage_child_fabric_vrfs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def run(self, tmp=None, task_vars=None):
130130
# return results
131131

132132
ndfc_vrf = self._execute_module(
133-
module_name="cisco.nd.nd_rest",
133+
module_name=task_vars['ansible_network_os_rest'],
134134
module_args={
135135
"method": "GET",
136136
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/vrfs/{vrf['name']}"
@@ -195,7 +195,7 @@ def run(self, tmp=None, task_vars=None):
195195
rendered_to_nice_json = templar.environment.filters['to_nice_json'](rendered_content)
196196

197197
ndfc_vrf_update = self._execute_module(
198-
module_name="cisco.nd.nd_rest",
198+
module_name=task_vars['ansible_network_os_rest'],
199199
module_args={
200200
"method": "PUT",
201201
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{child_fabric}/vrfs/{vrf['name']}",

plugins/action/dtc/manage_child_fabrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run(self, tmp=None, task_vars=None):
4646
for fabric in child_fabrics:
4747
json_data = '{"destFabric":"%s","sourceFabric":"%s"}' % (parent_fabric, fabric)
4848
add_fabric_result = self._execute_module(
49-
module_name="cisco.nd.nd_rest",
49+
module_name=task_vars['ansible_network_os_rest'],
5050
module_args={
5151
"method": "POST",
5252
"path": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msdAdd",
@@ -75,7 +75,7 @@ def run(self, tmp=None, task_vars=None):
7575
for fabric in child_fabrics:
7676
json_data = '{"destFabric":"%s","sourceFabric":"%s"}' % (parent_fabric, fabric)
7777
remove_fabric_result = self._execute_module(
78-
module_name="cisco.nd.nd_rest",
78+
module_name=task_vars['ansible_network_os_rest'],
7979
module_args={
8080
"method": "POST",
8181
"path": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msdExit",

plugins/action/dtc/prepare_msite_child_fabrics_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run(self, tmp=None, task_vars=None):
4545
# This is actaully not an accurrate API endpoint as it returns all fabrics in NDFC, not just the fabrics associated with MSD
4646
# Therefore, we need to get the fabric associations response and filter out the fabrics that are not associated with the parent fabric (MSD)
4747
msd_fabric_associations = self._execute_module(
48-
module_name="cisco.nd.nd_rest",
48+
module_name=task_vars['ansible_network_os_rest'],
4949
module_args={
5050
"method": "GET",
5151
"path": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations",

plugins/action/dtc/prepare_msite_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(self, tmp=None, task_vars=None):
4747
# This is actaully not an accurrate API endpoint as it returns all fabrics in NDFC, not just the fabrics associated with MSD
4848
# Therefore, we need to get the fabric associations response and filter out the fabrics that are not associated with the parent fabric (MSD)
4949
msd_fabric_associations = self._execute_module(
50-
module_name="cisco.nd.nd_rest",
50+
module_name=task_vars['ansible_network_os_rest'],
5151
module_args={
5252
"method": "GET",
5353
"path": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations",

plugins/plugin_utils/helper_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def ndfc_get_switch_policy(self, task_vars, tmp, switch_serial_number):
9797
N/A
9898
"""
9999
policy_data = self._execute_module(
100-
module_name="cisco.nd.nd_rest",
100+
module_name=task_vars['ansible_network_os_rest'],
101101
module_args={
102102
"method": "GET",
103103
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/policies/switches/{switch_serial_number}/SWITCH/SWITCH"
@@ -183,7 +183,7 @@ def ndfc_get_fabric_attributes(self, task_vars, tmp, fabric):
183183
N/A
184184
"""
185185
fabric_response = self._execute_module(
186-
module_name="cisco.nd.nd_rest",
186+
module_name=task_vars['ansible_network_os_rest'],
187187
module_args={
188188
"method": "GET",
189189
"path": f"/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{fabric}",

0 commit comments

Comments
 (0)