Cisco Cisco Intercloud Fabric for Provider Developer's Guide
Page 26
Adapter Development
This method fetches a list of templates from the cloud template catalog that matches the specified criteria. The
criteria can be:
criteria can be:
●
name: A template name that matches a regular expression.
●
tags: Tags in the template object.
●
status: Status of the template.
●
locationName: Name of the template location.
Code Stub
public
List<CapiTemplate> discoverTemplates(
CapiTenantAccountVO tenantAccountInfo, Properties criteria)
throws
CapiPluginTemplateException {
List<CapiTemplate> listTemplates =
new
ArrayList<CapiTemplate>();
logger
.info("Discover Templates");
if
(criteria !=
null
&& !criteria.isEmpty()) {
/*
* Dummy implementation only!!
*/
// Cloud Specific Code Start
// Cloud Specific Code End
if
(criteria.get(TemplateFilterCriteriaEnum.
NAME
.value()) !=
null
) {
CapiTemplate template =
new
CapiTemplate();
template.setTemplateBackendId(
"111111111111111111"
);
template.setTemplateStatus(TemplateStatusEnum.
COMPLETE
);
listTemplates.add(template);
}
}
return
listTemplates;
}
CapiPluginVmIf
deployVirtualMachine
This method deploys a virtual machine (server). The CapiServer class contains several embedded classes and
lists. It is important to understand the structure of the class to take full advantage of its contents. Some of the
contents are network, storage, CPU, memory, tags, parameters, and security-related instance variables and
methods.
lists. It is important to understand the structure of the class to take full advantage of its contents. Some of the
contents are network, storage, CPU, memory, tags, parameters, and security-related instance variables and
methods.
API
CapiServer deployVirtualMachine(
CapiTenantAccountVO tenantAccountInfo,
CapiServer serverDetails)
throws CapiPluginServerException;
CapiTenantAccountVO tenantAccountInfo,
CapiServer serverDetails)
throws CapiPluginServerException;
Adapter Development
This method gets the CapiServer and the TenantAccountVO. The object names are serverDetails and
tenantAccountInfo, respectively.
tenantAccountInfo, respectively.
1. Using this object, fetch the templateId.
2. From the serverDetails object, fetch the templateId.
3. From the templateId, fetch the CapiTemplate object.
There are several data structures that the code must read to create a VM. They are CapiNetworkResource,
memory, numCpus, the template to be used, and so on. See the provided VCDP adapter and Java
documentation for more information.
memory, numCpus, the template to be used, and so on. See the provided VCDP adapter and Java
documentation for more information.