/** * Detects whether {@code IpAddress} is ipv6 */ public static boolean isIpv6(IpAddress address) { checkNotNull(address, "Address cannot be null"); checkState(!(address.getIpv4Address() == null && address.getIpv6Address() == null), "Invalid address"); return address.getIpv6Address() != null; }
@Override protected IpAddress ipv4Address(final Ipv4Address addr) { return new IpAddress(addr); }
public Host(IpAddress _ipAddress) { super(); this._ipAddress = _ipAddress; this._domainName = null; this._value = _ipAddress.getValue(); }
private IpAddress getRemoteIp() { final IpAddress remoteIp = StrictBGPPeerRegistry.getIpAddress(this.channel.remoteAddress()); if (remoteIp.getIpv6Address() != null) { return new IpAddress(Ipv6Util.getFullForm(remoteIp.getIpv6Address())); } return remoteIp; }
public static String convertIpAddressToString(IpAddress ipAddress) { Preconditions.checkNotNull(ipAddress, "Supplied IpAddress value must not be null"); try { Preconditions.checkArgument(ipAddress.getIpv4Address().getValue() != null); return ipAddress.getIpv4Address().getValue(); } catch (Exception e) { LOG.debug("Supplied IpAddress value ({}) is not an instance of IPv4", ipAddress.toString()); } Preconditions.checkArgument(ipAddress.getIpv6Address().getValue() != null); return ipAddress.getIpv6Address().getValue(); }
private static @Nullable Ipv4Address getIPv4Addresses(EndpointL3 l3ep) { IpAddress ipAddress = l3ep.getKey().getIpAddress(); if (ipAddress.getIpv4Address() == null) { return null; } return ipAddress.getIpv4Address(); }
@Override protected void update(InstanceIdentifier<Floatingip> identifier, Floatingip original, Floatingip update) { if (LOG.isTraceEnabled()) { LOG.trace("Handling FloatingIptoFixedIp mapping : key: " + identifier + ", original value=" + original + ", update value=" + update); } IpAddress oldFixedIp = original.getFixedIpAddress(); IpAddress newFixedIp = update.getFixedIpAddress(); if (oldFixedIp != null && !oldFixedIp.equals(newFixedIp)) { clearFromFloatingIpInfo(original.getRouterId().getValue(), original.getPortId().getValue(), oldFixedIp .getIpv4Address().getValue()); } if (newFixedIp != null && !newFixedIp.equals(oldFixedIp)) { addToFloatingIpInfo(update.getRouterId().getValue(), update.getFloatingNetworkId(), update.getPortId() .getValue(), newFixedIp.getIpv4Address().getValue(), update.getFloatingIpAddress ().getIpv4Address().getValue()); } }
/** * Returns an Service Function Forwarder object which can be stored * in DataStore. The returned object is built on basis of OVS Bridge. * The ovsdbBridgeAugmentation argument must be not null otherwise * NullPointerException will be raised. * * @param nodeName * @param nnode Netconf node Object * @return ServiceFunctionForwarder Object */ public static ServiceFunctionForwarder buildServiceForwarderFromNetconf(String nodeName, NetconfNode nnode) { Preconditions.checkNotNull(nnode); SffName sffName = new SffName(nodeName); SffDataPlaneLocatorBuilder sffDataPlaneLocatorBuilder = new SffDataPlaneLocatorBuilder(); // TODO: should be replaced once OVS interface name will be available List<SffDataPlaneLocator> sffDataPlaneLocatorList = new ArrayList<>(); sffDataPlaneLocatorList.add(sffDataPlaneLocatorBuilder.build()); ServiceFunctionForwarderBuilder serviceFunctionForwarderBuilder = new ServiceFunctionForwarderBuilder(); serviceFunctionForwarderBuilder.setName(sffName); IpAddress ipAddress = new IpAddress(nnode.getHost().getIpAddress().getValue()); serviceFunctionForwarderBuilder.setIpMgmtAddress(ipAddress); return serviceFunctionForwarderBuilder.build(); }
@Override protected Ipv6Address maybeIpv6Address(final IpAddress addr) { return addr.getIpv6Address(); } }
private boolean isIpInList(List<IpAddress> ipList, IpAddress newIp) { for (IpAddress ip : ipList) { if (newIp.equals(ip)) { return true; } } return false; }
public static IpPrefix createDefaultPrefix(IpAddress ipAddress) { if (ipAddress.getIpv4Address() == null) { return null; } String ipv4 = ipAddress.getIpv4Address().getValue(); long mask = getDefaultMask(ipv4); return new IpPrefix(new Ipv4Prefix(String.format("%s/%d", ipv4, mask))); }
public List<Ipv6Address> getIpv6AddressesWithoutLLA() { List<Ipv6Address> ipv6AddrList = new ArrayList<>(); for (SubnetInfo subnetInfo : snetInfo.values()) { if (subnetInfo.getIpAddr().getIpv6Address() instanceof Ipv6Address) { ipv6AddrList.add(subnetInfo.getIpAddr().getIpv6Address()); } } return ipv6AddrList; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NeighborKey other = (NeighborKey) obj; if (_address == null) { if (other._address != null) { return false; } } else if(!_address.equals(other._address)) { return false; } return true; }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }
@Override protected IpAddress ipv6Address(final Ipv6Address addr) { return new IpAddress(addr); }
@Override public void start(final RIB rib, final Neighbor neighbor, final BGPOpenConfigMappingService mappingService, final WriteConfiguration configurationWriter) { this.currentConfiguration = neighbor; this.mappingService = mappingService; this.bgpAppPeerSingletonService = new BgpAppPeerSingletonService(rib, createAppRibId(neighbor), neighbor.getNeighborAddress().getIpv4Address(), configurationWriter); }
public BgpNextHopType(IpAddress _ipAddress) { super(); this._ipAddress = _ipAddress; this._enumeration = null; this._value = _ipAddress.getValue(); }
@Override public void readSpecific(@Nonnull InstanceIdentifier<Policy> id, @Nonnull ReadContext ctx, @Nonnull PolicyBuilder builder) throws ReadFailedException { PolicyKey key = id.firstKeyOf(Policy.class); Ipv6Address bsid = policyCtx.getPolicyBsid(key.getColor(), key.getEndpoint().getIpv6Address(), ctx.getMappingContext()); dumpManager.getDump(id, ctx.getModificationCache()).or(STATIC_EMPTY_REPLY).srPoliciesDetails.stream() .filter(srPoliciesDetails -> arrayToIpv6AddressNoZone(srPoliciesDetails.bsid.addr).getValue() .equals(bsid.getValue())) .findFirst() .ifPresent((SrPoliciesDetails details) -> bindPolicy(details, ctx, builder)); }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NeighborKey other = (NeighborKey) obj; if (_neighborAddress == null) { if (other._neighborAddress != null) { return false; } } else if(!_neighborAddress.equals(other._neighborAddress)) { return false; } return true; }
private String getAddressString(final IpAddress address) { Preconditions.checkArgument(address.getIpv4Address() != null || address.getIpv6Address() != null, "Address %s is invalid", address); if (address.getIpv4Address() != null) { return address.getIpv4Address().getValue(); } return address.getIpv6Address().getValue(); }