use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project bgpcep by opendaylight.
the class TableTypeActivatorTest method testActivator.
@Test
public void testActivator() {
final TableTypeActivator tableTypeActivator = new TableTypeActivator();
final SimpleBGPTableTypeRegistryProvider registry = new SimpleBGPTableTypeRegistryProvider();
tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(IPV4);
assertEquals(IPV4UNICAST.class, afiSafiType.get());
final Optional<Class<? extends AfiSafiType>> afiSafiType2 = registry.getAfiSafiType(IPV6);
assertEquals(IPV6UNICAST.class, afiSafiType2.get());
final Optional<BgpTableType> tableType = registry.getTableType(IPV4UNICAST.class);
assertEquals(IPV4, tableType.get());
final Optional<BgpTableType> tableType2 = registry.getTableType(IPV6UNICAST.class);
assertEquals(IPV6, tableType2.get());
tableTypeActivator.stopBGPTableTypeRegistryProvider();
tableTypeActivator.close();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project bgpcep by opendaylight.
the class AbstractVpnNlriParser method serializeNlri.
private static void serializeNlri(final List<VpnDestination> dests, final boolean isWithdrawnRoute, final ByteBuf buffer) {
final ByteBuf nlriByteBuf = Unpooled.buffer();
for (final VpnDestination dest : dests) {
final List<LabelStack> labelStack = dest.getLabelStack();
final IpPrefix prefix = dest.getPrefix();
LOG.debug("Serializing Nlri: VpnDestination={}, IpPrefix={}", dest, prefix);
AbstractVpnNlriParser.serializeLengtField(prefix, labelStack, nlriByteBuf);
LUNlriParser.serializeLabelStackEntries(labelStack, isWithdrawnRoute, nlriByteBuf);
RouteDistinguisherUtil.serializeRouteDistinquisher(dest.getRouteDistinguisher(), nlriByteBuf);
Preconditions.checkArgument(prefix.getIpv6Prefix() != null || prefix.getIpv4Prefix() != null, "Ipv6 or Ipv4 prefix is missing.");
LUNlriParser.serializePrefixField(prefix, nlriByteBuf);
}
buffer.writeBytes(nlriByteBuf);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project bgpcep by opendaylight.
the class TableTypeActivatorTest method testActivator.
@Test
public void testActivator() {
final TableTypeActivator tableTypeActivator = new TableTypeActivator();
final SimpleBGPTableTypeRegistryProvider registry = new SimpleBGPTableTypeRegistryProvider();
tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(IPV4);
Assert.assertEquals(L3VPNIPV4UNICAST.class, afiSafiType.get());
final Optional<Class<? extends AfiSafiType>> afiSafiType2 = registry.getAfiSafiType(IPV6);
Assert.assertEquals(L3VPNIPV6UNICAST.class, afiSafiType2.get());
final Optional<BgpTableType> tableType = registry.getTableType(L3VPNIPV4UNICAST.class);
Assert.assertEquals(IPV4, tableType.get());
final Optional<BgpTableType> tableType2 = registry.getTableType(L3VPNIPV6UNICAST.class);
Assert.assertEquals(IPV6, tableType2.get());
tableTypeActivator.stopBGPTableTypeRegistryProvider();
tableTypeActivator.close();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testPccIdReqIPv4Object.
@Test
public void testPccIdReqIPv4Object() throws PCEPDeserializerException {
final byte[] pccIdReqBytes = { /* object header */
0x14, 0x10, 0x00, 0x08, /* ipv4 address */
0x7f, 0x00, 0x00, 0x01 };
final PCEPPccIdReqIPv4ObjectParser parser = new PCEPPccIdReqIPv4ObjectParser();
final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer(pccIdReqBytes.length);
parser.serializeObject(pccIdReq, buf);
assertArrayEquals(pccIdReqBytes, buf.array());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testPceIdIPv4Object.
@Test
public void testPceIdIPv4Object() throws PCEPDeserializerException {
final byte[] pccIdReqBytes = { /* object header */
0x19, 0x10, 0x00, 0x08, /* ipv4 address */
0x7f, 0x00, 0x00, 0x01 };
final PCEPPceIdIPv4ObjectParser parser = new PCEPPceIdIPv4ObjectParser();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceId pceId = new PceIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pceId, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer(pccIdReqBytes.length);
parser.serializeObject(pceId, buf);
assertArrayEquals(pccIdReqBytes, buf.array());
}
Aggregations