summaryrefslogtreecommitdiffstats
path: root/cmso-service/src
diff options
context:
space:
mode:
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", "");