// Check if peer is configured in registry before retrieving preferences
if (!this.registry.isPeerConfigured(remoteIp)) {
final BGPDocumentedException cause = new BGPDocumentedException(
- String.format("BGP peer with ip: %s not configured, check configured peers in : %s", remoteIp, this.registry), BGPError.CONNECTION_REJECTED);
+ String.format("BGP peer with ip: %s not configured, check configured peers in : %s",
+ remoteIp, this.registry), BGPError.CONNECTION_REJECTED);
negotiationFailed(cause);
return;
}
if (remoteIp.getIpv6Address() != null) {
return new IpAddress(Ipv6Util.getFullForm(remoteIp.getIpv6Address()));
}
- return remoteIp;
+ return new IpAddress(new Ipv4Address(remoteIp.getIpv4Address()));
}
protected synchronized void handleMessage(final Notification msg) {
if (ip.getIpv6Address() != null) {
return new IpAddress(Ipv6Util.getFullForm(ip.getIpv6Address()));
}
- return ip;
+ return new IpAddress(new Ipv4Address(ip.getIpv4Address()));
}
@Override
final BGPTransportState transportStatePeer1 = peer1State.getBGPTransportState();
assertEquals(new PortNumber(PORT), transportStatePeer1.getLocalPort());
- assertEquals(new IpAddress(PEER1), transportStatePeer1.getRemoteAddress());
+ assertEquals(PEER1.getValue(), transportStatePeer1.getRemoteAddress().getIpv4Address().getValue());
assertEquals(State.UP, peer1State.getBGPSessionState().getSessionState());
checkEquals(()-> assertEquals(1L, peer1State.getBGPPeerMessagesState().getUpdateMessagesReceivedCount()));
final BGPTransportState transportState = peer4State.getBGPTransportState();
assertEquals(new PortNumber(PORT), transportState.getLocalPort());
- assertEquals(new IpAddress(PEER4), transportState.getRemoteAddress());
+ assertEquals(PEER4.getValue(), transportState.getRemoteAddress().getIpv4Address().getValue());
final BGPPeerMessagesState peerMessagesState = peer4State.getBGPPeerMessagesState();
assertEquals(0L, peerMessagesState.getNotificationMessagesReceivedCount());
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
* @return Ipv4Address
*/
public static Ipv4Address addressForByteBuf(final ByteBuf buffer) {
- return IetfInetUtil.INSTANCE.ipv4AddressFor(ByteArray.readBytes(buffer, IP4_LENGTH));
+ return new Ipv4Address(IetfInetUtil.INSTANCE.ipv4AddressFor(ByteArray.readBytes(buffer, IP4_LENGTH)));
}
/**
}
public static Ipv4Prefix incrementIpv4Prefix(final Ipv4Prefix ipv4Prefix) {
- final Map.Entry<Ipv4Address, Integer> splitIpv4Prefix = IetfInetUtil.INSTANCE.splitIpv4Prefix(ipv4Prefix);
+ final Map.Entry<Ipv4AddressNoZone, Integer> splitIpv4Prefix = IetfInetUtil.INSTANCE.splitIpv4Prefix(ipv4Prefix);
return IetfInetUtil.INSTANCE.ipv4PrefixFor(incrementIpv4Address(splitIpv4Prefix.getKey()),
splitIpv4Prefix.getValue());
}
* @return Ipv6Address
*/
public static Ipv6Address addressForByteBuf(final ByteBuf buffer) {
- return IetfInetUtil.INSTANCE.ipv6AddressFor(ByteArray.readBytes(buffer, IPV6_LENGTH));
+ return new Ipv6Address(IetfInetUtil.INSTANCE.ipv6AddressFor(ByteArray.readBytes(buffer, IPV6_LENGTH)));
}
/**
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
public void testInetAddressToIpAddress() {
final IpAddress ipAddress = Ipv4Util.getIpAddress(InetAddresses.forString("123.42.13.8"));
Assert.assertNotNull(ipAddress.getIpv4Address());
- Assert.assertEquals(new Ipv4Address("123.42.13.8"), ipAddress.getIpv4Address());
+ Assert.assertEquals(new Ipv4AddressNoZone("123.42.13.8"), ipAddress.getIpv4Address());
final IpAddress ipAddress2 = Ipv4Util.getIpAddress(InetAddresses.forString("2001:db8:1:2::"));
Assert.assertNotNull(ipAddress2.getIpv6Address());
- Assert.assertEquals(new Ipv6Address("2001:db8:1:2::"), ipAddress2.getIpv6Address());
+ Assert.assertEquals(new Ipv6AddressNoZone("2001:db8:1:2::"), ipAddress2.getIpv6Address());
}
@Test