use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.As4RouteTargetExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class RouteTarget4OctectASEcHandlerTest method testHandler.
@Test
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final As4RouteTargetExtendedCommunityCase expected = new As4RouteTargetExtendedCommunityCaseBuilder().setAs4RouteTargetExtendedCommunity(new As4RouteTargetExtendedCommunityBuilder().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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.As4RouteTargetExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class VpnNonMemberHandlerTest method testExtComAny.
@Test
public void testExtComAny() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("vpn-non-member-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setExtendedCommunities(Collections.singletonList(new ExtendedCommunitiesBuilder().setExtendedCommunity(new As4RouteTargetExtendedCommunityCaseBuilder().setAs4RouteTargetExtendedCommunity(RT).build()).build())).build());
doReturn(Collections.singletonList(RT)).when(this.exportParameters).getMemberships();
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
doReturn(Collections.emptyList()).when(this.exportParameters).getMemberships();
result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.As4RouteTargetExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class RouteTarget4OctectASEcHandlerTest method testHandler.
@Test
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final As4RouteTargetExtendedCommunityCase expected = new As4RouteTargetExtendedCommunityCaseBuilder().setAs4RouteTargetExtendedCommunity(new As4RouteTargetExtendedCommunityBuilder().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