Receiving the alarm list from OSS through the AlarmIRP interface

Hello. This topic is very poorly disclosed on the Web because it is of interest only in narrow circles. To fill this gap a little, this place seems to me the most suitable.
 
 
The CORBA AlarmIRP interface is present in all control systems of equipment manufacturers that I have encountered, as prescribed by the 3GPP 3G TS ???-2 standard. Consider the example of OSS-RC Ericsson, in whose documentation the process is somehow described. For NetAct Nokia and M-2000 Huawei the code will be approximately the same, with differences in the nuances of implementing one standard. I will try to describe as completely as possible the process of creating an application for reading the list of alarms, but since I have never written anything in Java before and have not worked with CORBA, I will allow some details to be left outside the scope of this article.
 
 
The whole application can be divided into 3 parts:
 
 
 
receiving IOR interface
 
Create an object referencing the
interface.  
call interface methods
 
 
So, according to the documentation IOR is stored in two places: in the file
/var/opt/ericsson/blkcm/data/bulkcm.nameservice
and on the web server
http: //"masterhost ip": 80 /ior /ExternalNameService.ior
We use the first method:
 
 
private String readIOR () {
String mastersvc = "/var/opt/ericsson/blkcm/data/bulkcm.nameservice";
File f = new File (mastersvc);
BufferedReader br;
String iorContents = null;
try {
br = new BufferedReader (new FileReader (f));
iorContents = br.readLine ();
br.close ();
} catch (IOException e) {
e.printStackTrace ();
}
return iorContents;
}

 
To be precise, the method above will return to us not the IOR, but a reference to the NameService (terminology CORBA), which we could get from the IOR file on the web server. If it's easier: we'll use the result to initialize the connection.
 
 
The second step is to initialize the ORB connection object:
 
 
public void createAlarmObj () {
org.omg.CORBA.Object rootObj = null;
NamingContextExt rootNameCon = null;
Properties props = new Properties ();
props.put ("org.omg.CORBA.ORBInitRef", "NameService =" + readIOR ());
org.omg.CORBA.ORB orb = ORB.init (new String[0], props);
//Resolve the CORBA Naming Service
try {
rootObj = orb.resolve_initial_references ("NameService");
rootNameCon = NamingContextExtHelper.narrow (rootObj);
String s = "com /ericsson /nms /fm_cirpagent /AlarmIRP";
//Locate Alarm IRP
rootObj = rootNameCon.resolve (rootNameCon.to_name (s));
_alarmIrp = com.ericsson.irp.AlarmIRPSystem._AlarmIRPOperationsHelper.narrow (rootObj);
} catch (InvalidName | NotFound | CannotProceed | org.omg.CosNaming.NamingContextPackage.InvalidName e) {
e.printStackTrace ();
}
}

 
Now we have a reference to an object to which we can access by calling its methods. In particular, the method get_alarm_list and returns the list we need. Here is his request from 3GPP:
 
This method returns Alarm Informations. If flag is
 
TRUE, all returned Alarm Informations shall be in AlarmInformationSeq
 
that contains ?1 or more Alarm Informations. Output parameter iter
 
shall be useless. If the flag is FALSE, no Alarm Information shall be
 
in AlarmInformationSeq. IRPAgent needs to use iter to retrieve them.
 
public void getActiveAlarms () {
BooleanHolder flag = new BooleanHolder (false); //false for iteration
com.ericsson.irp.AlarmIRPSystem.AlarmInformationIteratorHolder iter = new com.ericsson.irp.AlarmIRPSystem.AlarmInformationIteratorHolder ();
try {
_alarmIrp.get_alarm_list (alarmFilter, flag, iter);
EventBatchHolder alarmInformation = new EventBatchHolder ();
short alarmSize = 100;
List
alarms = new ArrayList
();
boolean haveMoreAlarms = false;
do {
if (iter.value! = null) {
haveMoreAlarms = iter.value.next_alarmInformations (alarmSize, alarmInformation);
alarms.addAll (Arrays.asList (alarmInformation.value));
}
} while (haveMoreAlarms);
for (StructuredEvent alarm: alarms) {
alarmPrint (alarm);
}
}
} catch (GetAlarmList | ParameterNotSupported | InvalidParameter | NextAlarmInformations e) {
e.printStackTrace ();
}
}

 
This method receives an iterator containing a list of crashes in the form of objects of type StructuredEvent which then outputs to the console alarmPrint (alarm) . Recording StructuredEvent contains the title header and, in fact, the data filterable_data . The data is also a record with the name name and the value value . The description of the fields is also in the standard:
 
const string NV_NOTIFICATION_ID = "a";
 
const string NV_CORRELATED_NOTIFICATIONS = "b";
 
const string NV_EVENT_TIME = "c";
 
const string NV_SYSTEM_DN = "d";
 
const string NV_MANAGED_OBJECT_CLASS = "e";
 
const string NV_MANAGED_OBJECT_INSTANCE = "f";
 
const string NV_SPECIFIC_PROBLEM = "i";
 
 
 
Now we'll put all this together and deduce for example instance and specific_problem :
 
 
private void alarmPrint (StructuredEvent alarm) {
String result = ""
if (alarm.filterable_data! = null) {
for (Property filterabledаta: alarm.filterable_data) {
String fieldName = filterableData.name;
switch (fieldName) {
case "f":
result = result + filterableData.value.extract_string () + ";";
break;
case "i":
result = result + filterableData.value.extract_string ();
break;
}
}
}
System.out.println (result);
}

 
Finally the complete code of the received draft:
 
 
The full code is [/b]
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import org.omg.CORBA. *;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.NotFound;
import org.omg.CosNotification.EventBatchHolder;
import org.omg.CosNotification.Property;
import org.omg.CosNotification.StructuredEvent;
import com.ericsson.irp.AlarmIRPSystem.GetAlarmList;
import com.ericsson.irp.AlarmIRPSystem.InvalidParameter;
import com.ericsson.irp.AlarmIRPSystem.NextAlarmInformations;
import com.ericsson.irp.AlarmIRPSystem.ParameterNotSupported;
public class AlarmClient {
private com.ericsson.irp.AlarmIRPSystem._AlarmIRPOperations _alarmIrp = null;
public static void main (String[].args) {
AlarmClient ac = new AlarmClient ();
ac.createAlarmObj ();
ac.getActiveAlarms ();
}
private String readIOR () {
File f = new File ("/var /opt /ericsson /blkcm /data /bulkcm.nameservice");
BufferedReader br;
String iorContents = null;
try {
br = new BufferedReader (new FileReader (f));
iorContents = br.readLine ();
br.close ();
} catch (IOException e) {
e.printStackTrace ();
}
return iorContents;
}
public void createAlarmObj () {
org.omg.CORBA.Object rootObj = null;
NamingContextExt rootNameCon = null;
Properties props = new Properties ();
props.put ("org.omg.CORBA.ORBInitRef", "NameService =" + readIOR ());
org.omg.CORBA.ORB orb = ORB.init (new String[0], props);
//Resolve the CORBA Naming Service
try {
rootObj = orb.resolve_initial_references ("NameService");
rootNameCon = NamingContextExtHelper.narrow (rootObj);
String s = "com /ericsson /nms /fm_cirpagent /AlarmIRP";
//Locate Alarm IRP
rootObj = rootNameCon.resolve (rootNameCon.to_name (s));
_alarmIrp = com.ericsson.irp.AlarmIRPSystem._AlarmIRPOperationsHelper.narrow (rootObj);
//System.out.println(_alarmIrp);
} catch (InvalidName | NotFound | CannotProceed | org.omg.CosNaming.NamingContextPackage.InvalidName e) {
e.printStackTrace ();
}
}
public void getActiveAlarms () {
BooleanHolder flag = new BooleanHolder (false); //false for iteration
com.ericsson.irp.AlarmIRPSystem.AlarmInformationIteratorHolder iter = new com.ericsson.irp.AlarmIRPSystem.AlarmInformationIteratorHolder ();
try {
_alarmIrp.get_alarm_list ("", flag, iter);
EventBatchHolder alarmInformation = new EventBatchHolder ();
short alarmSize = 100;
List
alarms = new ArrayList
();
boolean haveMoreAlarms = false;
do {
if (iter.value! = null) {
haveMoreAlarms = iter.value.next_alarmInformations (alarmSize, alarmInformation);
alarms.addAll (Arrays.asList (alarmInformation.value));
}
} while (haveMoreAlarms);
if (iter.value! = null) {
for (StructuredEvent alarm: alarms) {
alarmPrint (alarm);
}
}
} catch (GetAlarmList | ParameterNotSupported | InvalidParameter | NextAlarmInformations e) {
e.printStackTrace ();
}
}
private void alarmPrint (StructuredEvent alarm) {
String result = "";
if (alarm.filterable_data! = null) {
for (Property filterabledаta: alarm.filterable_data) {
String fieldName = filterableData.name;
switch (fieldName) {
case "f":
result = result + filterableData.value.extract_string () + ";";
break;
case "i":
result = result + filterableData.value.extract_string ();
break;
}
}
}
System.out.println (result);
}
}

 
 
Running is done by the command:
 
java -cp.: /opt /ericsson /fm_core /classes /alarmirp.jar AlarmClient
 
What in the end: in addition to the "fan" I have not yet used other applications. In the future there is NotificationIRP - Receiving events immediately after their appearance, BulkCmIRP - configuration from an external system, etc. The technology is similar, but if necessary, you can write a separate article. On this topic, perhaps, everything. I can answer the questions in the comments. Thank you!
+ +1 -

Comments 1

Offline
CJM
CJM 11 September 2018 15:15
where can we find com.ericsson.irp classes / jar ?

Add comment