private void listVnfms() { String line = String.format("%20s%20s%20s", "Vnfm type", "active", "enable"); System.out.println(line); for (VnfmManagerEndpoint endpoint : vnfmEndpointRepository.findAll()) { System.out.println( String.format( "%20s%20s%20s", endpoint.getType(), endpoint.isActive(), endpoint.isEnabled())); } }
public void checkEndpoint(String endpointName, Iterable<VnfmManagerEndpoint> endpoints) throws NotFoundException { boolean found = false; for (VnfmManagerEndpoint endpoint : endpoints) { log.debug("Check if VNFM is registered: " + endpoint.getType() + " == " + endpointName); if (endpoint.getType().equals(endpointName) && endpoint.isActive() && endpoint.isEnabled()) { found = true; break; } } if (!found) { throw new NotFoundException( "VNFManager with endpoint: " + endpointName + " is not registered, not enabled or not active."); } if (!found) { throw new NotFoundException("No VNFManagers were found"); } }
public void checkEndpoint( NetworkServiceDescriptor networkServiceDescriptor, Iterable<VnfmManagerEndpoint> endpoints) throws NotFoundException { // since the check for existence of VNFDs is done prior to this method call, we can assume that // at least one VNFD // exists if (networkServiceDescriptor.getVnfd().size() == 0) { throw new RuntimeException( "The NSD contains no VNFDs. This exception is not expected to be thrown at any time. If it is, you found a " + "bug."); } boolean found = false; for (VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor : networkServiceDescriptor.getVnfd()) { for (VnfmManagerEndpoint endpoint : endpoints) { if (endpoint.getType().equals(virtualNetworkFunctionDescriptor.getEndpoint()) && endpoint.isActive() && endpoint.isEnabled()) { found = true; break; } } if (!found) { throw new NotFoundException( "VNFManager with endpoint: " + virtualNetworkFunctionDescriptor.getEndpoint() + " is not registered or not enabled or not active."); } } }
@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."); } } } } } }
for (VnfmManagerEndpoint endpoint : vnfmEndpointRepository.findAll()) { if (endpoint.getEndpointType().ordinal() == EndpointType.REST.ordinal()) { if (endpoint.isEnabled()) { try { URL url = new URL(endpoint.getEndpoint());