private static PhysicalNetworkFunctionRecord createPhysicalNetworkFunctionRecord( PhysicalNetworkFunctionDescriptor physicalNetworkFunctionDescriptor) { // TODO implement it return new PhysicalNetworkFunctionRecord(); } }
protected boolean allVnfrInInactive(NetworkServiceRecord nsr) { for (VirtualNetworkFunctionRecord virtualNetworkFunctionRecord : nsr.getVnfr()) { if (virtualNetworkFunctionRecord.getStatus().ordinal() < Status.INACTIVE.ordinal()) { log.trace( "VNFR " + virtualNetworkFunctionRecord.getName() + " is in state: " + virtualNetworkFunctionRecord.getStatus()); return false; } } return true; }
private String getVNFCHostname(NetworkServiceRecord nsr, String vnfcId) { for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) { for (VirtualDeploymentUnit vdu : vnfr.getVdu()) { for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) { if (vnfcInstance.getId().equals(vnfcId)) { return vnfcInstance.getHostname(); } } } } return null; }
@Override public VNFRecordDependency getDependencyForAVNFRecordTarget( VirtualNetworkFunctionRecord virtualNetworkFunctionRecord) { NetworkServiceRecord nsr = nsrRepository.findFirstById(virtualNetworkFunctionRecord.getParent_ns_id()); if (nsr.getStatus().ordinal() != Status.ERROR.ordinal()) { Set<VNFRecordDependency> vnfRecordDependencies = nsr.getVnf_dependency(); for (VNFRecordDependency vnfRecordDependency : vnfRecordDependencies) { vnfRecordDependency = vnfrDependencyRepository.findOne(vnfRecordDependency.getId()); if (vnfRecordDependency.getTarget().equals(virtualNetworkFunctionRecord.getName())) { return vnfRecordDependency; } } } return null; }
private VirtualNetworkFunctionRecord createVNFR() { VirtualNetworkFunctionRecord vnfr = new VirtualNetworkFunctionRecord(); vnfr.setName("testVnfr"); vnfr.setStatus(Status.INITIALIZED); vnfr.setAudit_log("audit_log"); vnfr.setDescriptor_reference("test_dr"); VNFDeploymentFlavour deployment_flavour = new VNFDeploymentFlavour(); deployment_flavour.setFlavour_key("m1.small"); vnfr.setDeployment_flavour_key("m1.small"); return vnfr; }
private VirtualNetworkFunctionRecord getVNFR(NetworkServiceRecord nsr, String vnfrName) throws NotFoundException { for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) { if (vnfr.getName().equalsIgnoreCase(vnfrName)) { return vnfr; } } throw new NotFoundException( "No VNFR with name " + vnfrName + " in NSR " + nsr.getName() + " (" + nsr.getId() + ")"); }
private String getVnfcId() { for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) { for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) { if (this.vnfcInstance.getVc_id().equals(vnfcInstance.getVc_id())) { return vnfcInstance.getId(); } } if (vnfcInstance.getId() != null) { return vnfcInstance.getId(); } } return null; }
private VirtualNetworkFunctionRecord getVnfrTarget( NetworkServiceRecord networkServiceRecord, String target) throws NotFoundException { for (VirtualNetworkFunctionRecord vnfr : networkServiceRecord.getVnfr()) { if (vnfr.getName().equals(target)) { return vnfr; } } throw new NotFoundException("The vnfr with name: " + target + " is not found"); }
private VirtualNetworkFunctionRecord getVirtualNetworkFunctionRecord( String idVnf, NetworkServiceRecord networkServiceRecord) throws NotFoundException { VirtualNetworkFunctionRecord virtualNetworkFunctionRecord = null; for (VirtualNetworkFunctionRecord virtualNetworkFunctionRecord1 : networkServiceRecord.getVnfr()) { if (virtualNetworkFunctionRecord1.getId().equals(idVnf)) { virtualNetworkFunctionRecord = virtualNetworkFunctionRecord1; break; } } if (virtualNetworkFunctionRecord == null) { throw new NotFoundException("No VirtualNetworkFunctionRecord found with id " + idVnf); } return virtualNetworkFunctionRecord; }
private void assertEquals( VirtualLinkRecord virtualLinkRecord_exp, VirtualLinkRecord virtualLinkRecord_new) { Assert.assertEquals(virtualLinkRecord_exp.getVendor(), virtualLinkRecord_new.getVendor()); Assert.assertEquals( virtualLinkRecord_exp.getConnectivity_type(), virtualLinkRecord_new.getConnectivity_type()); Assert.assertEquals( virtualLinkRecord_exp.getConnection(), virtualLinkRecord_new.getConnection()); Assert.assertEquals( virtualLinkRecord_exp.getLeaf_requirement(), virtualLinkRecord_new.getLeaf_requirement()); Assert.assertEquals( virtualLinkRecord_exp.getRoot_requirement(), virtualLinkRecord_new.getRoot_requirement()); Assert.assertEquals(virtualLinkRecord_exp.getVim_id(), virtualLinkRecord_new.getVim_id()); Assert.assertEquals( virtualLinkRecord_exp.getAllocated_capacity(), virtualLinkRecord_new.getAllocated_capacity()); }
private VNFCInstance getVnfcInSuchState(String state) { for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) { for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) { if (vnfcInstance.getState() != null && vnfcInstance.getState().equals(state)) { return vnfcInstance; } } } return null; }
private synchronized NetworkServiceRecord getNetworkServiceRecordInActiveState( String id, String projectId) throws NotFoundException, WrongStatusException { NetworkServiceRecord networkServiceRecord = nsrRepository.findFirstByIdAndProjectId(id, projectId); if (networkServiceRecord == null) { throw new NotFoundException("No NetworkServiceRecord found with ID " + id); } if (networkServiceRecord.getStatus().ordinal() != Status.ACTIVE.ordinal()) { throw new WrongStatusException("NetworkServiceDescriptor must be in ACTIVE state"); } return networkServiceRecord; }
private VirtualNetworkFunctionRecord findVNF( Collection<VirtualNetworkFunctionRecord> listVNF, String id_vnf) throws NotFoundException { for (VirtualNetworkFunctionRecord vnfRecord : listVNF) { if (vnfRecord.getId().equals(id_vnf)) { return vnfRecord; } } throw new NotFoundException("VNFR with id " + id_vnf + " was not found"); } }
@Override protected NFVMessage doWork() throws NsrNotFoundException { log.info("Updated script for VNFR: " + virtualNetworkFunctionRecord.getName()); setHistoryLifecycleEvent(); saveVirtualNetworkFunctionRecord(); return null; }
@Override public void addVnfr( NetworkServiceRecord networkServiceRecord, VirtualNetworkFunctionDescriptor vnfd, DeployNSRBody body, Map<String, Set<String>> vduVimInstances, String monitoringIp) throws NotFoundException, InterruptedException, BadFormatException, ExecutionException { NetworkServiceDescriptor nsd = nsdRepository.findFirstByIdAndProjectId( networkServiceRecord.getDescriptor_reference(), networkServiceRecord.getProjectId()); vnfStateHandler.handleVNF(nsd, networkServiceRecord, body, vduVimInstances, vnfd, monitoringIp); }
@Override public VirtualLinkRecord add(VirtualLinkRecord virtualLinkRecord) { log.trace("Adding VirtualLinkDescriptor " + virtualLinkRecord); log.debug("Adding VirtualLinkDescriptor with Id " + virtualLinkRecord.getId()); return virtualLinkRecordRepository.save(virtualLinkRecord); }
private boolean isModifyHasBeenExecuted(VirtualNetworkFunctionRecord vnfr) { for (HistoryLifecycleEvent historyLifecycleEvent : vnfr.getLifecycle_event_history()) { if (historyLifecycleEvent.getEvent().equalsIgnoreCase("MODIFY") || historyLifecycleEvent.getEvent().equalsIgnoreCase("CONFIGURE")) { return true; } } return false; }
private VNFRecordDependency findVNFD( Collection<VNFRecordDependency> vnf_dependency, String id_vnfd) throws NotFoundException { for (VNFRecordDependency vnfDependency : vnf_dependency) { if (vnfDependency.getId().equals(id_vnfd)) { return vnfDependency; } } throw new NotFoundException("VNFD with id " + id_vnfd + " was not found"); }
private PhysicalNetworkFunctionRecord findPNFD( Collection<PhysicalNetworkFunctionRecord> listPNFR, String id_pnf) throws NotFoundException { for (PhysicalNetworkFunctionRecord pRecord : listPNFR) { if (pRecord.getId().equals(id_pnf)) { return pRecord; } } throw new NotFoundException("PNFD with id " + id_pnf + " was not found"); }
public Set<String> getNotInitializedVnfrSource(Set<String> ids, NetworkServiceRecord nsr) { Set<String> res = new HashSet<>(); for (String sourceName : ids) { log.debug("Looking for VNFR name: " + sourceName); boolean found = false; for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) { if (sourceName.equals(vnfr.getName())) { found = true; if (vnfr.getStatus().ordinal() < Status.INITIALIZED.ordinal()) res.add(vnfr.getName() + nsr.getId()); } } if (!found) res.add(sourceName + nsr.getId()); } if (!res.isEmpty()) log.debug("There are the following not initialized vnfr sources:" + res); return res; }