Package org.platformlayer.core.model

Examples of org.platformlayer.core.model.AddressModel


        public TagChanges get() {
          TagChanges tagChanges = new TagChanges();

          tagChanges.addTags.add(Tag.INSTANCE_KEY.build(model.getKey()));

          AddressModel ipv4 = address4.get();
          AddressModel ipv6 = address6.get();

          if (ipv4 != null) {
            tagChanges.addTags.add(Tag.NETWORK_ADDRESS.build(ipv4));
          }
View Full Code Here


  }

  private void addIpNeighborProxy(ScriptBuilder sb) throws OpsException {
    if (addresses != null) {
      for (Provider<AddressModel> addressProvider : addresses) {
        AddressModel addressModel = addressProvider.get();
        InetAddress address = addressModel.getInetAddress();
        if (InetAddressUtils.isIpv6(address)) {
          String hostPrimaryInterface = getHostPrimaryInterface();
          if (Strings.isNullOrEmpty(hostPrimaryInterface)) {
            throw new OpsException("primaryInterface not specified");
          }
View Full Code Here

    model.put("hostname", getHostname());

    model.put("name", lxcId);

    InterfaceModel eth0 = InterfaceModel.build("eth0");
    AddressModel ipv4 = address4.get();
    eth0.addAddress(ipv4);

    AddressModel ipv6 = address6.get();
    eth0.addAddress(ipv6);

    List<InterfaceModel> interfaces = Lists.newArrayList();
    interfaces.add(eth0);
View Full Code Here

  protected AddressModel reverse(InetSocketAddress item) {
    if (item == null) {
      return null;
    }

    AddressModel addressModel = new AddressModel();
    addressModel.address = item.getAddress().getHostAddress();
    AddressModels.populateDefaults(addressModel);
    return addressModel;
  }
View Full Code Here

      iso.buildDir = new File(getInstanceDir(), "config_iso_src");
      iso.model = new TemplateDataSource() {
        @Override
        public void buildTemplateModel(Map<String, Object> model) throws OpsException {
          InterfaceModel eth0 = InterfaceModel.build("eth0");
          AddressModel ipv4 = address4.get();
          eth0.addAddress(ipv4);

          AddressModel ipv6 = address6.get();
          eth0.addAddress(ipv6);

          List<InterfaceModel> interfaces = Lists.newArrayList();
          interfaces.add(eth0);

          model.put("interfaces", interfaces);

          List<String> authorizedKeys = Lists.newArrayList();
          authorizedKeys.add(OpenSshUtils.serialize(sshPublicKey));
          model.put("authorizedKeys", authorizedKeys);
        }
      };

      instance.addChild(iso);
    }

    {
      DownloadImage download = injected(DownloadImage.class);
      download.imageFile = getImagePath();
      download.recipeKey = recipeId;
      download.imageFormats = Arrays.asList(ImageFormat.DiskRaw, ImageFormat.DiskQcow2);
      instance.addChild(download);
    }

    {
      ManagedKvmInstance kvmInstance = addChild(ManagedKvmInstance.class);

      kvmInstance.id = id;
      kvmInstance.memoryMb = Math.max(256, minimumMemoryMB);
      kvmInstance.vcpus = 1;
      kvmInstance.base = getInstanceDir();
      kvmInstance.monitor = assignMonitorPort;
      kvmInstance.vnc = assignVncPort;
      kvmInstance.nics = buildVnics();
      kvmInstance.drives = buildDrives();

      kvmInstance.addresses.add(address4);
      kvmInstance.addresses.add(address6);
    }

    {
      final DirectInstance model = OpsContext.get().getInstance(DirectInstance.class);

      OpsProvider<TagChanges> tagChanges = new OpsProvider<TagChanges>() {
        @Override
        public TagChanges get() {
          TagChanges tagChanges = new TagChanges();

          tagChanges.addTags.add(Tag.INSTANCE_KEY.build(model.getKey()));

          AddressModel ipv4 = address4.get();
          AddressModel ipv6 = address6.get();

          tagChanges.addTags.add(Tag.NETWORK_ADDRESS.build(ipv4));
          tagChanges.addTags.add(Tag.NETWORK_ADDRESS.build(ipv6));

          return tagChanges;
View Full Code Here

      }
    }
  }

  public static AddressModel build(Properties properties) {
    AddressModel model = new AddressModel();

    model.cidr = properties.getProperty("cidr");

    model.address = properties.getProperty("address");
    model.netmask = properties.getProperty("netmask");
View Full Code Here

    return item.getInetAddress().getHostAddress();
  }

  @Override
  public AddressModel toItem(String key) {
    AddressModel addressModel = new AddressModel();

    if (this.addressModel == null) {
      InetAddress address = InetAddresses.forString(key);
      String cidr = address.getHostAddress() + "/" + range.getNetmaskLength();
      addressModel.cidr = cidr;

      AddressModels.populateDefaults(addressModel);
    } else {
      addressModel.copyFrom(this.addressModel);

      addressModel.address = key;

      IpRange netmask;
      if (!Strings.isNullOrEmpty(addressModel.netmask)) {
View Full Code Here

TOP

Related Classes of org.platformlayer.core.model.AddressModel

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.