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

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


/**
* Network domain utilities.
*/
public class NetworkResources {
   public static VLANNetworkDto vlanPost() {
      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.setAddress("192.168.1.0");
      vlan.setDefaultNetwork(true);
      vlan.setName("DefaultNetwork");
      vlan.setGateway("192.168.1.1");
      vlan.setMask(24);

      return vlan;
   }
View Full Code Here


      return nic;
   }

   public static VLANNetworkDto privateNetworkPut() {
      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.setId(1);
      vlan.setAddress("192.168.1.0");
      vlan.setDefaultNetwork(true);
      vlan.setName("DefaultNetwork");
      vlan.setGateway("192.168.1.1");
      vlan.setMask(24);
      vlan.setType(NetworkType.INTERNAL);
      vlan.addLink(new RESTLink("edit", "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1"));
      vlan.addLink(new RESTLink("ips", "http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips"));

      return vlan;
   }
View Full Code Here

      return vlan;
   }

   public static VLANNetworkDto publicNetworkPut() {
      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.setId(1);
      vlan.setAddress("192.168.1.0");
      vlan.setDefaultNetwork(true);
      vlan.setName("PublicNetwork");
      vlan.setGateway("192.168.1.1");
      vlan.setMask(24);
      vlan.setType(NetworkType.PUBLIC);
      vlan.addLink(new RESTLink("edit", "http://localhost/api/admin/datacenters/1/network/1"));
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/datacenters/1/network/1/ips"));

      return vlan;
   }
View Full Code Here

      return vlan;
   }

   public static VLANNetworkDto externalNetworkPut() {
      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.setId(1);
      vlan.setAddress("192.168.1.0");
      vlan.setDefaultNetwork(true);
      vlan.setName("ExternalNetwork");
      vlan.setGateway("192.168.1.1");
      vlan.setMask(24);
      vlan.setType(NetworkType.EXTERNAL);
      vlan.addLink(new RESTLink("edit", "http://localhost/api/admin/datacenters/1/network/1"));
      vlan.addLink(new RESTLink("enterprise", "http://localhost/api/admin/enterprises/1"));
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips"));

      return vlan;
   }
View Full Code Here

         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

      return vlan;
   }

   public static VLANNetworkDto unmanagedNetworkPut() {
      VLANNetworkDto vlan = new VLANNetworkDto();
      vlan.setId(1);
      vlan.setAddress("192.168.1.0");
      vlan.setDefaultNetwork(true);
      vlan.setName("UnmanagedNetwork");
      vlan.setGateway("192.168.1.1");
      vlan.setMask(24);
      vlan.setType(NetworkType.UNMANAGED);
      vlan.addLink(new RESTLink("edit", "http://localhost/api/admin/datacenters/1/network/1"));
      vlan.addLink(new RESTLink("enterprise", "http://localhost/api/admin/enterprises/1"));
      vlan.addLink(new RESTLink("ips", "http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips"));

      return vlan;
   }
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

   public void testSetGatewayNetwork() throws SecurityException, NoSuchMethodException, IOException {
      Invokable<?, ?> method = method(CloudApi.class, "setGatewayNetwork", VirtualMachineDto.class,
            VLANNetworkDto.class);

      VirtualMachineDto vm = CloudResources.virtualMachinePut();
      VLANNetworkDto network = NetworkResources.privateNetworkPut();

      GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(vm, network)));

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

      assertRequestLineEquals(
            request,
            "PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/network/configurations HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "");
View Full Code Here

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

      public UnmanagedNetwork 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(true);
         dto.setType(NetworkType.UNMANAGED);

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

         UnmanagedNetwork network = new UnmanagedNetwork(context, dto);
         network.datacenter = datacenter;
         network.enterprise = enterprise;
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.