Package org.jclouds.vcloud.domain

Examples of org.jclouds.vcloud.domain.NetworkConnection


      Vm vm = get(vApp.getChildren(), 0);

      NetworkConnectionSection net = vm.getNetworkConnectionSection();
      checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);

      NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);

      if (ipAllocationMode == null)
         ipAllocationMode = toConnect.getIpAddressAllocationMode();

      // make sure that we are in fact allocating ips
      if (ipAllocationMode == IpAddressAllocationMode.NONE)
         ipAllocationMode = IpAddressAllocationMode.POOL;

      if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
               && toConnect.getNetwork().equals(networkToConnect.getName())) {
         // then we don't need to change the network settings, and can save a call
      } else {
         Builder builder = net.toBuilder();
         builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
                  .ipAddressAllocationMode(ipAllocationMode).build()));
         logger.trace(">> updating networkConnection vm(%s)", vm.getName());

         waitForTask(client.getVmClient().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
         logger.trace("<< updated networkConnection vm(%s)", vm.getName());
View Full Code Here


   protected boolean connected;
   protected String MACAddress;
   protected IpAddressAllocationMode ipAddressAllocationMode;

   public NetworkConnection getResult() {
      NetworkConnection connection = new NetworkConnection(network, networkConnectionIndex, ipAddress,
               externalIpAddress, connected, MACAddress, ipAddressAllocationMode);
      this.network = null;
      this.networkConnectionIndex = -1;
      this.ipAddress = null;
      this.externalIpAddress = null;
View Full Code Here

      Vm vm = get(vApp.getChildren(), 0);

      NetworkConnectionSection net = vm.getNetworkConnectionSection();
      checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);

      NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);

      if (ipAllocationMode == null)
         ipAllocationMode = toConnect.getIpAddressAllocationMode();

      // make sure that we are in fact allocating ips
      if (ipAllocationMode == IpAddressAllocationMode.NONE)
         ipAllocationMode = IpAddressAllocationMode.POOL;

      if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
               && toConnect.getNetwork().equals(networkToConnect.getName())) {
         // then we don't need to change the network settings, and can save a call
      } else {
         Builder builder = net.toBuilder();
         builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
                  .ipAddressAllocationMode(ipAllocationMode).build()));
         logger.trace(">> updating networkConnection vm(%s)", vm.getName());

         waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
         logger.trace("<< updated networkConnection vm(%s)", vm.getName());
View Full Code Here

public class NetworkConnectionHandlerTest extends BaseHandlerTest {

   public void testDefault() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/networkconnection.xml");

      NetworkConnection result = factory.create(injector.getInstance(NetworkConnectionHandler.class)).parse(is);

      checkNetworkConnection(result);

   }
View Full Code Here

   protected boolean connected;
   protected String MACAddress;
   protected IpAddressAllocationMode ipAddressAllocationMode;

   public NetworkConnection getResult() {
      NetworkConnection connection = new NetworkConnection(network, networkConnectionIndex, ipAddress,
               externalIpAddress, connected, MACAddress, ipAddressAllocationMode);
      this.network = null;
      this.networkConnectionIndex = -1;
      this.ipAddress = null;
      this.externalIpAddress = null;
View Full Code Here

      Vm vm = get(vApp.getChildren(), 0);

      NetworkConnectionSection net = vm.getNetworkConnectionSection();
      checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);

      NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);

      if (ipAllocationMode == null)
         ipAllocationMode = toConnect.getIpAddressAllocationMode();

      // make sure that we are in fact allocating ips
      if (ipAllocationMode == IpAddressAllocationMode.NONE)
         ipAllocationMode = IpAddressAllocationMode.POOL;

      if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
               && toConnect.getNetwork().equals(networkToConnect.getName())) {
         // then we don't need to change the network settings, and can save a call
      } else {
         Builder builder = net.toBuilder();
         builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
                  .ipAddressAllocationMode(ipAllocationMode).build()));
         logger.trace(">> updating networkConnection vm(%s)", vm.getName());

         waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
         logger.trace("<< updated networkConnection vm(%s)", vm.getName());
View Full Code Here

      Vm vm = get(vApp.getChildren(), 0);

      NetworkConnectionSection net = vm.getNetworkConnectionSection();
      checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);

      NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);

      if (ipAllocationMode == null)
         ipAllocationMode = toConnect.getIpAddressAllocationMode();

      // make sure that we are in fact allocating ips
      if (ipAllocationMode == IpAddressAllocationMode.NONE)
         ipAllocationMode = IpAddressAllocationMode.POOL;

      if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
               && toConnect.getNetwork().equals(networkToConnect.getName())) {
         // then we don't need to change the network settings, and can save a call
      } else {
         Builder builder = net.toBuilder();
         builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
                  .ipAddressAllocationMode(ipAllocationMode).build()));
         logger.trace(">> updating networkConnection vm(%s)", vm.getName());

         waitForTask(client.getVmClient().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
         logger.trace("<< updated networkConnection vm(%s)", vm.getName());
View Full Code Here

public class NetworkConnectionHandlerTest extends BaseHandlerTest {

   public void testDefault() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/networkconnection.xml");

      NetworkConnection result = factory.create(injector.getInstance(NetworkConnectionHandler.class)).parse(is);

      checkNetworkConnection(result);

   }
View Full Code Here

   protected boolean connected;
   protected String MACAddress;
   protected IpAddressAllocationMode ipAddressAllocationMode;

   public NetworkConnection getResult() {
      NetworkConnection connection = new NetworkConnection(network, networkConnectionIndex, ipAddress,
               externalIpAddress, connected, MACAddress, ipAddressAllocationMode);
      this.network = null;
      this.networkConnectionIndex = -1;
      this.ipAddress = null;
      this.externalIpAddress = null;
View Full Code Here

public class NetworkConnectionHandlerTest extends BaseHandlerTest {

   public void testDefault() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/networkconnection.xml");

      NetworkConnection result = factory.create(injector.getInstance(NetworkConnectionHandler.class)).parse(is);

      checkNetworkConnection(result);

   }
View Full Code Here

TOP

Related Classes of org.jclouds.vcloud.domain.NetworkConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.