本文整理汇总了Java中org.openbaton.catalogue.mano.common.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.openbaton.catalogue.mano.common包,在下文中一共展示了Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleError
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public void handleError(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) {
log.error("Received Error for VNFR " + virtualNetworkFunctionRecord.getName());
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.ERROR)
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
try {
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, Event.ERROR)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
} catch (Exception e) {
e.printStackTrace();
log.error("Exception executing Error handling");
}
output.append("\n--------------------\n");
log.info("Executed script for ERROR. Output was: \n\n" + output);
}
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:21,代码来源:GenericVNFM.java
示例2: start
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord start(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws Exception {
log.info("Starting vnfr: " + virtualNetworkFunctionRecord.getName());
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.START)
!= null) {
if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.START)
.getLifecycle_events()
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, Event.START)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info("Executed script for START. Output was: \n\n" + output);
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:25,代码来源:GenericVNFM.java
示例3: stop
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord stop(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws Exception {
log.info("Stopping vnfr: " + virtualNetworkFunctionRecord.getName());
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.STOP)
!= null) {
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.STOP)
.getLifecycle_events()
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result : lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, Event.STOP)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info("Executed script for STOP. Output was: \n\n" + output);
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:23,代码来源:GenericVNFM.java
示例4: terminate
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord terminate(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) {
log.debug("RELEASE_RESOURCES");
log.info("Releasing resources for VNFR: " + virtualNetworkFunctionRecord.getName());
log.trace("Verison is: " + virtualNetworkFunctionRecord.getHbVersion());
List<Event> events = new ArrayList<>();
for (LifecycleEvent event : virtualNetworkFunctionRecord.getLifecycle_event()) {
events.add(event.getEvent());
}
if (events.contains(Event.RELEASE)) {
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu())
log.debug("Removing vdu: " + vdu);
try {
Thread.sleep(1000 + ((int) (Math.random() * 4000)));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:dummy-vnfm-amqp,代码行数:25,代码来源:DummyAMQPVNFManager.java
示例5: terminate
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord terminate(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) {
log.debug("RELEASE_RESOURCES");
log.info("Releasing resources for VNFR: " + virtualNetworkFunctionRecord.getName());
log.trace("Verison is: " + virtualNetworkFunctionRecord.getHb_version());
List<Event> events = new ArrayList<>();
for (LifecycleEvent event : virtualNetworkFunctionRecord.getLifecycle_event()) {
events.add(event.getEvent());
}
if (events.contains(Event.RELEASE)) {
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu())
log.debug("Removing vdu: " + vdu);
try {
Thread.sleep(1000 + ((int) (Math.random() * 4000)));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:dummy-vnfm-rest,代码行数:25,代码来源:DummyRestVNFManager.java
示例6: modify
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord modify(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, VNFRecordDependency dependency)
throws Exception {
log.trace(
"VirtualNetworkFunctionRecord VERSION is: " + virtualNetworkFunctionRecord.getHbVersion());
log.info("executing modify for VNFR: " + virtualNetworkFunctionRecord.getName());
log.debug("Got dependency: " + dependency);
log.debug("Parameters are: ");
for (Entry<String, DependencyParameters> entry : dependency.getParameters().entrySet()) {
log.debug("Source type: " + entry.getKey());
log.debug("Parameters: " + entry.getValue().getParameters());
}
if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.CONFIGURE)
!= null) {
log.debug(
"LifeCycle events: "
+ VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.CONFIGURE)
.getLifecycle_events());
log.info("-----------------------------------------------------------------------");
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, Event.CONFIGURE, dependency)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info("Executed script for CONFIGURE. Output was: \n\n" + output);
log.info("-----------------------------------------------------------------------");
} else {
log.debug("No LifeCycle events for Event.CONFIGURE");
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:39,代码来源:GenericVNFM.java
示例7: terminate
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord terminate(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws Exception {
log.debug("Termination of VNF: " + virtualNetworkFunctionRecord.getName());
if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.TERMINATE)
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, Event.TERMINATE)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info("Executed script for TERMINATE. Output was: \n\n" + output);
}
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) {
for (VNFCInstance vnfci : vdu.getVnfc_instance()) {
try {
ems.removeRegistrationUnit(vnfci.getHostname());
} catch (BadFormatException e) {
e.printStackTrace();
}
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:30,代码来源:GenericVNFM.java
示例8: startVNFCInstance
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord startVNFCInstance(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, VNFCInstance vnfcInstance)
throws Exception {
log.info("Starting vnfc instance: " + vnfcInstance.getHostname());
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.START)
!= null) {
if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.START)
.getLifecycle_events()
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, vnfcInstance, Event.START)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info(
"Executed script for START on VNFC Instance "
+ vnfcInstance.getHostname()
+ ". Output was: \n\n"
+ output);
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:31,代码来源:GenericVNFM.java
示例9: stopVNFCInstance
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord stopVNFCInstance(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, VNFCInstance vnfcInstance)
throws Exception {
log.info("Stopping vnfc instance: " + vnfcInstance.getHostname());
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.STOP)
!= null) {
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.STOP)
.getLifecycle_events()
!= null) {
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(virtualNetworkFunctionRecord, vnfcInstance, Event.STOP)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info(
"Executed script for STOP on VNFC Instance "
+ vnfcInstance.getHostname()
+ ". Output was: \n\n"
+ output);
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:30,代码来源:GenericVNFM.java
示例10: getOpLifecycle
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@SuppressWarnings({"unsafe", "unchecked"})
public Set<LifecycleEvent> getOpLifecycle() {
Map<String, ArrayList> lifecycleMap = (Map<String, ArrayList>) lifecycle;
Set<LifecycleEvent> lifecycleEvents = new HashSet<>();
if (lifecycle != null) {
for (String lifecycleName : lifecycleMap.keySet()) {
LifecycleEvent lifecycleEvent = new LifecycleEvent();
switch (lifecycleName.toLowerCase()) {
case "instantiate":
lifecycleEvent.setEvent(Event.INSTANTIATE);
break;
case "start":
lifecycleEvent.setEvent(Event.START);
break;
case "configure":
lifecycleEvent.setEvent(Event.CONFIGURE);
break;
case "delete":
lifecycleEvent.setEvent(Event.TERMINATE);
break;
case "stop":
lifecycleEvent.setEvent(Event.STOP);
break;
}
ArrayList<String> cmds = new ArrayList<>();
cmds.addAll(lifecycleMap.get(lifecycleName));
lifecycleEvent.setLifecycle_events(cmds);
lifecycleEvents.add(lifecycleEvent);
}
}
return lifecycleEvents;
}
开发者ID:openbaton,项目名称:NFVO,代码行数:40,代码来源:VNFInterfaces.java
示例11: handleVimDriverException
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
private NFVMessage handleVimDriverException(VimDriverException e) {
e.printStackTrace();
log.error(e.getMessage());
HistoryLifecycleEvent lifecycleEvent = new HistoryLifecycleEvent();
lifecycleEvent.setEvent(Event.ERROR.name());
lifecycleEvent.setDescription(e.getMessage());
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd'-'HH:mm:ss:SSS'-'z");
lifecycleEvent.setExecutedAt(format.format(new Date()));
virtualNetworkFunctionRecord.getLifecycle_event_history().add(lifecycleEvent);
virtualNetworkFunctionRecord.setStatus(Status.ERROR);
saveVirtualNetworkFunctionRecord();
return new OrVnfmErrorMessage(virtualNetworkFunctionRecord, e.getMessage());
}
开发者ID:openbaton,项目名称:NFVO,代码行数:14,代码来源:AbstractTask.java
示例12: getLifecycleEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
public static LifecycleEvent getLifecycleEvent(Collection<LifecycleEvent> events, Event event) {
for (LifecycleEvent lce : events)
if (lce.getEvent().ordinal() == event.ordinal()) {
return lce;
}
return null;
}
开发者ID:openbaton,项目名称:openbaton-libs,代码行数:8,代码来源:VnfmUtils.java
示例13: copyLifecycleScripts
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
/**
* Copy the lifecycle scripts into the correct charm.
*
* @param le
* @param event
* @param vnfdName
* @return
* @throws Exception
*/
private void copyLifecycleScripts(LifecycleEvent le, Event event, String vnfdName, String nsId)
throws Exception {
log.info("Copy scripts for lifecycle event " + event.name());
File scriptsFolder = new File("/tmp/openbaton/juju/" + nsId + "/scripts/" + vnfdName);
File[] listOfFiles = scriptsFolder.listFiles();
if (listOfFiles.length > 1)
throw new Exception(
"There is more than one folder in /tmp/openbaton/juju/scripts/" + vnfdName);
else if (listOfFiles.length < 1)
throw new Exception(
"No script folder found in /tmp/openbaton/juju/" + nsId + "/scripts/" + vnfdName);
String gitFolderPath = "";
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
throw new Exception(
"Git Repository expected but just found a normal file: " + listOfFiles[i].getName());
} else if (listOfFiles[i].isDirectory()) {
gitFolderPath = listOfFiles[i].getPath();
}
}
log.info("Found git folder " + gitFolderPath);
String dirName = event.name().toLowerCase() + "Scripts";
File scriptDir = new File("/tmp/openbaton/juju/" + nsId + "/" + vnfdName + "/hooks/" + dirName);
if (!scriptDir.exists())
(new File(
"/tmp/openbaton/juju/"
+ nsId
+ "/"
+ vnfdName
+ "/hooks/"
+ le.getEvent().name().toLowerCase()
+ "Scripts"))
.mkdirs();
for (String script : le.getLifecycle_events()) {
Files.copy(
Paths.get(gitFolderPath + "/" + script),
Paths.get(
"/tmp/openbaton/juju/" + nsId + "/" + vnfdName + "/hooks/" + dirName + "/" + script),
StandardCopyOption.COPY_ATTRIBUTES);
}
}
开发者ID:openbaton,项目名称:juju-vnfm,代码行数:56,代码来源:JujuVnfm.java
示例14: heal
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
public VirtualNetworkFunctionRecord heal(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord,
VNFCInstance component,
String cause)
throws Exception {
if ("switchToStandby".equals(cause)) {
for (VirtualDeploymentUnit virtualDeploymentUnit : virtualNetworkFunctionRecord.getVdu()) {
for (VNFCInstance vnfcInstance : virtualDeploymentUnit.getVnfc_instance()) {
if (vnfcInstance.getId().equals(component.getId())
&& "standby".equalsIgnoreCase(vnfcInstance.getState())) {
log.debug("Activation of the standby component");
if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.START)
!= null) {
log.debug(
"Executed scripts for event START "
+ lcm.executeScriptsForEvent(
virtualNetworkFunctionRecord, component, Event.START));
}
log.debug("Changing the status from standby to active");
//This is inside the vnfr
vnfcInstance.setState("ACTIVE");
// This is a copy of the object received as parameter and modified.
// It will be sent to the orchestrator
component.setState("ACTIVE");
break;
}
}
}
} else if (VnfmUtils.getLifecycleEvent(
virtualNetworkFunctionRecord.getLifecycle_event(), Event.HEAL)
!= null) {
if (VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), Event.HEAL)
.getLifecycle_events()
!= null) {
log.debug("Heal method started");
log.info("-----------------------------------------------------------------------");
StringBuilder output = new StringBuilder("\n--------------------\n--------------------\n");
for (String result :
lcm.executeScriptsForEvent(
virtualNetworkFunctionRecord, component, Event.HEAL, cause)) {
output.append(JsonUtils.parse(result));
output.append("\n--------------------\n");
}
output.append("\n--------------------\n");
log.info("Executed script for HEAL. Output was: \n\n" + output);
log.info("-----------------------------------------------------------------------");
}
}
return virtualNetworkFunctionRecord;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:54,代码来源:GenericVNFM.java
示例15: executeScriptsForEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
public Iterable<String> executeScriptsForEvent(
VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, Event event)
throws Exception { //TODO make it parallel
Map<String, String> env = getMap(virtualNetworkFunctionRecord);
Collection<String> res = new ArrayList<>();
LifecycleEvent le =
VnfmUtils.getLifecycleEvent(virtualNetworkFunctionRecord.getLifecycle_event(), event);
if (le != null) {
log.trace(
"The number of scripts for "
+ virtualNetworkFunctionRecord.getName()
+ " are: "
+ le.getLifecycle_events());
for (String script : le.getLifecycle_events()) {
log.info(
"Sending script: "
+ script
+ " to VirtualNetworkFunctionRecord: "
+ virtualNetworkFunctionRecord.getName());
for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) {
for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) {
Map<String, String> tempEnv = new HashMap<>();
for (Ip ip : vnfcInstance.getIps()) {
log.debug("Adding net: " + ip.getNetName() + " with value: " + ip.getIp());
tempEnv.put(ip.getNetName(), ip.getIp());
}
log.debug("adding floatingIp: " + vnfcInstance.getFloatingIps());
for (Ip fip : vnfcInstance.getFloatingIps()) {
tempEnv.put(fip.getNetName() + "_floatingIp", fip.getIp());
}
tempEnv.put("hostname", vnfcInstance.getHostname());
tempEnv = modifyUnsafeEnvVarNames(tempEnv);
env.putAll(tempEnv);
log.info("Environment Variables are: " + env);
String command = JsonUtils.getJsonObject("EXECUTE", script, env).toString();
String output =
ems.executeActionOnEMS(
vnfcInstance.getHostname(),
command,
virtualNetworkFunctionRecord,
vnfcInstance);
res.add(output);
log.debug("Saving log to file...");
logUtils.saveLogToFile(virtualNetworkFunctionRecord, script, vnfcInstance, output);
for (String key : tempEnv.keySet()) {
env.remove(key);
}
}
}
}
}
return res;
}
开发者ID:openbaton,项目名称:generic-vnfm,代码行数:58,代码来源:LifeCycleManagement.java
示例16: getLifecycleEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
public Event getLifecycleEvent() {
return lifecycleEvent;
}
开发者ID:openbaton,项目名称:NFVO,代码行数:4,代码来源:VDUMessage.java
示例17: setLifecycleEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
public void setLifecycleEvent(Event lifecycleEvent) {
this.lifecycleEvent = lifecycleEvent;
}
开发者ID:openbaton,项目名称:NFVO,代码行数:4,代码来源:VDUMessage.java
示例18: setEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
protected void setEvent() {
event = Event.START.name();
}
开发者ID:openbaton,项目名称:NFVO,代码行数:5,代码来源:StartTask.java
示例19: setEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
protected void setEvent() {
event = Event.SCALE_OUT.name();
}
开发者ID:openbaton,项目名称:NFVO,代码行数:5,代码来源:ScalingTask.java
示例20: setEvent
import org.openbaton.catalogue.mano.common.Event; //导入依赖的package包/类
@Override
protected void setEvent() {
event = Event.STOP.name();
}
开发者ID:openbaton,项目名称:NFVO,代码行数:5,代码来源:StopTask.java
注:本文中的org.openbaton.catalogue.mano.common.Event类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论