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

    // Look up a network in the Vdc
    Set<Reference> networks = vdc.getAvailableNetworks();
    Reference network = Iterables.getLast(networks);

    // Copy existing section and edit fields
    NetworkConnectionSection oldSection = vmApi
        .getNetworkConnectionSection(vmUrn);
    NetworkConnection newNetworkConnection = NetworkConnection.builder()
        .network(network.getName()).networkConnectionIndex(1)
        .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();
    NetworkConnectionSection newSection = oldSection.toBuilder()
        .networkConnection(newNetworkConnection).build();

    // The method under test
    Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(
        vmUrn, newSection);
    assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
        String.format(TASK_COMPLETE_TIMELY,
            "editNetworkConnectionSection"));

    // Retrieve the modified section
    NetworkConnectionSection modified = vmApi
        .getNetworkConnectionSection(vmUrn);

    // Check the retrieved object is well formed
    checkNetworkConnectionSection(modified);

    // Check the section was modified correctly
    for (NetworkConnection connection : modified.getNetworkConnections()) {
      if (connection.getNetwork().equals(
          newNetworkConnection.getNetwork())) {
        assertEquals(connection.getIpAddressAllocationMode(),
            newNetworkConnection.getIpAddressAllocationMode());
        assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection
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

      // Get URI for child VM
      String vmUrn = Iterables.getOnlyElement(vApp.getChildren().getVms()).getId();

      // The method under test
      try {
         NetworkConnectionSection section = getNetworkConnectionSection.apply(vmUrn);

         // Check the retrieved object is well formed
         checkNetworkConnectionSection(section);
      } catch (Exception e) {
         Throwables.propagate(e);
View Full Code Here

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

  
   protected void attachVmToVAppNetwork(Vm vm, String vAppNetworkName) {
      Set<NetworkConnection> networkConnections = vmApi.getNetworkConnectionSection(vm.getId())
               .getNetworkConnections();

      NetworkConnectionSection section = NetworkConnectionSection.builder()
               .info("info")
               .primaryNetworkConnectionIndex(0)
               .build();
     
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder()
                  .network(vAppNetworkName)
                  .isConnected(true)
                  .networkConnectionIndex(0)
                  .ipAddressAllocationMode(IpAddressAllocationMode.POOL)
                  .build();
        
         section = section.toBuilder().networkConnection(newNetworkConnection).build();
      }
      Task configureNetwork = vmApi.editNetworkConnectionSection(vm.getId(), section);
      assertTaskSucceedsLong(configureNetwork);
   }
View Full Code Here

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

      // enough data to tell whether or not it is a public network without
      // string
      // parsing. At worst, we could have properties set per cloud provider to
      // declare the networks which are public, then check against these in
      // networkconnection.getNetwork
      NetworkConnectionSection networkConnectionSection = findNetworkConnectionSectionForVApp.apply(vm);
      if (networkConnectionSection != null) {
         for (NetworkConnection connection : networkConnectionSection.getNetworkConnections()) {
            if (connection.getIpAddress() != null)
               ips.add(connection.getIpAddress());
            if (connection.getExternalIpAddress() != null)
               ips.add(connection.getExternalIpAddress());
         }
View Full Code Here

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

    // Look up a network in the Vdc
    Set<Reference> networks = vdc.getAvailableNetworks();
    Reference network = Iterables.getLast(networks);

    // Copy existing section and edit fields
    NetworkConnectionSection oldSection = vmApi
        .getNetworkConnectionSection(vmUrn);
    NetworkConnection newNetworkConnection = NetworkConnection.builder()
        .network(network.getName()).networkConnectionIndex(1)
        .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();
    NetworkConnectionSection newSection = oldSection.toBuilder()
        .networkConnection(newNetworkConnection).build();

    // The method under test
    Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(
        vmUrn, newSection);
    assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
        String.format(TASK_COMPLETE_TIMELY,
            "editNetworkConnectionSection"));

    // Retrieve the modified section
    NetworkConnectionSection modified = vmApi
        .getNetworkConnectionSection(vmUrn);

    // Check the retrieved object is well formed
    checkNetworkConnectionSection(modified);

    // Check the section was modified correctly
    for (NetworkConnection connection : modified.getNetworkConnections()) {
      if (connection.getNetwork().equals(
          newNetworkConnection.getNetwork())) {
        assertEquals(connection.getIpAddressAllocationMode(),
            newNetworkConnection.getIpAddressAllocationMode());
        assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection
View Full Code Here

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

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

      NetworkConnectionSection expected = getNetworkConnectionSection();

         assertEquals(api.getVmApi().getNetworkConnectionSection(vmURI), expected);
   }
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.