use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.action.extended.community.TrafficActionExtendedCommunityBuilder in project bgpcep by opendaylight.
the class FSExtendedCommunitiesTest method testTrafficActionSerializer.
@Test
public void testTrafficActionSerializer() throws BGPDocumentedException, BGPParsingException {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.route.attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCase trafficAction = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.route.attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCaseBuilder().setTrafficActionExtendedCommunity(new TrafficActionExtendedCommunityBuilder().setSample(true).setTerminalAction(true).build()).build();
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficAction).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(TRAFFIC_ACTION.length);
this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(TRAFFIC_ACTION, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.action.extended.community.TrafficActionExtendedCommunityBuilder in project bgpcep by opendaylight.
the class FSExtendedCommunitiesTest method testTrafficActionParser.
@Test
public void testTrafficActionParser() throws BGPDocumentedException, BGPParsingException {
final TrafficActionExtendedCommunityCase trafficAction = new TrafficActionExtendedCommunityCaseBuilder().setTrafficActionExtendedCommunity(new TrafficActionExtendedCommunityBuilder().setSample(true).setTerminalAction(true).build()).build();
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficAction).setTransitive(true).build();
final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(TRAFFIC_ACTION));
Assert.assertEquals(expected, parsed);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.action.extended.community.TrafficActionExtendedCommunityBuilder in project bgpcep by opendaylight.
the class TrafficActionEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
buffer.skipBytes(RESERVED);
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
final boolean sample = flags.get(SAMPLE_BIT);
final boolean terminal = flags.get(TERMINAL_BIT);
return new TrafficActionExtendedCommunityCaseBuilder().setTrafficActionExtendedCommunity(new TrafficActionExtendedCommunityBuilder().setSample(sample).setTerminalAction(terminal).build()).build();
}
Aggregations