Cisco Cisco UCS Director 5.0 Developer's Guide
Cisco UCS Director Cloupia Script Cookbook
15
7 Accessing Session or API for Virtual and Physical accounts
The functionalities are defined in the Cisco UCS Director features. If required, they
can be reused by accessing the feature API instead of redefining the same
functionality. Also, session objects are defined in Cisco UCS Director. Create the
required session object and access the API.
can be reused by accessing the feature API instead of redefining the same
functionality. Also, session objects are defined in Cisco UCS Director. Create the
required session object and access the API.
NetApp
The following snippet shows the Netapp LUN mapping functionality.
importPackage(com.cloupia.lib.cIaaS.netapp);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.lib.cIaaS.netapp.model);
function getNetAppApi()
{
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.lib.cIaaS.netapp.model);
function getNetAppApi()
{
var filerIdentity = new
NetAppFilerIdentity(input.accountName);
var accountName = null;
if (filerIdentity != null)
NetAppFilerIdentity(input.accountName);
var accountName = null;
if (filerIdentity != null)
{
accountName = filerIdentity.getAccountName();
}
accountName = filerIdentity.getAccountName();
}
var account =
InfrastructureDataUtil.getAccount(accountName);
var session = new NetAppSession(account);
var api = new NetAppAPI(session);
logger.addInfo("API: "+api);
InfrastructureDataUtil.getAccount(accountName);
var session = new NetAppSession(account);
var api = new NetAppAPI(session);
logger.addInfo("API: "+api);
}
getNetAppApi();
getNetAppApi();
VMware
importPackage(com.cloupia.lib.cIaaS.vmware);
importPackage(com.cloupia.service.cIM.inframgr);
function accessVMWareAccount(){
importPackage(com.cloupia.service.cIM.inframgr);
function accessVMWareAccount(){
var accountName = input.accountName;
var account = InfraPersistenceUtil.getAccount(accountName);
var si = new
VCenterConnectionManager(account).getServiceInstance();
var driver = new VCenterDriver();
var account = InfraPersistenceUtil.getAccount(accountName);
var si = new
VCenterConnectionManager(account).getServiceInstance();
var driver = new VCenterDriver();
}
accessVMWareAccount();
accessVMWareAccount();
Use the vcenterDriver API to invoke the VMware APIs and CRUD operations.
Example :
driver.updateSingleVM(Account creds, GenericVM gvm, VMWareVMSummary
vmsummary, boolean includeSnapshotInfo);
vmsummary, boolean includeSnapshotInfo);