2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.rib.spi;
10 import org.eclipse.jdt.annotation.NonNullByDefault;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId;
16 public final class RouterIds {
21 public static PeerId createPeerId(final IpAddress address) {
22 final Ipv4Address ipv4 = address.getIpv4Address();
23 return ipv4 != null ? createPeerId(ipv4)
24 : new PeerId(RouterId.PEER_ID_PREFIX + address.getIpv6Address().getValue());
27 public static PeerId createPeerId(final Ipv4Address address) {
28 return new PeerId(RouterId.PEER_ID_PREFIX + address.getValue());