@Override public void addManagerEndpoint(String endpoint_json) { VnfmManagerEndpoint endpoint = gson.fromJson(endpoint_json, VnfmManagerEndpoint.class); if (endpoint.getEndpointType() == null) { endpoint.setEndpointType(EndpointType.RABBIT); } log.info("Registering endpoint of type: " + endpoint.getType()); try { this.register(endpoint); } catch (AlreadyExistingException e) { log.warn(e.getLocalizedMessage()); } }
@Override public void register(VnfmManagerEndpoint endpoint) throws AlreadyExistingException { log.debug("Persisting: " + endpoint); for (VnfmManagerEndpoint endpointExisting : vnfmEndpointRepository.findAll()) { // TODO: decide whether the type or the endpoint (or both) is the unique identifier. strategy // here is different than in unregister function if (endpointExisting.getEndpoint().equals(endpoint.getEndpoint()) && endpointExisting.getType().equals(endpoint.getType()) && endpointExisting.getEndpointType().equals(endpoint.getEndpointType())) throw new AlreadyExistingException( "VnfmManagerEndpoint " + endpoint + " already exists in the DB"); } endpoint.setActive(true); this.vnfmEndpointRepository.save(endpoint); }
vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType()); } catch (NotFoundException e1) { e1.printStackTrace();
@Scheduled(initialDelay = 30000, fixedDelay = 20000) public void checkHeartBeat() { for (VnfmManagerEndpoint endpoint : vnfmEndpointRepository.findAll()) { if (endpoint.getEndpointType().ordinal() == EndpointType.RABBIT.ordinal()) { if (endpoint.isEnabled()) { try { if (!RabbitManager.getQueues( brokerIp.trim(), username, password, virtualHost, managementPort) .contains(endpoint.getEndpoint())) { if (endpoint.isActive()) { log.info("Set endpoint " + endpoint.getType() + " to unactive"); endpoint.setActive(false); vnfmEndpointRepository.save(endpoint); } } else { if (!endpoint.isActive()) { log.info("Set endpoint " + endpoint.getType() + " to active"); endpoint.setActive(true); vnfmEndpointRepository.save(endpoint); } } } catch (IOException ignored) { log.warn("Not able to list queues, probably " + brokerIp.trim() + " is not reachable."); } } } } } }
private void sendStart(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { VnfmSender vnfmSender; log.info("Calling START to: " + virtualNetworkFunctionRecord.getName() + " after MODIFY"); vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType()); vnfStateHandler.executeAction( vnfmSender.sendCommand( new OrVnfmStartStopMessage(virtualNetworkFunctionRecord, null, Action.START), vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()))); }
@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); }
@Scheduled(initialDelay = 15000, fixedDelay = 20000) public void checkHeartBeat() { for (VnfmManagerEndpoint endpoint : vnfmEndpointRepository.findAll()) { if (endpoint.getEndpointType().ordinal() == EndpointType.REST.ordinal()) { if (endpoint.isEnabled()) { try {
@Override public VnfmSender getVnfmSender(VirtualNetworkFunctionDescriptor vnfd) throws NotFoundException { VnfmManagerEndpoint endpoint = this.getEndpoint(vnfd); if (endpoint == null) { throw new NotFoundException( "VnfManager of type " + vnfd.getType() + " (endpoint = " + vnfd.getEndpoint() + ") is not registered"); } try { return getVnfmSender(endpoint.getEndpointType()); } catch (BeansException e) { throw new NotFoundException(e); } }
private void sendStart(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { VnfmSender vnfmSender; vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType()); log.info( "Calling START to: " + virtualNetworkFunctionRecord.getName() + " because it has 0 dependencies"); log.trace( "VNFR (" + virtualNetworkFunctionRecord.getId() + ") hibernate version is = " + virtualNetworkFunctionRecord.getHbVersion()); vnfStateHandler.executeAction( vnfmSender.sendCommand( new OrVnfmStartStopMessage(virtualNetworkFunctionRecord, null, Action.START), vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()))); }
private void sendStart(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { VnfmSender vnfmSender; vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType()); /*vnfmSender.sendCommand( new OrVnfmGenericMessage(virtualNetworkFunctionRecord, Action.START), vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()));*/ vnfStateHandler.executeAction( vnfmSender.sendCommand( new OrVnfmStartStopMessage(virtualNetworkFunctionRecord, null, Action.START), vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()))); }
try { vnfmSender = generator.getVnfmSender(endpoint.getEndpointType()); } catch (BeansException e) { throw new NotFoundException(e);
vnfmSender = generator.getVnfmSender(endpoint.getEndpointType()); } catch (BeansException e) { throw new NotFoundException(e);
vnfrToNotify = vnfrRepository.save(vnfrToNotify); VnfmManagerEndpoint vnfmManagerEndpoint = vnfmRegister.getVnfm(vnfrToNotify.getEndpoint()); VnfmSender vnfmSender = this.getVnfmSender(vnfmManagerEndpoint.getEndpointType());
@Override @Async public Future<Void> release(VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { VnfmManagerEndpoint endpoint = generator.getVnfm(virtualNetworkFunctionRecord.getEndpoint()); if (endpoint == null) { throw new NotFoundException( "VnfManager of type " + virtualNetworkFunctionRecord.getType() + " (endpoint = " + virtualNetworkFunctionRecord.getEndpoint() + ") is not registered"); } OrVnfmGenericMessage orVnfmGenericMessage = new OrVnfmGenericMessage(virtualNetworkFunctionRecord, Action.RELEASE_RESOURCES); VnfmSender vnfmSender; try { vnfmSender = generator.getVnfmSender(endpoint.getEndpointType()); } catch (BeansException e) { throw new NotFoundException(e); } vnfStateHandler.executeAction(vnfmSender.sendCommand(orVnfmGenericMessage, endpoint)); return new AsyncResult<>(null); }
vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType());
@Override @Async public Future<Void> removeVnfcDependency( VirtualNetworkFunctionRecord virtualNetworkFunctionRecord, VNFCInstance vnfcInstance) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { VnfmManagerEndpoint endpoint = generator.getVnfm(virtualNetworkFunctionRecord.getEndpoint()); if (endpoint == null) { throw new NotFoundException( "VnfManager of type " + virtualNetworkFunctionRecord.getType() + " (endpoint = " + virtualNetworkFunctionRecord.getEndpoint() + ") is not registered"); } OrVnfmScalingMessage message = new OrVnfmScalingMessage(); message.setAction(Action.SCALE_IN); message.setVirtualNetworkFunctionRecord(virtualNetworkFunctionRecord); message.setVnfcInstance(vnfcInstance); VnfmSender vnfmSender; try { vnfmSender = generator.getVnfmSender(endpoint.getEndpointType()); } catch (BeansException e) { throw new NotFoundException(e); } vnfStateHandler.executeAction(vnfmSender.sendCommand(message, endpoint)); return new AsyncResult<>(null); }
VnfmSender vnfmSender = this.getVnfmSender( vnfmRegister.getVnfm(virtualNetworkFunctionRecord.getEndpoint()).getEndpointType());