diff options
author | Jerry Flood <jflood@att.com> | 2019-04-05 16:55:13 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-04-05 17:11:14 -0400 |
commit | a5e82a2a703fd31cac33cef4bbe07445a274ba71 (patch) | |
tree | cb796ecac95d3da0c82f765273d0c07ece650830 | |
parent | c98cf7f69ff8a7765766a6ca569c874ae075fdea (diff) |
Fix so minizinc works in windows
Issue-ID: OPTFRA-458
Change-Id: Id63558456a13a31284f12007587706c66508512f
Signed-off-by: Jerry Flood <jflood@att.com>
10 files changed, 24 insertions, 30 deletions
diff --git a/cmso-database/src/main/docker/assembly/cmso-files.xml b/cmso-database/src/main/docker/assembly/cmso-files.xml index bdcb699..b857fa0 100644 --- a/cmso-database/src/main/docker/assembly/cmso-files.xml +++ b/cmso-database/src/main/docker/assembly/cmso-files.xml @@ -1,6 +1,6 @@ <!-- ============LICENSE_START======================================================= - ECOMP CMSO + CMSO ================================================================================ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. ================================================================================ diff --git a/cmso-optimizer/etc/config/optimizer.properties b/cmso-optimizer/etc/config/optimizer.properties index 653d21b..e3ab89a 100644 --- a/cmso-optimizer/etc/config/optimizer.properties +++ b/cmso-optimizer/etc/config/optimizer.properties @@ -56,3 +56,4 @@ cmso.minizinc.command.exe="C:/Program Files/MiniZinc IDE (bundled)/minizinc.exe" cmso.minizinc.command.solver=OSICBC cmso.minizinc.command.timelimit=60000 cmso.minizinc.command.mzn=scripts/minizinc/generic_attributes.mzn +cmso.minizinc.command.commandline=cmd.exe /C scripts\\minizinc\\run.bat
\ No newline at end of file diff --git a/cmso-optimizer/scripts/minizinc/run.bat b/cmso-optimizer/scripts/minizinc/run.bat index dc40503..8c07b3c 100644 --- a/cmso-optimizer/scripts/minizinc/run.bat +++ b/cmso-optimizer/scripts/minizinc/run.bat @@ -1 +1 @@ -%MINIZINC% --solver %MINIZINC_SOLVER% --time-limit %MINIZINC_TIMELIMIT% --soln-sep "" --search-complete-msg "" -o %MINIZINC_OUTPUT% %MINIZINC_MZN% %MINIZINC_DZN%
\ No newline at end of file +%MINIZINC% --solver %MINIZINC_SOLVER% --time-limit %MINIZINC_TIMELIMIT% --soln-sep "" --search-complete-msg "" -o "%MINIZINC_OUTPUT%" "%MINIZINC_MZN%" "%MINIZINC_DZN%"
\ No newline at end of file diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java index 9f2f8e6..b382278 100644 --- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/optimizer/OptimizerClient.java @@ -32,7 +32,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.text.ParseException; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -214,33 +213,26 @@ public class OptimizerClient { Path outputFileName = Paths.get(workingFolder.getAbsolutePath(), "results.yaml"); String dzn = request.toMiniZinc(); Files.write(inputFileName, dzn.getBytes()); - Map<String, String> environment = new HashMap<>(); ProcessBuilder processBuilder = buildCommand(inputFileName, outputFileName, timeLimit.toString()); process = processBuilder.start(); - //debug.debug("engine command=" + commandString); + // debug.debug("engine command=" + commandString); String stdout = IOUtils.toString(process.getInputStream(), "UTF-8"); String stderr = IOUtils.toString(process.getErrorStream(), "UTF-8"); debug.debug("stdout=" + stdout); debug.debug("stderr=" + stderr); - if (process.isAlive()) { - process.wait(); - } OptimizerResponseUtility responseUtility = new OptimizerResponseUtility(); OptimizerResults optimizerResults = responseUtility.parseOptimizerResult(outputFileName.toFile()); apiResponse.setOptimizerResults(optimizerResults); apiResponse.setStatus(OptimizerEngineResponseStatus.COMPLETED); - } catch (InterruptedException e) { - apiResponse.setStatus(OptimizerEngineResponseStatus.FAILED); - apiResponse.setErrorMessage( - LogMessages.OPTIMIZER_REQUEST_TIMEOUT.format(uuid.toString(), timeLimit.toString())); - Observation.report(LogMessages.OPTIMIZER_REQUEST_TIMEOUT, uuid.toString(), timeLimit.toString()); - process.destroyForcibly(); } catch (Exception e) { apiResponse.setStatus(OptimizerEngineResponseStatus.FAILED); apiResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage())); Observation.report(LogMessages.UNEXPECTED_RESPONSE, e, e.getMessage()); } finally { + if (process.isAlive()) { + process.destroyForcibly(); + } if (workingFolder.exists()) { workingFolder.delete(); } @@ -251,7 +243,8 @@ public class OptimizerClient { private ProcessBuilder buildCommand(Path inputFileName, Path outputFileName, String timeLimit) { ProcessBuilder processBuilder = new ProcessBuilder(); List<String> command = new ArrayList<>(); - String commandline = env.getProperty("cmso.minizinc.command.commandline", "/bin/bash -x scripts/minizinc/run.sh"); + String commandline = + env.getProperty("cmso.minizinc.command.commandline", "/bin/bash -x scripts/minizinc/run.sh"); String minizinc = env.getProperty("cmso.minizinc.command.exe", "minizinc"); String solver = env.getProperty("cmso.minizinc.command.solver", "OSICBC"); String script = env.getProperty("cmso.minizinc.command.mzn", "scripts/minizinc/generic_attributes.mzn"); @@ -263,7 +256,7 @@ public class OptimizerClient { environment.put("MINIZINC_MZN", script); environment.put("MINIZINC_DZN", inputFileName.toString()); for (String arg : commandline.split(" ")) { - command.add(arg); + command.add(arg); } processBuilder.command(command); return processBuilder; diff --git a/cmso-robot/docker/assembly/cmso-files.xml b/cmso-robot/docker/assembly/cmso-files.xml index a96ebe7..cb61e5a 100644 --- a/cmso-robot/docker/assembly/cmso-files.xml +++ b/cmso-robot/docker/assembly/cmso-files.xml @@ -1,6 +1,6 @@ <!-- ============LICENSE_START======================================================= - ECOMP CMSO + CMSO ================================================================================ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. ================================================================================ diff --git a/cmso-robot/robot/resources/test_templates/check_logs.robot b/cmso-robot/robot/resources/test_templates/check_logs.robot index 5926caa..d6070d1 100644 --- a/cmso-robot/robot/resources/test_templates/check_logs.robot +++ b/cmso-robot/robot/resources/test_templates/check_logs.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Tests for checking ECOMP Scheduler Logs +Documentation Tests for checking Scheduler Logs Library UUID Library SSHLibrary @@ -11,8 +11,8 @@ Resource ../scheduler_requests/create_schedule.robot Resource ../scheduler_requests/approval_requests.robot Resource ../json_templater.robot *** Variables **** -${log_location}= /opt/app/ecomp-scheduler/logs/ -${debug_log_location}= /opt/app/ecomp-scheduler/debug-logs/ +${log_location}= /opt/app/scheduler/logs/ +${debug_log_location}= /opt/app/scheduler/debug-logs/ ${date_time_regex}= ((([0-9]{2,4}-?){3}.([0-9]{2}:?){3}.*)) ${uuid_regex}= [0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12} @@ -29,7 +29,7 @@ Check Audit Logs ${log_level}= Convert to String (INFO|WARN|ERROR|FATAL) ${log_msg}= Convert to String (Accepted|No Content|OK) ${status_codes}= Convert to String (204|202|200) - ${audit_regex}= Convert to String \\|UNKNOWN\\|.*\\|ecomp-scheduler\\|.*\\|COMPLETE\\|${status codes}\\|${log_msg}\\|${uuid_regex}\\|${log_level}\\|.*\\|[0-9]{1,}\\|${server}\\|.* + ${audit_regex}= Convert to String \\|UNKNOWN\\|.*\\|scheduler\\|.*\\|COMPLETE\\|${status codes}\\|${log_msg}\\|${uuid_regex}\\|${log_level}\\|.*\\|[0-9]{1,}\\|${server}\\|.* #THis regex string follows the current expected audit.log structure logging guidelines as of 1710 here https://wiki.web.att.com/pages/viewpage.action?pageId=545861390 Open Connection ${GLOBAL_SCHEDULER_HOST} port=22 Login ${user-id} ${user-pass} #This may only work with dev server should investigate using Pageant with Robot @@ -54,7 +54,7 @@ Check Debug Logs ${resp}= Delete Change Management auth schedules/${uuid} Open Connection ${GLOBAL_SCHEDULER_HOST} port=22 Login ${user-id} ${user-pass} - ${result}= Grep Local File -E '${date_time_regex}\\|${uuid}' /opt/app/ecomp-scheduler/debug-logs/debug.log + ${result}= Grep Local File -E '${date_time_regex}\\|${uuid}' /opt/app/scheduler/debug-logs/debug.log #THis regex string follows the current expected debug.log structure logging guidelines as of 1710 here https://wiki.web.att.com/pages/viewpage.action?pageId=545861390 Close Connection Should not be Empty ${result} @@ -69,7 +69,7 @@ Check Metric Logs ${log_level}= Convert to String (INFO|WARN|ERROR|FATAL) ${log_msg}= Convert to String (Accepted|No Content|OK|[a-zA-Z]+) ${status_codes}= Convert to String (204|202|200) - ${regex}= Convert To String \\|UNKNOWN\\|.*\\|ecomp-scheduler\\|.*\\|http://([a-zA-Z]*\.){2,}(:[0-9]{1,5})?\\|(.*/?){1,}\\|COMPLETE\\|${status codes}\\|${log_msg}\\|${uuid_regex}\\|${log_level}\\|.*\\|[0-9]{1,}\\|${server}\\|.* + ${regex}= Convert To String \\|UNKNOWN\\|.*\\|scheduler\\|.*\\|http://([a-zA-Z]*\.){2,}(:[0-9]{1,5})?\\|(.*/?){1,}\\|COMPLETE\\|${status codes}\\|${log_msg}\\|${uuid_regex}\\|${log_level}\\|.*\\|[0-9]{1,}\\|${server}\\|.* #THis regex string follows the current expected metric.log structure logging guidelines as of 1710 here https://wiki.web.att.com/pages/viewpage.action?pageId=545861390 Open Connection ${GLOBAL_SCHEDULER_HOST} port=22 Login ${user-id} ${user-pass} @@ -85,7 +85,7 @@ Check Error Logs Open Connection ${GLOBAL_SCHEDULER_HOST} port=22 Login ${user-id} ${user-pass} - ${result}= Grep Local File '${date_time_regex}\\|${uuid_regex}\\|.*\\|ecomp-scheduler\\|.*\\|.*(WARN|ERROR|FATAL).*\\|.*\\|' ${log_location}error.log + ${result}= Grep Local File '${date_time_regex}\\|${uuid_regex}\\|.*\\|scheduler\\|.*\\|.*(WARN|ERROR|FATAL).*\\|.*\\|' ${log_location}error.log #THis regex string follows the current expected error.log structure logging guidelines as of 1710 here https://wiki.web.att.com/pages/viewpage.action?pageId=545861390 #It is difficult to generate errors that would be logged in error.log. so this only tests that any error in the log matches the expected format @{grep_result}= Split to Lines ${result} diff --git a/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java index e2b8220..32aa60c 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java +++ b/cmso-ticketmgt/src/main/java/org/onap/observations/Mdc.java @@ -55,7 +55,7 @@ import org.onap.observations.MessageHeaders.HeadersEnum; import org.slf4j.MDC; /** - * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY) + * EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY) **/ public class Mdc { public static final String SERVICE_NAME = "CSS-Scheduler"; diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java index 115177c..e02a47b 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java @@ -1,6 +1,6 @@ /* - * 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. diff --git a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java index d3688f6..4ba7d48 100644 --- a/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java +++ b/cmso-ticketmgt/src/main/java/org/onap/optf/cmso/common/CMSRequestError.java @@ -1,6 +1,6 @@ /* - * 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. diff --git a/cmso-topology/src/main/java/org/onap/observations/Mdc.java b/cmso-topology/src/main/java/org/onap/observations/Mdc.java index 5c2bd5f..403ca27 100644 --- a/cmso-topology/src/main/java/org/onap/observations/Mdc.java +++ b/cmso-topology/src/main/java/org/onap/observations/Mdc.java @@ -53,7 +53,7 @@ import org.onap.observations.MessageHeaders.HeadersEnum; import org.slf4j.MDC; /** - * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY) + * EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY) **/ public class Mdc { |