Ejemplo n.º 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;
  }
  /**
   * Get the GRETunnelService
   *
   * @return GRETunnelService
   * @throws IOException
   */
  private GRETunnelService getGRETunnelService() {

    GRETunnelService greService = new GRETunnelService();
    greService.setElementName("");
    greService.setName("gr-0/1/1.2");

    GRETunnelConfiguration greConfig = new GRETunnelConfiguration();
    greConfig.setSourceAddress("147.56.89.62");
    greConfig.setDestinationAddress("193.45.23.1");

    GRETunnelEndpoint gE = new GRETunnelEndpoint();
    gE.setIPv6Address("51:4F3::3A:B1");
    gE.setPrefixLength(Short.valueOf("64"));
    gE.setProtocolIFType(ProtocolIFType.IPV6);

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

    return greService;
  }