2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2020 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 importClass(org.slf4j.LoggerFactory);
24 var logger = executor.logger;
25 logger.trace("start: " + executor.subject.id + " - TSL");
27 var rootLogger = LoggerFactory.getLogger(logger.ROOT_LOGGER_NAME);
29 var ifSituation = executor.inFields["situation"];
31 var albumProblemMap = executor.getContextAlbum("albumProblemMap");
33 var returnValue = true;
34 if (ifSituation.get("problemID") == "NONE") {
35 logger.trace("-- situation has no problem, selecting <VpnSlaPolicyDecideNoneTask>");
36 executor.subject.getTaskKey("VpnSlaPolicyDecideNoneTask").copyTo(executor.selectedTask);
37 } else if (albumProblemMap.get(ifSituation.get("problemID")).get("status") == "SOLVED") {
38 logger.trace("-- situation is solved, selecting <VpnSlaPolicyDecideSolvedTask>");
39 executor.subject.getTaskKey("VpnSlaPolicyDecideSolvedTask").copyTo(executor.selectedTask);
40 } else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() > 0) {
41 logger.trace("-- situation is problem with violations, selecting <VpnSlaPolicyDecidePriorityTask>");
42 executor.subject.getTaskKey("VpnSlaPolicyDecidePriorityTask").copyTo(executor.selectedTask);
43 } else if (ifSituation.get("violatedSLAs") != null && ifSituation.get("violatedSLAs").size() == 0) {
44 logger.trace("-- situation is problem without violations, selecting <VpnSlaPolicyDecideSlaTask>");
45 executor.subject.getTaskKey("VpnSlaPolicyDecideSlaTask").copyTo(executor.selectedTask);
47 logger.error("-- detected unknown decision for situation <" + ifSituation.get("problemID") + ">");
48 rootLogger.error(executor.subject.id + " " + "-- detected unknown decision for situation <"
49 + ifSituation.get("problemID") + ">");
53 logger.trace("finished: " + executor.subject.id);
54 logger.debug(".d-tsl");