Beispiel #1
0
  /** @throws CapabilityException_Exception */
  private void deactivateOSPF() throws CapabilityException_Exception {
    queueService = OpennaasClient.getNetQueueCapabilityService();
    try {
      if (session.get(getText("network.name")) != null) {
        String networkId = ((ResourceIdentifier) session.get(getText("network.name"))).getId();
        INetOSPFCapabilityService capabilityService = OpennaasClient.getNetOSPFCapabilityService();
        capabilityService.deactivateOSPF(networkId);

        queueService.execute(networkId);
      }
    } catch (Exception e) {
      LOGGER.error("Can't deactivate ospf.");
    }
  }
  private void autobahn() throws ResourceException, ProtocolException {
    LOGGER.info("autobahn ...");
    l2BoDCapabilityService = OpennaasClient.getL2BoDCapabilityService();
    queueManager = OpennaasClient.getQueueManagerCapabilityService();
    resourceManagerService = OpennaasClient.getResourceManagerService();
    protocolSessionManagerService = OpennaasClient.getProtocolSessionManagerService();

    // BoD
    ResourceIdentifier identifier5 = null;

    identifier5 =
        resourceManagerService.createResource(
            getBoDResourceDescriptor("", getText("autobahn.bod.name"), "bod", ""));
    protocolSessionManagerService.registerContext(
        identifier5.getId(),
        getProtocolSessionContext(getText("protocol.bod.name"), getText("protocol.uri.autobahn")));
    resourceManagerService.startResource(identifier5);

    session.put(getText("autobahn.bod.name"), identifier5);

    // Connection 1
    String interfaceName1 = getText("autobahn.connection1.interface1");
    String interfaceName2 = getText("autobahn.connection1.interface2");
    String vlanid = getText("autobahn.connection1.vlanid");
    String endtime = getText("autobahn.connection1.endtime");
    String capacity = getText("autobahn.connection1.capacity");
    l2BoDCapabilityService.requestConnection(
        identifier5.getId(), interfaceName1, interfaceName2, vlanid, capacity, endtime);

    queueManager.execute(identifier5.getId());
    LOGGER.info("  connection 1 done.");

    // Connection 2
    interfaceName1 = getText("autobahn.connection2.interface1");
    interfaceName2 = getText("autobahn.connection2.interface2");
    vlanid = getText("autobahn.connection2.vlanid");
    endtime = getText("autobahn.connection2.endtime");
    capacity = getText("autobahn.connection2.capacity");

    l2BoDCapabilityService.requestConnection(
        identifier5.getId(), interfaceName1, interfaceName2, vlanid, capacity, endtime);

    queueManager.execute(identifier5.getId());
    LOGGER.info("  connection 2 done.");
  }
Beispiel #3
0
  /**
   * @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.");
    }
  }
Beispiel #4
0
  /**
   * Shutdown autobahn connections
   *
   * @throws CapabilityException_Exception
   */
  private void shutDownAutobahn()
      throws CapabilityException_Exception, ResourceException_Exception {
    try {
      l2BoDCapabilityService = OpennaasClient.getL2BoDCapabilityService();
      if (session.get(getText("autobahn.bod.name")) != null) {
        String autbahnId = ((ResourceIdentifier) session.get(getText("autobahn.bod.name"))).getId();

        try {
          List<String> list1 = new ArrayList<String>();
          list1.add(getText("autobahn.connection1.interface1"));
          list1.add(getText("autobahn.connection1.interface2"));
          l2BoDCapabilityService.shutDownConnection(autbahnId, list1);
        } catch (Exception e) {
          LOGGER.error(
              "Can't shut down autobahn connection 1 - "
                  + getText("autobahn.connection1.interface1")
                  + " - "
                  + getText("autobahn.connection1.interface2"));
        }

        try {
          List<String> list2 = new ArrayList<String>();
          list2.add(getText("autobahn.connection2.interface1"));
          list2.add(getText("autobahn.connection2.interface2"));
          l2BoDCapabilityService.shutDownConnection(autbahnId, list2);
        } catch (Exception e) {
          LOGGER.error(
              "Can't shut down autobahn connection 2 - "
                  + getText("autobahn.connection2.interface1")
                  + " - "
                  + getText("autobahn.connection2.interface2"));
        }

        // try {
        // List<String> list3 = new ArrayList<String>();
        // list3.add(getText("autobahn.connection3.interface1"));
        // list3.add(getText("autobahn.connection3.interface2"));
        // l2BoDCapabilityService.shutDownConnection(autbahnId, list3);
        // } catch (Exception e) {
        // LOGGER.error("Can't shut down autobahn connection 3 - "
        // + getText("autobahn.connection3.interface1") + " - "
        // + getText("autobahn.connection3.interface2"));
        // }
      }
    } catch (Exception e) {
      LOGGER.error("Can't shut down autobahn.");
    }
  }
  private void attachNetworkResources() throws CapabilityException {
    LOGGER.info("attachNetworkResources ...");
    networkBasicCapabilityService = OpennaasClient.getNetworkBasicCapabilityService();
    String networkId = ((ResourceIdentifier) session.get(getText("network.name"))).getId();

    networkBasicCapabilityService.l2attach(
        networkId,
        getInterface(getText("network.interface.unicmyre")),
        getInterface(getText("network.interface.myreunic")));

    networkBasicCapabilityService.l2attach(
        networkId,
        getInterface(getText("network.interface.unicgsn")),
        getInterface(getText("network.interface.gsnunic")));

    networkBasicCapabilityService.l2attach(
        networkId,
        getInterface(getText("network.interface.myregsn")),
        getInterface(getText("network.interface.gsnmyre")));

    LOGGER.info("attachNetworkResources done.");
  }
Beispiel #6
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.");
    }
  }
Beispiel #7
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.");
    }
  }