📜 ⬆️ ⬇️

Retrieving an alarm list from OSS via the AlarmIRP interface

Hello. This topic is very poorly disclosed on the Web because it is of interest only in narrow circles. In order to fill this gap a little, this place seems to me the most appropriate.

The CORBA AlarmIRP interface is present in all control systems of equipment manufacturers that I had to deal with, as prescribed by the 3GPP 3G TS 32.106-2 standard. Consider the example of OSS-RC Ericsson, in whose documentation the process is at least somehow described. For NetAct Nokia and Huawei M-2000, the code will be approximately the same, with differences in the nuances of the implementation of one standard. I will try to describe as clearly as possible the process of creating an application for reading the alarm list, but since I have never written anything in Java before and have not worked with CORBA, I will allow myself to leave some details outside of this article.

All applications can be divided into 3 parts:

  1. getting IOR interface
  2. creating an object that references an interface
  3. 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 not return the IOR, but a link to the NameService (CORBA terminology), which we could get from the IOR file on the web server. If simpler: we will use the result to initialize the connection.

The second stage is the initialization of 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 the object to which we can refer by calling its methods. In particular, the get_alarm_list method returns the list we need. Here is his search from 3GPP:
This method returns Alarm Informations. If flag is
TRUE, all returned AlarmInformationSeq
that contains 0,1 or more Alarm Informations. Output parameter iter
shall be useless. If flag is FALSE, no Alarm Information shall
in AlarmInformationSeq. IRPAgent needs to use them 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<StructuredEvent> alarms = new ArrayList<StructuredEvent>(); 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 gets an iterator containing a list of alarms in the form of objects of type StructuredEvent which then outputs to the console alarmPrint (alarm) . The StructuredEvent record contains a header header and, in fact, filterable_data data. Data is also an entry named name and 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 will put all this together and display for example instance and specific_problem :

 private void alarmPrint(StructuredEvent alarm){ String result = "" if (alarm.filterable_data != null) { for (Property filterableData: 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 full code of the draft received:

Full code
 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<StructuredEvent> alarms = new ArrayList<StructuredEvent>(); 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 filterableData: 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); } } 


Start is made by command:
java -cp.: / opt / ericsson / fm_core / classes / alarmirp.jar AlarmClient

What is the result: 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 - configuring from an external system, etc. The technology is similar, but if necessary, you can write a separate article. On this topic, perhaps, everything. Questions can be answered in the comments. Thank!

Source: https://habr.com/ru/post/422293/


All Articles