/**
   * Parses logical routers data from message and puts it into routerModel.
   *
   * @param routerModel to store parsed data
   * @param message to parse logical routers data from
   * @return routerModel updated with logical routers information from message.
   * @throws IOException
   * @throws SAXException
   */
  private System parseLRs(System routerModel, String message) throws IOException, SAXException {

    // remove LR from the model before parsing new configuration
    routerModel.removeAllremoveManagedSystemElementByType(ComputerSystem.class);

    DigesterEngine listLogicalRoutersParser = new ListLogicalRoutersParser();
    listLogicalRoutersParser.init();
    listLogicalRoutersParser.configurableParse(new ByteArrayInputStream(message.getBytes()));

    // put new LR in the model
    for (String key : listLogicalRoutersParser.getMapElements().keySet()) {
      ComputerSystem system = new ComputerSystem();
      system.setName((String) listLogicalRoutersParser.getMapElements().get(key));
      routerModel.addManagedSystemElement(system);
    }

    return routerModel;
  }
예제 #2
0
 public static ComputerSystem newParamsLRWithInterface(String lrName) {
   ComputerSystem lrModel = new ComputerSystem();
   lrModel.setName(lrName);
   lrModel.setElementName(lrName);
   return lrModel;
 }
예제 #3
0
 public static ComputerSystem getLogicalRouter(String lrName) {
   ComputerSystem lrModel = new ComputerSystem();
   lrModel.setName(lrName);
   lrModel.setElementName(lrName);
   return lrModel;
 }