Examples of NetworkConnectionSection


Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vApp/editNetworkConnectionSectionTask.xml", VCloudDirectorMediaType.TASK)
            .httpResponseBuilder().build());

    NetworkConnectionSection section = getNetworkConnectionSection().toBuilder()
          .build();

    Task expected = editNetworkConnectionSectionTask();

    assertEquals(api.getVmApi().editNetworkConnectionSection(vmURI, section), expected);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      return task;
   }

   public static NetworkConnectionSection getNetworkConnectionSection() {
      NetworkConnectionSection section = NetworkConnectionSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      return task;
   }

   public static NetworkConnectionSection getNetworkConnectionSection() {
      NetworkConnectionSection section = NetworkConnectionSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      return task;
   }

   public static NetworkConnectionSection getNetworkConnectionSection() {
      NetworkConnectionSection section = NetworkConnectionSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      return task;
   }

   public static NetworkConnectionSection getNetworkConnectionSection() {
      NetworkConnectionSection section = NetworkConnectionSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      // if the vm contains a network connection and the vApp does not contain any configured
      // network
      if (vmHasNetworkConnectionConfigured(vm)) {
         if (!vAppHasNetworkConfigured(vApp)) {
            // add a new network connection section for the vm.
            NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder()
                     .info("Empty network configuration parameters").build();
            // adding the network connection section to the instantiation params of the vapp.
            vmInstantiationParams = InstantiationParams.builder().sections(ImmutableSet.of(networkConnectionSection))
                     .build();
         }

         // if the vm already contains a network connection section and if the vapp contains a
         // configured network -> vm could be mapped to that network.
         else {
            Set<VAppNetworkConfiguration> vAppNetworkConfigurations = listVappNetworkConfigurations(vApp);
            for (VAppNetworkConfiguration vAppNetworkConfiguration : vAppNetworkConfigurations) {
               NetworkAssignment networkAssignment = NetworkAssignment.builder()
                        .innerNetwork(vAppNetworkConfiguration.getNetworkName())
                        .containerNetwork(vAppNetworkConfiguration.getNetworkName()).build();
               networkAssignments.add(networkAssignment);
            }
         }
      }

      // if the vm does not contain any network connection sections and if the
      // vapp contains a network configuration. we should add the vm to this
      // vapp network
      else {
         if (vAppHasNetworkConfigured(vApp)) {
            VAppNetworkConfiguration vAppNetworkConfiguration = getVAppNetworkConfig(vApp);
            NetworkConnection networkConnection = NetworkConnection.builder()
                     .network(vAppNetworkConfiguration.getNetworkName())
                     .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();

            NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder().info("networkInfo")
                     .primaryNetworkConnectionIndex(0).networkConnection(networkConnection).build();

            // adding the network connection section to the instantiation params of the vapp.
            vmInstantiationParams = InstantiationParams.builder().sections(ImmutableSet.of(networkConnectionSection))
                     .build();
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

         return input.getNetworkName().equals(networkName);
      }
   }
  
   private void cleanUpNetworkConnectionSection(Vm toAddVm) {
      NetworkConnectionSection networkConnectionSection = vmApi.getNetworkConnectionSection(toAddVm.getId());
      Set<NetworkConnection> networkConnections = networkConnectionSection.getNetworkConnections();
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder().isConnected(false).build();
         networkConnectionSection = networkConnectionSection.toBuilder().networkConnection(newNetworkConnection)
                  .build();
      }

      Task configureNetwork = vmApi.editNetworkConnectionSection(toAddVm.getId(), networkConnectionSection);
      assertTaskSucceedsLong(configureNetwork);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

   private void disconnectVmFromVAppNetwork(Vm vm) {
     
      Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getId())
               .getNetworkConnections();

      NetworkConnectionSection section = NetworkConnectionSection.builder()
               .info("info")
               .primaryNetworkConnectionIndex(0)
               .build();

      for (NetworkConnection networkConnection : networkConnections) {
         section = section
                  .toBuilder()
                  .networkConnection(networkConnection.toBuilder()
                           .network("none")
                           .ipAddressAllocationMode(IpAddressAllocationMode.NONE)
                           .build())
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

      // if the vm contains a network connection and the vApp does not contain any configured
      // network
      if (vmHasNetworkConnectionConfigured(vm)) {
         if (!vAppHasNetworkConfigured(vApp)) {
            // add a new network connection section for the vm.
            NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder()
                     .info("Empty network configuration parameters").build();
            // adding the network connection section to the instantiation params of the vapp.
            vmInstantiationParams = InstantiationParams.builder().sections(ImmutableSet.of(networkConnectionSection))
                     .build();
         }

         // if the vm already contains a network connection section and if the vapp contains a
         // configured network -> vm could be mapped to that network.
         else {
            Set<VAppNetworkConfiguration> vAppNetworkConfigurations = listVappNetworkConfigurations(vApp);
            for (VAppNetworkConfiguration vAppNetworkConfiguration : vAppNetworkConfigurations) {
               NetworkAssignment networkAssignment = NetworkAssignment.builder()
                        .innerNetwork(vAppNetworkConfiguration.getNetworkName())
                        .containerNetwork(vAppNetworkConfiguration.getNetworkName()).build();
               networkAssignments.add(networkAssignment);
            }
         }
      }

      // if the vm does not contain any network connection sections and if the
      // vapp contains a network configuration. we should add the vm to this
      // vapp network
      else {
         if (vAppHasNetworkConfigured(vApp)) {
            VAppNetworkConfiguration vAppNetworkConfiguration = getVAppNetworkConfig(vApp);
            NetworkConnection networkConnection = NetworkConnection.builder()
                     .network(vAppNetworkConfiguration.getNetworkName())
                     .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();

            NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder().info("networkInfo")
                     .primaryNetworkConnectionIndex(0).networkConnection(networkConnection).build();

            // adding the network connection section to the instantiation params of the vapp.
            vmInstantiationParams = InstantiationParams.builder().sections(ImmutableSet.of(networkConnectionSection))
                     .build();
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection

         return input.getNetworkName().equals(networkName);
      }
   }
  
   private void cleanUpNetworkConnectionSection(Vm toAddVm) {
      NetworkConnectionSection networkConnectionSection = vmApi.getNetworkConnectionSection(toAddVm.getId());
      Set<NetworkConnection> networkConnections = networkConnectionSection.getNetworkConnections();
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder().isConnected(false).build();
         networkConnectionSection = networkConnectionSection.toBuilder().networkConnection(newNetworkConnection)
                  .build();
      }

      Task configureNetwork = vmApi.editNetworkConnectionSection(toAddVm.getId(), networkConnectionSection);
      assertTaskSucceedsLong(configureNetwork);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.