Search in sources :

Example 1 with TrafficMarkingExtendedCommunityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder in project bgpcep by opendaylight.

the class TrafficMarkingEcHandler method parseExtendedCommunity.

@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
    buffer.skipBytes(RESERVED);
    final Dscp dscp = new Dscp(buffer.readUnsignedByte());
    return new TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(new TrafficMarkingExtendedCommunityBuilder().setGlobalAdministrator(dscp).build()).build();
}
Also used : TrafficMarkingExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder) TrafficMarkingExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder) Dscp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.Dscp)

Example 2 with TrafficMarkingExtendedCommunityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testTrafficMarkingSerializer.

@Test
public void testTrafficMarkingSerializer() 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.TrafficMarkingExtendedCommunityCase trafficMarking = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.route.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(new TrafficMarkingExtendedCommunityBuilder().setGlobalAdministrator(new Dscp((short) 63)).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficMarking).setTransitive(true).build();
    final ByteBuf output = Unpooled.buffer(TRAFFIC_MARKING.length);
    this.registry.serializeExtendedCommunity(expected, output);
    Assert.assertArrayEquals(TRAFFIC_MARKING, output.array());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) TrafficMarkingExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunities) TrafficMarkingExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunitiesBuilder) Dscp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.Dscp) Test(org.junit.Test)

Example 3 with TrafficMarkingExtendedCommunityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder in project bgpcep by opendaylight.

the class FSExtendedCommunitiesTest method testTrafficMarkingParser.

@Test
public void testTrafficMarkingParser() throws BGPDocumentedException, BGPParsingException {
    final TrafficMarkingExtendedCommunityCase trafficMarking = new TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(new TrafficMarkingExtendedCommunityBuilder().setGlobalAdministrator(new Dscp((short) 63)).build()).build();
    final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficMarking).setTransitive(true).build();
    final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(TRAFFIC_MARKING));
    Assert.assertEquals(expected, parsed);
}
Also used : TrafficMarkingExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder) TrafficMarkingExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder) TrafficMarkingExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCase) ExtendedCommunities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunities) Dscp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.Dscp) ExtendedCommunitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunitiesBuilder) Test(org.junit.Test)

Aggregations

Dscp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.Dscp)3 TrafficMarkingExtendedCommunityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.traffic.marking.extended.community.TrafficMarkingExtendedCommunityBuilder)3 TrafficMarkingExtendedCommunityCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCaseBuilder)3 Test (org.junit.Test)2 ExtendedCommunities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunities)2 ExtendedCommunitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunitiesBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 TrafficMarkingExtendedCommunityCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCase)1