diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-24 17:06:39 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-24 17:13:01 -0500 |
commit | 7ab8e99936aa0dd72c8b0f54620bbfef8d7ec455 (patch) | |
tree | 7018cb258315e327f4817a7f01abe344426f4426 | |
parent | 147e9ee814448c8bbec4aa3aeac4b7118b7c1bc7 (diff) |
bugfixes jan 24th
Fix null pointer exception when no requestParameters are specified
Add configurable timer in ActivateVfModuleBB to delay call to SDNC
activate - Use raw slf4j logger - use {} formatting
Add configurable timer in ActivateVfModuleBB to delay call to SDNC
activate - Use raw slf4j logger
Add configurable timer in ActivateVfModuleBB to delay call to SDNC
activate - removed unused references in test class
Add configurable timer in ActivateVfModuleBB to delay call to SDNC
activate
Update PortGroup objects separately from the parent VCE object -
restore setVariable calls back into vce object - they might be needed
later.
Update PortGroup objects separately from the parent VCE object -
updated test class
extra call to get PortGroups
Update PortGroup objects separately from the parent VCE object - use
PortGroup.getInterfaceRole() getter method instead of accessing field
directly.
Update PortGroup objects separately from the parent VCE object
Added back required headers for tenant isolation.
removed workflow exception from outmapping in execute
Fix possible null ptr exception, fix to add braces.
Default networkTechnology in Update as done in Create
Fix failing junits, mapper force upper case nwtech
update exception builder to properly throw exception error message
supporting assign service instance a la carte as well
adding in proper exception handling in network rest v1
add the unassign action to R macro data file
Change-Id: Ide420514f81b8083b4c76c762c064de199624cf7
Issue-ID: SO-1424
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
26 files changed, 451 insertions, 112 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java index 3e4d18cb1b..153ee78cb0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java @@ -54,7 +54,7 @@ public class CreateNetworkRequest extends NetworkRequestCommon { private String networkType; private String networkTypeVersion; private String modelCustomizationUuid; - private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; + private String networkTechnology = "NEUTRON"; private List<Subnet> subnets; private ProviderVlanNetwork providerVlanNetwork; private ContrailNetwork contrailNetwork; @@ -62,7 +62,6 @@ public class CreateNetworkRequest extends NetworkRequestCommon { private Boolean backout = true; private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); - @JsonProperty private boolean contrailRequest; public CreateNetworkRequest() { @@ -125,13 +124,12 @@ public class CreateNetworkRequest extends NetworkRequestCommon { this.networkTypeVersion = networkTypeVersion; } - public NetworkTechnology getNetworkTechnology() { + public String getNetworkTechnology() { return networkTechnology; } - public void setNetworkTechnology(NetworkTechnology networkTechnology) { + public void setNetworkTechnology(String networkTechnology) { this.networkTechnology = networkTechnology; - this.contrailRequest = determineContrail(); } public List<Subnet> getSubnets() { @@ -156,7 +154,6 @@ public class CreateNetworkRequest extends NetworkRequestCommon { public void setContrailNetwork(ContrailNetwork contrailNetwork) { this.contrailNetwork = contrailNetwork; - this.contrailRequest = determineContrail(); } public Boolean getFailIfExists() { @@ -195,12 +192,8 @@ public class CreateNetworkRequest extends NetworkRequestCommon { return this.contrailRequest; } - @JsonIgnore - protected void setContrailRequest(boolean contrailRequest) { + public void setContrailRequest(boolean contrailRequest) { this.contrailRequest = contrailRequest; } - private boolean determineContrail() { - return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); - } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java index a7976840b7..595662251f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java @@ -52,7 +52,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { private String networkType; private String networkTypeVersion; private String modelCustomizationUuid; - private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; + private String networkTechnology = "NEUTRON"; private List<Subnet> subnets; private ProviderVlanNetwork providerVlanNetwork; private ContrailNetwork contrailNetwork; @@ -130,13 +130,12 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { this.networkTypeVersion = networkTypeVersion; } - public NetworkTechnology getNetworkTechnology() { + public String getNetworkTechnology() { return networkTechnology; } - public void setNetworkTechnology(NetworkTechnology networkTechnology) { + public void setNetworkTechnology(String networkTechnology) { this.networkTechnology = networkTechnology; - this.contrailRequest = determineContrail(); } public List<Subnet> getSubnets() { @@ -161,7 +160,6 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { public void setContrailNetwork(ContrailNetwork contrailNetwork) { this.contrailNetwork = contrailNetwork; - this.contrailRequest = determineContrail(); } public Boolean getBackout() { @@ -195,8 +193,4 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { return contrailRequest; } - private boolean determineContrail() { - return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); - } - } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java index 08851c2ce9..5e04fc49ee 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java @@ -38,13 +38,4 @@ public class NetworkRequestTest { assertEquals(true, networkResponse.isSynchronous()); } - @Test - public void isContrailRequest() { - CreateNetworkRequest networkResponse = new CreateNetworkRequest(); - assertEquals(false, networkResponse.isContrailRequest()); - networkResponse.setNetworkTechnology(NetworkTechnology.CONTRAIL); - assertEquals(false, networkResponse.isContrailRequest()); - networkResponse.setContrailNetwork(new ContrailNetwork()); - assertEquals(true, networkResponse.isContrailRequest()); - } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java index 27829a6156..6e2fcb02c9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java @@ -55,9 +55,12 @@ public interface MsoNetworkAdapter @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") String physicalNetworkName, @WebParam(name="vlans") List<Integer> vlans, + @WebParam(name="shared") String shared, + @WebParam(name="external") String external, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="networkId", mode=Mode.OUT) Holder<String> networkId, @WebParam(name="neutronNetworkId", mode=Mode.OUT) Holder<String> neutronNetworkId, @@ -77,6 +80,7 @@ public interface MsoNetworkAdapter @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="policyFqdns") List<String> policyFqdns, @WebParam(name="routeTableFqdns") List<String> routeTableFqdns, @WebParam(name="request") MsoRequest msoRequest, @@ -100,7 +104,10 @@ public interface MsoNetworkAdapter @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @WebParam(name="vlans") @XmlElement(required=true) List<Integer> vlans, + @WebParam(name="shared") String shared, + @WebParam(name="external") String external, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String,String> networkParams, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="subnetIdMap", mode=Mode.OUT) Holder<Map<String, String>> subnetIdMap, @WebParam(name="rollback", mode=Mode.OUT) Holder<NetworkRollback> rollback ) @@ -117,6 +124,7 @@ public interface MsoNetworkAdapter @WebParam(name="shared") String shared, @WebParam(name="external") String external, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String,String> networkParams, @WebParam(name="policyFqdns") List<String> policyFqdns, @WebParam(name="routeTableFqdns") List<String> routeTableFqdns, @WebParam(name="request") MsoRequest msoRequest, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java index 99f590b773..a85da58536 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java @@ -22,6 +22,7 @@ package org.onap.so.adapters.network; import java.util.List; +import java.util.Map; import javax.jws.Oneway; import javax.jws.WebMethod; @@ -56,6 +57,7 @@ public interface MsoNetworkAdapterAsync @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); @@ -71,6 +73,7 @@ public interface MsoNetworkAdapterAsync @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @WebParam(name="vlans") @XmlElement(required=true) List<Integer> vlans, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 608f39adb4..8181714c0a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -122,6 +122,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String,String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) { @@ -145,6 +146,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Holder <String> neutronNetworkId = new Holder <> (); Holder <NetworkRollback> networkRollback = new Holder <> (); Holder <Map <String, String>> subnetIdMap = new Holder <> (); + + HashMap<String, String> params = (HashMap<String,String>) networkParams; + if (params == null) + params = new HashMap<String,String>(); + String shared = null; + String external = null; + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); try { networkAdapter.createNetwork (cloudSiteId, @@ -154,9 +165,12 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkName, physicalNetworkName, vlans, + shared, + external, failIfExists, backout, subnets, + params, msoRequest, networkId, neutronNetworkId, @@ -239,6 +253,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String physicalNetworkName, List <Integer> vlans, List <Subnet> subnets, + Map <String,String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) { @@ -261,6 +276,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { // Synchronous Web Service Outputs Holder <NetworkRollback> networkRollback = new Holder <> (); Holder <Map <String, String>> subnetIdMap = new Holder <> (); + + HashMap<String, String> params = (HashMap<String,String>) networkParams; + if (params == null) + params = new HashMap<String,String>(); + String shared = null; + String external = null; + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); try { networkAdapter.updateNetwork (cloudSiteId, @@ -271,7 +296,10 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkName, physicalNetworkName, vlans, + shared, + external, subnets, + params, msoRequest, subnetIdMap, networkRollback); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 45285d0e51..d250561f16 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -138,9 +138,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkName, String physicalNetworkName, List <Integer> vlans, + String shared, + String external, Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String, String> networkParams, MsoRequest msoRequest, Holder <String> networkId, Holder <String> neutronNetworkId, @@ -155,8 +158,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { physicalNetworkName, vlans, null, - null, - null, + shared, + external, failIfExists, backout, subnets, @@ -182,6 +185,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String, String> networkParams, List <String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, @@ -660,7 +664,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkName, String physicalNetworkName, List <Integer> vlans, + String shared, + String external, List <Subnet> subnets, + Map<String,String> networkParams, MsoRequest msoRequest, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { @@ -673,8 +680,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { physicalNetworkName, vlans, null, - null, - null, + shared, + external, subnets, null, null, @@ -695,6 +702,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String shared, String external, List <Subnet> subnets, + Map<String, String> networkParams, List <String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index effe7a8c61..8d08b3b52c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -168,6 +168,13 @@ public class NetworkAdapterRest { Holder<String> networkFqdn = new Holder<>(); Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> rollback = new Holder<>(); + + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<String,String>(); + } + String shared = null; + String external = null; String cloudsite = req.getCloudSiteId(); if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) { @@ -186,6 +193,20 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } else { + if (ctn.getShared() != null) { + shared = ctn.getShared(); + } + } + if (params.containsKey("external")) { + external = params.get("external"); + } else { + if (ctn.getExternal() != null) { + external = ctn.getExternal(); + } + } adapter.createNetworkContrail( req.getCloudSiteId(), req.getTenantId(), @@ -193,11 +214,12 @@ public class NetworkAdapterRest { req.getModelCustomizationUuid(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), - req.getContrailNetwork().getShared(), - req.getContrailNetwork().getExternal(), + shared, + external, req.getFailIfExists(), req.getBackout(), req.getSubnets(), + params, req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), @@ -212,6 +234,10 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); adapter.createNetwork( req.getCloudSiteId(), req.getTenantId(), @@ -220,9 +246,12 @@ public class NetworkAdapterRest { req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), req.getProviderVlanNetwork().getVlans(), + shared, + external, req.getFailIfExists(), req.getBackout(), req.getSubnets(), + params, req.getMsoRequest(), networkId, neutronNetworkId, @@ -593,6 +622,12 @@ public class NetworkAdapterRest { try { Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> rollback = new Holder<> (); + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<String,String>(); + } + String shared = null; + String external = null; if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { subnetIdMap.value = testMap(); @@ -607,6 +642,20 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } else { + if (ctn.getShared() != null) { + shared = ctn.getShared(); + } + } + if (params.containsKey("external")) { + external = params.get("external"); + } else { + if (ctn.getExternal() != null) { + external = ctn.getExternal(); + } + } adapter.updateNetworkContrail( req.getCloudSiteId(), req.getTenantId(), @@ -615,9 +664,10 @@ public class NetworkAdapterRest { req.getNetworkStackId(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), - req.getContrailNetwork().getShared(), - req.getContrailNetwork().getExternal(), + shared, + external, req.getSubnets(), + params, req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), @@ -629,6 +679,12 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } + if (params.containsKey("external")) { + external = params.get("external"); + } adapter.updateNetwork( req.getCloudSiteId(), req.getTenantId(), @@ -638,7 +694,10 @@ public class NetworkAdapterRest { req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), req.getProviderVlanNetwork().getVlans(), + shared, + external, req.getSubnets(), + params, req.getMsoRequest(), subnetIdMap, rollback); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java index 094d308221..f8dcddde04 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java @@ -25,10 +25,12 @@ import org.junit.Test; import org.onap.so.adapters.vnf.BaseRestTestUtils; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.Subnet; import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; @@ -184,8 +186,11 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { " </soapenv:Body>\n" + "</soapenv:Envelope>") .withStatus(HttpStatus.SC_OK))); + HashMap<String,String> networkParams = new HashMap<String,String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId", + "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<Subnet>(), networkParams, "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @@ -199,14 +204,17 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json"); mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(); + HashMap<String,String> networkParams = new HashMap<String,String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId", + "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), networkParams, "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @Test public void updateNetworkATest_NetworkException() { impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "networkId", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), "messageId", + "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), new HashMap<String,String>(), "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @@ -237,8 +245,10 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { .withStatus(HttpStatus.SC_OK))); mockOpenStackGetStackCreatedVUSP_200(); mockOpenStackPostStacks_200(); + mockOpenStackPostStacks_200(); + HashMap<String,String> networkParams = new HashMap<String,String>(); impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId", + "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @@ -251,15 +261,18 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { .withStatus(HttpStatus.SC_OK))); mockOpenStackGetStackCreatedVUSP_200(); mockOpenStackPostStacks_200(); + HashMap<String,String> networkParams = new HashMap<String,String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId", + "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @Test public void createNetworkATest_NetworkException() { impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), "messageId", + "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), new HashMap<String,String>(), "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java index 6123415b41..3910d9ec44 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java @@ -88,7 +88,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { request.setSkipAAI(true); request.setFailIfExists(false); MsoRequest msoReq = new MsoRequest(); - NetworkTechnology networkTechnology = NetworkTechnology.CONTRAIL; + String networkTechnology = "CONTRAIL"; msoReq.setRequestId(MSO_REQUEST_ID); msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); @@ -296,6 +296,33 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { assertThat(response.getBody(), sameBeanAs(expectedResponse)); } + @Test + public void testCreateNetworkNC_Shared_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { + + mockOpenStackResponseAccess(wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(); + + mockOpenStackGetStackCreatedAppC_200(); + + mockOpenStackGetStackAppC_404(); + + headers.add("Content-Type", MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.APPLICATION_JSON); + + String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json"); + HttpEntity<String> entity = new HttpEntity<String>(request, headers); + + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + @Override protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ return new String(Files.readAllBytes(Paths.get(fileLocation))); diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json new file mode 100644 index 0000000000..3a116a6fc1 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json @@ -0,0 +1,46 @@ +{ + "createNetworkRequest": { + "skipAAI": true, + "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709", + "synchronous": true, + "cloudSiteId": "mtn13", + "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f", + "networkId": "da886914-efb2-4917-b335-c8381528d90b", + "networkName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844", + "networkTechnology": "NEUTRON", + "subnets": [{ + "subnetName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3_subnet_1", + "subnetId": "da60501d-9aa8-48d2-99b7-26644fa01093", + "cidr": "20", + "gatewayIp": "", + "ipVersion": "4", + "enableDHCP": false, + "addrFromStart": true, + "hostRoutes": [] + }], + "providerVlanNetwork": { + "physicalNetworkName": "FALSE", + "vlans": [] + }, + "contrailNetwork": { + "shared": "false", + "external": "false", + "routeTargets": [], + "policyFqdns": [], + "routeTableFqdns": [] + }, + "failIfExists": true, + "backout": false, + "networkParams": { + "shared": "true", + "external": "false" + }, + "msoRequest": { + "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7", + "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6" + }, + "contrailRequest": false + } +}
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json new file mode 100644 index 0000000000..2e5517cebb --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json @@ -0,0 +1,25 @@ +{ + "createNetworkResponse": { + "networkId": "da886914-efb2-4917-b335-c8381528d90b", + "neutronNetworkId": null, + "networkStackId": "stackname/stackId", + "networkFqdn": null, + "networkCreated": true, + "subnetMap": { + + }, + "rollback": { + "networkStackId": "stackname/stackId", + "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f", + "cloudId": "mtn13", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844", + "networkCreated": true, + "msoRequest": { + "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7", + "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6" + } + }, + "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709" + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 42da72528f..adffee6d42 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -61,6 +61,35 @@ public class ExceptionBuilder { msg = msg.concat(exception.getMessage()); buildAndThrowWorkflowException(execution, errorCode, msg); } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try{ + msoLogger.error(exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex){ + //log trace, allow process to complete gracefully + msoLogger.error(ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { if (execution instanceof DelegateExecutionImpl) { @@ -74,6 +103,7 @@ public class ExceptionBuilder { WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); msoLogger.info("Outgoing WorkflowException is " + exception); msoLogger.info("Throwing MSOWorkflowException"); throw new BpmnError("MSOWorkflowException"); diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index ef19e6e35b..3670676a84 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -1,16 +1,16 @@ <?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.8.2"> +<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="2.0.3"> <bpmn:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="ActivateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_0ieafii" sourceRef="ActivateVfModuleBB_Start" targetRef="SetTimerDuration" /> <bpmn:endEvent id="ActivateVfModuleBB_End"> <bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="ActivateVfModule" name=" SDNC Activate (vf module) " camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0e44ywc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yzril6</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UpdateVfModuleActiveStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1j4x1ej</bpmn:incoming> @@ -24,11 +24,24 @@ <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="mso-request-id" target="mso-request-id" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1a495wm</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1yzril6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1j4x1ej</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_1a495wm" sourceRef="ActivateVfModule" targetRef="CallActivity_sdncHandler" /> <bpmn:sequenceFlow id="SequenceFlow_1j4x1ej" sourceRef="CallActivity_sdncHandler" targetRef="UpdateVfModuleActiveStatus" /> + <bpmn:serviceTask id="SetTimerDuration" name="Set Timer Duration" camunda:expression="${ActivateVfModule.setTimerDuration(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0qc2sao</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:intermediateCatchEvent id="Timer" name="Timer"> + <bpmn:incoming>SequenceFlow_0qc2sao</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0e44ywc</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${execution.getVariable("vfModuleActivateTimerDuration")}</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0qc2sao" sourceRef="SetTimerDuration" targetRef="Timer" /> + <bpmn:sequenceFlow id="SequenceFlow_0e44ywc" sourceRef="Timer" targetRef="ActivateVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_1yzril6" sourceRef="ActivateVfModule" targetRef="CallActivity_sdncHandler" /> </bpmn:process> <bpmn:error id="Error_0q258vt" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -40,47 +53,61 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii"> - <di:waypoint xsi:type="dc:Point" x="209" y="120" /> - <di:waypoint xsi:type="dc:Point" x="262" y="120" /> + <di:waypoint x="209" y="120" /> + <di:waypoint x="274" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="190.5" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End"> - <dc:Bounds x="736" y="102" width="36" height="36" /> + <dc:Bounds x="956" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="710" y="142" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule"> - <dc:Bounds x="262" y="80" width="100" height="80" /> + <dc:Bounds x="490" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus"> - <dc:Bounds x="600" y="80" width="100" height="80" /> + <dc:Bounds x="770" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv"> - <di:waypoint xsi:type="dc:Point" x="700" y="120" /> - <di:waypoint xsi:type="dc:Point" x="736" y="120" /> + <di:waypoint x="870" y="120" /> + <di:waypoint x="956" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="673" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler"> - <dc:Bounds x="420" y="80" width="100" height="80" /> + <dc:Bounds x="639" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm"> - <di:waypoint xsi:type="dc:Point" x="362" y="120" /> - <di:waypoint xsi:type="dc:Point" x="420" y="120" /> + <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> + <di:waypoint x="739" y="120" /> + <di:waypoint x="770" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="391" y="99" width="0" height="12" /> + <dc:Bounds x="560" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej"> - <di:waypoint xsi:type="dc:Point" x="520" y="120" /> - <di:waypoint xsi:type="dc:Point" x="600" y="120" /> + <bpmndi:BPMNShape id="ServiceTask_0tg4hn9_di" bpmnElement="SetTimerDuration"> + <dc:Bounds x="274" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_17kjdjp_di" bpmnElement="Timer"> + <dc:Bounds x="417" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="560" y="99" width="0" height="12" /> + <dc:Bounds x="421" y="145" width="29" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0qc2sao_di" bpmnElement="SequenceFlow_0qc2sao"> + <di:waypoint x="374" y="120" /> + <di:waypoint x="417" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e44ywc_di" bpmnElement="SequenceFlow_0e44ywc"> + <di:waypoint x="453" y="120" /> + <di:waypoint x="490" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yzril6_di" bpmnElement="SequenceFlow_1yzril6"> + <di:waypoint x="590" y="120" /> + <di:waypoint x="639" y="120" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> 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 70ae02b0fe..a389e8077b 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 @@ -22,7 +22,6 @@ <camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" /> <camunda:out source="RetryDuration" target="RetryDuration" /> <camunda:in source="suppressRollback" target="suppressRollback" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing> @@ -563,4 +562,4 @@ </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index 1e3f175cf1..f501151ec9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -50,6 +50,7 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ActivateVfModule; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; @@ -171,6 +172,9 @@ public abstract class BaseBPMNTest { protected AAICommonTasks aaiCommonTasks; @MockBean + protected ActivateVfModule activateVfModule; + + @MockBean protected AssignVnf assignVnf; @MockBean diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index 2c2777154d..1bce605076 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -22,22 +22,30 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.Before; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class ActivateVfModuleBBTest extends BaseBPMNTest{ + + @Before + public void before() { + variables.put("vfModuleActivateTimerDuration", "PT2S"); + } + @Test public void sunnyDay() throws InterruptedException, IOException { mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + while(runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult() != null) { + Thread.sleep(1000); + } assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "CallActivity_sdncHandler", + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "SetTimerDuration", "Timer", "ActivateVfModule", "CallActivity_sdncHandler", "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -47,8 +55,11 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + while(runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult() != null) { + Thread.sleep(1000); + } assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("ActivateVfModuleBB_Start", "ActivateVfModule", "UpdateVfModuleActiveStatus") + .hasPassedInOrder("ActivateVfModuleBB_Start", "SetTimerDuration", "Timer", "ActivateVfModule", "UpdateVfModuleActiveStatus") .hasNotPassed("ActivateVfModuleBB_End"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index d821223507..d919c53c9c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -68,8 +68,8 @@ public class NetworkAdapterRestV1 { throw new Exception("No Network Request was created. networkAdapterRequest was null."); } } catch (Exception ex) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex.getStackTrace().toString()); - } + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex); + } } public void processCallback (DelegateExecution execution) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java new file mode 100644 index 0000000000..32c852b0e1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java @@ -0,0 +1,35 @@ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class ActivateVfModule { + + private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class); + + protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration"; + protected static final String DEFAULT_TIMER_DURATION = "PT180S"; + + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private Environment environment; + + + public void setTimerDuration(BuildingBlockExecution execution) { + try { + String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION); + logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration); + execution.setVariable("vfModuleActivateTimerDuration", waitDuration); + } catch (Exception e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index d18fd006f4..bff320a0b6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -303,8 +303,9 @@ public class WorkflowAction { } } - // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it. + if (sIRequest.getRequestDetails().getRequestParameters() != null && + sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); for (Map<String, Object> params : userParams) { if (params.containsKey(HOMINGSOLUTION)) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 794314bf8c..4c84ee4003 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -22,6 +22,7 @@ package org.onap.so.client.adapter.network.mapper; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -92,14 +93,19 @@ public class NetworkAdapterObjectMapper { networkTechnology = l3Network.getNetworkTechnology(); logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology); } - createNetworkRequest.setNetworkTechnology(setNetworkTechnology(networkTechnology)); + if (networkTechnology != null) { + createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase()); + if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) { + createNetworkRequest.setContrailRequest(true); + } + } //build and set Contrail Network ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer); createNetworkRequest.setContrailNetwork(contrailNetwork); - //set Network Parameters from VID request - createNetworkRequest.setNetworkParams(userInput); + //set Network Parameters from VID request, add "shared" and "external" to this map + createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network)); createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext); @@ -112,16 +118,6 @@ public class NetworkAdapterObjectMapper { return createNetworkRequest; } - protected NetworkTechnology setNetworkTechnology(String networkTechnology) { - if(networkTechnology.equalsIgnoreCase("Contrail")) { - return NetworkTechnology.CONTRAIL; - } else if(networkTechnology.equalsIgnoreCase("Neutron")){ - return NetworkTechnology.NEUTRON; - } else { - return NetworkTechnology.VMWARE; - } - } - public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException { DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); @@ -182,7 +178,7 @@ public class NetworkAdapterObjectMapper { updateNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network)); updateNetworkRequest.setProviderVlanNetwork(buildProviderVlanNetwork(l3Network)); updateNetworkRequest.setContrailNetwork(buildContrailNetwork(l3Network, customer)); - updateNetworkRequest.setNetworkParams(userInput); + updateNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network)); updateNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance)); setFlowFlags(updateNetworkRequest, orchestrationContext); @@ -371,4 +367,16 @@ public class NetworkAdapterObjectMapper { updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); //NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default } -}
\ No newline at end of file + + private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) { + if (userInput == null) + userInput = new HashMap<String, String>(); + if (!userInput.containsKey("shared")) { + userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString()); + } + if (!userInput.containsKey("external")) { + userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString()); + } + return userInput; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java new file mode 100644 index 0000000000..57e463c0f8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModuleTest.java @@ -0,0 +1,24 @@ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.so.bpmn.BaseTaskTest; + +public class ActivateVfModuleTest extends BaseTaskTest { + + @InjectMocks + private ActivateVfModule activateVfModule = new ActivateVfModule(); + + @Test + public void setWaitBeforeDurationTest() throws Exception { + when(env.getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION)).thenReturn("PT300S"); + activateVfModule.setTimerDuration(execution); + verify(env, times(1)).getProperty(ActivateVfModule.VF_MODULE_TIMER_DURATION_PATH, ActivateVfModule.DEFAULT_TIMER_DURATION); + assertEquals("PT300S", (String) execution.getVariable("vfModuleActivateTimerDuration")); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index 1a86d713a2..0a6310b364 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -30,6 +30,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -99,24 +100,6 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ } @Test - public void testSetNetworkTechnology() { - String networkTechnology = "Contrail"; - NetworkTechnology expectedNetworkTechnology = NetworkTechnology.CONTRAIL; - NetworkTechnology actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Neutron"; - expectedNetworkTechnology = NetworkTechnology.NEUTRON; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - networkTechnology = "Vmware"; - expectedNetworkTechnology = NetworkTechnology.VMWARE; - actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); - assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); - - } - @Test public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { String cloudRegionPo = "cloudRegionPo"; @@ -129,12 +112,17 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); expectedCreateNetworkRequest.setBackout(false); expectedCreateNetworkRequest.setFailIfExists(true); - expectedCreateNetworkRequest.setNetworkTechnology(NetworkTechnology.CONTRAIL); + expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL"); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId(requestContext.getMsoRequestId()); msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); expectedCreateNetworkRequest.setMsoRequest(msoRequest); expectedCreateNetworkRequest.setSkipAAI(true); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); + expectedCreateNetworkRequest.setNetworkParams(networkParams); expectedCreateNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId"); @@ -148,13 +136,15 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); l3Network.setNetworkTechnology("Contrail"); + l3Network.setIsSharedNetwork(true); + l3Network.setIsExternalNetwork(false); doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint(); doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid(); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); - assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("messageId")); } @Test @@ -243,6 +233,12 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ l3Network.getSubnets().add(actualSubnet); l3Network.getNetworkPolicies().add(networkPolicy); l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference); + l3Network.setIsSharedNetwork(false); + l3Network.setIsExternalNetwork(false); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "false"); + networkParams.put("external", "false"); + networkParams.put("testUserInputKey", "testUserInputValue"); UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest(); expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); @@ -256,7 +252,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedUpdateNetworkRequest.setSubnets(subnets); expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork); - expectedUpdateNetworkRequest.setNetworkParams(userInput); + expectedUpdateNetworkRequest.setNetworkParams(networkParams); expectedUpdateNetworkRequest.setMsoRequest(msoRequest); expectedUpdateNetworkRequest.setSkipAAI(true); expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java index 4f3816ad90..b3bfcc1648 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java @@ -30,6 +30,7 @@ public enum AAIObjectPlurals implements GraphInventoryObjectPlurals { CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers"), GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"), + PORT_GROUP(AAIObjectType.VCE.uriTemplate(), "/port-groups"), PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"), P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"), L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks"), diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index c782ab4904..0237f91833 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -45,6 +45,7 @@ import org.onap.aai.domain.yang.OwningEntity; import org.onap.aai.domain.yang.PInterface; import org.onap.aai.domain.yang.PhysicalLink; import org.onap.aai.domain.yang.Platform; +import org.onap.aai.domain.yang.PortGroup; import org.onap.aai.domain.yang.Project; import org.onap.aai.domain.yang.Pserver; import org.onap.aai.domain.yang.RouteTableReference; @@ -83,6 +84,7 @@ public enum AAIObjectType implements GraphInventoryObjectType { ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, RouteTableReference.class), DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}"), VCE(AAINamespaceConstants.NETWORK, Vce.class), + PORT_GROUP(AAIObjectType.VCE.uriTemplate(), PortGroup.class), VPN_BINDING(AAINamespaceConstants.NETWORK, VpnBinding.class), CONFIGURATION(AAINamespaceConstants.NETWORK, Configuration.class), PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class), diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index 4e8e9562ce..5ead7ddd7f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -21,6 +21,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.helpers; import java.net.URL; +import java.util.UUID; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; @@ -92,6 +93,11 @@ public class SDCClientHelper { HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); httpClient.addBasicAuthHeader(sdcClientAuth, msoKey); + httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId); + httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString()); + httpClient.addAdditionalHeader("Content-Type", SDCClientHelper.SDC_CONTENT_TYPE); + httpClient.addAdditionalHeader("Accept", SDCClientHelper.SDC_ACCEPT_TYPE); + httpClient.addAdditionalHeader("USER_ID", sdcActivateUserId); Response apiResponse = setHttpPostResponse(httpClient, jsonPayload); int statusCode = apiResponse.getStatus();; |