diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-14 09:21:10 -0400 |
---|---|---|
committer | Boslet, Cory (cb645j) <cb645j@att.com> | 2019-04-23 14:31:16 -0500 |
commit | 279c53ce4ff89ae58cb87d1458e538f686031d65 (patch) | |
tree | cdbed4c17e5a470eb0adc15e7b0fed25bc91b2ab /bpmn/so-bpmn-tasks/src/main/java | |
parent | 48478b9531fb2901c392ce1142f9443b5d805148 (diff) |
Sniro BB now supports sole service proxies
Enhanced sniro BB to account for sole service proxies to support 1908.
Change-Id: I4bf57c7c43de755be03d2284cde321d182255ceb
Issue-ID: SO-1790
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java | 33 | ||||
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java | 14 |
2 files changed, 44 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 29037980cc..a927767ec7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -334,6 +334,18 @@ public class SniroHomingV2 { } } } + List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies(); + if (!serviceProxies.isEmpty()) { + logger.debug("Adding service proxies to placement demands list"); + for (ServiceProxy sp : serviceProxies) { + if (isBlank(sp.getId())) { + sp.setId(UUID.randomUUID().toString()); + } + Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy()); + addCandidates(sp, demand); + placementDemands.add(demand); + } + } return placementDemands; } @@ -400,6 +412,7 @@ public class SniroHomingV2 { private void addCandidates(SolutionCandidates candidates, Demand demand) { List<Candidate> required = candidates.getRequiredCandidates(); List<Candidate> excluded = candidates.getExcludedCandidates(); + List<Candidate> existing = candidates.getExistingCandidates(); if (!required.isEmpty()) { List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); @@ -424,7 +437,18 @@ public class SniroHomingV2 { } demand.setExcludedCandidates(cans); } - // TODO support existing candidates + if (!existing.isEmpty()) { + List<org.onap.so.client.sniro.beans.Candidate> cans = + new ArrayList<org.onap.so.client.sniro.beans.Candidate>(); + for (Candidate c : existing) { + org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); + can.setIdentifierType(c.getIdentifierType()); + can.setIdentifiers(c.getIdentifiers()); + can.setCloudOwner(c.getCloudOwner()); + cans.add(can); + } + demand.setExistingCandidates(cans); + } } /** @@ -462,6 +486,7 @@ public class SniroHomingV2 { List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks(); List<AllottedResource> allottes = serviceInstance.getAllottedResources(); List<GenericVnf> vnfs = serviceInstance.getVnfs(); + List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies(); logger.debug("Processing placement solution " + i + 1); for (int p = 0; p < placements.length(); p++) { @@ -502,6 +527,12 @@ public class SniroHomingV2 { break search; } } + for (ServiceProxy proxy : serviceProxies) { + if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) { + proxy.setServiceInstance(setSolution(solutionInfo, placement)); + break search; + } + } } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java index 19378cdbfa..fe2b63ff92 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java @@ -7,9 +7,9 @@ * 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. @@ -38,6 +38,8 @@ public class Demand implements Serializable { private List<Candidate> requiredCandidates; @JsonProperty("excludedCandidates") private List<Candidate> excludedCandidates; + @JsonProperty("existingCandidates") + private List<Candidate> existingCandidates; public List<Candidate> getRequiredCandidates() { @@ -80,4 +82,12 @@ public class Demand implements Serializable { this.modelInfo = modelInfo; } + public List<Candidate> getExistingCandidates() { + return existingCandidates; + } + + public void setExistingCandidates(List<Candidate> existingCandidates) { + this.existingCandidates = existingCandidates; + } + } |