use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project bgpcep by opendaylight.
the class Ipv4NlriParserTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Ipv4Prefix prefix1 = new Ipv4Prefix(this.ipPrefix1);
final Ipv4Prefix prefix2 = new Ipv4Prefix(this.ipPrefix2);
final Ipv4Prefix wrongPrefix = new Ipv4Prefix(this.additionalIpWD);
this.prefixes.add(new Ipv4PrefixesBuilder().setPrefix(prefix1).build());
this.prefixes.add(new Ipv4PrefixesBuilder().setPrefix(prefix2).build());
this.ip4caseWD = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
this.ip4caseAD = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
final ArrayList<Ipv4Prefixes> fakePrefixes = new ArrayList<>(this.prefixes);
fakePrefixes.add(new Ipv4PrefixesBuilder().setPrefix(wrongPrefix).build());
this.ip4caseWDWrong = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
this.ip4caseADWrong = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
final ByteBuf buffer1 = Unpooled.buffer(5);
ByteBufWriteUtil.writeMinimalPrefix(prefix1, buffer1);
this.inputBytes.writeBytes(buffer1.array());
final ByteBuf buffer2 = Unpooled.buffer(5);
ByteBufWriteUtil.writeMinimalPrefix(prefix2, buffer2);
this.inputBytes.writeBytes(buffer2.array());
Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix in project bgpcep by opendaylight.
the class TestUtil method createWithdrawnRoutes.
private static List<WithdrawnRoutes> createWithdrawnRoutes() {
final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("10.10.20.0/24")).build();
final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("20.20.10.0/24")).build();
final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("30.10.10.0/24")).build();
return Lists.newArrayList(w1, w2, w3);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.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.lisp.address.types.rev151105.lisp.address.address.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.lisp.address.types.rev151105.lisp.address.address.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());
}
}
Aggregations