use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class Ipv4SpecificEcHandlerTest method testHandlerDeprecated.
@Test
public void testHandlerDeprecated() {
final Ipv4SpecificEcHandler handler = new Ipv4SpecificEcHandler();
final Inet4SpecificExtendedCommunityCase input = new Inet4SpecificExtendedCommunityCaseBuilder().setInet4SpecificExtendedCommunity(new Inet4SpecificExtendedCommunityBuilder().setGlobalAdministrator(new Ipv4AddressNoZone("12.51.2.5")).setLocalAdministrator(new byte[] { 21, 45 }).build()).build();
final Inet4SpecificExtendedCommunityCase expected = new Inet4SpecificExtendedCommunityCaseBuilder().setInet4SpecificExtendedCommunity(new Inet4SpecificExtendedCommunityBuilder().setInet4SpecificExtendedCommunityCommon(new Inet4SpecificExtendedCommunityCommonBuilder().setGlobalAdministrator(new Ipv4AddressNoZone("12.51.2.5")).setLocalAdministrator(new byte[] { 21, 45 }).build()).build()).build();
final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
handler.serializeExtendedCommunity(input, output);
assertArrayEquals(INPUT, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class OpaqueEcHandlerTest method testHandler.
@Test
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final OpaqueEcHandler handler = new OpaqueEcHandler();
final OpaqueExtendedCommunityCase expected = new OpaqueExtendedCommunityCaseBuilder().setOpaqueExtendedCommunity(new OpaqueExtendedCommunityBuilder().setValue(new byte[] { 21, 45, 5, 4, 3, 1 }).build()).build();
final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class RouteOriginAsTwoOctetEcHandlerTest method testHandler.
@Test
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final RouteOriginAsTwoOctetEcHandler handler = new RouteOriginAsTwoOctetEcHandler();
final RouteOriginExtendedCommunityCase expected = new RouteOriginExtendedCommunityCaseBuilder().setRouteOriginExtendedCommunity(new RouteOriginExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(24))).setLocalAdministrator(new byte[] { 4, 2, 8, 7 }).build()).build();
final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class SourceAS4OctectASHandlerTest method testHandler.
@Test
public void testHandler() {
final SourceAs4ExtendedCommunityCase expected = new SourceAs4ExtendedCommunityCaseBuilder().setSourceAs4ExtendedCommunity(new SourceAs4ExtendedCommunityBuilder().setGlobalAdministrator(new AsNumber(Uint32.valueOf(20))).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
this.handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
assertEquals(209, this.handler.getSubType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class RouteOrigin4OctectASEcHandlerTest method testHandler.
@Test
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final As4RouteOriginExtendedCommunityCase expected = new As4RouteOriginExtendedCommunityCaseBuilder().setAs4RouteOriginExtendedCommunity(new As4RouteOriginExtendedCommunityBuilder().setAs4SpecificCommon(AS_COMMON).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
this.handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
}
Aggregations