diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2020-02-03 14:48:24 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-02-03 14:48:26 -0500 |
commit | b58f841d09e1d832ea4aeae1334f151a98a1f4c8 (patch) | |
tree | d18b6906ed5b2c4ccf5a5876d33907d82b85774e /bpmn/MSOCommonBPMN | |
parent | e9c0b88ed9b0e9a538ee87f25f3ea4c99f853702 (diff) |
modifications to create network to add lob
Add platform and line of business to network
Update to split out network
Issue-ID: SO-2637
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I5cbc3bc77986b6d4d420d2158df46924fcd74c0b
Diffstat (limited to 'bpmn/MSOCommonBPMN')
3 files changed, 49 insertions, 6 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 6b3ad1d528..554e987fc8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -100,6 +100,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); @JsonProperty("vpn-binding") private List<VpnBinding> vpnBindings = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; public ModelInfoNetwork getModelInfoNetwork() { return modelInfoNetwork; @@ -313,6 +317,22 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { return vpnBindings; } + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + @Override public boolean equals(final Object other) { if (!(other instanceof L3Network)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index a4793476e4..145d4c83a7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -915,7 +915,7 @@ public class BBInputSetup implements JavaDelegate { if (network == null && (parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { network = createNetwork(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getResourceId(), - parameter.getInstanceParams()); + parameter.getInstanceParams(), parameter); parameter.getServiceInstance().getNetworks().add(network); } if (network != null) { @@ -924,12 +924,20 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, String networkId, - List<Map<String, String>> instanceParams) { + List<Map<String, String>> instanceParams, BBInputSetupParameter parameter) { lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); L3Network network = new L3Network(); network.setNetworkId(networkId); network.setNetworkName(instanceName); network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (parameter != null) { + if (parameter.getLineOfBusiness() != null) { + network.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(parameter.getLineOfBusiness())); + } + if (parameter.getLineOfBusiness() != null) { + network.setPlatform(this.mapperLayer.mapRequestPlatform(parameter.getPlatform())); + } + } if (instanceParams != null) { for (Map<String, String> params : instanceParams) { network.getCloudParams().putAll(params); @@ -1284,7 +1292,7 @@ public class BBInputSetup implements JavaDelegate { if (collectionNetworkResourceCust != null) { if ((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network network = createNetwork(lookupKeyMap, null, networkId, null); + L3Network network = createNetwork(lookupKeyMap, null, networkId, null, null); serviceInstance.getNetworks().add(network); return network; } else { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index a45e803cf0..1acf4edb4a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -1262,7 +1262,7 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; - L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); + L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null, parameter); SPY_bbInputSetup.populateL3Network(parameter); verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @@ -2832,17 +2832,32 @@ public class BBInputSetupTest { expected.setNetworkId(networkId); expected.setNetworkName(instanceName); expected.setCloudParams(cloudParams); + Platform platform = new Platform(); + platform.setPlatformName("platformName"); + expected.setPlatform(platform); + LineOfBusiness lineOfBusiness = new LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName("lineOfBusiness"); + expected.setLineOfBusiness(lineOfBusiness); expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); List<Map<String, String>> instanceParams = new ArrayList<>(); instanceParams.add(cloudParams); - L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams); + org.onap.so.serviceinstancebeans.Platform platformRequest = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusinessRequest = + new org.onap.so.serviceinstancebeans.LineOfBusiness(); + lineOfBusinessRequest.setLineOfBusinessName("lineOfBusiness"); + platformRequest.setPlatformName("platformName"); + BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) + .setPlatform(platformRequest).setLineOfBusiness(lineOfBusinessRequest).build(); + L3Network actual = + SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams, parameter); assertThat(actual, sameBeanAs(expected)); assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID)); expected.getCloudParams().clear(); - actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null); + + actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null, parameter); assertThat(actual, sameBeanAs(expected)); } |