Search in sources :

Example 11 with Vnfs

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));
}
Also used : Resources(org.onap.so.serviceinstancebeans.Resources) File(java.io.File) Vnfs(org.onap.so.serviceinstancebeans.Vnfs) Test(org.junit.Test)

Example 12 with Vnfs

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));
}
Also used : Resources(org.onap.so.serviceinstancebeans.Resources) File(java.io.File) Vnfs(org.onap.so.serviceinstancebeans.Vnfs) Test(org.junit.Test)

Example 13 with Vnfs

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);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Example 14 with Vnfs

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;
}
Also used : Networks(org.onap.so.serviceinstancebeans.Networks) VfModules(org.onap.so.serviceinstancebeans.VfModules) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Service(org.onap.so.serviceinstancebeans.Service) Vnfs(org.onap.so.serviceinstancebeans.Vnfs)

Aggregations

Vnfs (org.onap.so.serviceinstancebeans.Vnfs)14 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)7 VfModules (org.onap.so.serviceinstancebeans.VfModules)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 Map (java.util.Map)4 Networks (org.onap.so.serviceinstancebeans.Networks)4 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)3 Service (org.onap.so.serviceinstancebeans.Service)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 File (java.io.File)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Test (org.junit.Test)2 NetworkResourceCustomization (org.onap.so.db.catalog.beans.NetworkResourceCustomization)2 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)2 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)2 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)2 ValidationException (org.onap.so.exceptions.ValidationException)2