Esempio n. 1
0
  private boolean handleProtectionChangeEvent(
      AbstractNe ne, Map<String, String> values, CHANGE oper) {
    try {
      String workingAid = values.get("AID1");
      String protectionAid = values.get("AID2");
      NetworkElement omeNe = (NetworkElement) ne;

      // Set up the data for event
      HashMap<String, String> eventData = new HashMap<String, String>();
      eventData.put("workingAid", workingAid);
      eventData.put("proctectingAid", protectionAid);
      eventData.put("operation", oper.asString());
      dbchgEvent.addDataElement(eventData);
      getParameters().put(AbstractCommandlet.RESULT_KEY, dbchgEvent);
      // String command = values.get("COMMAND");
      if (oper == CHANGE.DELETE) {
        // don't handle any thing, for now
        log.debug("Got the DLT-FFP report for " + workingAid + ":" + protectionAid);

        DbUtility.INSTANCE.updateOrAddFacilityAttr(
            ne, workingAid, AbstractFacilityXml.PROTECTIONSCHEME_ATTR, "N/A");
        DbUtility.INSTANCE.updateOrAddFacilityAttr(
            ne, protectionAid, AbstractFacilityXml.PROTECTIONSCHEME_ATTR, "N/A");
        omeNe.getProtectionAid().remove(workingAid);
        omeNe.getProtectionAid().remove(protectionAid);
        eventData.put(AbstractFacilityXml.PROTECTIONSCHEME_ATTR, "N/A");
        return true;
      }
      log.debug("Got the ENT-FFP report for " + workingAid + ":" + protectionAid);
      String[] aidMap = workingAid.split("-");
      Map<String, String> paramList = new HashMap<String, String>();
      paramList.put(ObjectElement.OPERATION_KEY, "RTRV-FFP-" + aidMap[0]);
      paramList.put("WRKGAID", aidMap[0] + "-1-ALL");

      List<Map<String, String>> result = omeNe.getTl1Session().sendToNE(paramList);
      if (result != null) {
        Iterator<Map<String, String>> ir = result.iterator();
        while (ir.hasNext()) {
          Map<String, String> aResult = ir.next();
          String protectionScheme = aResult.get("PS");
          omeNe.getProtectionAid().add(workingAid);
          omeNe.getProtectionAid().add(protectionAid);

          DbUtility.INSTANCE.updateOrAddFacilityAttr(
              ne, workingAid, AbstractFacilityXml.PROTECTIONSCHEME_ATTR, protectionScheme);
          DbUtility.INSTANCE.updateOrAddFacilityAttr(
              ne, protectionAid, AbstractFacilityXml.PROTECTIONSCHEME_ATTR, protectionScheme);
          eventData.put(AbstractFacilityXml.PROTECTIONSCHEME_ATTR, protectionScheme);
        }
        return true;
      }
    } catch (Exception e) {
      log.error("Failed to handle FFP event", e);
    }
    return false;
  }