2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. 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 distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.consumer;
21 import java.io.IOException;
22 import org.junit.After;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test.config.GeneralConfigForTest;
26 import org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.vesdomain.fault.StrimziKafkaFaultVESMsgConsumer;
28 public class TestStrimziKafkaFaultVESMsgConsumer {
30 private static final String DEFAULT_SDNRUSER = "admin";
31 private static final String DEFAULT_SDNRPASSWD = "admin";
32 private static final String DEFAULT_SDNRBASEURL = "http://localhost:8181";
33 private static final String CONFIGURATIONFILE = "test2.properties";
36 private static final String faultVESMsg = ""
37 + "{\"event\":" + " {\"commonEventHeader\":"
38 + " { \"domain\":\"fault\","
39 + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\","
40 + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\","
41 + " \"eventType\":\"O_RAN_COMPONENT_Alarms\","
43 + " \"priority\":\"Low\","
44 + " \"reportingEntityId\":\"\","
45 + " \"reportingEntityName\":\"1e9a28bcd119_50007\","
46 + " \"sourceId\":\"\","
47 + " \"sourceName\":\"1e9a28bcd119_50007\","
48 + " \"startEpochMicrosec\":1614004128699785,"
49 + " \"lastEpochMicrosec\":1614004128699785,"
50 + " \"nfNamingCode\":\"sdn controller\","
51 + " \"nfVendorName\":\"sdn\","
52 + " \"timeZoneOffset\":\"+00:00\","
53 + " \"version\":\"4.0.1\","
54 + " \"vesEventListenerVersion\":\"7.0.1\""
58 + " \"faultFieldsVersion\":\"4.0\","
59 + " \"alarmCondition\":\"8\","
60 + " \"alarmInterfaceA\":\"dkom32\","
61 + " \"eventSourceType\":\"O_RAN_COMPONENT\","
62 + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\","
63 + " \"eventSeverity\":\"@eventSeverity@\","
64 + " \"vfStatus\":\"Active\","
65 + " \"alarmAdditionalInformation\":"
67 + " \"eventTime\":\"2019-11-20T14:59:47.3Z\","
68 + " \"equipType\":\"O-RAN-sim\","
69 + " \"vendor\":\"Melacon\","
70 + " \"model\":\"Simulated Device\""
77 private static final String faultVESMsg_Incomplete = ""
79 + " {\"commonEventHeader\":"
80 + " { \"domain\":\"fault\","
81 + " \"eventId\":\"1e9a28bcd119_50007_2019-11-20T14:59:47.3Z\","
82 + " \"eventName\":\"fault_O_RAN_COMPONENT_Alarms\","
83 + " \"eventType\":\"O_RAN_COMPONENT_Alarms\","
85 + " \"priority\":\"Low\","
86 + " \"reportingEntityId\":\"\","
87 + " \"reportingEntityName\":\"1e9a28bcd119_50007\","
88 + " \"sourceId\":\"\","
89 + " \"sourceName\":\"1e9a28bcd119_50007\","
90 + " \"startEpochMicrosec\":1612349525626,"
91 + " \"lastEpochMicrosec\":1612349525626,"
92 + " \"nfNamingCode\":\"sdn controller\","
93 + " \"nfVendorName\":\"sdn\","
94 + " \"timeZoneOffset\":\"+00:00\","
95 + " \"version\":\"4.0.1\","
96 + " \"vesEventListenerVersion\":\"7.0.1\","
100 + " \"faultFieldsVersion\":\"4.0\","
101 + " \"alarmCondition\":\"8\","
102 + " \"alarmInterfaceA\":\"dkom32\","
103 + " \"eventSourceType\":\"O_RAN_COMPONENT\","
104 + " \"specificProblem\":\"dsonj32 don32 mdson32pk654\","
105 + " \"eventSeverity\":\"CRITICAL\","
106 + " \"vfStatus\":\"Active\","
107 + " \"alarmAdditionalInformation\":"
109 + " \"eventTime\":\"2019-11-20T14:59:47.3Z\","
110 + " \"equipType\":\"O-RAN-sim\","
111 + " \"vendor\":\"Melacon\","
112 + " \"model\":\"Simulated Device\""
119 private GeneralConfigForTest cfgTest;
122 public void before() throws IOException {
123 cfgTest = new GeneralConfigForTest(CONFIGURATIONFILE);
127 public void after() {
133 public void test() throws IOException {
134 StrimziKafkaFaultVESMsgConsumer faultMsgConsumer = new StrimziKafkaFaultVESMsgConsumer(cfgTest.getCfg(), null);
137 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "CRITICAL"));
138 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Major"));
139 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "minor"));
140 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "NonAlarmed"));
141 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "warning"));
142 faultMsgConsumer.processMsg(faultVESMsg.replace("@eventSeverity@", "Unknown"));
143 faultMsgConsumer.processMsg(faultVESMsg_Incomplete);
144 } catch (Exception e) {
146 System.out.println("Exception while processing Fault Message - " + e.getMessage());