@Test public void testGetNextIp() { Subnet subnet = _subnetList.get(0); assertThat(subnet.getNextIp(), equalTo(Ip.parse("172.31.0.2"))); assertThat(subnet.getNextIp(), equalTo(Ip.parse("172.31.0.3"))); assertThat(subnet.getNextIp(), equalTo(Ip.parse("172.31.0.4"))); }
Ip getNextIp() { for (long ipAsLong = _lastGeneratedIp + 1; ipAsLong < _cidrBlock.getEndIp().asLong(); ipAsLong++) { if (!_allocatedIps.contains(ipAsLong)) { _allocatedIps.add(ipAsLong); _lastGeneratedIp = ipAsLong; return Ip.create(ipAsLong); } } throw new BatfishException(String.format("%s subnet ran out of IPs", _subnetId)); }
Subnet implements AwsVpcEntity, Serializable { Ip getNextIp() { for (long ipAsLong = _lastGeneratedIp + 1; ipAsLong < _cidrBlock.getEndIp().asLong(); ipAsLong++) { if (!_allocatedIps.contains(ipAsLong)) { _allocatedIps.add(ipAsLong); _lastGeneratedIp = ipAsLong; return Ip.create(ipAsLong); } } throw new BatfishException(String.format("%s subnet ran out of IPs", _subnetId)); } }
Subnet implements AwsVpcEntity, Serializable { Ip getNextIp() { for (long ipAsLong = _lastGeneratedIp + 1; ipAsLong < _cidrBlock.getEndIp().asLong(); ipAsLong++) { if (!_allocatedIps.contains(ipAsLong)) { _allocatedIps.add(ipAsLong); _lastGeneratedIp = ipAsLong; return Ip.create(ipAsLong); } } throw new BatfishException(String.format("%s subnet ran out of IPs", _subnetId)); } Subnet(
      Prefix cidrBlock,
      String ownerId,
      String subnetArn,
      String subnetId,
      String vpcId,
      String availabilityZone,
      Map<String, String> tags); }
Subnet implements AwsVpcEntity, Serializable { Ip getNextIp() { for (long ipAsLong = _lastGeneratedIp + 1; ipAsLong < _cidrBlock.getEndIp().asLong(); ipAsLong++) { if (!_allocatedIps.contains(ipAsLong)) { _allocatedIps.add(ipAsLong); _lastGeneratedIp = ipAsLong; return Ip.create(ipAsLong); } } throw new BatfishException(String.format("%s subnet ran out of IPs", _subnetId)); } Subnet(
      Prefix cidrBlock,
      String ownerId,
      String subnetArn,
      String subnetId,
      String vpcId,
      String availabilityZone,
      Map<String, String> tags); @Nonnull Prefix getCidrBlock(); @Nonnull String getOwnerId(); @Nonnull String getSubnetArn(); @Override String getId(); @Nonnull String getVpcId(); @Nonnull String getAvailabilityZone(); Optional<NetworkAcl> getNetworkAcl(Region region); @Override boolean equals(Object o); @Override int hashCode(); static String nodeName(String subnetId); static String instancesInterfaceName(String subnetId); }
Subnet implements AwsVpcEntity, Serializable { Ip getNextIp() { for (long ipAsLong = _lastGeneratedIp + 1; ipAsLong < _cidrBlock.getEndIp().asLong(); ipAsLong++) { if (!_allocatedIps.contains(ipAsLong)) { _allocatedIps.add(ipAsLong); _lastGeneratedIp = ipAsLong; return Ip.create(ipAsLong); } } throw new BatfishException(String.format("%s subnet ran out of IPs", _subnetId)); } Subnet(
      Prefix cidrBlock,
      String ownerId,
      String subnetArn,
      String subnetId,
      String vpcId,
      String availabilityZone,
      Map<String, String> tags); @Nonnull Prefix getCidrBlock(); @Nonnull String getOwnerId(); @Nonnull String getSubnetArn(); @Override String getId(); @Nonnull String getVpcId(); @Nonnull String getAvailabilityZone(); Optional<NetworkAcl> getNetworkAcl(Region region); @Override boolean equals(Object o); @Override int hashCode(); static String nodeName(String subnetId); static String instancesInterfaceName(String subnetId);  }