/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2020 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
-package org.onap.so.adapters.etsisol003adapter.lcm.extclients;
+package org.onap.so.adapters.etsi.sol003.adapter.common.configuration;
import java.util.Iterator;
-import org.onap.so.adapters.etsisol003adapter.lcm.v1.JSON;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
* that will be useful to some such classes.
*
* @author gareth.roper@est.tech
+ * @author Waqas Ikram (waqas.ikram@est.tech)
*/
public abstract class AbstractServiceProviderConfiguration {
iterator.remove();
}
}
- final Gson gson = new JSON().getGson();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(getGson()));
}
+
+ protected abstract Gson getGson();
+
}
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.so.adapters.etsisol003adapter.lcm.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* Configures the HttpRestServiceProvider for REST call to a VNFM.
}
}
+ @Override
+ protected Gson getGson() {
+ return new JSON().getGson();
+ }
+
}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.etsisol003adapter.pkgm.extclients;
-
-import java.time.LocalDateTime;
-import java.util.Iterator;
-import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
-import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.GsonHttpMessageConverter;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.web.client.RestTemplate;
-import org.threeten.bp.OffsetDateTime;
-import com.google.gson.Gson;
-
-/**
- * A base class that can be extended by classes for configuring HttpRestServiceProvider classes. Provides common methods
- * that will be useful to some such classes.
- *
- * @author gareth.roper@est.tech
- */
-public abstract class AbstractServiceProviderConfiguration {
- private final JSON.OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new JSON.OffsetDateTimeTypeAdapter();
-
- public void setGsonMessageConverter(final RestTemplate restTemplate) {
- final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
- while (iterator.hasNext()) {
- if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
- iterator.remove();
- }
- }
- final Gson gson = JSON.createGson().registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
- .registerTypeAdapter(LocalDateTime.class,
- new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter())
- .create();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
- }
-}
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
-import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
-import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.GsonHttpMessageConverter;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
/**
* Configures the HttpRestServiceProvider to make REST calls to the ETSI Catalog Manager
}
- public void setGsonMessageConverter(final RestTemplate restTemplate) {
- final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
- while (iterator.hasNext()) {
- if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
- iterator.remove();
- }
- }
- final Gson gson = new GsonBuilder().create();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ @Override
+ protected Gson getGson() {
+ return new JSON().getGson();
}
}
package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
*/
@Configuration
public class VnfmHttpServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
+ private final JSON.OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new JSON.OffsetDateTimeTypeAdapter();
+
public static final String VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN = "vnfmAdapterHttpServiceProvider";
@Bean
return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
}
+ @Override
+ protected Gson getGson() {
+ return JSON.createGson().registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
+ .registerTypeAdapter(LocalDateTime.class,
+ new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter())
+ .create();
+ }
+
}
private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
- if (network.getNetworkType().equals(NetworkType.VLAN)) {
+ if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
vlan.setVlanInterface(network.getName() + network.getProviderSegID());
vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
lIf.setVlans(vlans);
}
// Build sriov-vf to the l-interface
- if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
+ if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
SriovVfs sriovVfs = new SriovVfs();
// JAXB does not generate setters for list, however getter ensures its creation.
// Thus, all list manipulations must be made on live list.
import org.junit.rules.ExpectedException;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import static org.junit.Assert.assertNotNull;
public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
msoRequest.setServiceInstanceId("12345");
instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId",
msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
+ assertNotNull(msoRequest);
}
}
import org.springframework.beans.factory.annotation.Autowired;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
+import static org.junit.Assert.assertNotNull;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
@Test
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, null, Boolean.TRUE, Boolean.FALSE,
msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
+ assertNotNull(map);
}
@Test
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.FALSE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(msoRequest);
}
@Test
} catch (Exception e) {
}
+ assertNotNull(outputs);
}
private VfModuleCustomization getVfModuleCustomization() {
}
// check if the resource contains vf-module
- if (vnfResource != null && vnfResource.getVfModules() != null) {
+ if (isVnfResourceWithVfModule(vnfResource)) {
sequencedResourceList.addAll(vnfResource.getVfModules());
}
return sequencedResourceList;
}
+ private static boolean isVnfResourceWithVfModule(VnfResource vnfResource) {
+ return vnfResource != null && vnfResource.getVfModules() != null;
+ }
+
private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) {
List<Resource> sequencedResourceList = new ArrayList<>();
- if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) {
+ if (isVnfGroupOrderFilled(vnfResource)) {
String[] grpSequence = vnfResource.getGroupOrder().split(",");
for (String grpType : grpSequence) {
for (GroupResource gResource : vnfResource.getGroups()) {
}
return sequencedResourceList;
}
+
+ private static boolean isVnfGroupOrderFilled(VnfResource vnfResource) {
+ return vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder());
+ }
}
import org.onap.so.bpmn.core.domain.ResourceType;
import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.domain.VnfcResource;
+import org.onap.so.bpmn.core.domain.ModuleResource;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
List<Resource> instanceResourceList =
InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest);
- Assert.assertEquals(7, instanceResourceList.size());
+ Assert.assertEquals(9, instanceResourceList.size());
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
Assert.assertEquals("device", instanceResourceList.get(1).getModelInfo().getModelName());
Assert.assertEquals("sitewan", instanceResourceList.get(2).getModelInfo().getModelName());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType());
Assert.assertEquals("sitewan", instanceResourceList.get(3).getModelInfo().getModelName());
- Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(4).getResourceType());
- Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(5).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(4).getResourceType());
+ Assert.assertEquals("dummy", instanceResourceList.get(4).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(5).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(6).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(7).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(8).getResourceType());
}
// Test when PK is empty
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
}
+ @Test
+ public void testSimpleVFResourceWithGroup() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+
+ createGroupKeyResource(vnfResource);
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
+ }
+
+ @Test
+ public void testVFResourceWithEmptyGroup() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list2,INDEX,name]\"}");
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ @Test
+ public void testVFResourceWithModule() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+
+ // Come from package org.onap.so.bpmn.core.domain.VnfResourceTest
+ List<ModuleResource> moduleResources;
+ moduleResources = new ArrayList<>();
+ ModuleResource moduleresource = getModuleResource();
+ moduleResources.add(moduleresource);
+ vnfResource.setModules(moduleResources);
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.MODULE, instanceResourceList.get(1).getResourceType());
+ }
+
+ private ModuleResource getModuleResource() {
+ ModuleResource moduleresource = new ModuleResource();
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+ return moduleresource;
+ }
+
// Test when PK is not empty and PK does not contain any groups
@Test
public void testVFWithEmptyGroupResource() throws IOException {
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
- VnfcResource vnfcResource = new VnfcResource();
- vnfcResource.setResourceInput("{\"a\":\"test|default_value\"}");
- GroupResource groupResource = new GroupResource();
- groupResource.setVnfcs(Arrays.asList(vnfcResource));
- ModelInfo wanModel = new ModelInfo();
- wanModel.setModelName("wan");
- groupResource.setModelInfo(wanModel);
-
- vnfResource.setGroupOrder("wan");
- vnfResource.setGroups(Arrays.asList(groupResource));
+ createGroupKeyResource(vnfResource);
List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
Assert.assertEquals(2, instanceResourceList.size());
Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
}
+ private void createGroupKeyResource(VnfResource vnfResource) {
+ GroupResource groupResource = prepareGroupResource("{\"a\":\"test|default_value\"}", "wan");
+
+ vnfResource.setGroupOrder("wan");
+ vnfResource.setGroups(Arrays.asList(groupResource));
+ }
+
private VnfResource createResourceSequence() {
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}");
- VnfcResource vnfcResource = new VnfcResource();
- vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}");
+ GroupResource groupResource = prepareGroupResource("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}", "sitewan");
+ GroupResource groupResource2 = prepareGroupResource("{\"a\":\"[sdwandevice_list,INDEX,test]\"}", "device");
+ GroupResource groupDummyResource = prepareGroupResource("{\"a\":\"[dummy,INDEX,test]\"}", "dummy");
- GroupResource groupResource = new GroupResource();
- groupResource.setVnfcs(Arrays.asList(vnfcResource));
- ModelInfo wanModel = new ModelInfo();
- wanModel.setModelName("sitewan");
- groupResource.setModelInfo(wanModel);
+ vnfResource.setGroupOrder("device,sitewan,dummy");
+ vnfResource.setGroups(Arrays.asList(groupResource, groupResource2, groupDummyResource));
+ return vnfResource;
+ }
+ private GroupResource prepareGroupResource(String sourceInput, String modelName) {
VnfcResource vnfcDeviceResource = new VnfcResource();
- vnfcDeviceResource.setResourceInput("{\"a\":\"[sdwandevice_list,INDEX,test]\"}");
- GroupResource groupResource2 = new GroupResource();
- groupResource2.setVnfcs(Arrays.asList(vnfcDeviceResource));
+ vnfcDeviceResource.setResourceInput(sourceInput);
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcDeviceResource));
ModelInfo deviceModel = new ModelInfo();
- deviceModel.setModelName("device");
- groupResource2.setModelInfo(deviceModel);
-
- vnfResource.setGroupOrder("device,sitewan");
- vnfResource.setGroups(Arrays.asList(groupResource, groupResource2));
- return vnfResource;
+ deviceModel.setModelName(modelName);
+ groupResource.setModelInfo(deviceModel);
+ return groupResource;
}
}
"deviceName":"vCPE",
"portNumer":"0/0/1"
}
+ ],
+ "emptygroup_list2": [
+
],
"sdwanvpnresource_list":[
{
"class":"VNF",
"systemIp":"20.20.20.1"
}
- ]
+ ],
+ "dummy":""
},
{
"sdwansite_emails":"chenchuanyu@huawei.com",
"class":"PNF",
"systemIp":"20.20.20.2"
}
- ]
+ ],
+ "dummy":""
}
]
}
mso:
infra:
auditInventory: false
+ camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A
spring:
datasource:
hikari:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
step: 1m # Step size (i.e. reporting frequency) to use.
+org:
+ onap:
+ so:
+ adapters:
+ network:
+ encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7
checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution)
checkAndSetRequestParam(siRequest,"serviceType",false, execution)
checkAndSetRequestParam(siRequest,"operationId",false, execution)
-
+ checkAndSetRequestParam(siRequest,"scriptName",false, execution)
//prepare init operation status
execution.setVariable("progress", "0")
execution.setVariable("result", "processing")
String profileId = currentNSSI['profileId']
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
+ String scriptName = execution.getVariable("scriptName")
DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
deAllocateNssi.setNsiId(nsiId)
deAllocateNssi.setNssiId(nssiId)
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
+ deAllocateNssi.setScriptName(scriptName)
NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
<bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="start">
<bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing>
<camunda:in source="operationId" target="operationId" />
<camunda:in source="operationType" target="operationType" />
<camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="scriptName" target="scriptName" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing>
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
import java.io.IOException;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.client.sdnc.SDNCClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.jayway.jsonpath.JsonPath;
-import net.minidev.json.JSONArray;
/**
* This class retrieve pre-load data from SDNC using <br/>
private final SDNCClient sdncClient;
+ private final ObjectMapper mapper;
+
@Autowired
public SdncInputParametersProvider(final SDNCClient sdncClient) {
this.sdncClient = sdncClient;
+ this.mapper = new ObjectMapper();
}
@Override
try {
LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
final String jsonResponse = sdncClient.get(url);
-
- final JSONArray vnfParametersArray = JsonPath.read(jsonResponse, VNF_PARAMETERS_PATH);
- if (vnfParametersArray != null) {
- for (int index = 0; index < vnfParametersArray.size(); index++) {
- final Object vnfParametersObject = vnfParametersArray.get(index);
- if (vnfParametersObject instanceof JSONArray) {
- final JSONArray vnfParameters = (JSONArray) vnfParametersObject;
- final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters);
- final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
- final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
- final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
- LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
- return inputParameter;
- }
+ final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
+
+ try {
+
+ if (json != null) {
+ final List<VnfParameter> vnfParametersArray =
+ mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
+ final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
+ final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
+ final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
+ final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
+ LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
+ return inputParameter;
}
+
+ } catch (final IOException exception) {
+ LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
}
} catch (final Exception exception) {
LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
}
- private Map<String, String> getVnfParameterMap(final JSONArray array) {
- try {
- if (array != null) {
- final ObjectMapper mapper = new ObjectMapper();
- final VnfParameter[] readValue = mapper.readValue(array.toJSONString(), VnfParameter[].class);
- LOGGER.debug("Vnf parameters: {}", Arrays.asList(readValue));
- return Arrays.asList(readValue).stream()
- .filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
- .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
- }
- } catch (final IOException exception) {
- LOGGER.error("Unable to parse vnf parameters : {}", array, exception);
+ private Map<String, String> getVnfParameterMap(final List<VnfParameter> array) {
+ if (array != null) {
+ return array.stream().filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
+ .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
}
+
return Collections.emptyMap();
}
package org.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
public class E2EServiceInstanceDeleteRequest {
private String globalSubscriberId;
private String serviceType;
+ @JsonIgnore
+ private String scriptName;
+
public String getGlobalSubscriberId() {
return globalSubscriberId;
}
this.serviceType = serviceType;
}
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
}
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.31.0</version>
-
- <configuration>
+ <configuration combine.self="override">
<verbose>true</verbose>
<apiVersion>1.23</apiVersion>
<pullRegistry>${docker.pull.registry}</pullRegistry>
<pushRegistry>${docker.push.registry}</pushRegistry>
-
<images>
<image>
<name>${docker.image.prefix}/base-image:1.0</name>