/** * Converts IpAddress and PortNumber to InetSocketAddress * * @param ipAddress * @param port * @return InetSocketAddress */ public static InetSocketAddress toInetSocketAddress(final IpAddress ipAddress, final PortNumber port) { final String ipString = toStringIP(ipAddress); return new InetSocketAddress(InetAddresses.forString(ipString), port.getValue()); }
public static String getNeighborInstanceName(final InstanceIdentifier<?> rootIdentifier) { return Ipv4Util.toStringIP(rootIdentifier.firstKeyOf(Neighbor.class).getNeighborAddress()); }
private BgpPeerSingletonService(final RIB rib, final Neighbor neighbor, final BGPOpenConfigMappingService mappingService, final WriteConfiguration configurationWriter) { this.neighborAddress = neighbor.getNeighborAddress(); this.bgpPeer = new BGPPeer(Ipv4Util.toStringIP(this.neighborAddress), rib, mappingService.toPeerRole(neighbor), rpcRegistry); final List<BgpParameters> bgpParameters = getBgpParameters(neighbor, rib, mappingService); final KeyMapping key = OpenConfigMappingUtil.getNeighborKey(neighbor); this.prefs = new BGPSessionPreferences(rib.getLocalAs(), getHoldTimer(neighbor), rib.getBgpIdentifier(), getPeerAs(neighbor, rib), bgpParameters, getPassword(key)); this.activeConnection = OpenConfigMappingUtil.isActive(neighbor); this.dispatcher = rib.getDispatcher(); this.inetAddress = Ipv4Util.toInetSocketAddress(this.neighborAddress, OpenConfigMappingUtil.getPort(neighbor)); this.retryTimer = OpenConfigMappingUtil.getRetryTimer(neighbor); this.key = Optional.fromNullable(key); this.configurationWriter = configurationWriter; this.serviceGroupIdentifier = rib.getRibIServiceGroupIdentifier(); LOG.info("Peer Singleton Service {} registered", this.serviceGroupIdentifier); //this need to be always the last step this.registration = rib.registerClusterSingletonService(this); }
this.bundleContext, "(" + InstanceType.PEER.getBeanName() + "=" + Ipv4Util.toStringIP(getHost()) + ")"); final BGPPeerRuntimeMXBean peer = peerTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES); final BGPPeerRuntimeRegistration runtimeRegistration = getRootRuntimeBeanRegistratorWrapper().register(peer);