本文整理汇总了Java中org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit.getVnfc方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualDeploymentUnit.getVnfc方法的具体用法?Java VirtualDeploymentUnit.getVnfc怎么用?Java VirtualDeploymentUnit.getVnfc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit
的用法示例。
在下文中一共展示了VirtualDeploymentUnit.getVnfc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; //导入方法依赖的package包/类
@Override
public VirtualNetworkFunctionDescriptor add(
VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor, String projectId)
throws NotFoundException, NetworkServiceIntegrityException {
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss z");
virtualNetworkFunctionDescriptor.setCreatedAt(format.format(new Date()));
virtualNetworkFunctionDescriptor.setUpdatedAt(format.format(new Date()));
virtualNetworkFunctionDescriptor.setProjectId(projectId);
if (virtualNetworkFunctionDescriptor.getVdu() == null
|| virtualNetworkFunctionDescriptor.getVdu().size() == 0)
throw new NotFoundException("You should specify at least one VDU in each VNFD!");
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionDescriptor.getVdu()) {
if (vdu.getVnfc() == null || vdu.getVnfc().size() == 0)
throw new NotFoundException("You should specify at least one VNFC in each VDU!");
}
nsdUtils.checkIntegrity(virtualNetworkFunctionDescriptor);
return vnfdRepository.save(virtualNetworkFunctionDescriptor);
}
示例2: checkIntegrityVDU
import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; //导入方法依赖的package包/类
private void checkIntegrityVDU(VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor)
throws NetworkServiceIntegrityException {
int i = 1;
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionDescriptor.getVdu()) {
if (vdu.getVnfc() == null || vdu.getVnfc().size() == 0) {
log.warn("Not found any VNFC in VDU of VNFD " + virtualNetworkFunctionDescriptor.getName());
}
if (vdu.getName() == null || vdu.getName().isEmpty()) {
vdu.setName(virtualNetworkFunctionDescriptor.getName() + "-" + i);
i++;
}
if (vdu.getVm_image() == null || vdu.getVm_image().isEmpty()) {
throw new NetworkServiceIntegrityException(
"At least one VDU in the VNFD "
+ virtualNetworkFunctionDescriptor.getName()
+ " does not contain an image.");
}
if (vdu.getName() == null || vdu.getName().equalsIgnoreCase("")) {
vdu.setName("vdu" + i);
}
vdu.setProjectId(virtualNetworkFunctionDescriptor.getProjectId());
}
}
示例3: doWork
import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; //导入方法依赖的package包/类
@Override
protected NFVMessage doWork() throws Exception {
if (virtualNetworkFunctionRecord.getName().contains("client")) log.info("client");
log.info(
"Executing task: AllocateResources for VNFR: " + virtualNetworkFunctionRecord.getName());
log.trace(
"VNFR ("
+ virtualNetworkFunctionRecord.getId()
+ ") received hibernate version is = "
+ virtualNetworkFunctionRecord.getHbVersion());
printOldAndNewHibernateVersion();
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) {
BaseVimInstance vimInstance = vims.get(vdu.getId());
if (vimInstance == null) {
throw new NullPointerException(
"Our algorithms are too complex, even for us, this is what abnormal IQ means :(");
}
vimInstance = vimRepository.findFirstById(vimInstance.getId());
log.debug(
"Allocating VDU: "
+ vdu.getName()
+ " to vim instance: "
+ vimInstance.getName()
+ " - id: "
+ vimInstance.getId());
for (VNFComponent vnfc : vdu.getVnfc()) {
resourceManagement
.allocate(vdu, virtualNetworkFunctionRecord, vnfc, vimInstance, userData)
.get();
}
}
setHistoryLifecycleEvent(new Date());
saveVirtualNetworkFunctionRecord();
OrVnfmGenericMessage orVnfmGenericMessage =
new OrVnfmGenericMessage(virtualNetworkFunctionRecord, Action.ALLOCATE_RESOURCES);
log.trace(
"Answering the AllocateResources call via RPC with the following message: "
+ orVnfmGenericMessage);
log.info(
"Finished task: AllocateResources for VNFR: " + virtualNetworkFunctionRecord.getName());
return orVnfmGenericMessage;
}
示例4: checkQuotaOnVimInstance
import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; //导入方法依赖的package包/类
@Override
public BaseVimInstance checkQuotaOnVimInstance(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, BaseVimInstance vimInstance)
throws VimException, PluginException {
if (vimInstance instanceof OpenstackVimInstance) {
Quota leftQuota = vimBroker.getLeftQuota(vimInstance);
log.debug("Left Quota on VimInstance " + vimInstance.getName() + " at start is " + leftQuota);
//Fetch the Flavor for getting allocated resources needed
DeploymentFlavour flavor = null;
for (DeploymentFlavour currentFlavor : ((OpenstackVimInstance) vimInstance).getFlavours()) {
if (currentFlavor
.getFlavour_key()
.equals(virtualNetworkFunctionRecord.getDeployment_flavour_key())) {
flavor = currentFlavor;
break;
}
}
if (flavor == null)
throw new VimException(
"deployment flavor object is null, it means that there is no PoP supporting the deployment flavour selected");
//Subtract needed resources from the left resources
int nc = 0;
for (VirtualDeploymentUnit virtualDeploymentUnit : virtualNetworkFunctionRecord.getVdu()) {
for (VNFComponent ignored : virtualDeploymentUnit.getVnfc()) {
nc++;
}
}
for (int i = 1; i <= nc; i++) {
leftQuota.setInstances(leftQuota.getInstances() - 1);
leftQuota.setCores(leftQuota.getCores() - flavor.getVcpus());
leftQuota.setRam(leftQuota.getRam() - flavor.getRam());
log.debug(
"Left Quota on VimInstance "
+ vimInstance.getName()
+ " after considering VDU is "
+ leftQuota);
}
//If one value is negative, it is not possible to deploy the VNFR on (at least on one VimInstance) -> return false
if (leftQuota.getInstances() < 0 || leftQuota.getRam() < 0 || leftQuota.getCores() < 0) {
log.error(
"Not enough resources are available to deploy VNFR "
+ virtualNetworkFunctionRecord.getName());
throw new VimException(
"Not enough resources are available to deploy VNFR "
+ virtualNetworkFunctionRecord.getName());
}
}
return vimInstance;
}