本文整理汇总了Java中org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord.getName方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualNetworkFunctionRecord.getName方法的具体用法?Java VirtualNetworkFunctionRecord.getName怎么用?Java VirtualNetworkFunctionRecord.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord
的用法示例。
在下文中一共展示了VirtualNetworkFunctionRecord.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestLog
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的package包/类
@Override
@Async
public Future<NFVMessage> requestLog(VirtualNetworkFunctionRecord vnfr, String hostname)
throws NotFoundException, BadFormatException, ExecutionException, InterruptedException {
VnfmManagerEndpoint endpoint = generator.getVnfm(vnfr.getEndpoint());
if (endpoint == null)
throw new NotFoundException(
"VnfManager of type "
+ vnfr.getType()
+ " (endpoint = "
+ vnfr.getEndpoint()
+ ") is not registered");
OrVnfmLogMessage orVnfmLogMessage = new OrVnfmLogMessage(vnfr.getName(), hostname);
VnfmSender vnfmSender;
try {
vnfmSender = generator.getVnfmSender(endpoint.getEndpointType());
} catch (BeansException e) {
throw new NotFoundException(e);
}
Future<NFVMessage> answerFuture = vnfmSender.sendCommand(orVnfmLogMessage, endpoint);
answerFuture.get();
NFVMessage message = answerFuture.get();
return new AsyncResult<>(message);
}
示例2: saveLogToFile
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的package包/类
public synchronized void saveLogToFile(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord,
String script,
VNFCInstance vnfcInstance1,
String output,
boolean error)
throws IOException {
log.debug("Old is: " + old);
if (old > 0) {
String path = "";
if (!error) {
path =
scriptsLogPath
+ virtualNetworkFunctionRecord.getName()
+ "/"
+ vnfcInstance1.getHostname()
+ ".log";
} else {
path =
scriptsLogPath
+ virtualNetworkFunctionRecord.getName()
+ "/"
+ vnfcInstance1.getHostname()
+ "-error.log";
}
File f = new File(path);
log.debug("The full log path is: " + path);
if (!f.exists()) {
f.getParentFile().mkdirs();
f.createNewFile();
}
if (!error) {
Files.write(
Paths.get(path),
("Output of Script : " + script + "\n\n").getBytes(),
StandardOpenOption.APPEND);
Files.write(
Paths.get(path),
parser
.fromJson(output, JsonObject.class)
.get("output")
.getAsString()
.replaceAll("\\\\n", "\n")
.getBytes(),
StandardOpenOption.APPEND);
log.debug(
"Wrote "
+ parser
.fromJson(output, JsonObject.class)
.get("output")
.getAsString()
.replaceAll("\\\\n", "\n")
+ " on file "
+ Paths.get(path));
} else {
Files.write(
Paths.get(path),
("Error log of Script : " + script + "\n\n").getBytes(),
StandardOpenOption.APPEND);
Files.write(
Paths.get(path),
parser
.fromJson(output, JsonObject.class)
.get("err")
.getAsString()
.replaceAll("\\\\n", "\n")
.getBytes(),
StandardOpenOption.APPEND);
}
Files.write(
Paths.get(path),
"\n\n\n~~~~~~~~~~~~~~~~~~~~~~~~~\n#########################\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n"
.getBytes(),
StandardOpenOption.APPEND);
}
}
示例3: scaleOUT
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的package包/类
private void scaleOUT(
NetworkServiceRecord networkServiceRecord,
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord,
VirtualDeploymentUnit virtualDeploymentUnit,
VNFComponent component,
String mode,
List<String> vimInstanceNames)
throws BadFormatException, NotFoundException {
networkServiceRecord.setTask("Scaling out");
List<String> componentNetworks = new ArrayList<>();
if (component.getConnection_point() == null || component.getConnection_point().isEmpty()) {
throw new BadFormatException("No connection points were passed for scaling out.");
}
for (VNFDConnectionPoint connectionPoint : component.getConnection_point()) {
if (connectionPoint.getVirtual_link_reference() == null
|| connectionPoint.getVirtual_link_reference().equals("")) {
throw new BadFormatException("Connection points have to contain a virtual link reference.");
}
componentNetworks.add(connectionPoint.getVirtual_link_reference());
}
List<String> vnfrNetworks = new ArrayList<>();
for (InternalVirtualLink virtualLink : virtualNetworkFunctionRecord.getVirtual_link()) {
vnfrNetworks.add(virtualLink.getName());
}
for (String virtualLinkReference : componentNetworks) {
if (!vnfrNetworks.contains(virtualLinkReference)) {
throw new BadFormatException(
"The virtual link reference "
+ virtualLinkReference
+ " does not exist in the VNFR "
+ virtualNetworkFunctionRecord.getName()
+ ". It has to be one of the "
+ "following: "
+ String.join(", ", vnfrNetworks));
}
}
log.info(
"Adding VNFComponent to VirtualNetworkFunctionRecord "
+ virtualNetworkFunctionRecord.getName());
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) {
if (vdu.getId().equals(virtualDeploymentUnit.getId())) {
vdu.getVnfc().add(component);
}
}
vnfcRepository.save(component);
nsrRepository.saveCascade(networkServiceRecord);
log.debug("new VNFComponent is " + component);
VNFRecordDependency dependencyTarget =
dependencyManagement.getDependencyForAVNFRecordTarget(virtualNetworkFunctionRecord);
log.debug("Found Dependency: " + dependencyTarget);
try {
vnfmManager
.addVnfc(
virtualNetworkFunctionRecord, component, dependencyTarget, mode, vimInstanceNames)
.get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
示例4: checkQuotaOnVimInstance
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的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;
}
示例5: doWork
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的package包/类
@Override
protected Object doWork() throws Exception {
log.info("Start VNFRStatusTester on VNFR type " + vnfrType);
this.setAbstractRestAgent(requestor.getNetworkServiceRecordAgent());
NetworkServiceRecord nsr = (NetworkServiceRecord) getParam();
if (status == null)
throw new IntegrationTestException(
"Status to test is not declared. Specify it in the .ini file.");
boolean found = false;
for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) {
if (vnfr.getType().equals(vnfrType)) {
found = true;
log.debug("The status of the VNFR of type " + vnfrType + " is " + vnfr.getStatus());
if (!vnfr.getStatus().equals(status)) {
log.error(
"The status of VNFR "
+ vnfr.getName()
+ " of type "
+ vnfr.getType()
+ " is not "
+ status
+ " but "
+ vnfr.getStatus()
+ ".");
throw new IntegrationTestException(
"The status of VNFR "
+ vnfr.getName()
+ " of type "
+ vnfr.getType()
+ " is not "
+ status
+ " but "
+ vnfr.getStatus()
+ ".");
}
}
}
if (!found) log.warn("did not find a VNFR of type " + vnfrType);
log.debug("--- VNFRStatusTester finished successfully");
return param;
}
示例6: doWork
import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; //导入方法依赖的package包/类
@Override
protected Object doWork() throws Exception {
log.info("Start ScalingTester");
this.setAbstractRestAgent(requestor.getNetworkServiceRecordAgent());
NetworkServiceRecord nsr = (NetworkServiceRecord) getParam();
NetworkServiceRecordAgent agent = requestor.getNetworkServiceRecordAgent();
boolean found = false;
for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) {
if (vnfr.getType().equals(vnfrType)) {
found = true;
Status state = getVNFRState(nsr.getId(), vnfr.getId());
if (!state.equals(Status.ACTIVE))
throw new IntegrationTestException(
"State of VNFR "
+ vnfr.getName()
+ " of type "
+ vnfr.getType()
+ " is not ACTIVE but "
+ state
+ ".");
int numInstances = getNumberOfVNFCInstances(nsr.getId(), vnfr.getId());
log.info(
"Found "
+ numInstances
+ " VNFC instance/s of VNFR "
+ vnfr.getType()
+ " with id "
+ vnfr.getId());
if (numInstances == vnfcCount) {
log.info("ScalingTester finished successfully");
} else {
log.error(
"Expected number of VNFCInstances was "
+ vnfcCount
+ " but ScalingTester found "
+ numInstances);
throw new IntegrationTestException("ScalingTester did not finish successfully");
}
}
}
if (!found) log.warn("did not find a VNFR of type " + vnfrType);
// get the updated nsr
NetworkServiceRecord nsrUpdated = agent.findById(nsr.getId());
if (nsrUpdated == null)
log.warn("Could not retrieve the updated NSR. This may cause errors in following tasks");
return nsrUpdated;
}