cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2652
Views
5
Helpful
2
Replies

APIC Cobra SDK - export Policy to remote location

thwollnik
Level 1
Level 1

Hi!

Im trying to export my apic policy via a python script. Creating an export policy works also creating the remote destination works.

But how do I tell the APIC to use the destination I created for the export policy. There is no attribute in the  cobra.model.config.ExportP module to set the export destination

See my code so far below:

#import neccessary modules .. 
loginSession = LoginSession(apicUrl, 'admin', 'admin', requestFormat='xml')
moDir = MoDirectory(loginSession)
moDir.login()
uniMo = moDir.lookupByClass('polUni')
topuniMo = moDir.lookupByDn((str(moDir.lookupByClass('polUni')[0].dn)))


fabricInst = cobra.model.fabric.Inst(topuniMo)

backup = cobra.model.config.ExportP(fabricInst, name="Backup_ACIsim", snapshot="true", adminSt="triggered" )
bckpath = cobra.model.file.RemotePath(fabricInst, host="192.168.1.9", name="NAS", nameAlias="", protocol="scp", remotePath="", remotePort="22", userName="admin", userPasswd="admin" )

c = cobra.mit.request.ConfigRequest()

c.addMo(fabricInst)

moDir.commit(c)

Appreciate any hint!

1 Accepted Solution

Accepted Solutions

Remi Astruc
Level 1
Level 1

Hello,

 

I don't use the Cobra SDK, but from MIT perspective, I guess you should add child details into your Export policy.

 

Under cobra.model.config.ExportP you should have a class cobra.model.config.RsRemotePath in which you will set the property tnFileRemotePathName="bckpath"

 

Remi

View solution in original post

2 Replies 2

Remi Astruc
Level 1
Level 1

Hello,

 

I don't use the Cobra SDK, but from MIT perspective, I guess you should add child details into your Export policy.

 

Under cobra.model.config.ExportP you should have a class cobra.model.config.RsRemotePath in which you will set the property tnFileRemotePathName="bckpath"

 

Remi

Yeah, that should work. Thank you.