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 var logger = executor.logger;
23 logger.trace("start: " + executor.subject.id);
24 logger.trace("-- infields: " + executor.inFields);
26 var ifEdgeName = executor.inFields["edgeName"];
27 var ifEdgeStatus = executor.inFields["status"];
29 var albumTopoEdges = executor.getContextAlbum("albumTopoEdges");
31 logger.trace("-- got infields, testing existing edge");
33 var ctxtEdge = albumTopoEdges.get(ifEdgeName);
34 if (ctxtEdge != null) {
35 albumTopoEdges.remove(ifEdgeName);
36 logger.trace("-- removed edge: <" + ifEdgeName + ">");
39 logger.trace("-- creating edge: <" + ifEdgeName + ">");
40 ctxtEdge = "{name:" + ifEdgeName + ", start:" + executor.inFields["start"] + ", end:" + executor.inFields["end"]
41 + ", active:" + ifEdgeStatus + "}";
42 albumTopoEdges.put(ifEdgeName, ctxtEdge);
44 if (logger.isTraceEnabled()) {
45 logger.trace(" >> *** Edges ***");
46 if (albumTopoEdges != null) {
47 for (var i = 0; i < albumTopoEdges.values().size(); i++) {
48 logger.trace(" >> >> " + albumTopoEdges.values().get(i).get("name") + " \t "
49 + albumTopoEdges.values().get(i).get("start") + " --> " + albumTopoEdges.values().get(i).get("end")
50 + " \t " + albumTopoEdges.values().get(i).get("active"));
53 logger.trace(" >> >> edge album is null");
57 executor.outFields["report"] = "edge ctxt :: added edge " + ifEdgeName;
59 logger.info("vpnsla: ctxt added edge " + ifEdgeName);
61 logger.trace("finished: " + executor.subject.id);