use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix in project bgpcep by opendaylight.
the class TestUtil method createNlri.
private static List<Nlri> createNlri() {
final Nlri n1 = new NlriBuilder().setPrefix(new Ipv4Prefix("10.10.10.10/24")).build();
final Nlri n2 = new NlriBuilder().setPrefix(new Ipv4Prefix("20.20.20.20/24")).build();
final Nlri n3 = new NlriBuilder().setPrefix(new Ipv4Prefix("30.30.30.30/24")).build();
return Lists.newArrayList(n1, n2, n3);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix in project bgpcep by opendaylight.
the class BmpMockSession method advertizeRoutes.
private static void advertizeRoutes(final int count, final AdjRibInType type, final Channel channel, final Ipv4Address peerAddress) {
Ipv4Prefix prefix = PREFIX;
for (int i = 0; i < count; i++) {
channel.writeAndFlush(BmpMockUtil.createRouteMonitoring(peerAddress, type, prefix));
prefix = incrementIpv4Prefix(prefix);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix in project bgpcep by opendaylight.
the class PCEPXROSubobjectParserTest method testXROIp4PrefixSubobject.
@Test
public void testXROIp4PrefixSubobject() throws PCEPDeserializerException {
final XROIpv4PrefixSubobjectParser parser = new XROIpv4PrefixSubobjectParser();
final SubobjectBuilder subs = new SubobjectBuilder();
subs.setMandatory(false);
subs.setAttribute(Attribute.Interface);
subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/22"))).build()).build());
assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(ip4PrefixBytes, 2)), false));
final ByteBuf buff = Unpooled.buffer();
parser.serializeSubobject(subs.build(), buff);
assertArrayEquals(ip4PrefixBytes, ByteArray.getAllBytes(buff));
try {
parser.parseSubobject(null, true);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
try {
parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix in project bgpcep by opendaylight.
the class PCCTunnelBuilder method getDefaultEROEndpointHop.
private static Subobject getDefaultEROEndpointHop() {
final SubobjectBuilder builder = new SubobjectBuilder();
builder.setLoose(false);
builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix(ENDPOINT_PREFIX))).build()).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix in project bgpcep by opendaylight.
the class EROSubobjectParserTest method testEROIp4PrefixSubobject.
@Test
public void testEROIp4PrefixSubobject() throws RSVPParsingException {
final EROIpv4PrefixSubobjectParser parser = new EROIpv4PrefixSubobjectParser();
final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
subs.setLoose(true);
subs.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.255/22"))).build()).build());
assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(IP_4_PREFIX_BYTES, 2)), true));
final ByteBuf buff = Unpooled.buffer();
parser.serializeSubobject(subs.build(), buff);
Assert.assertArrayEquals(IP_4_PREFIX_BYTES, ByteArray.getAllBytes(buff));
try {
parser.parseSubobject(null, true);
Assert.fail();
} catch (final IllegalArgumentException e) {
Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
try {
parser.parseSubobject(Unpooled.EMPTY_BUFFER, true);
Assert.fail();
} catch (final IllegalArgumentException e) {
Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
}
}
Aggregations