Exemple #1
0
  /**
   * @throws ResourceException_Exception
   * @throws CapabilityException_Exception
   * @throws ActionException_Exception
   * @throws ProtocolException_Exception
   */
  private void removeLR()
      throws ResourceException_Exception, CapabilityException_Exception, ActionException_Exception,
          ProtocolException_Exception {
    try {
      chassisCapab = OpennaasClient.getChassisCapabilityService();
      resourceManagerService = OpennaasClient.getResourceManagerService();
      queueCapab = OpennaasClient.getQueueManagerCapabilityService();

      ResourceIdentifier lrUnic = (ResourceIdentifier) session.get(getText("unic.lrouter.name"));
      ResourceIdentifier lrGSN = (ResourceIdentifier) session.get(getText("myre.lrouter.name"));
      ResourceIdentifier lrMyre = (ResourceIdentifier) session.get(getText("gsn.lrouter.name"));

      try {
        if (lrUnic != null) {
          resourceManagerService.stopResource(lrUnic);
          resourceManagerService.removeResourceById(lrUnic.getId());

          if (session.get(getText("unic.router.name")) != null) {
            ComputerSystem router = new ComputerSystem();
            String routerUnicId =
                ((ResourceIdentifier) session.get(getText("unic.router.name"))).getId();
            router.setName(getText("unic.lrouter.name"));
            chassisCapab.deleteLogicalRouter(routerUnicId, router);
            queueCapab.execute(routerUnicId);
          }
        }
      } catch (Exception e) {
        LOGGER.error("Can't delete " + getText("unic.lrouter.name") + " LR");
      }

      try {
        if (lrMyre != null) {
          resourceManagerService.stopResource(lrMyre);
          resourceManagerService.removeResourceById(lrMyre.getId());

          if (session.get(getText("myre.router.name")) != null) {
            ComputerSystem router = new ComputerSystem();
            String routerMyreId =
                ((ResourceIdentifier) session.get(getText("myre.router.name"))).getId();
            router.setName(getText("myre.lrouter.name"));
            chassisCapab.deleteLogicalRouter(routerMyreId, router);
            queueCapab.execute(routerMyreId);
          }
        }
      } catch (Exception e) {
        LOGGER.error("Can't delete " + getText("myre.lrouter.name") + " LR");
      }

      try {
        if (lrMyre != null) {
          resourceManagerService.stopResource(lrGSN);
          resourceManagerService.removeResourceById(lrGSN.getId());

          if (session.get(getText("gsn.router.name")) != null) {
            ComputerSystem router = new ComputerSystem();
            String routerGSNId =
                ((ResourceIdentifier) session.get(getText("gsn.router.name"))).getId();
            router.setName(getText("gsn.lrouter.name"));
            chassisCapab.deleteLogicalRouter(routerGSNId, router);
            queueCapab.execute(routerGSNId);
          }
        }
      } catch (Exception e) {
        LOGGER.error("Can't delete " + getText("gsn.router.name") + " LR");
      }

    } catch (Exception e) {
      LOGGER.error("Can't delete all logical routers.");
    }
  }
Exemple #2
0
  /**
   * @throws CapabilityException_Exception
   * @throws ResourceException_Exception
   * @throws ProtocolException_Exception
   */
  private void removeResources()
      throws CapabilityException_Exception, ResourceException_Exception,
          ProtocolException_Exception {
    try {
      resourceManagerService = OpennaasClient.getResourceManagerService();

      try {
        if (session.get(getText("unic.router.name")) != null) {
          ResourceIdentifier routerUnic =
              (ResourceIdentifier) session.get(getText("unic.router.name"));
          resourceManagerService.stopResource(routerUnic);
          resourceManagerService.removeResourceById(routerUnic.getId());
        }
      } catch (Exception e) {
        LOGGER.error("Can't remove or stop " + getText("unic.router.name"));
      }

      try {
        if (session.get(getText("gsn.router.name")) != null) {
          ResourceIdentifier routerGSN =
              (ResourceIdentifier) session.get(getText("gsn.router.name"));
          resourceManagerService.stopResource(routerGSN);
          resourceManagerService.removeResourceById(routerGSN.getId());
        }
      } catch (Exception e) {
        LOGGER.error("Can't remove or stop " + getText("gsn.router.name"));
      }

      try {
        if (session.get(getText("myre.router.name")) != null) {
          ResourceIdentifier routerMyre =
              (ResourceIdentifier) session.get(getText("myre.router.name"));
          resourceManagerService.stopResource(routerMyre);
          resourceManagerService.removeResourceById(routerMyre.getId());
        }
      } catch (Exception e) {
        LOGGER.error("Can't remove or stop " + getText("myre.router.name"));
      }

      try {
        if (session.get(getText("network.name")) != null) {
          ResourceIdentifier networkDemo =
              (ResourceIdentifier) session.get(getText("network.name"));
          resourceManagerService.stopResource(networkDemo);
          resourceManagerService.removeResourceById(networkDemo.getId());
        }
      } catch (Exception e) {
        LOGGER.error("Can't remove or stop " + getText("network.name"));
      }

      try {
        if (session.get(getText("autobahn.bod.name")) != null) {
          ResourceIdentifier autobahnDemo =
              (ResourceIdentifier) session.get(getText("autobahn.bod.name"));
          resourceManagerService.stopResource(autobahnDemo);
          resourceManagerService.removeResourceById(autobahnDemo.getId());
        }
      } catch (Exception e) {
        LOGGER.error("Can't remove or stop " + getText("network.name"));
      }

    } catch (Exception e) {
      LOGGER.error("Can't remove resources.");
    }
  }