Exemple #1
0
  @Override
  public boolean start() throws Exception {
    /*
     * "DBCHGSEQ=1038,DATE=05-03-30,TIME=20-45-53,USERID=ADMIN,SOURCE=1,
     * PRIORITY=GEN_TL1_CMD:ENT-CRS-STS1:STS1-1-9-1-8,STS1-1-10-1-8::
     * CKTID=\"Performance Testing 8\":"
     */
    AbstractNe ne = (AbstractNe) getParameters().get(NePoxyDefinitionsParser.NETWORKELEMENT_KEY);
    ne.upDateLocalInfo();
    dbchgEvent = new Tl1XmlDbChangeEvent(ne);
    TL1AlarmEvent anEvent =
        (TL1AlarmEvent) getParameters().get(AbstractNetworkElement.EVENTRECV_KEY);
    Map<String, String> values = anEvent.getPayloads().get(0);
    // dbchgEvent.setReportType(anEvent.getCommandCode());

    log.debug("Process DBCHG event: " + values);
    dbchgEvent.setOccurrentDate(values.get("DATE"));
    dbchgEvent.setOccurrentTime(values.get("TIME"));

    String neId = ne.getNeId();
    dbchgEvent.setEventId(neId + "_" + values.get("DBCHGSEQ"));
    dbchgEvent.setOwnerId(ne.getTerminalId());
    String command = values.get("COMMAND");
    // String cktid = values.get("CKTID");
    dbchgEvent.updateDescription(values.get("PRIOR"));
    // dbchgEvent.setReportType(command);

    boolean result = false;
    if (command.indexOf("ENT-") >= 0 || command.indexOf("DLT-") >= 0) {
      if (command.indexOf("ENT-") >= 0) {
        operation = CHANGE.ADD;
      } else {
        operation = CHANGE.DELETE;
      }

      if (command.indexOf("-CRS-") >= 0) {
        dbchgEvent.setReportType("connection");
        result = handleConnectionEvent(ne, values, dbchgEvent);
      } else if (command.indexOf("-OC") >= 0
          || command.indexOf("-WAN") >= 0
          || command.indexOf("-ETH") >= 0) {
        dbchgEvent.setReportType("facility");
        result = handleStateChangeEvent(ne, values, operation);
      } else if (command.indexOf("-BLSRMAP") >= 0) {
        dbchgEvent.setReportType("facility");
        result = handleBlsrChangeEvent(ne, values, operation);
      } else if (command.indexOf("-FFP-") >= 0) {
        dbchgEvent.setReportType("facility");
        result = handleProtectionChangeEvent(ne, values, operation);
      }
    } else if (command.indexOf("-TNE") >= 0) {
      /*
       * Provisioned Tunnel Endpoints operations ignored, this statement stops
       * us entering the next bloc and thinking we are dealing with ETH or WAN
       * changes
       */

    } else if (command.indexOf("STCHG-") >= 0
        || command.indexOf("ED-") >= 0
        || command.indexOf("RST-") >= 0
        || command.indexOf("RMV-") >= 0) {
      /*
       * for the ED-ETH, ED-WAN, ..., we can process the event based on the data
       * included in the report without going back to the NE for the changed
       * attributes, but we perform a complete retrieval anyway, just in case...
       */
      dbchgEvent.setReportType("facility");
      operation = CHANGE.MODIFY;
      result = handleStateChangeEvent(ne, values, operation);
    }

    return result;
  }
Exemple #2
0
  private void checkForEplWanDbChange(
      AbstractNe ne,
      Tl1CommandCode mod,
      String wanType,
      String ethType,
      String shelf,
      String slot,
      String port) {
    // ethType can vary: ETH, ETH10G, ETH100, etc.

    String wanAid = wanType + "-" + shelf + "-" + slot + "-" + port;
    String ethAid = ethType + "-" + shelf + "-" + slot + "-" + port;

    log.debug("Checking for change in DB due to Connection event: aid: " + wanAid);

    Map<String, String> paramList = new HashMap<String, String>();
    paramList.put(ObjectElement.OPERATION_KEY, mod.toString());
    paramList.put("AID", wanAid);

    try {
      ArrayList<Map<String, String>> temp = new ArrayList<Map<String, String>>();
      temp.add(new HashMap<String, String>());
      List<Map<String, String>> wanResult =
          ((NetworkElement) ne).getTl1Session().sendToNE(paramList);

      if (wanResult != null) {
        Map<String, String> aWanResult = wanResult.get(0);

        String ethEplFac = DbUtility.INSTANCE.retrieveAFacility(ne, shelf, slot, port);
        if (ethEplFac == null) {

          return;
        }
        OmeFacilityXML eplFacXML = new OmeFacilityXML(ethEplFac);

        // Build the list of EPL WAN->ETH*** XML attributes based on the NE
        // key/value.
        Map<String, String> currentNeAttrValue = new HashMap<String, String>();
        Iterator<String> keyIr = OmeFacilityXML.wanToEthEPLNeToXmlMapping.keySet().iterator();
        while (keyIr.hasNext()) {
          String neKey = keyIr.next();
          String xmlKey = OmeFacilityXML.wanToEthEPLNeToXmlMapping.get(neKey);
          String aValue = aWanResult.get(neKey);
          if (aValue != null) {
            currentNeAttrValue.put(xmlKey, aValue);
          }
        }

        Map<String, String> updateList = eplFacXML.updateFacilityAttr(ethAid, currentNeAttrValue);

        if (updateList != null) {
          // TODO: The WAN event from here up to LPCP_PORT should be screened
          // first...
          // to evaluate whether or not the updated attributes are of interest
          // to LPCP_PORT. WAN attributes of interest currently are:
          // - VCAT
          // - Basic Rate (?)

          log.debug("Facility's attr to update in checkForDbChange:" + updateList);
          DbUtility.INSTANCE.updateAFacility(ne, updateList, ethAid);
          updateList.put("operation", "modify");
          updateList.put("aid", ethAid);

          Tl1XmlDbChangeEvent additionalEvent = new Tl1XmlDbChangeEvent(ne);
          additionalEvent.setOccurrentDate(dbchgEvent.getOccurrentDate());
          additionalEvent.setOccurrentTime(dbchgEvent.getOccurrentTime());
          additionalEvent.setEventId(ne.getNeId() + "_" + System.currentTimeMillis());
          additionalEvent.setOwnerId(ne.getTerminalId());
          additionalEvent.setNotificationType("facility");
          additionalEvent.updateDescription("PROXY_GEN");
          additionalEvent.addDataElement(updateList);
          getParameters().put(AbstractCommandlet.ADDITIONALEVENT_KEY, additionalEvent);
        } else {

        }
      } else {
        log.error("Got empty result from querying new state of " + wanAid + " from NE");
      }
    } catch (Exception e) {
      log.error("Failed to perform " + mod + " from " + ne.getNeName(), e);
    }
  }