Package com.abiquo.server.core.infrastructure.network

Examples of com.abiquo.server.core.infrastructure.network.VLANNetworkDto


         this.networkServiceType = Optional.of(networkServiceType);
         return this;
      }

      public ExternalNetwork build() {
         VLANNetworkDto dto = new VLANNetworkDto();
         dto.setName(name);
         dto.setTag(tag);
         dto.setGateway(gateway);
         dto.setAddress(address);
         dto.setMask(mask);
         dto.setPrimaryDNS(primaryDNS);
         dto.setSecondaryDNS(secondaryDNS);
         dto.setSufixDNS(suffixDNS);
         dto.setDefaultNetwork(defaultNetwork == null ? Boolean.FALSE : defaultNetwork);
         dto.setUnmanaged(Boolean.FALSE);
         dto.setType(NetworkType.EXTERNAL);

         NetworkServiceType nst = networkServiceType.or(datacenter.defaultNetworkServiceType());
         dto.addLink(new RESTLink("networkservicetype", nst.unwrap().getEditLink().getHref()));

         ExternalNetwork network = new ExternalNetwork(context, dto);
         network.datacenter = datacenter;
         network.enterprise = enterprise;
View Full Code Here


    *      Resource#
    *      VirtualDatacenterResource-GetdefaultVLANusedbydefaultinVirtualDatacenter
    *      </a>
    */
   public Network<?> getDefaultNetwork() {
      VLANNetworkDto network = context.getApi().getCloudApi().getDefaultNetwork(target);
      return wrap(context, network.getType() == NetworkType.INTERNAL ? PrivateNetwork.class : ExternalNetwork.class,
            network);
   }
View Full Code Here

   public PrivateNetwork findPrivateNetwork(final Predicate<Network<PrivateIp>> filter) {
      return Iterables.getFirst(filter(listPrivateNetworks(), filter), null);
   }

   public PrivateNetwork getPrivateNetwork(final Integer id) {
      VLANNetworkDto network = context.getApi().getCloudApi().getPrivateNetwork(target, id);
      return wrap(context, PrivateNetwork.class, network);
   }
View Full Code Here

    *      PublicNetworkResource-Getthelistofpublicnetworks</a>
    * @return Network with the given id or <code>null</code> if it does not
    *         exist.
    */
   public Network<?> getNetwork(final Integer id) {
      VLANNetworkDto network = context.getApi().getInfrastructureApi().getNetwork(target, id);
      return Network.wrapNetwork(context, network);
   }
View Full Code Here

         this.virtualDatacenter = virtualDatacenter;
         return this;
      }

      public PrivateNetwork build() {
         VLANNetworkDto dto = new VLANNetworkDto();
         dto.setName(name);
         dto.setTag(tag);
         dto.setGateway(gateway);
         dto.setAddress(address);
         dto.setMask(mask);
         dto.setPrimaryDNS(primaryDNS);
         dto.setSecondaryDNS(secondaryDNS);
         dto.setSufixDNS(suffixDNS);
         dto.setDefaultNetwork(defaultNetwork);
         dto.setUnmanaged(false);
         dto.setType(NetworkType.INTERNAL);

         PrivateNetwork network = new PrivateNetwork(context, dto);
         network.virtualDatacenter = virtualDatacenter;

         return network;
View Full Code Here

         this.networkServiceType = Optional.of(networkServiceType);
         return this;
      }

      public PublicNetwork build() {
         VLANNetworkDto dto = new VLANNetworkDto();
         dto.setName(name);
         dto.setTag(tag);
         dto.setGateway(gateway);
         dto.setAddress(address);
         dto.setMask(mask);
         dto.setPrimaryDNS(primaryDNS);
         dto.setSecondaryDNS(secondaryDNS);
         dto.setSufixDNS(suffixDNS);
         dto.setDefaultNetwork(defaultNetwork);
         dto.setUnmanaged(false);
         dto.setType(NetworkType.PUBLIC);

         NetworkServiceType nst = networkServiceType.or(datacenter.defaultNetworkServiceType());
         dto.addLink(new RESTLink("networkservicetype", nst.unwrap().getEditLink().getHref()));

         PublicNetwork network = new PublicNetwork(context, dto);
         network.datacenter = datacenter;

         return network;
View Full Code Here

      binder.bindToRequest(request, network);
   }

   @Test(expectedExceptions = NoSuchElementException.class)
   public void testBindNetworkConfigurationRefWithoutVirtualMachine() throws SecurityException, NoSuchMethodException {
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      Invokable<?, ?> method = method(TestNetworkConfig.class, "withoutVirtualMachine", VLANNetworkDto.class);
      GeneratedHttpRequest request = GeneratedHttpRequest.builder()
            .invocation(Invocation.create(method, ImmutableList.<Object> of(network))).method(HttpMethod.GET)
            .endpoint(URI.create("http://localhost")).build();
View Full Code Here

      binder.bindToRequest(request, network);
   }

   public void testBindNetworkConfigurationRef() throws SecurityException, NoSuchMethodException, IOException {
      VirtualMachineDto vm = CloudResources.virtualMachinePut();
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      Invokable<?, ?> method = method(TestNetworkConfig.class, "withAll", VirtualMachineDto.class, VLANNetworkDto.class);
      GeneratedHttpRequest request = GeneratedHttpRequest.builder()
            .invocation(Invocation.create(method, ImmutableList.<Object> of(vm, network))).method(HttpMethod.GET)
            .endpoint(URI.create("http://localhost")).build();

      BindNetworkConfigurationRefToPayload binder = new BindNetworkConfigurationRefToPayload(new JAXBParser("false"));

      String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId();

      GeneratedHttpRequest newRequest = binder.bindToRequest(request, network);
      assertPayloadEquals(newRequest.getPayload(), withHeader("<links><link href=\"" + configLink
            + "\" rel=\"network_configuration\"/></links>"), LinksDto.class);
   }
View Full Code Here

TOP

Related Classes of com.abiquo.server.core.infrastructure.network.VLANNetworkDto

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.