22
22
"VPC_PAIR_DELETE_PATH" : "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair?serialNumber={}" ,
23
23
"VPC_PAIR_DEPLOY_PATH" : "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{}/config-deploy/{}?forceShowRun=false" ,
24
24
"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" ,
25
26
"FABRIC_ACCESS_MODE" : "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{}/accessmode" ,
26
27
},
27
28
}
@@ -209,6 +210,21 @@ def dcnm_vpc_pair_utils_get_vpc_pair_info_from_dcnm(self, swid):
209
210
else :
210
211
return []
211
212
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
+
212
228
# Get the Profile information now and combine both the first response data and the current one to
213
229
# form the 'have' object. There is no direct call to get this combined information.
214
230
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):
226
242
resp ["DATA" ]["peerTwoId" ] = peerTwoId
227
243
resp ["DATA" ]["peerOneDbId" ] = peerOneDbId
228
244
resp ["DATA" ]["peerTwoDbId" ] = peerTwoDbId
245
+ resp ["DATA" ]["useVirtualPeerlink" ] = useVirtualPeerlink
229
246
230
247
# Some of the fields in 'have' may be different than what is sent in CREATE/UPDATE/DELETE payloads to DCNM. Update these
231
248
# 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):
634
651
path = self .paths ["VPC_PAIR_UPDATE_PATH" ]
635
652
636
653
json_payload = json .dumps (elem )
654
+ # Sample json_payload
655
+ # '{"useVirtualPeerlink":true,"peerOneId":"FDO24020JMB","peerTwoId":"FDO24020JMT"}'
656
+
637
657
resp = dcnm_send (self .module , "PUT" , path , json_payload )
638
658
639
659
if resp != []:
0 commit comments