aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Varma <vv8305@att.com>2019-04-03 01:42:01 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-03 01:42:01 +0000
commit2bfc71e1c9eb6b746648242e02e88625180490af (patch)
treecd4a7c911f769d55483295a97ffd7317917d8d0f
parentb7fdb7f351980948b4745e6297111e3c2f50417f (diff)
parentc1f470829573d967756d88fb5eff87082528829b (diff)
Merge "Remove callbackdata from domain data"
-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", "");