Skip to content

Commit 671ab98

Browse files
committed
Enable useVirtualPeerlink for state merged
1 parent 43d5ca5 commit 671ab98

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

plugins/module_utils/network/dcnm/dcnm_vpc_pair_utils.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"VPC_PAIR_DELETE_PATH": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair?serialNumber={}",
2323
"VPC_PAIR_DEPLOY_PATH": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{}/config-deploy/{}?forceShowRun=false",
2424
"VPC_PAIR_CFG_SAVE_PATH": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{}/config-save",
25+
"VPC_PEER_LINK_GET_PATH": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair/recommendation?serialNumber={}&useVirtualPeerlink=true",
2526
"FABRIC_ACCESS_MODE": "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{}/accessmode",
2627
},
2728
}
@@ -209,6 +210,21 @@ def dcnm_vpc_pair_utils_get_vpc_pair_info_from_dcnm(self, swid):
209210
else:
210211
return []
211212

213+
# Get useVirtualPeerlink information
214+
path = self.paths["VPC_PEER_LINK_GET_PATH"]
215+
path = path.format(peerOneId)
216+
resp = dcnm_send(self.module, "GET", path)
217+
218+
if (
219+
resp
220+
and (resp["RETURN_CODE"] == 200)
221+
and (resp["MESSAGE"] == "OK")
222+
and resp["DATA"]
223+
):
224+
useVirtualPeerlink = resp["DATA"][0].get("useVirtualPeerlink", None)
225+
else:
226+
return []
227+
212228
# Get the Profile information now and combine both the first response data and the current one to
213229
# form the 'have' object. There is no direct call to get this combined information.
214230
path = self.paths["VPC_PAIR_GET_POLICY_PATH"]
@@ -226,6 +242,7 @@ def dcnm_vpc_pair_utils_get_vpc_pair_info_from_dcnm(self, swid):
226242
resp["DATA"]["peerTwoId"] = peerTwoId
227243
resp["DATA"]["peerOneDbId"] = peerOneDbId
228244
resp["DATA"]["peerTwoDbId"] = peerTwoDbId
245+
resp["DATA"]["useVirtualPeerlink"] = useVirtualPeerlink
229246

230247
# Some of the fields in 'have' may be different than what is sent in CREATE/UPDATE/DELETE payloads to DCNM. Update these
231248
# fields,if any, so that all keys are consistent between 'want' and 'have'. This will be necessary for compare function to
@@ -634,6 +651,9 @@ def dcnm_vpc_pair_utils_process_modify_payloads(self):
634651
path = self.paths["VPC_PAIR_UPDATE_PATH"]
635652

636653
json_payload = json.dumps(elem)
654+
# Sample json_payload
655+
# '{"useVirtualPeerlink":true,"peerOneId":"FDO24020JMB","peerTwoId":"FDO24020JMT"}'
656+
637657
resp = dcnm_send(self.module, "PUT", path, json_payload)
638658

639659
if resp != []:

plugins/modules/dcnm_vpc_pair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ def dcnm_vpc_pair_validate_input(self, cfg):
909909
"peerOneId": {"required": "True", "type": "ipv4"},
910910
"peerTwoId": {"required": "True", "type": "ipv4"},
911911
"templateName": {"type": "str"},
912-
"useVirtualPeerLink": {"type": "bool"},
912+
"useVirtualPeerlink": {"type": "bool"},
913913
"profile": {"type": "dict"},
914914
}
915915

0 commit comments

Comments
 (0)