@Override protected String ipv4AddressString(final Ipv4Address addr) { return addr.getValue(); }
public IpAddress(Ipv4Address _ipv4Address) { super(); this._ipv4Address = _ipv4Address; this._ipv6Address = null; this._value = _ipv4Address.getValue().toString().toCharArray(); }
public char[] getValue() { if (_value == null) { if (_ipv4Address != null) { _value = _ipv4Address.getValue().toString().toCharArray(); } else if (_ipv6Address != null) { _value = _ipv6Address.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
protected synchronized void remove(InstanceIdentifier<Neighbors> iid, Neighbors val) { LOG.debug("received remove Neighbors config val {}", val.getAddress().getValue()); synchronized(BgpConfigurationManager.this) { BgpRouter br = getClient(yangObj); if (br == null) { return; } String peerIp = val.getAddress().getValue(); try { //itmProvider.deleteTunnelsToDCGW(new IpAddress(val.getAddress().getValue().toCharArray())); br.delNeighbor(peerIp); } catch (Exception e) { LOG.error(yangObj+" Delete received exception: \""+e+"\"; " +delWarn); } } }
protected synchronized void remove(InstanceIdentifier<UpdateSource> iid, UpdateSource val) { LOG.debug("received remove UpdateSource config val {}", val.getSourceIp().getValue()); synchronized(BgpConfigurationManager.this) { BgpRouter br = getClient(yangObj); if (br == null) { return; } String peerIp = val.getPeerIp().getValue(); try { br.delUpdateSource(peerIp); } catch (Exception e) { LOG.error(yangObj+" Delete received exception: \""+e+"\"; " +delWarn); } } }
protected synchronized void add(InstanceIdentifier<ConfigServer> iid, ConfigServer val) { LOG.debug("received bgp connect config host {}", val.getHost().getValue()); try { initer.await(); } catch (Exception e) { } LOG.debug("issueing bgp router connect to host {}", val.getHost().getValue()); synchronized(BgpConfigurationManager.this) { boolean res = bgpRouter.connect(val.getHost().getValue(), val.getPort().intValue()); if (!res) { LOG.error(yangObj + "Add failed; "+addWarn); } } }
protected synchronized void remove(InstanceIdentifier<EbgpMultihop> iid, EbgpMultihop val) { LOG.debug("received remove EbgpMultihop config val {}", val.getPeerIp().getValue()); synchronized(BgpConfigurationManager.this) { BgpRouter br = getClient(yangObj); if (br == null) { return; } String peerIp = val.getPeerIp().getValue(); try { br.delEbgpMultihop(peerIp); } catch (Exception e) { LOG.error(yangObj+" Delete received exception: \""+e+"\"; " +delWarn); } } }
private String getIpAddress(EndpointType endpoint) { String ipAddress = ""; if( endpoint instanceof IpAddress) { ipAddress = ((IpAddress) endpoint).getIpAddress().getIpv4Address().getValue(); } else if (endpoint instanceof Interface) { ipAddress = ((Interface)endpoint).getInterfaceIp().getIpv4Address().getValue(); } return ipAddress; }
protected DhcpInfo setDnsServersIpAddrs(List<IpAddress> dnsServers) { for (IpAddress ipAddr: dnsServers) { addDnsServer(ipAddr.getIpv4Address().getValue()); } return this; }
private String getIpAddress(EndpointType source) { String ipAddress = null; if( source instanceof IpAddress) { ipAddress = ((IpAddress) source).getIpAddress().getIpv4Address().getValue(); } else if (source instanceof Interface) { ipAddress = ((Interface)source).getInterfaceIp().getIpv4Address().getValue(); } return ipAddress; }
public static String getConfigHost() { if (config == null) { return cHostStartup; } ConfigServer ts = config.getConfigServer(); return (ts == null ? cHostStartup : ts.getHost().getValue()); }
@Override public String getDCGwIP() { Bgp conf = getConfig(); if (conf == null) { return null; } List<Neighbors> nbrs = conf.getNeighbors(); if (nbrs == null) { return null; } return nbrs.get(0).getAddress().getValue(); }
public long getAsNumber(String nbrIp) { Bgp conf = bgpManager.getConfig(); if (conf == null) { return -1; } List<Neighbors> nbrs = conf.getNeighbors(); if (nbrs == null) { return -1; } for (Neighbors nbr : nbrs) { if (nbrIp.equals(nbr.getAddress().getValue())) { return nbr.getRemoteAs().longValue(); } } return -1; }
public static String getEndpointIpAddressForDPN(DataBroker broker, BigInteger dpnId) { String nextHopIp = null; InstanceIdentifier<DPNTEPsInfo> tunnelInfoId = InstanceIdentifier.builder(DpnEndpoints.class).child(DPNTEPsInfo.class, new DPNTEPsInfoKey(dpnId)).build(); Optional<DPNTEPsInfo> tunnelInfo = VpnUtil.read(broker, LogicalDatastoreType.CONFIGURATION, tunnelInfoId); if (tunnelInfo.isPresent()) { List<TunnelEndPoints> nexthopIpList = tunnelInfo.get().getTunnelEndPoints(); if (nexthopIpList != null && !nexthopIpList.isEmpty()) { nextHopIp = nexthopIpList.get(0).getIpAddress().getIpv4Address().getValue(); } } return nextHopIp; }
public static String getStringIpAddress(IpAddress ipAddress) { if (ipAddress.getIpv4Address() != null) { return ipAddress.getIpv4Address().getValue(); } return ipAddress.getIpv6Address().getValue(); }
@Override protected void remove(InstanceIdentifier<Interface> identifier, Interface intrf) { LOG.trace("Removing interface : key: " + identifier + ", value=" + intrf ); if (intrf.getType().equals(L3tunnel.class)) { BigInteger dpnId = interfaceManager.getDpnForInterface(intrf); IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class); IpAddress gatewayIp = intfData.getGatewayIp(); IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp; nexthopManager.removeRemoteNextHop(dpnId, intrf.getName(), remoteIp.getIpv4Address().getValue()); } }
private InetSocketAddress getInetAddress() { try { final InetAddress inetAd = InetAddress.getByName(getBindingAddress().getIpv4Address() == null ? getBindingAddress().getIpv6Address().getValue() : getBindingAddress().getIpv4Address().getValue()); return new InetSocketAddress(inetAd, getPort().getValue()); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Unable to bind netconf endpoint to address " + getBindingAddress(), e); } }
@Override protected void add(InstanceIdentifier<Interface> identifier, Interface intrf) { LOG.trace("Adding Interface : key: " + identifier + ", value=" + intrf ); if (intrf.getType().equals(L3tunnel.class)) { IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class); IpAddress gatewayIp = intfData.getGatewayIp(); IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp; NodeConnectorId ofPort = intrf.getAugmentation(BaseIds.class).getOfPortId(); nexthopManager.createRemoteNextHop(intrf.getName(), ofPort.toString(), remoteIp.getIpv4Address().getValue()); } }
private Subnet createSubnet(List<L3Address> endPoints, NetworkDomainId networkDomainId , L2FloodDomainId floodDomainId) { L3Address endPoint = endPoints.get(0); String ip = endPoint.getIpAddress().getIpv4Address().getValue(); ip = ip.substring(0, ip.lastIndexOf('.')) + ".1"; return new SubnetBuilder() .setId(new SubnetId(networkDomainId.getValue())) .setParent(new ContextId(floodDomainId.getValue())) .setVirtualRouterIp( GBPRendererHelper.createIpAddress(ip)) .setIpPrefix(GBPRendererHelper.createIpPrefix(ip + "/24")) .build(); }
private InetSocketAddress getSocketAddress() { if(getAddress().getDomainName() != null) { return new InetSocketAddress(getAddress().getDomainName().getValue(), getPort().getValue()); } else { final IpAddress ipAddress = getAddress().getIpAddress(); final String ip = ipAddress.getIpv4Address() != null ? ipAddress.getIpv4Address().getValue() : ipAddress.getIpv6Address().getValue(); return new InetSocketAddress(ip, getPort().getValue()); } }