Пример #1
0
  /**
   * Get the GRETunnelService
   *
   * @return GRETunnelService
   * @throws IOException
   */
  public static GRETunnelService getGRETunnelService(
      String tunnelName, String ipv4Address, String subnetMask, String ipSource, String ipDestiny) {
    GRETunnelService greService = new GRETunnelService();
    greService.setElementName("");
    greService.setName(tunnelName);

    GRETunnelConfiguration greConfig = new GRETunnelConfiguration();
    greConfig.setSourceAddress(ipSource);
    greConfig.setDestinationAddress(ipDestiny);

    GRETunnelEndpoint gE = new GRETunnelEndpoint();
    gE.setIPv4Address(ipv4Address);
    gE.setSubnetMask(subnetMask);

    greService.setGRETunnelConfiguration(greConfig);
    greService.addProtocolEndpoint(gE);

    return greService;
  }