<!--
============LICENSE_START=======================================================
- ECOMP CMSO
+ CMSO
================================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
================================================================================
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
-%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
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;
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();
}
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");
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;
<!--
============LICENSE_START=======================================================
- ECOMP CMSO
+ CMSO
================================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
================================================================================
*** Settings ***
-Documentation Tests for checking ECOMP Scheduler Logs
+Documentation Tests for checking Scheduler Logs
Library UUID
Library SSHLibrary
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}
${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
${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}
${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}
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}
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";
/*
- * 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.
/*
- * 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.
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 {