diff options
author | Shankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com> | 2019-03-26 01:23:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-26 01:23:55 +0000 |
commit | 5a0a92bc0fc09648addba82aacada5e8d72de9a9 (patch) | |
tree | 3d52996a8620a956ed88c52f85ba9b099ee1af50 /cmso-service/src/main/java | |
parent | 52f7b81b377d095267f65cd9bb90c6c9965bf04c (diff) | |
parent | eefc5da9df56ca00b4cf66e1eca981a15a6b61ca (diff) |
Merge "Commit 16 for Create Optimized Sched API"
Diffstat (limited to 'cmso-service/src/main/java')
6 files changed, 344 insertions, 340 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java index 41534f8..e760b85 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java @@ -1,41 +1,39 @@ /*
- * Copyright © 2017-2019 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- * See the License for the specific language governing permissions and
+ * Copyright © 2017-2019 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * 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. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
+ */
package org.onap.optf.cmso.sostatus;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
-
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -43,44 +41,38 @@ import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.onap.observations.Mdc;
import org.onap.observations.Observation;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
-import org.onap.optf.cmso.filters.CMSOClientFilters;
+import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
import org.onap.optf.cmso.model.dao.ScheduleDAO;
import org.onap.optf.cmso.service.rs.models.HealthCheckComponent;
import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse;
-import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse.MSO_STATUS;
+import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse.MsoStatus;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
@Component
public class MsoStatusClient {
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDAO;
+ ChangeManagementGroupDAO cmGroupdao;
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
Environment env;
@@ -88,22 +80,33 @@ public class MsoStatusClient { @Autowired
PropertiesManagement pm;
+ /**
+ * Execute.
+ *
+ * @param id the id
+ * @throws JobExecutionException the job execution exception
+ */
public void execute(String id) throws JobExecutionException {
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", id.toString());
try {
- UUID uuid = UUID.fromString(id);
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(uuid);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDao.lockOne(uuid);
if (cmSchedule == null) {
Observation.report(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString());
return;
}
poll(cmSchedule);
} catch (Exception e) {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
}
debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", id.toString());
}
+ /**
+ * Poll.
+ *
+ * @param cmSchedule the cm schedule
+ */
@Transactional
public void poll(ChangeManagementSchedule cmSchedule) {
Map<String, String> mdcSave = Mdc.save();
@@ -113,12 +116,13 @@ public class MsoStatusClient { String url = env.getProperty("so.url");
String user = env.getProperty("so.user");
String pass = pm.getProperty("so.pass", "");
- if (!url.endsWith("/"))
+ if (!url.endsWith("/")) {
url = url + "/";
+ }
url = url + requestId;
Client client = ClientBuilder.newClient();
client.register(new BasicAuthenticatorFilter(user, pass));
- client.register(new CMSOClientFilters());
+ client.register(new CmsoClientFilters());
WebTarget target = client.target(url);
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);
Response response = null;
@@ -132,11 +136,11 @@ public class MsoStatusClient { if (resp != null) {
cmSchedule.setMsoStatus(resp.getRequestState());
cmSchedule.setMsoMessage(resp.getStatusMessage());
- MSO_STATUS msoStatus = MSO_STATUS.UNKNOWN;
+ MsoStatus msoStatus = MsoStatus.UNKNOWN;
try {
- msoStatus = MSO_STATUS.valueOf(resp.getRequestState());
+ msoStatus = MsoStatus.valueOf(resp.getRequestState());
} catch (Exception e) {
- Observation.report(LogMessages.UNRECOGNIZED_MSO_STATUS, resp.getRequestState());
+ Observation.report(LogMessages.UNRECOGNIZED_MSO_STATUS, resp.getRequestState());
}
long finishTime = getFinishTime(resp);
switch (msoStatus) {
@@ -161,16 +165,14 @@ public class MsoStatusClient { }
break;
- case 404: // Not found
- {
+ case 404: { // Not found
// Do not keep polling...
cmSchedule.setStatus(CMSStatusEnum.Failed.toString());
cmSchedule.setMsoStatus("Not found");
cmSchedule.setMsoMessage("Call to MSO Failed :" + response.toString());
}
break;
- case 400: // Bad request
- {
+ case 400: { // Bad request
// Do not keep polling...
cmSchedule.setStatus(CMSStatusEnum.Error.toString());
cmSchedule.setMsoStatus("Bad Request");
@@ -191,7 +193,7 @@ public class MsoStatusClient { cmSchedule.setMsoStatus("ConnectionException");
cmSchedule.setMsoMessage("Could not call MSO:" + e.getMessage());
} catch (Exception e) {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
// Probably a transient error... Keep polling
cmSchedule.setMsoTimeMillis(System.currentTimeMillis());
cmSchedule.setMsoStatus("Exception");
@@ -200,7 +202,7 @@ public class MsoStatusClient { Mdc.restore(mdcSave);
}
// Propagate final MSO status to top level
- cmScheduleDAO.save(cmSchedule);
+ cmScheduleDao.save(cmSchedule);
propagateStatus(cmSchedule);
}
@@ -214,7 +216,8 @@ public class MsoStatusClient { Date dateTime = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z").parse(timestr);
finishTime = dateTime.getTime();
} catch (Exception e) {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse MSO finish timestamp: " + timestr);
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e,
+ "Unable to parse MSO finish timestamp: " + timestr);
}
}
return finishTime;
@@ -232,22 +235,26 @@ public class MsoStatusClient { ObjectNode request = (ObjectNode) json.get("request");
ObjectNode requestStatus = (ObjectNode) request.get("requestStatus");
MsoOrchestrationQueryResponse msoResponse =
- om.treeToValue(requestStatus, MsoOrchestrationQueryResponse.class);
+ om.treeToValue(requestStatus, MsoOrchestrationQueryResponse.class);
return msoResponse;
} catch (Exception e) {
- Observation.report(LogMessages.UNABLE_TO_PARSE_MSO_RESPONSE, e, e.getMessage(), resp);
+ Observation.report(LogMessages.UNABLE_TO_PARSE_MSO_RESPONSE, e, e.getMessage(), resp);
}
return null;
}
+ /**
+ * Health check.
+ *
+ * @return the health check component
+ */
public HealthCheckComponent healthCheck() {
Map<String, String> mdcSave = Mdc.save();
String requestId = "healthCheck";
String url = env.getProperty("so.url", "");
- String user = env.getProperty("so.user", "");
- String pass = pm.getProperty("so.pass", "");
- if (!url.endsWith("/"))
+ if (!url.endsWith("/")) {
url = url + "/";
+ }
url = url + "healthcheck";
HealthCheckComponent hcc = new HealthCheckComponent();
@@ -255,8 +262,11 @@ public class MsoStatusClient { hcc.setUrl(url);
Client client = ClientBuilder.newClient();
+ String user = env.getProperty("so.user", "");
+ String pass = pm.getProperty("so.pass", "");
+
client.register(new BasicAuthenticatorFilter(user, pass));
- client.register(new CMSOClientFilters());
+ client.register(new CmsoClientFilters());
WebTarget target = client.target(url);
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java index 6c52cc3..0a4c2f2 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java @@ -1,38 +1,34 @@ /*
- * Copyright © 2017-2019 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * Copyright © 2017-2019 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * 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. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
package org.onap.optf.cmso.sostatus;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.UUID;
-
import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
@@ -44,12 +40,10 @@ import org.quartz.JobExecutionException; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
/**
- * This is the Quartz Job that is run to send the workflow to VID for execution
- *
+ * This is the Quartz Job that is run to send the workflow to VID for execution.
+ *
*
*/
@Component
@@ -63,7 +57,7 @@ public class MsoStatusJob implements Job { MsoStatusClient mso;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
Environment env;
@@ -79,8 +73,8 @@ public class MsoStatusJob implements Job { String requestId = context.getJobDetail().getJobDataMap().getString(ContextKeys.msoRequestId.toString());
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", requestId, id.toString());
try {
- UUID uuid = UUID.fromString(id);
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.findById(uuid).orElse(null);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDao.findById(uuid).orElse(null);
if (cmSchedule == null) {
log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id, requestId);
return;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java index 1c3677c..9eacfd1 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java @@ -1,27 +1,27 @@ /*
* Copyright © 2017-2019 AT&T Intellectual Property.
* Modifications Copyright © 2018 IBM.
- *
+ *
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
+ *
+ *
* Unless otherwise specified, all documentation contained herein is licensed
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");
* you may not use this documentation except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* https://creativecommons.org/licenses/by/4.0/
- *
+ *
* Unless required by applicable law or agreed to in writing, documentation
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,24 +31,24 @@ package org.onap.optf.cmso.sostatus;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.onap.observations.Mdc;
import org.onap.observations.Observation;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
import org.onap.optf.cmso.common.DomainsEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
-import org.onap.optf.cmso.filters.CMSOClientFilters;
+import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.onap.optf.cmso.model.Schedule;
import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
@@ -62,12 +62,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
/**
- * This is the Quartz Job that is run to send the workflow to VID for execution
- *
+ * This is the Quartz Job that is run to send the workflow to VID for execution.
+ *
*
*/
@Component
@@ -76,10 +73,10 @@ public class ScheduleStatusJob implements Job { private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
PropertiesManagement pm;
@@ -87,12 +84,18 @@ public class ScheduleStatusJob implements Job { @Autowired
Environment env;
+ /**
+ * Execute.
+ *
+ * @param context the context
+ * @throws JobExecutionException the job execution exception
+ */
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
debug.debug(LogMessages.SCHEDULE_STATUS_JOB, "Entered");
try {
// First poll SO for WF status
- List<ChangeManagementSchedule> list = cmScheduleDAO.findAllTriggered();
+ List<ChangeManagementSchedule> list = cmScheduleDao.findAllTriggered();
for (ChangeManagementSchedule s : list) {
debug.debug("Dispathcing to check status of CM schedule Id=" + s.getUuid());
dispatchMso(s.getUuid());
@@ -104,7 +107,7 @@ public class ScheduleStatusJob implements Job { //
// Update overall status of in flight schedules including closing tickets
- List<Schedule> list = scheduleDAO.findAllInProgress(DomainsEnum.ChangeManagement.toString());
+ List<Schedule> list = scheduleDao.findAllInProgress(DomainsEnum.ChangeManagement.toString());
for (Schedule s : list) {
debug.debug("Dispatching to check status of scheduleId=" + s.getScheduleId());
dispatchScheduleStatusChecker(s.getUuid());
@@ -115,6 +118,11 @@ public class ScheduleStatusJob implements Job { debug.debug(LogMessages.SCHEDULE_STATUS_JOB, "Exited");
}
+ /**
+ * Dispatch schedule status checker.
+ *
+ * @param uuid the uuid
+ */
public void dispatchScheduleStatusChecker(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
@@ -125,7 +133,7 @@ public class ScheduleStatusJob implements Job { String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
client.register(new BasicAuthenticatorFilter(user, pass));
- client.register(CMSOClientFilters.class);
+ client.register(CmsoClientFilters.class);
WebTarget target = client.target(url);
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);
Response response = null;
@@ -153,6 +161,11 @@ public class ScheduleStatusJob implements Job { }
+ /**
+ * Dispatch mso.
+ *
+ * @param uuid the uuid
+ */
public void dispatchMso(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
@@ -163,7 +176,7 @@ public class ScheduleStatusJob implements Job { String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
client.register(new BasicAuthenticatorFilter(user, pass));
- client.register(CMSOClientFilters.class);
+ client.register(CmsoClientFilters.class);
WebTarget target = client.target(url);
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);
Response response = null;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java index f75365a..0200520 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java @@ -1,36 +1,36 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- * See the License for the specific language governing permissions and
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * 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. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
+ */
package org.onap.optf.cmso.test.loopback;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -40,14 +40,10 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.onap.optf.cmso.optimizer.bean.CMOptimizerRequest;
+import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
+import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse;
import org.onap.optf.cmso.wf.bean.WfChangeManagementResponse;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
@Api
@Path("/v1/loopbacktest")
@@ -55,24 +51,34 @@ import io.swagger.annotations.ApiResponses; public interface SchedulerTestLoopbackService {
// ******************************************************************
@POST
- @Path("/optimizer")
+ @Path("/optimize/schedule")
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.")
@ApiResponses(value = {@ApiResponse(code = 202, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
- public Response putToOptimizer(@ApiParam(value = "SNIRO request message") CMOptimizerRequest request,
- @Context UriInfo uri);
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ public Response putToOptimizer(@ApiParam(value = "Optimizer request message") OptimizerRequest request,
+ @Context UriInfo uri);
+
+ // ******************************************************************
+ @GET
+ @Path("/optimize/schedule/{id}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.", response = OptimizerResponse.class)
+ @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ public Response getOptimizerResponse(@ApiParam(value = "Optimizer request is") @PathParam("id") String id,
+ @Context UriInfo uri);
// ******************************************************************
@POST
@Path("/onap/so/infra/orchestrationRequests/v7/schedule/{vnfName}")
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Test SO sheduling in loopback mode.",
- response = WfChangeManagementResponse.class)
+ response = WfChangeManagementResponse.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response soScheduleLoopback(@ApiParam(value = "vnfName") @PathParam("vnfName") String vnfName,
- @ApiParam(value = "SO request message") String request, @Context UriInfo uri);
+ @ApiParam(value = "SO request message") String request, @Context UriInfo uri);
// ******************************************************************
@GET
@@ -80,8 +86,8 @@ public interface SchedulerTestLoopbackService { @Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Test SO Status query loopback.", response = MsoOrchestrationQueryResponse.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response soQueryLoopback(@ApiParam(value = "MSO request ID") @PathParam("requestId") String requestId,
- @Context UriInfo uri);
+ @Context UriInfo uri);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java index b2ff6d4..b179719 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java @@ -1,79 +1,67 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * 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.
- * See the License for the specific language governing permissions and
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * 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. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
+ */
package org.onap.optf.cmso.test.loopback;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import javax.ws.rs.ProcessingException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.ResponseProcessingException;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
+import org.onap.observations.Observation;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
-import org.onap.optf.cmso.optimizer.bean.CMOptimizerRequest;
-import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse;
-import org.onap.optf.cmso.optimizer.bean.CMRequestInfo;
-import org.onap.optf.cmso.optimizer.bean.CMSchedule;
-import org.onap.optf.cmso.optimizer.bean.CMSchedulingInfo;
-import org.onap.optf.cmso.optimizer.bean.CMVnfDetails;
-import org.onap.optf.cmso.service.rs.CMSOOptimizerCallbackImpl;
+import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
+import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
+import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo;
+import org.onap.optf.cmso.optimizer.model.ScheduledElement;
+import org.onap.optf.cmso.optimizer.model.ScheduledElement.ScheduleType;
+import org.onap.optf.cmso.optimizer.model.UnScheduledElement;
+import org.onap.optf.cmso.service.rs.CmsoOptimizerCallbackImpl;
+import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow;
+import org.onap.optf.cmso.service.rs.models.v2.ElementInfo;
import org.onap.optf.cmso.wf.bean.WfCmResponse200;
import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;
import org.onap.optf.cmso.wf.bean.WfMsoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
@Controller
public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackService {
private static EELFLogger log = EELFManager.getInstance().getLogger(SchedulerTestLoopbackServiceImpl.class);
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
- private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
@Autowired
Environment env;
@@ -81,70 +69,22 @@ public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackSe @Autowired
PropertiesManagement pm;
+ // **
+ // This is test mode only code.
+ private static Map<String, String> optimizerResponses = new HashMap<>();
+
@Override
- public Response putToOptimizer(CMOptimizerRequest request, UriInfo uri) {
+ public Response putToOptimizer(OptimizerRequest request, UriInfo uri) {
//
try {
- CMOptimizerResponse r = new CMOptimizerResponse();
- CMRequestInfo ri = request.getRequestInfo();
- CMSchedulingInfo si = request.getSchedulingInfo();
- r.setTransactionId(ri.getTransactionId());
- r.setRequestState("Done.");
- r.setScheduleId(ri.getRequestId());
- String callback = ri.getCallbackUrl();
-
- // This is a dumb opt. WIll not make sense for multiple groups
- // Use the code in the callback to help
- List<String> nodes = new ArrayList<String>();
- // get total number of nodes across all groups.
- for (CMVnfDetails sr : si.getVnfDetails()) {
- nodes.add(sr.getNode());
- }
-
- DateTime startTime = CMSOOptimizerCallbackImpl.convertISODate(si.getStartTime(), "startTime");
-
- // Ignore the finish time for now in the calc. Just accept what they
- // gave
- DateTime finishTime = CMSOOptimizerCallbackImpl.convertISODate(si.getEndTime(), "endTime");
- DateTimeFormatter sniroFmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC();
-
- int add = si.getAdditionalDurationInSecs();
- int normal = si.getNormalDurationInSecs();
- int concurrencyLimit = si.getConcurrencyLimit();
- long totalDuration = (long) add + normal;
- long serialized = 0;
- if (nodes.size() > concurrencyLimit) {
- serialized = (nodes.size() / concurrencyLimit);
- serialized = (serialized * totalDuration) * 1000;
- }
- DateTime latestInstanceStartTime = startTime.plus(serialized);
- finishTime = latestInstanceStartTime.plus(totalDuration * 1000);
- // Reformat request into a response setting the groups start finish
- // time based upon
- Map<String, CMSchedule> map = new HashMap<String, CMSchedule>();
- for (CMVnfDetails sr : si.getVnfDetails()) {
- String groupId = sr.getGroupId();
- CMSchedule cms = map.get(groupId);
- if (cms == null) {
- cms = new CMSchedule();
- cms.setGroupId(groupId);
- cms.setFinishTime(groupId);
- map.put(groupId, cms);
- cms.setStartTime(sniroFmt.print(startTime));
- cms.setFinishTime(sniroFmt.print(finishTime));
- cms.setLatestInstanceStartTime(sniroFmt.print(latestInstanceStartTime));
- }
- cms.getNode().add(sr.getNode());
- }
- r.setSchedule(map.values().toArray(new CMSchedule[map.values().size()]));
-
- Thread responseThread = new Thread(new Runnable() {
- public void run() {
- sendAsyncResponse(r, callback);
- }
- });
- responseThread.start();
-
+ OptimizerResponse rsp = new OptimizerResponse();
+ rsp.setRequestId(request.getRequestId());
+ rsp.setStatus(OptimizerResponse.OptimizeScheduleStatus.COMPLETED);
+ List<OptimizerScheduleInfo> schedules = getSchedules(request);
+ rsp.setSchedules(schedules);
+ ObjectMapper om = new ObjectMapper();
+ String response = om.writeValueAsString(rsp);
+ optimizerResponses.put(rsp.getRequestId(), response);
return Response.accepted().build();
} catch (Exception e) {
log.error("Unexpected exception", e);
@@ -152,45 +92,90 @@ public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackSe return Response.serverError().build();
}
- private void sendAsyncResponse(CMOptimizerResponse r, String url) {
+ private List<OptimizerScheduleInfo> getSchedules(OptimizerRequest request) {
+ List<OptimizerScheduleInfo> list = new ArrayList<>();
+ OptimizerScheduleInfo osi = new OptimizerScheduleInfo();
+ List<ScheduledElement> scheduledList = new ArrayList<>();
+ List<UnScheduledElement> unscheduledList = new ArrayList<>();
+ osi.setScheduledElements(scheduledList);
+ osi.setUnScheduledElements(unscheduledList);
+ list.add(osi);
+
+
+ List<ChangeWindow> cws = request.getChangeWindows();
+ // Assume we cannot get here without at least 1 CW
+ ChangeWindow cw = cws.get(0);
+
+ // This is a dumb opt. WIll not make sense for multiple groups
+ // Use the code in the callback to help
+ Map<String, String> nodes = new HashMap<>();
+ List<String> nodeList = new ArrayList<>();
+ // get total number of nodes across all groups.
+ for (ElementInfo sr : request.getElements()) {
+ nodes.put(sr.getElementId(), sr.getGroupId());
+ nodeList.add(sr.getElementId());
+ }
+
+ DateTime startTime = new DateTime(cw.getStartTime().getTime());
+
+
+ long add = request.getAdditionalDuration() * 1000L;
+ long normal = request.getNormalDuration() * 1000L;
+ int concurrencyLimit = request.getConcurrencyLimit();
+ long totalDuration = add + normal;
+ long serialized = 0;
+ if (nodes.size() > concurrencyLimit) {
+ serialized = (nodes.size() / concurrencyLimit);
+ serialized = (serialized * totalDuration);
+ }
+ DateTime latestInstanceStartTime = startTime.plus(serialized);
+ DateTime finishTime = latestInstanceStartTime.plus(totalDuration);
+ // Reformat request into a response setting the groups start finish
+ // time based upon
+
+ Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();
try {
- Client client = ClientBuilder.newClient();
- String user = env.getProperty("mechid.user", "");
- String pass = pm.getProperty("mechid.pass", "");
- client.register(new BasicAuthenticatorFilter(user, pass));
- WebTarget target = client.target(url);
- Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);
- try {
- Response response = invocationBuilder.post(Entity.json(r));
- switch (response.getStatus()) {
- case 202:
- // Scheduled with SNIRO
- break;
- case 400: // Bad request
- case 500:
- default: {
- }
- }
- } catch (ResponseProcessingException e) {
- errors.error(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());
- debug.debug(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());
-
- } catch (ProcessingException e) {
- log.error(LogMessages.OPTIMIZER_EXCEPTION.toString(), e);
- log.error(LogMessages.OPTIMIZER_EXCEPTION, e.getMessage());
+ CmsoOptimizerCallbackImpl.makeMap(startTime.getMillis(), latestInstanceStartTime.getMillis(),
+ concurrencyLimit, totalDuration, nodeList, startAndFinishTimeMap);
+ for (String node : nodes.keySet()) {
+ Map<String, Long> map = startAndFinishTimeMap.get(node);
+ Long nodeStart = map.get("startTime");
+ Long nodeEnd = map.get("finishTime");
+ ScheduledElement se = new ScheduledElement();
+ se.setElementId(node);
+ se.setDurationSeconds((nodeEnd - nodeStart) / 1000); // in seconds
+ se.setStartTime(new Date(nodeStart));
+ se.setEndTime(new Date(nodeEnd));
+ se.setScheduleType(ScheduleType.INDIVIDUAL);
+ se.setGroupId(nodes.get(node));
+ scheduledList.add(se);
}
} catch (Exception e) {
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ return list;
+ }
+
+ @Override
+ public Response getOptimizerResponse(String id, UriInfo uri) {
+ //
+ try {
+ String rsp = optimizerResponses.get(id);
+ return Response.ok(rsp).build();
+ } catch (Exception e) {
+ log.error("Unexpected exception", e);
}
+ return Response.serverError().build();
}
+
+ @Override
public Response soScheduleLoopback(String vnfName, String request, UriInfo uri) {
String msoRequestId = env.getProperty("loopback.mso.requestId", "4ccbfb85-1d05-442e");
- String r = UUID.randomUUID().toString();
+ String ruuid = UUID.randomUUID().toString();
WfMsoRequestReferences rr = new WfMsoRequestReferences();
- rr.setInstanceId(r);
+ rr.setInstanceId(ruuid);
rr.setRequestId(msoRequestId);
WfMsoResponse mso = new WfMsoResponse();
mso.setRequestReferences(rr);
@@ -204,12 +189,13 @@ public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackSe public Response soQueryLoopback(String requestId, UriInfo uri) {
// Abbreviated response. Only interested in requestStatus....
String response = "{\"request\" : {" + "\"requestId\" : \"dummy-request-id\","
- + "\"startTime\" : \"Wed, 26 Aug 2017 06:36:07 GMT\"," + "\"requestScope\" : \"vfModule\","
- + "\"requestType\" : \"createInstance\"," + "\"requestDetails\" : {}," + "\"instanceReferences\" : {},"
- + "\"requestStatus\" : { " + "\"requestState\" : \"COMPLETE\","
- + "\"statusMessage\" : \"Vf Module has been created successfully.\"," + "\"percentProgress\" : 100,"
- + "\"finishTime\" : \"Crap so cmso uses current time\"}}}";
+ + "\"startTime\" : \"Wed, 26 Aug 2017 06:36:07 GMT\"," + "\"requestScope\" : \"vfModule\","
+ + "\"requestType\" : \"createInstance\"," + "\"requestDetails\" : {},"
+ + "\"instanceReferences\" : {}," + "\"requestStatus\" : { " + "\"requestState\" : \"COMPLETE\","
+ + "\"statusMessage\" : \"Vf Module has been created successfully.\","
+ + "\"percentProgress\" : 100," + "\"finishTime\" : \"Crap so cmso uses current time\"}}}";
return Response.ok().entity(response).build();
}
+
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java index d2953b6..f329cfc 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java @@ -1,36 +1,37 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright � 2017-2018 AT&T Intellectual Property. Modifications Copyright � 2018 IBM.
*
- * 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
+ * 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
+ * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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. See the License for the specific language governing permissions and limitations under
+ * the License.
*
*
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * https://creativecommons.org/licenses/by/4.0/
+ * https://creativecommons.org/licenses/by/4.0/
*
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
* limitations under the License.
-*/
+ */
package org.onap.optf.cmso.test.loopback;
+import com.fasterxml.jackson.databind.JsonNode;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -38,12 +39,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import com.fasterxml.jackson.databind.JsonNode;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
@Api
@Path("/v1/tm")
@@ -56,7 +51,7 @@ public interface TicketMgtLoopbackService { @Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Dummy out ticket management check status call.", response = JsonNode.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response tmGetChangeRecord(@ApiParam(value = "TM request message") JsonNode request, @Context UriInfo uri);
// ******************************************************************
@@ -65,9 +60,9 @@ public interface TicketMgtLoopbackService { @Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Dummy out ticket management create call.", response = JsonNode.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response tmCreateChangeRecord(@ApiParam(value = "TM request message") JsonNode request,
- @Context UriInfo uri);
+ @Context UriInfo uri);
// ******************************************************************
@POST
@@ -75,19 +70,19 @@ public interface TicketMgtLoopbackService { @Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Dummy out ticket management close call.", response = JsonNode.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response tmCloseCancelChangeRecord(@ApiParam(value = "TM request message") JsonNode request,
- @Context UriInfo uri);
+ @Context UriInfo uri);
// ******************************************************************
@POST
@Path("/updateChangeRecord")
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "", notes = "Dummy out ticket management update to in progress call.",
- response = JsonNode.class)
+ response = JsonNode.class)
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
+ @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response tmUpdateChangeRecord(@ApiParam(value = "TM request message") JsonNode request,
- @Context UriInfo uri);
+ @Context UriInfo uri);
}
|