summaryrefslogtreecommitdiffstats
path: root/cmso-service/src
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-04-02 19:03:03 -0400
committerJerry Flood <jflood@att.com>2019-04-02 19:04:12 -0400
commitc1f470829573d967756d88fb5eff87082528829b (patch)
treeaeb386312c5cc8b67346f0e0bcfbdb90fe7eac17 /cmso-service/src
parentcb0a9f1021977d3d6cd6326541c203cf2913bf47 (diff)
Remove callbackdata from domain data
Issue-ID: OPTFRA-436 Change-Id: I9e679a004dd410d4c944ca0288f405b784f4f99d Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-service/src')
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java32
2 files changed, 20 insertions, 16 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
index 1c3505e..ff27937 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
@@ -180,6 +180,10 @@ public class CmsoOptimizerClient {
debug.debug("Successfully scheduled optimization: " + schedule.getScheduleId());
// Scheduled with optimizer
break;
+ case 200:
+ debug.debug("Successfully completed optimization: " + schedule.getScheduleId());
+ // Scheduled with optimizer
+ break;
case 400: {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setOptimizerStatus("HTTP Status: " + response.getStatus());
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java
index 02b803f..4fccf7e 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java
@@ -206,12 +206,17 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
osm.setUserId(sm.getUserId());
List<NameValue> dd = new ArrayList<>();
List<Map<String, String>> smdd = sm.getDomainData();
+ String callbackData = null;
for (Map<String, String> map : smdd) {
for (String name : map.keySet()) {
if (!name.equals(CmDomainDataEnum.CallbackData.toString())) {
NameValue nv = new NameValue(name, map.get(name));
dd.add(nv);
}
+ else
+ {
+ callbackData= map.get(name);
+ }
}
}
osm.setCommonData(dd);
@@ -250,7 +255,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
for (String node : vdm.getNode()) {
ElementInfo element = new ElementInfo();
element.setElementId(node);
- element.setRequest(getRequestFromCallbackData(node, dd));
+ element.setRequest(getRequestFromCallbackData(node, callbackData));
element.setGroupId(vdm.getGroupId());
elements.add(element);
}
@@ -260,22 +265,17 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
return osm;
}
- private Object getRequestFromCallbackData(String node, List<NameValue> dd)
+ private Object getRequestFromCallbackData(String node, String value)
throws CMSException, JsonParseException, JsonMappingException, IOException {
- for (NameValue nv : dd) {
- if (nv.getName().equals(CmDomainDataEnum.CallbackData.toString())) {
- String value = nv.getValue().toString();
- ObjectMapper om = new ObjectMapper();
- JsonNode json = om.readValue(value, JsonNode.class);
- JsonNode details = json.get("requestDetails");
- int ii = 0;
- for (ii = 0; ii < details.size(); ii++) {
- JsonNode request = details.get(ii);
- String id = request.get("vnfName").asText();
- if (id.equals(node)) {
- return request;
- }
- }
+ ObjectMapper om = new ObjectMapper();
+ JsonNode json = om.readValue(value, JsonNode.class);
+ JsonNode details = json.get("requestDetails");
+ int ii = 0;
+ for (ii = 0; ii < details.size(); ii++) {
+ JsonNode request = details.get(ii);
+ String id = request.get("vnfName").asText();
+ if (id.equals(node)) {
+ return request;
}
}
throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, "CallbackData", "");