use of org.onap.so.serviceinstancebeans.Vnfs in project so by onap.
the class BBInputSetupTest method testVnfsByKey.
@Test
public void testVnfsByKey() throws IOException {
org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
Resources resources = serviceMacro.getResources();
Vnfs expectedVnf = resources.getVnfs().get(0);
assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByKey("ab153b6e-c364-44c0-bef6-1f2982117f04", resources));
}
use of org.onap.so.serviceinstancebeans.Vnfs in project so by onap.
the class BBInputSetupTest method testFindVnfsByInstanceName.
@Test
public void testFindVnfsByInstanceName() throws IOException {
org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
Resources resources = serviceMacro.getResources();
Vnfs expectedVnf = resources.getVnfs().get(0);
assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByInstanceName("vmxnjr001", resources));
}
use of org.onap.so.serviceinstancebeans.Vnfs in project so by onap.
the class ConfigureInstanceParamsForVnfTest method createVnfs.
private List<Vnfs> createVnfs() {
Vnfs vnf1 = new Vnfs();
vnf1.setInstanceName(VNF_1_INSTANCE_NAME);
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(VNF_1_CUSTOMIZATION_ID);
vnf1.setModelInfo(modelInfo);
vnf1.setInstanceParams(VNF_1_INSTANCE_PARAMS);
Vnfs vnf2 = new Vnfs();
modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(VNF_2_CUSTOMIZATION_ID);
vnf2.setModelInfo(modelInfo);
vnf2.setInstanceName(VNF_2_INSTANCE_NAME);
vnf2.setInstanceParams(VNF_2_INSTANCE_PARAMS);
return Arrays.asList(vnf1, vnf2);
}
use of org.onap.so.serviceinstancebeans.Vnfs in project so by onap.
the class RequestHandlerUtils method configureCloudConfig.
protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
for (Map<String, Object> params : reqParams.getUserParams()) {
if (params.containsKey("service")) {
Service service = serviceMapper(params);
Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
if (targetConfiguration.isPresent()) {
return targetConfiguration.get();
} else {
for (Networks network : service.getResources().getNetworks()) {
targetConfiguration = addCloudConfig(network.getCloudConfiguration());
if (targetConfiguration.isPresent()) {
return targetConfiguration.get();
}
}
for (Vnfs vnf : service.getResources().getVnfs()) {
targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
if (targetConfiguration.isPresent()) {
return targetConfiguration.get();
}
for (VfModules vfModule : vnf.getVfModules()) {
targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
if (targetConfiguration.isPresent()) {
return targetConfiguration.get();
}
}
}
}
}
}
return null;
}
Aggregations