0

I am trying to establish connection to Huawei U2000 NBI corba to get alarms using the .ior file to connect. I already have the IDL files compiled to Java. Below is my main code initializing ORB

package com.be.u2k;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

import org.omg.CORBA.ORB;

import AlarmIRPSystem.AlarmIRP;
import AlarmIRPSystem.AlarmIRPHelper;

public class Main {

    public static void main(String[] args) {

        try {
          String filename = System.getProperty ("user.home") + System.getProperty ("file.separator")+"u2k.ior";

          File f = new File(filename);

          if (!f.exists()) {
            System.out.println("File " + filename + " does not exist.");
            System.exit(-1);
          } else if (f.isDirectory()) {
            System.out.println("File " + filename + " is a directory.");
            System.exit(-1);
          }

          BufferedReader br = new BufferedReader(new FileReader(f));
          String iorContents = br.readLine();
          br.close();

          ORB orbWithIor = ORB.init(args, null);
          org.omg.CORBA.Object obj = orbWithIor.string_to_object(iorContents);

          AlarmIRP alarmIrp = AlarmIRPHelper.narrow(obj);
          System.out.println("AlarmIRPHelper.narrow success!") ;
        } catch (Exception e) {
          System.out.println("ERROR : " + e) ;
          e.printStackTrace(System.out);
        }
    }
}

Why do I keep getting BAD_PARAM error when running it with

java -jar ServerU2kAlarm.jar

admin@ip-10-44-0-10:~$ java -jar ServerU2kAlarm.jar
ERROR : org.omg.CORBA.BAD_PARAM:   vmcid: 0x0  minor code: 0  completed: No
org.omg.CORBA.BAD_PARAM:   vmcid: 0x0  minor code: 0  completed: No
    at AlarmIRPSystem.AlarmIRPHelper.narrow(AlarmIRPHelper.java:60)
    at com.be.u2k.Main.main(Main.java:36)

Did I miss anything out with my ORB object? Thanks.

Roxxy
  • 57
  • 9

1 Answers1

1

I'm dealing with the same issue now. First you have to get EPIRP for HW U2000. Here is the example code AlarmIRP.Code not yet completed. To get to the IOR of the service to be used, the relevant irpId and irpClassName must be given in the get_IRP_reference method.

For managerIdentifier read this explanation: managerIdentifier value

Image for HW U2000 Relations between IRPs

        ***
        Properties properties = new Properties();
        properties.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
        properties.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
        properties.put("ORBInitRef.NameService", settings.getIorString());

        // Connect to name service
        ORB orb = ORB.init((String[]) null, properties);
        POA poa = POAHelper.narrow(orb.resolve_initial_references(settings.getRootPoaName()));
        poa.the_POAManager().activate();
        logger.info("ORB init success");

        org.omg.CORBA.Object obj = orb.string_to_object(settings.getIorString());

        String epirpVersion = null;
        String systemDn = null;
        String irpId = null;
        String irpClassName = null;
        EPIRP epirp = EPIRPHelper.narrow(obj);
        String[] epirpVersions = epirp.get_EP_IRP_versions();
        for (String str : epirpVersions) {
            if (null != str && !"".equals(str.trim())) {
                epirpVersion = str;
            }
        }

        SupportedIRPListTypeHolder supportedIrpList = new SupportedIRPListTypeHolder();
        if (ResultType._OK == epirp.get_IRP_outline("", supportedIrpList).value()) {
            SupportedIRPListTypeElement[] typeHolder = supportedIrpList.value;
            for (SupportedIRPListTypeElement irpListEle : typeHolder) {
                systemDn = irpListEle.systemDN;

                logger.info("dnType:    " + systemDn);
                for (IRPElement irpElement : irpListEle.irpList) {
                    irpId = irpElement.irpId;
                    logger.info("irpId: " + irpId);
                    irpClassName = irpElement.irpClassName;
                    logger.info("irpClassName: " + irpClassName);
                    logger.info("irpVersion: " + irpElement.irpVersion);
                    logger.info("irpManagementScope: ");
                    for (String s : irpElement.irpManagementScope.value()) {
                        logger.info(s);
                    }
                }
            }
        } else {
            logger.error("Failed");
        }

        StringHolder alarmIrpIOR = new StringHolder();
        epirp.get_IRP_reference(managerIdentifier, systemDn, irpId, irpClassName, alarmIrpIOR);
        logger.info("AlarmIRP:" + alarmIrpIOR.value);

        //Connect to AlarmIRP
        AlarmIRP alarmIRP = AlarmIRPHelper.narrow(orb.string_to_object(alarmIrpIOR.value));
Erdi Gürbüz
  • 74
  • 2
  • 3
  • Hi egcodes, I managed to initialize the CORBA connection to U2000 with the answer you've provided. I did a preview of the docs again and found this [Relations between IRPs](http://imgur.com/a/UzXog). Does it mean I need to get first to NotificationIRP before I get to AlarmIRP? If I am going to pass another ior string value to AlarmIRPHelper.narrow method then how do I obtain the ior string value from NotificationIRP object? I checked the NotificationIRP class and there was no method `get_IRP_outline`. – Roxxy Jul 31 '17 at 07:37
  • First, you must narrrow this service EPIRP. Then you get other service(Alarm,Notification) IOR from EPRIP obj. – Erdi Gürbüz Jul 31 '17 at 07:58
  • Thanks egcodes. It was a success narrowing the EPIRP with your answer. But I am now getting the error below then using the ior obtained from EPIRP object. `NotificationIRP notifIrp = NotificationIRPHelper.narrow(orb.string_to_object(notifIrpIOR.value));` It is in that part the error occured. It is the same error for NotificationIRP and AlarmIRP. `ERROR : org.omg.CORBA.BAD_PARAM: Narrow failed vmcid: 0x0 minor code: 0 completed: No org.omg.CORBA.BAD_PARAM: Narrow failed vmcid: 0x0 minor code: 0 ` [full log](https://pastebin.com/pQpuYfC8) – Roxxy Jul 31 '17 at 08:56
  • I think Alarm IOR or Notfication IOR wrong you got from EPIRP. Did you see AlarmIRP id and className or NotficationIrp in supportedIrpList ? I have not written any more code since there is no alarmIRP, notificationIRP services on my HWU2000 system. – Erdi Gürbüz Jul 31 '17 at 09:00
  • I did not see any. This what I only got from supportedIrpList `dnType: DC=www.huawei.com , SubNetwork=1 , ManagementNode=1 , IRPAgent=1 irpId: 8 irpClassName: EPIRP irpVersion: EP IRP V1.2.0 irpManagementScope:` What does that mean if the AlarmIRP or NotificationIRP className if not there? – Roxxy Jul 31 '17 at 09:03
  • I got stuck in the same place. So I wonder if these services are active?Because if so, it have to appear here. – Erdi Gürbüz Jul 31 '17 at 09:06
  • Hi egcodes, thanks you're such a great help. I was able to fetch the IOR for AlarmIRP after reviewing again the docs [Table 3-9](http://imgur.com/a/Rs86x) instead of passing the EPIRP version to method get_IRP_outline `epirp.get_IRP_outline(epirpVersion, supportedIrpList)`, I passed an empty string `epirp.get_IRP_outline("", supportedIrpList)`. It returned all the all the IRPs supported by the IRPAgent EPIRP. – Roxxy Aug 01 '17 at 01:58
  • Have you successfully fetched and read the alarm list data values? I keep getting this error [ERROR: org.omg.CORBA.MARSHAL: Sequence length too large](https://stackoverflow.com/questions/45475682/error-org-omg-corba-marshal-sequence-length-too-large) when reading the values of the alarms list – Roxxy Aug 03 '17 at 05:39
  • I answered your question this link: https://stackoverflow.com/questions/45475682/error-org-omg-corba-marshal-sequence-length-too-large/45476910#45476910 – Erdi Gürbüz Aug 03 '17 at 06:53