use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCaseBuilder 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.update.attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCaseBuilder 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