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

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


                  .payload(
                        payloadFromResourceWithContentType("/payloads/externalips-lastpage.xml",
                              normalize(ExternalIpsDto.MEDIA_TYPE))) //
                  .build());

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/2/limits/2/externalnetworks/2/ips"));

      IpOptions options = IpOptions.builder().startWith(3).build();
      PaginatedCollection<ExternalIpDto, ExternalIpsDto> ips = api.listExternalIps(vlan, options);

      assertEquals(ips.size(), 2);
View Full Code Here


                  .payload(
                        payloadFromResourceWithContentType("/payloads/unmanagedips-lastpage.xml",
                              normalize(UnmanagedIpsDto.MEDIA_TYPE))) //
                  .build());

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/2/limits/2/externalnetworks/2/ips"));

      PagedIterable<UnmanagedIpDto> unmanagedIps = api.listUnmanagedIps(vlan);
      List<UnmanagedIpDto> ips = unmanagedIps.concat().toList();

      assertEquals(ips.size(), 4);
View Full Code Here

                  .payload(
                        payloadFromResourceWithContentType("/payloads/unmanagedips-lastpage.xml",
                              normalize(UnmanagedIpsDto.MEDIA_TYPE))) //
                  .build());

      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/2/limits/2/externalnetworks/2/ips"));

      IpOptions options = IpOptions.builder().startWith(3).build();
      PaginatedCollection<UnmanagedIpDto, UnmanagedIpsDto> ips = api.listUnmanagedIps(vlan, options);

      assertEquals(ips.size(), 2);
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

      VLANNetworksDto networks = context.getApi().getCloudApi().listPrivateNetworks(target);
      return wrap(context, PrivateNetwork.class, networks.getCollection());
   }

   public PrivateNetwork getPrivateNetwork(final Integer id) {
      VLANNetworkDto network = context.getApi().getCloudApi().getPrivateNetwork(target, id);
      return wrap(context, PrivateNetwork.class, 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

    *      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

   @Override
   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
      checkArgument(checkNotNull(input, "input") instanceof VLANNetworkDto,
            "this binder is only valid for VLANNetworkDto objects");

      VLANNetworkDto network = (VLANNetworkDto) input;
      RESTLink editLink = checkNotNull(network.getEditLink(), "VLANNetworkDto must have an edit link");

      LinksDto refs = new LinksDto();
      switch (network.getType()) {
         case INTERNAL:
            refs.addLink(new RESTLink("internalnetwork", editLink.getHref()));
            break;
         case EXTERNAL:
            refs.addLink(new RESTLink("externalnetwork", editLink.getHref()));
View Full Code Here

   @Override
   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
      checkArgument(checkNotNull(input, "input") instanceof VLANNetworkDto,
            "this binder is only valid for VLANNetworkDto objects");

      VLANNetworkDto network = (VLANNetworkDto) input;
      checkArgument(network.getType() == NetworkType.UNMANAGED, "this binder is only valid for UNMANAGED networks");

      RESTLink ipsLink = checkNotNull(network.searchLink("ips"), "VLANNetworkDto must have an ips link");

      LinksDto refs = new LinksDto();
      refs.addLink(new RESTLink("unmanagedip", ipsLink.getHref()));

      return super.bindToRequest(request, refs);
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.