protected synchronized void setHistoryLifecycleEvent() { HistoryLifecycleEvent lifecycleEvent = new HistoryLifecycleEvent(); lifecycleEvent.setEvent(event); SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd'-'HH:mm:ss:SSS'-'z"); lifecycleEvent.setExecutedAt(format.format(new Date())); lifecycleEvent.setDescription(description); if (virtualNetworkFunctionRecord.getLifecycle_event_history() == null) { virtualNetworkFunctionRecord.setLifecycle_event_history(new LinkedHashSet<>()); } virtualNetworkFunctionRecord.getLifecycle_event_history().add(lifecycleEvent); log.debug("Added lifecycle event history: " + lifecycleEvent); }
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())); if (virtualNetworkFunctionRecord.getLifecycle_event_history() == null) { virtualNetworkFunctionRecord.setLifecycle_event_history(new LinkedHashSet<>()); } virtualNetworkFunctionRecord.getLifecycle_event_history().add(lifecycleEvent); virtualNetworkFunctionRecord.setStatus(Status.ERROR); try { saveVirtualNetworkFunctionRecord(); } catch (NotFoundException e1) { log.error(e1.getMessage()); } return new OrVnfmErrorMessage(virtualNetworkFunctionRecord, e.getMessage()); }
private NFVMessage handleVimException(VimException e) { e.printStackTrace(); log.error(e.getMessage()); HistoryLifecycleEvent lifecycleEvent = new HistoryLifecycleEvent(); lifecycleEvent.setEvent(Event.ERROR.name()); SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd'-'HH:mm:ss:SSS'-'z"); lifecycleEvent.setExecutedAt(format.format(new Date())); lifecycleEvent.setDescription(e.getMessage()); VNFCInstance vnfcInstance = e.getVnfcInstance(); if (vnfcInstance != null) { log.info("The VM was not correctly deployed. ExtId is: " + vnfcInstance.getVc_id()); log.debug("Details are: " + vnfcInstance); for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) { if (vdu.getId().equals(e.getVirtualDeploymentUnit().getId())) { if (vdu.getVnfc_instance() == null) { vdu.setVnfc_instance(new LinkedHashSet<>()); } vdu.getVnfc_instance().add(vnfcInstance); log.debug("Found VDU and set vnfcInstance"); } } } virtualNetworkFunctionRecord.getLifecycle_event_history().add(lifecycleEvent); try { saveVirtualNetworkFunctionRecord(); } catch (NotFoundException e1) { log.error(e1.getLocalizedMessage()); } return new OrVnfmErrorMessage(virtualNetworkFunctionRecord, e.getMessage()); }