summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java69
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java44
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java40
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json407
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json41
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java60
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java207
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java156
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java148
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java141
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java36
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java167
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java149
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java158
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java152
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
36 files changed, 741 insertions, 1940 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 22ce6d9781..93460ff119 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -23,21 +23,11 @@
package org.onap.so.openstack.utils;
-import com.woorea.openstack.base.client.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
-import com.woorea.openstack.quantum.Quantum;
-import com.woorea.openstack.quantum.model.Network;
-import com.woorea.openstack.quantum.model.Networks;
-import com.woorea.openstack.quantum.model.Segment;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
+import java.util.Optional;
+
import org.onap.so.cloud.CloudConfig;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
@@ -62,6 +52,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Port;
+import com.woorea.openstack.quantum.model.Segment;
+
@Component
public class MsoNeutronUtils extends MsoCommonUtils
{
@@ -211,6 +215,24 @@ public class MsoNeutronUtils extends MsoCommonUtils
throw me;
}
}
+
+ public Optional<Port> getNeutronPort(String neutronPortId, String tenantId, String cloudSiteId)
+ {
+ try {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ () -> new MsoCloudSiteNotFound(cloudSiteId));
+ Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+ Port port = findPortById (neutronClient, neutronPortId);
+ if (port == null) {
+ return Optional.empty();
+ }
+ return Optional.of(port);
+ }
+ catch (RuntimeException | MsoException e) {
+ logger.error("Error retrieving neutron port", e);
+ return Optional.empty();
+ }
+ }
/**
* Delete the specified Network (by ID) in the given cloud.
@@ -488,6 +510,29 @@ public class MsoNeutronUtils extends MsoCommonUtils
}
}
}
+
+
+ private Port findPortById (Quantum neutronClient, String neutronPortId)
+ {
+ if (neutronPortId == null) {
+ return null;
+ }
+
+ try {
+ OpenStackRequest<Port> request = neutronClient.ports().show(neutronPortId);
+ Port port = executeAndRecordOpenstackRequest(request);
+ return port;
+ }
+ catch (OpenStackResponseException e) {
+ if (e.getStatus() == 404) {
+ return null;
+ } else {
+ logger.error("{} {} Openstack Error, GET Neutron Port By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
+ ErrorCode.DataError.getValue(), neutronPortId, e);
+ throw e;
+ }
+ }
+ }
/*
* Find a network (or query its existence) by its Name. This method avoids an
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 19e3ab71f5..72dee07379 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -34,6 +34,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,7 @@ import com.woorea.openstack.heat.model.Link;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@Component
public class HeatStackAudit {
@@ -55,6 +57,9 @@ public class HeatStackAudit {
protected MsoHeatUtils heat;
@Autowired
+ protected MsoNeutronUtils neutron;
+
+ @Autowired
protected AuditVServer auditVservers;
public boolean auditHeatStackCreate(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
@@ -82,8 +87,9 @@ public class HeatStackAudit {
if(novaResources.isEmpty())
return true;
else{
+ List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources,cloudRegion,tenantId);
List<Resource> resourceGroups = extractResourceGroups(resources);
- Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources);
+ Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources,neutronPortDetails);
Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
vserversToAudit);
if(isCreateAudit){
@@ -186,18 +192,16 @@ public class HeatStackAudit {
lInterface.getInterfaceId(),subinterfaceStack.getId());
}
- protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources) {
+ protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources, List<Optional<Port>> neutronPortDetails) {
Set<Vserver> vserversToAudit = new HashSet<>();
for (Resource novaResource : novaResources) {
Vserver auditVserver = new Vserver();
auditVserver.setLInterfaces(new LInterfaces());
auditVserver.setVserverId(novaResource.getPhysicalResourceId());
- Stream<Resource> filteredNeutronNetworks = resources.getList().stream()
- .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId()))
- .filter(resource -> "OS::Neutron::Port".equals(resource.getType()));
- filteredNeutronNetworks.forEach(network -> {
+ Stream<Port> filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails);
+ filteredNeutronPorts.forEach(port -> {
LInterface lInterface = new LInterface();
- lInterface.setInterfaceId(network.getPhysicalResourceId());
+ lInterface.setInterfaceId(port.getId());
auditVserver.getLInterfaces().getLInterface().add(lInterface);
});
vserversToAudit.add(auditVserver);
@@ -205,6 +209,31 @@ public class HeatStackAudit {
return vserversToAudit;
}
+ /**
+ * @param novaResource Single openstack resource that is of type Nova
+ * @param neutronPorts List of Neutron ports created within the stack
+ * @return Filtered list of neutron ports taht relate to the nova server in openstack
+ */
+ protected Stream<Port> filterNeutronPorts(Resource novaResource, List<Optional<Port>> neutronPorts) {
+ List<Port> filteredNeutronPorts = neutronPorts.stream().filter(Optional::isPresent).map(Optional::get)
+ .collect(Collectors.toList());
+ return filteredNeutronPorts.stream()
+ .filter(port -> port.getDeviceId().equalsIgnoreCase(novaResource.getPhysicalResourceId()));
+ }
+
+ /**
+ * @param resources Resource stream created by the stack in openstack
+ * @param cloudSiteId Unique site id to identify which openstack we talk to
+ * @param tenantId The tenant within the cloud we are talking to where resouces exist
+ * @return List of optional neutron ports found within the cloud site and tenant
+ */
+ protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources,String cloudSiteId,String tenantId){
+ return resources.getList().stream()
+ .filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
+ .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),cloudSiteId,tenantId)).collect(Collectors.toList());
+
+ }
+
protected Optional<String> extractResourcePathFromHref(String href) {
try {
Optional<String> stackPath = extractStackPathFromHref(href);
@@ -234,3 +263,4 @@ public class HeatStackAudit {
}
}
+
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index 5eea46d09f..987e4cf76d 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -42,6 +43,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -49,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -61,6 +64,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
private MsoHeatUtils msoHeatUtilsMock;
@Mock
+ private MsoNeutronUtils neutronUtilsMock;
+
+ @Mock
private AuditVServer auditVserver;
private static final String cloudRegion = "cloudRegion";
@@ -72,10 +78,32 @@ public class HeatStackAuditTest extends HeatStackAudit {
private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ private List<Optional<Port>> portList = new ArrayList<>();
+
@Before
public void setup() throws Exception{
resources= objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class);
+ Port neutronPort1 =stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class);
+ doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock).getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion,tenantId);
+ Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class);
+ doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock).getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion,tenantId);
+ Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class);
+ doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock).getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion,tenantId);
+ Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class);
+ doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock).getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion,tenantId);
+ Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class);
+ doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock).getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion,tenantId);
+ Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class);
+ doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock).getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion,tenantId);
+
+ portList.add(Optional.empty());
+ portList.add(Optional.of(neutronPort1));
+ portList.add(Optional.of(neutronPort2));
+ portList.add(Optional.of(neutronPort3));
+ portList.add(Optional.of(neutronPort4));
+ portList.add(Optional.of(neutronPort5));
+ portList.add(Optional.of(neutronPort6));
}
@Test
@@ -111,13 +139,13 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -187,7 +215,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class);
doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class);
- Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources,portList);
Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit);
String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
@@ -219,7 +247,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_service1_port_0 = new LInterface();
@@ -227,7 +255,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -244,7 +272,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
expectedVservers.add(vServer1);
- Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources,portList);
assertThat(actualVservers, sameBeanAs(expectedVservers));
}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 22e66d41bb..3366ce4a05 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -1,6 +1,6 @@
{
- "resources": [
- {
+ "resources": [
+ {
"links": [
{
"href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id",
@@ -22,207 +22,208 @@
"resource_type": "OS::Heat::RandomString",
"updated_time": "2019-02-07T22:56:12Z"
},
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_trusted_port_0",
+ "physical_resource_id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_trusted_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_service1_port_0",
+ "physical_resource_id": "36551a08-592c-4329-ab75-6c594420754c",
+ "required_by": [
+ "ssc_1_subint_service1_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service1_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
+ "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_1",
+ "physical_resource_id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
+ "rel": "self"
+ },
{
- "resource_name": "ssc_1_trusted_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_trusted_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service1_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service1_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service1_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "27391d94-33af-474a-927d-d409249e8fd3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "resource_type": "OS::Heat::ResourceGroup"
- },
- {
- "resource_name": "ssc_1_mgmt_port_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_mgmt_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service2_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service2_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service2_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_int_ha_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_int_ha_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_server_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_server_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "resource_type": "OS::Nova::Server"
- },
- {
- "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
- "resource_type": "OS::Heat::ResourceGroup"
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_0",
+ "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
}
- ]
+ ],
+ "logical_resource_id": "ssc_1_service2_port_0",
+ "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "required_by": [
+ "ssc_1_subint_service2_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service2_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_int_ha_port_0",
+ "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_int_ha_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_server_1",
+ "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "required_by": [],
+ "resource_name": "ssc_server_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Nova::Server",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
+ "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ }
+ ]
}
+
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
new file mode 100644
index 0000000000..e4bd83c21d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
new file mode 100644
index 0000000000..376a526133
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "27391d94-33af-474a-927d-d409249e8fd3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
new file mode 100644
index 0000000000..f0549216be
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
new file mode 100644
index 0000000000..fa10b0c864
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
new file mode 100644
index 0000000000..54a9ee8404
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
new file mode 100644
index 0000000000..c47dfd755b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index 4554835b33..2e1fc97336 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -76,5 +76,10 @@
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
index 4dabec3e9b..77a3f21dca 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
@@ -21,14 +21,72 @@
package org.onap.so.adapters.vnfmadapter.rest;
import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import java.util.UUID;
+import javax.validation.Valid;
+import javax.ws.rs.core.MediaType;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiParam;
/**
* Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
*/
@Controller
-@RequestMapping(value = BASE_URL)
+@RequestMapping(value = BASE_URL, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class VnfmAdapterController {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterController.class);
+
+ @PostMapping(value = "/vnfs/{vnfId}")
+ public ResponseEntity<CreateVnfResponse> vnfCreate(
+ @ApiParam(value = "The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.",
+ required = true) @PathVariable("vnfId") final String vnfId,
+ @ApiParam(value = "VNF creation parameters",
+ required = true) @Valid @RequestBody final CreateVnfRequest createVnfRequest,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single top level invocation of ONAP",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.REQUEST_ID,
+ required = false) final String requestId,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies the client application user agent or user invoking the API",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.PARTNER_NAME,
+ required = false) final String partnerName,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single invocation of a single component",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.INVOCATION_ID,
+ required = false) final String invocationId) {
+
+ setLoggingMDCs(requestId, partnerName, invocationId);
+
+ logger.info("REST request vnfCreate with body: {}", createVnfRequest);
+
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(UUID.randomUUID().toString());
+ clearLoggingMDCs();
+ return new ResponseEntity<>(response, HttpStatus.ACCEPTED);
+ }
+
+ private void setLoggingMDCs(final String requestId, final String partnerName, final String invocationId) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ }
+
+ private void clearLoggingMDCs() {
+ MDC.clear();
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
new file mode 100644
index 0000000000..842b3b56be
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.vnfmadapter.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.MediaType;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class VnfmAdapterControllerTest {
+
+ @LocalServerPort
+ private int port;
+
+ private final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ @Test
+ public void createVnf_ValidRequest_Returns202AndJobId() throws Exception {
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response = restTemplate.exchange(request, CreateVnfResponse.class);
+ assertEquals(202, response.getStatusCode().value());
+ assertNotNull(response.getBody().getJobId());
+ }
+
+ @Test
+ public void createVnf_UnauthorizedUser_Returns401() throws Exception {
+ final TestRestTemplate restTemplateWrongPassword = new TestRestTemplate("test", "wrongPassword");
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response =
+ restTemplateWrongPassword.exchange(request, CreateVnfResponse.class);
+ assertEquals(401, response.getStatusCode().value());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
index 21441b9b73..60385a7990 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
@@ -34,7 +34,6 @@ import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
-import org.onap.so.bpmn.mock.StubResponseAAI
import static org.mockito.Mockito.*
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
index 2bd5181c31..6a4d53654b 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
@@ -37,7 +37,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.bpmn.mock.StubResponseAAI
import static com.github.tomakehurst.wiremock.client.WireMock.*
import static org.mockito.ArgumentMatchers.any
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
deleted file mode 100644
index b9a413fc96..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-/**
- *
- * Mock Resource which is used to start, stop the WireMock Server
- * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
- * You can also selectively setup a stub (use reset before setting up), reset all stubs
- */
-@Path("/server")
-public class MockResource {
-
- private boolean started = false;
- private final Integer defaultPort = 28090;
- private WireMockServer wireMockServer = null;
- private static Map<String,String> mockProperties = new HashMap<>();
-
- public static String getMockProperties(String key) {
- return mockProperties.get(key);
- }
-
- private synchronized void initMockServer(int portNumber) {
- String path = "src/test/resources/" + "__files/sdncSimResponse.xml";
- path = path.substring(0,path.indexOf("__files/"));
-
- wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer")
- .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer"));
- //.withRootDirectory(path));
- //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
- WireMock.configureFor("localhost", portNumber);
- wireMockServer.start();
-// StubResponse.setupAllMocks();
- started= true;
- }
-
- public static void main(String [] args) {
- MockResource mockresource = new MockResource();
- mockresource.start(28090);
- mockresource.reset();
-// mockresource.setupStub("MockCreateTenant");
- }
-
- /**
- * Starts the wiremock server in default port
- * @return
- */
- @GET
- @Path("/start")
- @Produces("application/json")
- public Response start() {
- return startMockServer(defaultPort);
- }
-
- private Response startMockServer(int port) {
- if (!started) {
- initMockServer(defaultPort);
- System.out.println("Started Mock Server in port " + port);
- return Response.status(200).entity("Started Mock Server in port " + port).build();
- } else {
- return Response.status(200).entity("Mock Server is already running").build();
- }
- }
-
- /**
- * Starts the wiremock server in a different port
- * @param portNumber
- * @return
- */
- @GET
- @Path("/start/{portNumber}")
- @Produces("application/json")
- public Response start(@PathParam("portNumber") Integer portNumber) {
- if (portNumber == null) portNumber = defaultPort;
- return startMockServer(portNumber);
- }
-
-
- /**
- * Stop the wiremock server
- * @return
- */
- @GET
- @Path("/stop")
- @Produces("application/json")
- public synchronized Response stop() {
- if (wireMockServer.isRunning()) {
- wireMockServer.stop();
- started = false;
- return Response.status(200).entity("Stopped Mock Server in port ").build();
- }
- return Response.status(200).entity("Mock Server is not running").build();
- }
-
-
- /**
- * Return list of mock properties
- * @return
- */
- @GET
- @Path("/properties")
- @Produces("application/json")
- public Response getProperties() {
- return Response.status(200).entity(mockProperties).build();
- }
-
- /**
- * Update a particular mock property at run-time
- * @param name
- * @param value
- * @return
- */
- @POST
- @Path("/properties/{name}/{value}")
- public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
- if (mockProperties.size() > 50) return Response.serverError().build();
- mockProperties.put(name, value);
- return Response.status(200).build();
- }
-
- /**
- * Reset all stubs
- * @return
- */
- @GET
- @Path("/reset")
- @Produces("application/json")
- public Response reset() {
- WireMock.reset();
- return Response.status(200).entity("Wiremock stubs are reset").build();
- }
-
-
- /**
- * Setup a stub selectively
- * Prior to use, make sure that stub method is available in StubResponse class
- * @param methodName
- * @return
- */
-
- // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
-// @GET
-// @Path("/stub/{methodName}")
-// @Produces("application/json")
-// public Response setupStub(@PathParam("methodName") String methodName) {
-//
-// @SuppressWarnings("rawtypes")
-// Class params[] = {};
-// Object paramsObj[] = {};
-//
-// try {
-// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params);
-// try {
-// thisMethod.invoke(StubResponse.class, paramsObj);
-// } catch (IllegalAccessException | IllegalArgumentException
-// | InvocationTargetException e) {
-// return Response.status(200).entity("Error invoking " + methodName ).build();
-// }
-// } catch (NoSuchMethodException | SecurityException e) {
-// return Response.status(200).entity("Stub " + methodName + " not found...").build();
-// }
-// return Response.status(200).entity("Successfully invoked " + methodName).build();
-// }
-
-
- public static Map<String,String> getMockProperties(){
- return mockProperties;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
deleted file mode 100644
index 6c62920781..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-import org.junit.Ignore;
-
-/**
- *
- * JAX RS Application wiring for Mock Resource
- */
-@ApplicationPath("/console")
-@Ignore
-public class MockResourceApplication extends Application {
-
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public MockResourceApplication() {
- singletons.add(new MockResource());
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
deleted file mode 100644
index 8515307394..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- private String syncResponse;
- private String callbackResponseWrapper;
-
- public SDNCAdapterAsyncTransformer() {
- syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml");
- callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml");
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-vf-module-assign";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String sdncResponse = responseDefinition.getBody();
- System.out.println("sdncResponse:" + sdncResponse);
-
- if (sdncResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- sdncResponse = new String(responseFile);
- System.out.println("sdncResponse(2):" + sdncResponse);
- }
- }
-
- // Next substitute the SDNC response into the callbackResponse (SOAP wrapper).
- // Also, replace the request ID wherever it appears
- String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 2000;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
deleted file mode 100644
index 11788be76e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class);
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterMockTransformer() {
- callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
- }
-
- public SDNCAdapterMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-transformer";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- logger.info("callbackResponse:" + callbackResponse);
-
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace("testRequestId", requestId);
- }
-
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response:" + callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
deleted file mode 100644
index 344c3b521d..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class);
-
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterNetworkTopologyMockTransformer() {
- callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
- }
-
- public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "network-topology-operation-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- logger.info("request callbackUrl : " + callbackUrl);
- logger.info("request requestId : " + requestId);
-
- logger.info("file path/name : " + responseDefinition.getBodyFileName());
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- // extract Response responseRequestId
- String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- logger.info("response requestId: " + responseRequestId);
- logger.info("callbackResponse (before): " + callbackResponse);
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- }
- logger.info("callbackResponse (after):" + callbackResponse);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory()
- .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
index e0c51b794c..66dc1f9910 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
@@ -80,29 +80,6 @@ public class StubResponseSDNCAdapter {
.withBodyFile(responseFile)));
}
- public static void mockSDNCAdapterSimulator(String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
public static void mockSDNCAdapterRest() {
stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
.willReturn(aResponse()
@@ -133,17 +110,4 @@ public class StubResponseSDNCAdapter {
.withHeader("Content-Type", "application/json")));
}
- public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withTransformers("network-topology-operation-transformer")
- .withBodyFile(responseFile)));
- }
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
index 91ecbd23b4..75283515af 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
@@ -53,29 +53,6 @@ public class StubResponseVNFAdapter {
.willReturn(aResponse()
.withStatus(500)));
}
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
deleted file mode 100644
index e190535e7e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates VNF Adapter Asynch Callback response.
- * This should work for any of the operations.
- *
- * This transformer uses the mapped message as the asynchronous response.
- * By definition, the async API sends a 202 (with no body) in the sync response.
- *
- */
-public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- public VnfAdapterAsyncTransformer() {
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-async";
- }
-
- /**
- * Grab the incoming request, extract properties to be copied to the response
- * (request id, vnf id, vf module ID, message ID). Then fetch the actual response
- * body from its FileSource, make the replacements.
- *
- * The sync response is an empty 202 response.
- * The transformed mapped response file is sent asynchronously after a delay.
- *
- * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by
- * default waits for 5s before the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- // Note: Should recognize both XML and JSON. But current BPMN uses XML.
- String notificationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
-
- String vnfId = requestBody.substring(requestBody.indexOf("<vnfId>")+7, requestBody.indexOf("</vnfId>"));
- String vfModuleId = requestBody.substring(requestBody.indexOf("<vfModuleId>")+12, requestBody.indexOf("</vfModuleId>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String requestId = requestBody.substring(requestBody.indexOf("<requestId>")+11, requestBody.indexOf("</requestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String vnfResponse = responseDefinition.getBody();
- System.out.println("VNF Response:" + vnfResponse);
-
- if (vnfResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- vnfResponse = new String(responseFile);
- System.out.println("vnfResponse(2):" + vnfResponse);
- }
- }
-
- // Transform the SDNC response to escape < and >
- vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId);
- vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId);
- vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId);
- vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 5000;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("notification Url:" + notificationUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(202).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
deleted file mode 100644
index 362d9508d3..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterCreateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-create-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before): {}", notifyCallbackResponse);
- logger.info("vnf Response (after): {}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
deleted file mode 100644
index b67f3dcedd..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterDeleteMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-delete-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :",e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
deleted file mode 100644
index 48ced35810..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterQueryMockTransformer.java class
- *
- */
-
-
-public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer
- .class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterQueryMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
- }
-
- public VnfAdapterQueryMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-query-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
-
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- logger.info("Inside Callback" );
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
deleted file mode 100644
index edf05422d1..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterRollbackMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
- }
-
- public VnfAdapterRollbackMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-rollback-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
deleted file mode 100644
index 5693877574..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterUpdateMockTransformer.java class
- *
- */
-public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String requestId;
- private String ackResponse;
-
- public VnfAdapterUpdateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
- }
-
- public VnfAdapterUpdateMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-update-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
-
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 2437476b59..76ca2a89cc 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -88,7 +88,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index 138a20b609..f412720af7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -50,7 +50,7 @@ public class AAIConfigurationResources {
*/
public void createConfiguration(Configuration configuration) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
- configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 99d5fca31f..cae4a19f20 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -42,7 +42,6 @@ import org.springframework.stereotype.Component;
public class SDNCClient {
private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
- private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
@Autowired
private SDNCProperties properties;
@@ -61,6 +60,8 @@ public class SDNCClient {
public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -70,7 +71,8 @@ public class SDNCClient {
public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(url);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -91,7 +93,8 @@ public class SDNCClient {
public String get(String queryLink) throws MapperException, BadResponseException {
String request = "";
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 4aeed71177..4bf445949a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.createConfiguration(configuration);
- assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
+ assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus());
verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index e09dcd8d2d..cd05aa558e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -116,10 +116,11 @@ public class ActivateVnfStatusOperationalEnvironment {
// Update AAI to ACTIVE if Overall success
if (isOverallSuccess) {
- OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(this.queryServiceModelResponse.getVnfOperationalEnvId());
+ String vnfOperationalEnvironmentId = this.queryServiceModelResponse.getVnfOperationalEnvId();
+ OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(vnfOperationalEnvironmentId);
if (aaiOpEnv != null) {
aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE");
- aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+ aaiHelper.updateAaiOperationalEnvironment(vnfOperationalEnvironmentId, aaiOpEnv);
}else {
requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index 6722941f95..c0250f7315 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -240,9 +240,9 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
- stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
activateVnfStatus.execute(requestId, request);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
index 34832b9917..0a74c1d7be 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
@@ -33,10 +33,12 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.openpojo.business.annotation.BusinessKey;
/**
@@ -50,6 +52,8 @@ import com.openpojo.business.annotation.BusinessKey;
*/
@Entity
+
+@JsonInclude(Include.NON_NULL)
@Table(name = "request_processing_data")
public class RequestProcessingData implements Serializable{
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 5958397851..9c29d968c9 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -308,7 +308,7 @@ public class RequestsDbClient {
public void saveRequestProcessingData(RequestProcessingData requestProcessingData) {
HttpHeaders headers = getHttpHeaders();
- URI uri = getUri(endpoint + requestProcessingDataURI);
+ URI uri = getUri(requestProcessingDataURI);
HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers);
restTemplate.postForLocation(uri, entity);
}