コード例 #1
0
ファイル: DestroyAction.java プロジェクト: edugrasa/opennaas
  /**
   * @throws CapabilityException_Exception
   * @throws ActionException_Exception
   * @throws ProtocolException_Exception
   */
  private void removeGRE()
      throws CapabilityException_Exception, ActionException_Exception, ProtocolException_Exception {
    try {
      queueCapab = OpennaasClient.getQueueManagerCapabilityService();
      greCapab = OpennaasClient.getGRETunnelCapabilityService();
      if (session.get(getText("myre.lrouter.name")) != null) {
        GreTunnelService greTunnelService = new GreTunnelService();
        String lrMyreId = ((ResourceIdentifier) session.get(getText("myre.lrouter.name"))).getId();

        greTunnelService.setName(getText("myre.iface.gre"));
        greCapab.deleteGRETunnel(lrMyreId, greTunnelService);

        queueCapab.execute(lrMyreId);
      }
    } catch (Exception e) {
      LOGGER.error("Can't delete GRE.");
    }
  }
コード例 #2
0
ファイル: DestroyAction.java プロジェクト: edugrasa/opennaas
  /**
   * @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.");
    }
  }