2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix. All rights reserved.
4 * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
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=========================================================
23 var uuidType = java.util.UUID;
25 var albumID = uuidType.fromString("d0050623-18e5-46c9-9298-9a567990cd7c");
27 var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString());
29 var responseStatus = executor.subject.getOutFieldSchemaHelper("CDSResponseStatusEvent", "status").createNewInstance();
31 responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName"))
32 responseStatus.put("nfName", pmSubscriptionInfo.get("nfName"))
33 responseStatus.put("changeType", pmSubscriptionInfo.get("changeType"))
35 var response = executor.inFields.get("payload")
37 if ("failure".equals(response.get("create_DasH_subscription_DasH_response").get("odl_DasH_response").get("status"))) {
38 responseStatus.put("message", "failed")
40 responseStatus.put("message", "success")
43 var cdsResponseEventFields = java.util.HashMap();
44 cdsResponseEventFields.put("status", responseStatus);
45 executor.addFieldsToOutput(cdsResponseEventFields);
47 var logEventFields = java.util.HashMap();
48 logEventFields.put("final_status", "FINAL_SUCCESS");
49 logEventFields.put("message", "Operation successfully completed.");
50 executor.addFieldsToOutput(logEventFields);