@Override
  protected Object doExecute() throws Exception {
    printInitCommand("Update VRRP virtual link address");

    try {

      IResource router = getResourceFromFriendlyName(resourceId);

      IVRRPCapability vrrpCapability =
          (IVRRPCapability) router.getCapabilityByInterface(IVRRPCapability.class);

      VRRPGroup vrrpGroup = new VRRPGroup();
      vrrpGroup.setVrrpName(vrrpGroupId);
      vrrpGroup.setVirtualLinkAddress(virtualLinkAddress);

      vrrpCapability.updateVRRPVirtualLinkAddress(vrrpGroup);

      printEndCommand();
      return null;

    } catch (Exception e) {
      printError("Error updating VRRP virtual Link address.");
      printError(e);
      printEndCommand();
      return -1;
    }
  }
Esempio n. 2
0
  public static VRRPGroup newParamsVRRPGroupWithOneEndpoint(
      String virtualIPAddress,
      String interfaceName,
      String interfaceIPAddress,
      String interfaceSubnetMask) {
    // VRRPGroup
    VRRPGroup vrrpGroup = new VRRPGroup();
    vrrpGroup.setVrrpName(201);
    vrrpGroup.setVirtualIPAddress(virtualIPAddress);

    // VRRPProtocolEndpoint
    VRRPProtocolEndpoint vrrProtocolEndpoint1 = new VRRPProtocolEndpoint();
    vrrProtocolEndpoint1.setPriority(100);
    vrrProtocolEndpoint1.setService(vrrpGroup);

    // IPProtocolEndpoint
    IPProtocolEndpoint ipProtocolEndpoint1 = new IPProtocolEndpoint();
    ipProtocolEndpoint1.setIPv4Address(interfaceIPAddress);
    ipProtocolEndpoint1.setSubnetMask(interfaceSubnetMask);
    vrrProtocolEndpoint1.bindServiceAccessPoint(ipProtocolEndpoint1);

    // EthernetPort
    EthernetPort eth1 = new EthernetPort();
    eth1.setLinkTechnology(NetworkPort.LinkTechnology.ETHERNET);
    eth1.setName(interfaceName);
    ipProtocolEndpoint1.addLogiaclPort(eth1);

    return vrrpGroup;
  }