This fixes the violations and flips the switch on.
JIRA: BGPCEP-713
Change-Id: Ia1125469441ea17a8185976bf8a0cd2efab47822
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <violationSeverity>warn</violationSeverity>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
final SimpleFlowspecExtensionProviderContext flowspecContext = this.activator.getContext();
regs.add(context.registerSubsequentAddressFamily(FlowspecSubsequentAddressFamily.class, FLOWSPEC_SAFI));
- regs.add(context.registerSubsequentAddressFamily(FlowspecL3vpnSubsequentAddressFamily.class, FLOWSPEC_L3VPN_SAFI));
+ regs.add(context.registerSubsequentAddressFamily(FlowspecL3vpnSubsequentAddressFamily.class,
+ FLOWSPEC_L3VPN_SAFI));
final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
- final SimpleFlowspecIpv4NlriParser fsIpv4Handler = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
- final SimpleFlowspecIpv6NlriParser fsIpv6Handler = new SimpleFlowspecIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
- regs.add(
- context.registerNlriParser(
- Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
- )
- );
- regs.add(
- context.registerNlriParser(
- Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, fsIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
- )
- );
+ final SimpleFlowspecIpv4NlriParser fsIpv4Handler = new SimpleFlowspecIpv4NlriParser(
+ flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv6NlriParser fsIpv6Handler = new SimpleFlowspecIpv6NlriParser(
+ flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ regs.add(context.registerNlriParser(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class,
+ fsIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class));
+ regs.add(context.registerNlriParser(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class,
+ fsIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class));
regs.add(context.registerNlriSerializer(FlowspecRoutes.class, fsIpv4Handler));
regs.add(context.registerNlriSerializer(FlowspecIpv6Routes.class, fsIpv6Handler));
- final FlowspecL3vpnIpv4NlriParser fsL3vpnIpv4Handler = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
- final FlowspecL3vpnIpv6NlriParser fsL3vpnIpv6Handler = new FlowspecL3vpnIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
- regs.add(
- context.registerNlriParser(
- Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class
- )
- );
- regs.add(
- context.registerNlriParser(
- Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, fsL3vpnIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class
- )
- );
+ final FlowspecL3vpnIpv4NlriParser fsL3vpnIpv4Handler = new FlowspecL3vpnIpv4NlriParser(
+ flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv6NlriParser fsL3vpnIpv6Handler = new FlowspecL3vpnIpv6NlriParser(
+ flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ regs.add(context.registerNlriParser(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
+ fsL3vpnIpv4Handler, ipv4NextHopParser, Ipv4NextHopCase.class));
+ regs.add(context.registerNlriParser(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class,
+ fsL3vpnIpv6Handler, ipv6NextHopParser, Ipv6NextHopCase.class));
regs.add(context.registerNlriSerializer(FlowspecL3vpnIpv4Routes.class, fsL3vpnIpv4Handler));
regs.add(context.registerNlriSerializer(FlowspecL3vpnIpv6Routes.class, fsL3vpnIpv6Handler));
final RedirectAsTwoOctetEcHandler redirect2bHandler = new RedirectAsTwoOctetEcHandler();
- regs.add(context.registerExtendedCommunityParser(redirect2bHandler.getType(true), redirect2bHandler.getSubType(), redirect2bHandler));
+ regs.add(context.registerExtendedCommunityParser(redirect2bHandler.getType(true),
+ redirect2bHandler.getSubType(), redirect2bHandler));
regs.add(context.registerExtendedCommunitySerializer(RedirectExtendedCommunityCase.class, redirect2bHandler));
final TrafficActionEcHandler trafficActionHandler = new TrafficActionEcHandler();
- regs.add(context.registerExtendedCommunityParser(trafficActionHandler.getType(true), trafficActionHandler.getSubType(), trafficActionHandler));
- regs.add(context.registerExtendedCommunitySerializer(TrafficActionExtendedCommunityCase.class, trafficActionHandler));
+ regs.add(context.registerExtendedCommunityParser(trafficActionHandler.getType(true),
+ trafficActionHandler.getSubType(), trafficActionHandler));
+ regs.add(context.registerExtendedCommunitySerializer(TrafficActionExtendedCommunityCase.class,
+ trafficActionHandler));
final TrafficMarkingEcHandler trafficMarkingHandler = new TrafficMarkingEcHandler();
- regs.add(context.registerExtendedCommunityParser(trafficMarkingHandler.getType(true), trafficMarkingHandler.getSubType(), trafficMarkingHandler));
- regs.add(context.registerExtendedCommunitySerializer(TrafficMarkingExtendedCommunityCase.class, trafficMarkingHandler));
+ regs.add(context.registerExtendedCommunityParser(trafficMarkingHandler.getType(true),
+ trafficMarkingHandler.getSubType(), trafficMarkingHandler));
+ regs.add(context.registerExtendedCommunitySerializer(TrafficMarkingExtendedCommunityCase.class,
+ trafficMarkingHandler));
final TrafficRateEcHandler trafficRateEcHandler = new TrafficRateEcHandler();
- regs.add(context.registerExtendedCommunityParser(trafficRateEcHandler.getType(true), trafficRateEcHandler.getSubType(), trafficRateEcHandler));
- regs.add(context.registerExtendedCommunitySerializer(TrafficRateExtendedCommunityCase.class, trafficRateEcHandler));
+ regs.add(context.registerExtendedCommunityParser(trafficRateEcHandler.getType(true),
+ trafficRateEcHandler.getSubType(), trafficRateEcHandler));
+ regs.add(context.registerExtendedCommunitySerializer(TrafficRateExtendedCommunityCase.class,
+ trafficRateEcHandler));
final RedirectIpv6EcHandler redirectIpv6EcHandler = new RedirectIpv6EcHandler();
- regs.add(context.registerExtendedCommunityParser(redirectIpv6EcHandler.getType(true), redirectIpv6EcHandler.getSubType(), redirectIpv6EcHandler));
- regs.add(context.registerExtendedCommunitySerializer(RedirectIpv6ExtendedCommunityCase.class, redirectIpv6EcHandler));
+ regs.add(context.registerExtendedCommunityParser(redirectIpv6EcHandler.getType(true),
+ redirectIpv6EcHandler.getSubType(), redirectIpv6EcHandler));
+ regs.add(context.registerExtendedCommunitySerializer(RedirectIpv6ExtendedCommunityCase.class,
+ redirectIpv6EcHandler));
final RedirectAsFourOctetEcHandler redirect4bHandler = new RedirectAsFourOctetEcHandler();
- regs.add(context.registerExtendedCommunityParser(redirect4bHandler.getType(true), redirect4bHandler.getSubType(), redirect4bHandler));
- regs.add(context.registerExtendedCommunitySerializer(RedirectAs4ExtendedCommunityCase.class, redirect4bHandler));
+ regs.add(context.registerExtendedCommunityParser(redirect4bHandler.getType(true),
+ redirect4bHandler.getSubType(), redirect4bHandler));
+ regs.add(context.registerExtendedCommunitySerializer(RedirectAs4ExtendedCommunityCase.class,
+ redirect4bHandler));
final RedirectIpv4EcHandler redirectIpv4Handler = new RedirectIpv4EcHandler();
- regs.add(context.registerExtendedCommunityParser(redirectIpv4Handler.getType(true), redirectIpv4Handler.getSubType(), redirectIpv4Handler));
- regs.add(context.registerExtendedCommunitySerializer(RedirectIpv4ExtendedCommunityCase.class, redirectIpv4Handler));
+ regs.add(context.registerExtendedCommunityParser(redirectIpv4Handler.getType(true),
+ redirectIpv4Handler.getSubType(), redirectIpv4Handler));
+ regs.add(context.registerExtendedCommunitySerializer(RedirectIpv4ExtendedCommunityCase.class,
+ redirectIpv4Handler));
final RedirectIpNextHopEcHandler redirectIpNhHandler = new RedirectIpNextHopEcHandler();
- regs.add(context.registerExtendedCommunityParser(redirectIpNhHandler.getType(true), redirectIpNhHandler.getSubType(), redirectIpNhHandler));
- regs.add(context.registerExtendedCommunitySerializer(RedirectIpNhExtendedCommunityCase.class, redirectIpNhHandler));
+ regs.add(context.registerExtendedCommunityParser(redirectIpNhHandler.getType(true),
+ redirectIpNhHandler.getSubType(), redirectIpNhHandler));
+ regs.add(context.registerExtendedCommunitySerializer(RedirectIpNhExtendedCommunityCase.class,
+ redirectIpNhHandler));
return regs;
}
final FSIpv4FragmentHandler fragmentHandler = new FSIpv4FragmentHandler();
this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpv4FragmentHandler.FRAGMENT_VALUE,
fragmentHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(FragmentCase.class, fragmentHandler));
+ this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(FragmentCase.class,
+ fragmentHandler));
}
private void registerIpv6FlowspecTypeHandlers(
final FSIpv6NextHeaderHandler nextHeaderHandler = new FSIpv6NextHeaderHandler();
this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(
FSIpv6NextHeaderHandler.NEXT_HEADER_VALUE, nextHeaderHandler));
- this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(NextHeaderCase.class, nextHeaderHandler));
+ this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeSerializer(NextHeaderCase.class,
+ nextHeaderHandler));
final FSIpv6FragmentHandler fragmentHandler = new FSIpv6FragmentHandler();
this.registrations.add(flowspecTypeRegistry.registerFlowspecTypeParser(FSIpv6FragmentHandler.FRAGMENT_VALUE,
static synchronized FlowspecIpv4RIBSupport getInstance(
final SimpleFlowspecExtensionProviderContext context,
final BindingNormalizedNodeSerializer mappingService) {
- if (SINGLETON == null){
+ if (SINGLETON == null) {
SINGLETON = new FlowspecIpv4RIBSupport(context, mappingService);
}
return SINGLETON;
public final int index;
- AFI(int i) {
- this.index = i;
+ AFI(int index) {
+ this.index = index;
}
}
public final int index;
- SAFI(int i) {
- this.index = i;
+ SAFI(int index) {
+ this.index = index;
}
}
- private final SimpleFlowspecTypeRegistry flowspecTypeRegistries[][] = new SimpleFlowspecTypeRegistry[2][2];
+ private final SimpleFlowspecTypeRegistry[][] flowspecTypeRegistries = new SimpleFlowspecTypeRegistry[2][2];
public SimpleFlowspecExtensionProviderContext() {
for (AFI afi : AFI.values()) {
}
@Override
- public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(
new DestinationFlowspecIpv4Builder()
.setFlowspec(flowspecList)
}
@Override
- public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
- .setDestinationFlowspecIpv4(
- new DestinationFlowspecIpv4Builder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspecIpv4(new DestinationFlowspecIpv4Builder()
.setFlowspec(flowspecList)
.setPathId(pathId)
- .build()
- ).build();
+ .build()).build();
}
@Override
protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase) {
- final DestinationFlowspecIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase) dstType)
- .getDestinationFlowspecIpv4();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase) {
+ final DestinationFlowspecIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecCase) dstType).getDestinationFlowspecIpv4();
serializeNlri(new Object[] {destFlowspec.getFlowspec()}, destFlowspec.getPathId(), byteAggregator);
}
}
@Override
protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase) {
- final DestinationFlowspecIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase) dstType)
- .getDestinationFlowspecIpv4();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase) {
+ final DestinationFlowspecIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecCase) dstType).getDestinationFlowspecIpv4();
serializeNlri(new Object[] {destFlowspec.getFlowspec()}, destFlowspec.getPathId(), byteAggregator);
}
}
}
@Override
- public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setFlowspec(flowspecList)
}
@Override
- public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[0];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setFlowspec(flowspecList)
@Override
protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) {
- final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) dstType)
- .getDestinationFlowspecIpv6();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) {
+ final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecIpv6Case) dstType).getDestinationFlowspecIpv6();
serializeNlri(new Object[] {destFlowspec.getFlowspec()}, destFlowspec.getPathId(), byteAggregator);
}
}
@Override
protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) {
- final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) dstType)
- .getDestinationFlowspecIpv6();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) {
+ final DestinationFlowspecIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecIpv6Case) dstType).getDestinationFlowspecIpv6();
serializeNlri(new Object[] {destFlowspec.getFlowspec()}, destFlowspec.getPathId(), byteAggregator);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectAs4ExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.RedirectAs4ExtendedCommunity,
"The extended community %s is not RedirectAs4ExtendedCommunityCase type.", extendedCommunity);
- final RedirectAs4 redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectAs4ExtendedCommunity) extendedCommunity).getRedirectAs4();
+ final RedirectAs4 redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.RedirectAs4ExtendedCommunity) extendedCommunity).getRedirectAs4();
ByteBufWriteUtil.writeUnsignedInt(redirect.getGlobalAdministrator().getValue(), byteAggregator);
ByteBufWriteUtil.writeUnsignedShort(redirect.getLocalAdministrator(), byteAggregator);
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
final RedirectAs4Builder builder = new RedirectAs4Builder();
builder.setGlobalAdministrator(new AsNumber(buffer.readUnsignedInt()));
builder.setLocalAdministrator(buffer.readUnsignedShort());
public int getSubType() {
return SUBTYPE;
}
-
}
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteArray;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.RedirectExtendedCommunity,
"The extended community %s is not RedirectExtendedCommunityCase type.", extendedCommunity);
- final RedirectExtendedCommunity redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectExtendedCommunity) extendedCommunity).getRedirectExtendedCommunity();
+ final RedirectExtendedCommunity redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev180329.RedirectExtendedCommunity) extendedCommunity).getRedirectExtendedCommunity();
ByteBufWriteUtil.writeUnsignedShort(redirect.getGlobalAdministrator().getValue().intValue(), byteAggregator);
byteAggregator.writeBytes(redirect.getLocalAdministrator());
}
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
final ShortAsNumber as1 = new ShortAsNumber((long) buffer.readUnsignedShort());
final byte[] byteValue = ByteArray.readBytes(buffer, TRAFFIC_RATE_SIZE);
return new RedirectExtendedCommunityCaseBuilder().setRedirectExtendedCommunity(
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectIpv4ExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.RedirectIpv4ExtendedCommunity,
"The extended community %s is not RedirectIpv4ExtendedCommunityCase type.", extendedCommunity);
- final RedirectIpv4 redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectIpv4ExtendedCommunity) extendedCommunity).getRedirectIpv4();
+ final RedirectIpv4 redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.RedirectIpv4ExtendedCommunity) extendedCommunity).getRedirectIpv4();
ByteBufWriteUtil.writeIpv4Address(redirect.getGlobalAdministrator(), byteAggregator);
ByteBufWriteUtil.writeUnsignedShort(redirect.getLocalAdministrator(), byteAggregator);
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
final RedirectIpv4Builder builder = new RedirectIpv4Builder();
builder.setGlobalAdministrator(Ipv4Util.addressForByteBuf(buffer));
builder.setLocalAdministrator(buffer.readUnsignedShort());
public int getSubType() {
return SUBTYPE;
}
-
}
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
return new RedirectIpv6ExtendedCommunityCaseBuilder().setRedirectIpv6(
new RedirectIpv6Builder()
.setGlobalAdministrator(Ipv6Util.addressForByteBuf(buffer))
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.BitArray;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficActionExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.TrafficActionExtendedCommunity,
"The extended community %s is not TrafficActionExtendedCommunityCase type.", extendedCommunity);
- final TrafficActionExtendedCommunity trafficAction = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficActionExtendedCommunity) extendedCommunity).getTrafficActionExtendedCommunity();
+ final TrafficActionExtendedCommunity trafficAction = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bgp.flowspec.rev180329.TrafficActionExtendedCommunity) extendedCommunity)
+ .getTrafficActionExtendedCommunity();
byteAggregator.writeZero(RESERVED);
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(SAMPLE_BIT, trafficAction.isSample());
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
buffer.skipBytes(RESERVED);
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
final boolean sample = flags.get(SAMPLE_BIT);
.setTerminalAction(terminal)
.build()).build();
}
-
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficMarkingExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.TrafficMarkingExtendedCommunity,
"The extended community %s is not TrafficMarkingExtendedCommunity type.", extendedCommunity);
- final TrafficMarkingExtendedCommunity trafficMarking = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficMarkingExtendedCommunity) extendedCommunity).getTrafficMarkingExtendedCommunity();
+ final TrafficMarkingExtendedCommunity trafficMarking = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params
+ .xml.ns.yang.bgp.flowspec.rev180329.TrafficMarkingExtendedCommunity) extendedCommunity)
+ .getTrafficMarkingExtendedCommunity();
byteAggregator.writeZero(RESERVED);
ByteBufWriteUtil.writeUnsignedByte(trafficMarking.getGlobalAdministrator().getValue(), byteAggregator);
}
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
buffer.skipBytes(RESERVED);
final Dscp dscp = new Dscp(buffer.readUnsignedByte());
return new TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(
new TrafficMarkingExtendedCommunityBuilder()
.setGlobalAdministrator(dscp).build()).build();
}
-
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec.extended.communities;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
import org.opendaylight.protocol.util.ByteArray;
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficRateExtendedCommunity,
+ checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+ .flowspec.rev180329.TrafficRateExtendedCommunity,
"The extended community %s is not TrafficRateExtendedCommunity type.", extendedCommunity);
- final TrafficRateExtendedCommunity trafficRate = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.TrafficRateExtendedCommunity) extendedCommunity).getTrafficRateExtendedCommunity();
+ final TrafficRateExtendedCommunity trafficRate = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.TrafficRateExtendedCommunity) extendedCommunity)
+ .getTrafficRateExtendedCommunity();
ByteBufWriteUtil.writeShort(trafficRate.getInformativeAs().getValue().shortValue(), byteAggregator);
byteAggregator.writeBytes(trafficRate.getLocalAdministrator().getValue());
}
}
@Override
- public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+ public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
final ShortAsNumber as = new ShortAsNumber((long) buffer.readUnsignedShort());
final Bandwidth value = new Bandwidth(ByteArray.readBytes(buffer, TRAFFIC_RATE_SIZE));
return new TrafficRateExtendedCommunityCaseBuilder().setTrafficRateExtendedCommunity(
static final int IS_A_FRAGMENT = 6;
static final int DONT_FRAGMENT = 7;
- protected abstract Fragment parseFragment(final byte fragment);
- protected abstract byte serializeFragment(final Fragment fragment);
+ protected abstract Fragment parseFragment(byte fragment);
+
+ protected abstract byte serializeFragment(Fragment fragment);
@Override
public void serializeType(final FlowspecType fsType, final ByteBuf output) {
package org.opendaylight.protocol.bgp.flowspec.handlers;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericOperand;
/**
return buffer.toString();
}
- abstract <T extends N> V getValue(final T item);
+ abstract <T extends N> V getValue(T item);
- abstract <T extends N> NumericOperand getOp(final T item);
+ abstract <T extends N> NumericOperand getOp(T item);
}
\ No newline at end of file
private static final int GREATER_THAN = 6;
private static final int EQUAL = 7;
- /**
- * Serializes specific numeric operand type depending on the length field value.
- *
- * @param list of operands to be serialized
- * @param nlriByteBuf where the operands will be serialized
- */
- protected abstract <T extends N> void serialize(final List<T> list, final ByteBuf nlriByteBuf);
-
- protected abstract <T extends N> String toString(final List<T> list);
-
@Override
public final NumericOperand create(final Set<String> operandValues) {
return new NumericOperand(
buffer.writeByte(operandValues.toByte() | byteLength);
}
+ /**
+ * Serializes specific numeric operand type depending on the length field value.
+ *
+ * @param list of operands to be serialized
+ * @param nlriByteBuf where the operands will be serialized
+ */
+ protected abstract <T extends N> void serialize(List<T> list, ByteBuf nlriByteBuf);
+
@Override
public final NumericOperand parse(final byte operand) {
final BitArray operandValues = BitArray.valueOf(operand);
}
return buffer.toString();
}
+
+ protected abstract <T extends N> String toString(List<T> list);
}
* @param opValues set of operand values
* @return specific type of operand
*/
- protected abstract T create(final Set<String> opValues);
+ protected abstract T create(Set<String> opValues);
/**
* Serializes operand to bytes.
* @param endOfList if this operand is at the end of the list
* @param buffer where the operand will be serialized to
*/
- protected abstract void serialize(final T op, final int length, final boolean endOfList,
- final ByteBuf buffer);
+ protected abstract void serialize(T op, int length, boolean endOfList, ByteBuf buffer);
/**
* Parses operand from byte value.
* @param op byte representation of an operand
* @return operand object
*/
- protected abstract T parse(final byte op);
+ protected abstract T parse(byte op);
/**
* Creates a string representation of the operand.
* @param isFirst true if this operand is the first in list of operands
* @return String representation of the operand
*/
- protected abstract String toString(final T op, final boolean isFirst);
+ protected abstract String toString(T op, boolean isFirst);
}
*/
package org.opendaylight.protocol.bgp.flowspec.handlers;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
import org.opendaylight.protocol.util.Ipv4Util;
@Override
public void serializeType(final FlowspecType value, final ByteBuf output) {
- Preconditions.checkArgument(value instanceof DestinationPrefixCase, "DestinationPrefixCase class is mandatory!");
+ checkArgument(value instanceof DestinationPrefixCase, "DestinationPrefixCase class is mandatory!");
output.writeByte(DESTINATION_PREFIX_VALUE);
ByteBufWriteUtil.writeMinimalPrefix(((DestinationPrefixCase) value).getDestinationPrefix(), output);
}
@Override
protected final Fragment parseFragment(final byte fragment) {
final BitArray bs = BitArray.valueOf(fragment);
- return new Fragment(bs.get(DONT_FRAGMENT), bs.get(FIRST_FRAGMENT), bs.get(IS_A_FRAGMENT), bs.get(LAST_FRAGMENT));
+ return new Fragment(bs.get(DONT_FRAGMENT), bs.get(FIRST_FRAGMENT), bs.get(IS_A_FRAGMENT),
+ bs.get(LAST_FRAGMENT));
}
@Override
*/
package org.opendaylight.protocol.bgp.flowspec.handlers;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.FlowspecType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv6.flowspec.flowspec.type.DestinationIpv6PrefixCase;
@Override
public void serializeType(final FlowspecType value, final ByteBuf output) {
- Preconditions.checkArgument(value instanceof DestinationIpv6PrefixCase, "DestinationIpv6PrefixCase class is mandatory!");
+ checkArgument(value instanceof DestinationIpv6PrefixCase, "DestinationIpv6PrefixCase class is mandatory!");
output.writeByte(IPV6_DESTINATION_PREFIX_VALUE);
FSIpv6SourcePrefixHandler.writePrefix(((DestinationIpv6PrefixCase) value).getDestinationPrefix(), output);
import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
/**
+ * Helper for parsing IPv4 Flowspec.
+ *
* @author Kevin Wang
*/
public final class FlowspecIpv4NlriParserHelper {
.INSTANCE.create((Set<String>) dataContainerChild.getValue())));
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode
= node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
- valueNode.ifPresent(dataContainerChild
- -> nextHeadersBuilder.setValue((Short) dataContainerChild.getValue()));
+ valueNode.ifPresent(
+ dataContainerChild -> nextHeadersBuilder.setValue((Short) dataContainerChild.getValue()));
nextHeaders.add(nextHeadersBuilder.build());
}
.INSTANCE.create((Set<String>) dataContainerChild.getValue())));
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode
= node.getChild(AbstractFlowspecNlriParser.VALUE_NID);
- valueNode.ifPresent(dataContainerChild
- -> flowLabelsBuilder.setValue((Long) dataContainerChild.getValue()));
+ valueNode.ifPresent(
+ dataContainerChild -> flowLabelsBuilder.setValue((Long) dataContainerChild.getValue()));
flowLabels.add(flowLabelsBuilder.build());
}
}
/**
- * For flowspec-l3vpn, there is a route distinguisher field at the beginning of NLRI (8 bytes)
+ * For flowspec-l3vpn, there is a route distinguisher field at the beginning of NLRI (8 bytes).
*/
private static RouteDistinguisher readRouteDistinguisher(final ByteBuf nlri) {
final RouteDistinguisher rd = RouteDistinguisherUtil.parseRouteDistinguisher(nlri);
final Class<? extends AddressFamily> afiClass,
final T flowspecNlriParser
) {
- super(mappingService, cazeClass, containerClass, listClass, afiClass, FlowspecL3vpnSubsequentAddressFamily.class,
- dstContainerClassQName, flowspecNlriParser);
+ super(mappingService, cazeClass, containerClass, listClass, afiClass,
+ FlowspecL3vpnSubsequentAddressFamily.class, dstContainerClassQName, flowspecNlriParser);
}
@Override
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
/**
+ * L3 VPN IPv4 flowspec parser.
+ *
* @author Kevin Wang
*/
public final class FlowspecL3vpnIpv4NlriParser extends AbstractFlowspecL3vpnNlriParser {
}
@Override
- public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
- .setDestinationFlowspecL3vpnIpv4(
- new DestinationFlowspecL3vpnIpv4Builder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ .setDestinationFlowspecL3vpnIpv4(new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
.setFlowspec(flowspecList)
.setPathId(pathId)
- .build()
- ).build();
+ .build()).build();
}
@Override
- public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
- .setDestinationFlowspecL3vpnIpv4(
- new DestinationFlowspecL3vpnIpv4Builder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ .setDestinationFlowspecL3vpnIpv4(new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
.setFlowspec(flowspecList)
.setPathId(pathId)
- .build()
- ).build();
+ .build()).build();
}
@Override
@Override
protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) {
- final DestinationFlowspecL3vpnIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) dstType)
- .getDestinationFlowspecL3vpnIpv4();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) {
+ final DestinationFlowspecL3vpnIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) dstType).getDestinationFlowspecL3vpnIpv4();
serializeNlri(
new Object[] {
destFlowspec.getRouteDistinguisher(),
@Override
protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) {
- final DestinationFlowspecL3vpnIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) dstType)
- .getDestinationFlowspecL3vpnIpv4();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) {
+ final DestinationFlowspecL3vpnIpv4 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) dstType).getDestinationFlowspecL3vpnIpv4();
serializeNlri(
new Object[] {
destFlowspec.getRouteDistinguisher(),
public static synchronized FlowspecL3vpnIpv4RIBSupport getInstance(
final SimpleFlowspecExtensionProviderContext context,
final BindingNormalizedNodeSerializer mappingService) {
- if(SINGLETON == null){
+ if (SINGLETON == null) {
SINGLETON = new FlowspecL3vpnIpv4RIBSupport(context, mappingService);
}
return SINGLETON;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
/**
+ * L3 VPN IPv6 flowspec parser.
+ *
* @author Kevin Wang
*/
public final class FlowspecL3vpnIpv6NlriParser extends AbstractFlowspecL3vpnNlriParser {
}
@Override
- public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createWithdrawnDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
- .setDestinationFlowspecL3vpnIpv6(
- new DestinationFlowspecL3vpnIpv6Builder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ .setDestinationFlowspecL3vpnIpv6(new DestinationFlowspecL3vpnIpv6Builder()
.setRouteDistinguisher(rd)
.setFlowspec(flowspecList)
.setPathId(pathId)
- .build()
- ).build();
+ .build()).build();
}
@Override
- public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields, @Nullable final PathId pathId) {
+ public DestinationType createAdvertizedRoutesDestinationType(@Nonnull final Object[] nlriFields,
+ @Nullable final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
- .setDestinationFlowspecL3vpnIpv6(
- new DestinationFlowspecL3vpnIpv6Builder()
+ return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ .setDestinationFlowspecL3vpnIpv6(new DestinationFlowspecL3vpnIpv6Builder()
.setRouteDistinguisher(rd)
.setFlowspec(flowspecList)
.setPathId(pathId)
- .build()
- ).build();
+ .build()).build();
}
@Override
@Override
protected void serializeMpReachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
- final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) dstType)
- .getDestinationFlowspecL3vpnIpv6();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
+ final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) dstType).getDestinationFlowspecL3vpnIpv6();
serializeNlri(
new Object[] {
destFlowspec.getRouteDistinguisher(),
@Override
protected void serializeMpUnreachNlri(final DestinationType dstType, final ByteBuf byteAggregator) {
- if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
- final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) dstType)
- .getDestinationFlowspecL3vpnIpv6();
+ if (dstType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) {
+ final DestinationFlowspecL3vpnIpv6 destFlowspec = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+ .ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) dstType).getDestinationFlowspecL3vpnIpv6();
serializeNlri(
new Object[] {
destFlowspec.getRouteDistinguisher(),
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import org.junit.Test;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_SAFI));
assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_VPN_SAFI));
act.start(context);
- assertEquals(FlowspecSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_SAFI));
- assertEquals(FlowspecL3vpnSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(FLOWSPEC_VPN_SAFI));
+ assertEquals(FlowspecSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
+ .classForFamily(FLOWSPEC_SAFI));
+ assertEquals(FlowspecL3vpnSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
+ .classForFamily(FLOWSPEC_VPN_SAFI));
act.close();
}
}
= Collections.singletonList(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
private static final DestinationFlowspecIpv4 DEST_FLOW = new DestinationFlowspecIpv4Builder()
.setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
- private static final DestinationFlowspecCase REACH_NLRI
- = new DestinationFlowspecCaseBuilder().setDestinationFlowspecIpv4(DEST_FLOW).build();
+ private static final DestinationFlowspecCase REACH_NLRI = new DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspecIpv4(DEST_FLOW).build();
private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
- .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase UNREACH_NLRI
- = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
- .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase UNREACH_NLRI =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(DEST_FLOW).build();
@Override
@Test
public void testPutRoutes() {
this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
- final FlowspecRoute route = (FlowspecRoute) this.insertedRoutes.get(0).getValue();
- assertEquals(this.route, route);
+ assertEquals(this.route, this.insertedRoutes.get(0).getValue());
}
@Test
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
- final Routes routes = new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder()
- .setFlowspecRoute(Collections.singletonList(this.route)).build()).build();
- tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
+ tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(new FlowspecRoutesCaseBuilder()
+ .setFlowspecRoutes(new FlowspecRoutesBuilder().setFlowspecRoute(Collections.singletonList(this.route))
+ .build()).build())).getRootNode();
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
@Test
public void testPutRoutes() {
this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
- final FlowspecRoute route = (FlowspecRoute) this.insertedRoutes.get(0).getValue();
- assertEquals(this.route, route);
+ assertEquals(this.route, this.insertedRoutes.get(0).getValue());
}
@Test
tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
- final Routes routes = new FlowspecIpv6RoutesCaseBuilder()
- .setFlowspecIpv6Routes(new FlowspecIpv6RoutesBuilder()
- .setFlowspecRoute(Collections.singletonList(this.route)).build()).build();
- tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
+ tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(new FlowspecIpv6RoutesCaseBuilder()
+ .setFlowspecIpv6Routes(new FlowspecIpv6RoutesBuilder()
+ .setFlowspecRoute(Collections.singletonList(this.route)).build()).build())).getRootNode();
final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
Assert.assertFalse(result.isEmpty());
}
public class FlowspecL3vpnIpv4NlriParserTest {
- private static final NodeIdentifier RD_NID = new NodeIdentifier(QName.create(Flowspec.QNAME.getNamespace(), Flowspec.QNAME.getRevision(), "route-distinguisher"));
+ private static final NodeIdentifier RD_NID = new NodeIdentifier(QName.create(Flowspec.QNAME.getNamespace(),
+ Flowspec.QNAME.getRevision(), "route-distinguisher"));
private static final NodeIdentifier PROTOCOL_IP_NID = new NodeIdentifier(ProtocolIps.QNAME);
private static final String ROUTE_DISTINGUISHER = "1.2.3.4:10";
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final FlowspecL3vpnIpv4NlriParser FS_PARSER = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ private final FlowspecL3vpnIpv4NlriParser fsParser = new FlowspecL3vpnIpv4NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
@Before
public void setUp() {
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationPrefixCase destinationPrefix = new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("10.0.1.0/32")).build();
+ final DestinationPrefixCase destinationPrefix = new DestinationPrefixCaseBuilder().setDestinationPrefix(
+ new Ipv4Prefix("10.0.1.0/32")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourcePrefixCase sourcePrefix = new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("1.2.3.4/32")).build();
+ final SourcePrefixCase sourcePrefix = new SourcePrefixCaseBuilder().setSourcePrefix(
+ new Ipv4Prefix("1.2.3.4/32")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
- final DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv4();
+ final DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv4();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
mp.setAdvertizedRoutes(
new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
.setDestinationFlowspecL3vpnIpv4(
new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
);
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
+ parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
+ + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
+ + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
+ this.fsParser.stringNlri(flows));
}
private static void testFlows(
}
private static FlowspecType createSps() {
- final List<SourcePorts> sports = Lists.newArrayList(new SourcePortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(8080).build());
+ final List<SourcePorts> sports = Lists.newArrayList(new SourcePortsBuilder().setOp(
+ new NumericOperand(false, true, true, false, false)).setValue(8080).build());
return new SourcePortCaseBuilder().setSourcePorts(sports).build();
}
private static FlowspecType createProts() {
- final List<ProtocolIps> protocols = Lists.newArrayList(new ProtocolIpsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
+ final List<ProtocolIps> protocols = Lists.newArrayList(new ProtocolIpsBuilder().setOp(
+ new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
return new ProtocolIpCaseBuilder().setProtocolIps(protocols).build();
}
private static FlowspecType createDps() {
- final List<DestinationPorts> destports = Lists.newArrayList(new DestinationPortsBuilder().setOp(new NumericOperand(false, false, false, true, false)).setValue(4089).build(),
- new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(179).build());
+ final List<DestinationPorts> destports = Lists.newArrayList(
+ new DestinationPortsBuilder().setOp(new NumericOperand(false, false, false, true, false)).setValue(4089)
+ .build(),
+ new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(179)
+ .build());
return new DestinationPortCaseBuilder().setDestinationPorts(destports).build();
}
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationPrefixCase destinationPrefix = new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("10.0.1.0/32")).build();
+ final DestinationPrefixCase destinationPrefix = new DestinationPrefixCaseBuilder().setDestinationPrefix(
+ new Ipv4Prefix("10.0.1.0/32")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourcePrefixCase sourcePrefix = new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("1.2.3.4/32")).build();
+ final SourcePrefixCase sourcePrefix = new SourcePrefixCaseBuilder().setSourcePrefix(
+ new Ipv4Prefix("1.2.3.4/32")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
- final DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv4();
+ final DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv4();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
mp.setAdvertizedRoutes(
new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
.setDestinationFlowspecL3vpnIpv4(
new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
);
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
+ parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
+ + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
+ + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
+ this.fsParser.stringNlri(flows));
}
private static PortCase createPorts() {
- final List<Ports> ports = Lists.newArrayList(new PortsBuilder().setOp(new NumericOperand(false, false, true, true, false)).setValue(137).build(),
+ final List<Ports> ports = Lists.newArrayList(
+ new PortsBuilder().setOp(new NumericOperand(false, false, true, true, false)).setValue(137).build(),
new PortsBuilder().setOp(new NumericOperand(true, false, true, false, true)).setValue(139).build(),
new PortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(8080).build());
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
- DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv4();
+ DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv4();
final List<Flowspec> flows = flowspecDst.getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
mp.setAfi(Ipv4AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
.setDestinationFlowspecL3vpnIpv4(
new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
parser.serializeNlri(new Object[] {rd, flows}, null, buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
+ + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
+ + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
+ this.fsParser.stringNlri(flows));
}
private static FlowspecType createFragment() {
- final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
+ final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+ new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
return new FragmentCaseBuilder().setFragments(fragments).build();
}
private static FlowspecType createDscp() {
- final List<Dscps> dscps = Lists.newArrayList(new DscpsBuilder().setOp(new NumericOperand(false, true, false, true, false)).setValue(new Dscp((short) 42)).build());
+ final List<Dscps> dscps = Lists.newArrayList(new DscpsBuilder().setOp(
+ new NumericOperand(false, true, false, true, false)).setValue(new Dscp((short) 42)).build());
return new DscpCaseBuilder().setDscps(dscps).build();
}
private static PacketLengthCase createPackets() {
- final List<PacketLengths> packets = Lists.newArrayList(new PacketLengthsBuilder().setOp(new NumericOperand(false, true, false, false, true))
- .setValue(57005).build());
+ final List<PacketLengths> packets = Lists.newArrayList(new PacketLengthsBuilder().setOp(
+ new NumericOperand(false, true, false, false, true)).setValue(57005).build());
return new PacketLengthCaseBuilder().setPacketLengths(packets).build();
}
private static TcpFlagsCase createTcp() {
- final List<TcpFlags> flags = Lists.newArrayList(new TcpFlagsBuilder().setOp(new BitmaskOperand(false, false, false, true)).setValue(1025).build(),
+ final List<TcpFlags> flags = Lists.newArrayList(
+ new TcpFlagsBuilder().setOp(new BitmaskOperand(false, false, false, true)).setValue(1025).build(),
new TcpFlagsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(22193).build());
return new TcpFlagsCaseBuilder().setTcpFlags(flags).build();
}
private static FlowspecType createIcmpCode() {
- final List<Codes> codes = Lists.newArrayList(new CodesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue((short) 4).build(),
+ final List<Codes> codes = Lists.newArrayList(
+ new CodesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue((short) 4).build(),
new CodesBuilder().setOp(new NumericOperand(false, true, false, false, false)).setValue((short) 5).build());
return new IcmpCodeCaseBuilder().setCodes(codes).build();
}
private static FlowspecType createIcmpType() {
- final List<Types> types = Lists.newArrayList(new TypesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue((short) 2).build(),
+ final List<Types> types = Lists.newArrayList(
+ new TypesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue((short) 2).build(),
new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue((short) 3).build());
return new IcmpTypeCaseBuilder().setTypes(types).build();
}
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
- DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv4();
+ DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv4Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv4();
final List<Flowspec> flows = flowspecDst.getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
mp.setAfi(Ipv4AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
.setDestinationFlowspecL3vpnIpv4(
new DestinationFlowspecL3vpnIpv4Builder()
.setRouteDistinguisher(rd)
parser.serializeNlri(new Object[] {rd, flows}, PATH_ID, buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
+ + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
+ + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
+ this.fsParser.stringNlri(flows));
}
@Test
public void testExtractFlowspecDestPrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PREFIX_NID).withValue("127.0.0.5/32").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PREFIX_NID)
+ .withValue("127.0.0.5/32").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("127.0.0.5/32")).build());
+ expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(
+ new Ipv4Prefix("127.0.0.5/32")).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourcePrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).withValue("127.0.0.6/32").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID)
+ .withValue("127.0.0.6/32").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("127.0.0.6/32")).build());
+ expectedFS.setFlowspecType(new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("127.0.0.6/32"))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecProtocolIps() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 100).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 200).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 240).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
+ .build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 240).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(Lists.newArrayList(
- new ProtocolIpsBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
- new ProtocolIpsBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
- new ProtocolIpsBuilder().setValue((short) 240).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
+ new ProtocolIpsBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false))
+ .build(),
+ new ProtocolIpsBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false))
+ .build(),
+ new ProtocolIpsBuilder().setValue((short) 240).setOp(new NumericOperand(true, true, true, false, false))
+ .build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecPorts() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PORTS_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue(100).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE))
+ .build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue(100).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new PortCaseBuilder().setPorts(Lists.newArrayList(new PortsBuilder().setValue(100).setOp(new NumericOperand(true, true, false, false, true)).build())).build());
+ expectedFS.setFlowspecType(new PortCaseBuilder().setPorts(Lists.newArrayList(new PortsBuilder().setValue(100)
+ .setOp(new NumericOperand(true, true, false, false, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecDestinationPorts() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PORT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(1024).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PORT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue(1024).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(Lists.newArrayList(new DestinationPortsBuilder().setValue(1024).setOp(new NumericOperand(false, true, true, false, false)).build())).build());
+ expectedFS.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(Lists.newArrayList(
+ new DestinationPortsBuilder().setValue(1024).setOp(new NumericOperand(false, true, true, false, false))
+ .build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourcePorts() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PORT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue(8080).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PORT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
+ AbstractNumericOperandParser.GREATER_THAN_VALUE,
+ AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue(8080).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(Lists.newArrayList(new SourcePortsBuilder().setValue(8080).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(Lists.newArrayList(
+ new SourcePortsBuilder().setValue(8080).setOp(new NumericOperand(true, true, true, true, true)).build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourceTypes() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_TYPE_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 22).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_TYPE_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
+ AbstractNumericOperandParser.GREATER_THAN_VALUE,
+ AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 22).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.newArrayList(new TypesBuilder().setValue((short) 22).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.newArrayList(
+ new TypesBuilder().setValue((short) 22).setOp(new NumericOperand(true, true, true, true, true)).build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourceCodes() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_CODE_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet()).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 23).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_CODE_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 23).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.newArrayList(new CodesBuilder().setValue((short) 23).setOp(new NumericOperand(false, false, false, false, false)).build())).build());
+ expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.newArrayList(new CodesBuilder()
+ .setValue((short) 23).setOp(new NumericOperand(false, false, false, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourceTcpFlags() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.TCP_FLAGS_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue(99).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.TCP_FLAGS_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue(99).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.newArrayList(new TcpFlagsBuilder().setValue(99).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
+ expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.newArrayList(new TcpFlagsBuilder()
+ .setValue(99).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecPacketLengths() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PACKET_LENGTHS_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue(101).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.PACKET_LENGTHS_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue(101).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.newArrayList(new PacketLengthsBuilder().setValue(101).setOp(new NumericOperand(true, false, false, true, false)).build())).build());
+ expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.newArrayList(
+ new PacketLengthsBuilder().setValue(101).setOp(
+ new NumericOperand(true, false, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecDscps() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DSCP_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue((short) 15).build()).build())
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue((short) 15).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.newArrayList(new DscpsBuilder().setValue(new Dscp((short) 15)).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
+ expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.newArrayList(new DscpsBuilder().setValue(
+ new Dscp((short) 15)).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecFragments() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
+ BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
+ .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+ AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
+ AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder()
+ .setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecRouteDistinguisher() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(
Builders.leafBuilder()
private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4Case UNREACH_NLRI
= new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
- .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.
- DestinationFlowspecL3vpnIpv4CaseBuilder().setDestinationFlowspecL3vpnIpv4(DEST_FLOW).build();
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv4CaseBuilder()
+ .setDestinationFlowspecL3vpnIpv4(DEST_FLOW).build();
private FlowspecL3vpnIpv4RIBSupport ribSupport;
static {
@Test
public void testBuildMpUnreachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(
- new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()), ATTRIBUTES);
+ new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()),
+ ATTRIBUTES);
assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(Attributes2.class)
.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
assertNull(update.getAttributes().augmentation(Attributes1.class));
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(
- new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()), Collections.emptyList(), ATTRIBUTES);
- final AdvertizedRoutes advertised = update.getAttributes().augmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes();
+ new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Collections.singletonList(ROUTE)).build()),
+ Collections.emptyList(), ATTRIBUTES);
+ final AdvertizedRoutes advertised = update.getAttributes().augmentation(Attributes1.class).getMpReachNlri()
+ .getAdvertizedRoutes();
assertEquals(REACH_NLRI, advertised.getDestinationType());
assertNull(update.getAttributes().augmentation(Attributes2.class));
}
private MultiPathSupport muliPathSupport;
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final FlowspecL3vpnIpv6NlriParser FS_PARSER = new FlowspecL3vpnIpv6NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final FlowspecL3vpnIpv6NlriParser fsParser = new FlowspecL3vpnIpv6NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
private static final byte[] REACHED_NLRI = new byte[]{
0x1B, // NLRI length: 19+8=27
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build();
+ final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
+ new Ipv6Prefix("102:304:500::/40")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build();
+ final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
+ new Ipv6Prefix("102:304:600::/40")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
- final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
+ final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder()
+ .setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
builder.setFlowspecType(headersCase);
fs.add(builder.build());
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
- DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv6();
+ DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv6();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
assertEquals(sourcePrefix, flows.get(1).getFlowspecType());
assertEquals(headersCase, flows.get(2).getFlowspecType());
- mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes
+ .destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
.setDestinationFlowspecL3vpnIpv6(
new DestinationFlowspecL3vpnIpv6Builder()
.setRouteDistinguisher(rd)
);
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
+ this.fsParser.stringNlri(flows));
}
@Test
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build();
+ final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
+ new Ipv6Prefix("102:304:500::/40")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build();
+ final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
+ new Ipv6Prefix("102:304:600::/40")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
- final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
+ final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder()
+ .setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
builder.setFlowspecType(headersCase);
fs.add(builder.build());
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
- final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv6();
+ final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv6();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
assertEquals(sourcePrefix, flows.get(1).getFlowspecType());
assertEquals(headersCase, flows.get(2).getFlowspecType());
- mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes
+ .destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
.setDestinationFlowspecL3vpnIpv6(
new DestinationFlowspecL3vpnIpv6Builder()
.setPathId(PATH_ID)
);
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
+ this.fsParser.stringNlri(flows));
}
@Test
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
- final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv6();
+ final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv6();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
assertEquals(label, flows.get(1).getFlowspecType());
mp.setAfi(Ipv6AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
.setDestinationFlowspecL3vpnIpv6(
new DestinationFlowspecL3vpnIpv6Builder()
.setRouteDistinguisher(rd)
);
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
+ + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
}
private static FragmentCase createFragment() {
- final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
+ final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+ new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
return new FragmentCaseBuilder().setFragments(fragments).build();
}
private static FlowspecType createLabel() {
final List<FlowLabel> labels = new ArrayList<>(2);
- labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false)).setValue(16777222L).build());
- labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(258L).build());
+ labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
+ .setValue(16777222L).build());
+ labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
+ .setValue(258L).build());
return new FlowLabelCaseBuilder().setFlowLabel(labels).build();
}
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
- final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecL3vpnIpv6();
+ final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+ .yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecL3vpnIpv6Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecL3vpnIpv6();
final List<Flowspec> flows = flowspecDst.getFlowspec();
final RouteDistinguisher rd = flowspecDst.getRouteDistinguisher();
assertEquals(label, flows.get(1).getFlowspecType());
mp.setAfi(Ipv6AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder()
.setDestinationFlowspecL3vpnIpv6(
new DestinationFlowspecL3vpnIpv6Builder()
.setRouteDistinguisher(rd)
);
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
+ + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
}
@Test
public void testExtractFlowspecFragments() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
+ BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+ AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
+ AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(
+ new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(
+ new BitmaskOperand(true, true, true, true)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecNextHeaders() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 100).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 200).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 210).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
+ .build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue((short) 210).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.newArrayList(
- new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
- new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
- new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
+ new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false))
+ .build(),
+ new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false))
+ .build(),
+ new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false))
+ .build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecFlowLabels() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(100L).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue(100L).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(200L).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
+ .withValue(200L).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
new FlowLabelBuilder().setValue(100L).setOp(new NumericOperand(true, true, false, false, false)).build(),
- new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
+ new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build()))
+ .build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecDestPrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.DEST_PREFIX_NID).withValue("102:304:500::/40").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.DEST_PREFIX_NID)
+ .withValue("102:304:500::/40").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build());
+ expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
+ new Ipv6Prefix("102:304:500::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourcePrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.SOURCE_PREFIX_NID).withValue("102:304:600::/40").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.SOURCE_PREFIX_NID)
+ .withValue("102:304:600::/40").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build());
+ expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40"))
+ .build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
}
private MultiPathSupport muliPathSupport;
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final SimpleFlowspecIpv6NlriParser FS_PARSER = new SimpleFlowspecIpv6NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final SimpleFlowspecIpv6NlriParser fsParser = new SimpleFlowspecIpv6NlriParser(
+ this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
+ SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
private static final byte[] REACHED_NLRI = new byte[] {
0x13,
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build();
+ final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder()
+ .setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build();
+ final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
+ new Ipv6Prefix("102:304:600::/40")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
- final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
+ final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(
+ new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
builder.setFlowspecType(headersCase);
fs.add(builder.build());
- mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes
+ .destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setFlowspec(fs)
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
- final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecIpv6().getFlowspec();
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecIpv6Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecIpv6().getFlowspec();
assertEquals(3, flows.size());
assertEquals(destinationPrefix, flows.get(0).getFlowspecType());
assertEquals(sourcePrefix, flows.get(1).getFlowspecType());
assertEquals(headersCase, flows.get(2).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
+ this.fsParser.stringNlri(flows));
}
@Test
final MpReachNlriBuilder mp = new MpReachNlriBuilder();
final FlowspecBuilder builder = new FlowspecBuilder();
- final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build();
+ final DestinationIpv6PrefixCase destinationPrefix = new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
+ new Ipv6Prefix("102:304:500::/40")).build();
builder.setFlowspecType(destinationPrefix);
fs.add(builder.build());
- final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build();
+ final SourceIpv6PrefixCase sourcePrefix = new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
+ new Ipv6Prefix("102:304:600::/40")).build();
builder.setFlowspecType(sourcePrefix);
fs.add(builder.build());
- final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
+ final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(
+ new NumericOperand(false, true, true, false, false)).setValue((short) 6).build());
final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
builder.setFlowspecType(headersCase);
fs.add(builder.build());
- mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes
+ .destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setPathId(PATH_ID)
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
- final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) result.getAdvertizedRoutes().getDestinationType())
- .getDestinationFlowspecIpv6().getFlowspec();
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecIpv6Case) result.getAdvertizedRoutes().getDestinationType())
+ .getDestinationFlowspecIpv6().getFlowspec();
assertEquals(3, flows.size());
assertEquals(destinationPrefix, flows.get(0).getFlowspecType());
assertEquals(sourcePrefix, flows.get(1).getFlowspecType());
assertEquals(headersCase, flows.get(2).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
+ new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(),
+ buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
+ this.fsParser.stringNlri(flows));
}
@Test
fs.add(builder.build());
mp.setAfi(Ipv6AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setFlowspec(fs)
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
- final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecIpv6().getFlowspec();
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecIpv6Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecIpv6().getFlowspec();
assertEquals(2, flows.size());
assertEquals(fragment, flows.get(0).getFlowspecType());
assertEquals(label, flows.get(1).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
+ + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
}
private static FragmentCase createFragment() {
- final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
+ final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+ new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
return new FragmentCaseBuilder().setFragments(fragments).build();
}
private static FlowspecType createLabel() {
final List<FlowLabel> labels = new ArrayList<>(2);
- labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false)).setValue(16777222L).build());
- labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(258L).build());
+ labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
+ .setValue(16777222L).build());
+ labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
+ .setValue(258L).build());
return new FlowLabelCaseBuilder().setFlowLabel(labels).build();
}
fs.add(builder.build());
mp.setAfi(Ipv6AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6CaseBuilder()
.setDestinationFlowspecIpv6(
new DestinationFlowspecIpv6Builder()
.setPathId(PATH_ID)
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
- final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) result.getWithdrawnRoutes().getDestinationType())
- .getDestinationFlowspecIpv6().getFlowspec();
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec
+ .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecIpv6Case) result.getWithdrawnRoutes().getDestinationType())
+ .getDestinationFlowspecIpv6().getFlowspec();
assertEquals(2, flows.size());
assertEquals(fragment, flows.get(0).getFlowspecType());
assertEquals(label, flows.get(1).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.fsParser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
+ new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
+ + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
}
@Test
public void testExtractFlowspecFragments() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
+ .withChild(Builders.unkeyedListBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+ AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
+ BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+ AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
+ AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder()
+ .setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build()))
+ .build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecNextHeaders() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 100).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 200).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 210).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
+ .build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue((short) 210).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.newArrayList(
- new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
- new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
- new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
+ new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false))
+ .build(),
+ new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false))
+ .build(),
+ new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false))
+ .build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecFlowLabels() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(100L).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+ AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue(100L).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(200L).build()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
+ .withValue(200L).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
new FlowLabelBuilder().setValue(100L).setOp(new NumericOperand(true, true, false, false, false)).build(),
- new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
+ new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build()))
+ .build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecDestPrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PREFIX_NID).withValue("102:304:500::/40").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PREFIX_NID)
+ .withValue("102:304:500::/40").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build());
+ expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
+ new Ipv6Prefix("102:304:500::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
@Test
public void testExtractFlowspecSourcePrefix() {
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry = Builders.mapEntryBuilder();
+ final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> entry =
+ Builders.mapEntryBuilder();
entry.withNodeIdentifier(new NodeIdentifierWithPredicates(FlowspecRoute.QNAME, FlowspecRoute.QNAME, entry));
entry.withChild(Builders.unkeyedListBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.SOURCE_PREFIX_NID).withValue("102:304:600::/40").build()).build()).build()).build());
+ .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.SOURCE_PREFIX_NID)
+ .withValue("102:304:600::/40").build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build());
+ expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
+ new Ipv6Prefix("102:304:600::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.flowspec;
import java.util.Optional;
public class TableTypeActivatorTest {
- private static final BgpTableType IPV4_FLOW = new BgpTableTypeImpl(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class);
- private static final BgpTableType IPV6_FLOW = new BgpTableTypeImpl(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class);
- private static final BgpTableType IPV4_VPN_FLOW = new BgpTableTypeImpl(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class);
- private static final BgpTableType IPV6_VPN_FLOW = new BgpTableTypeImpl(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class);
+ private static final BgpTableType IPV4_FLOW = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+ FlowspecSubsequentAddressFamily.class);
+ private static final BgpTableType IPV6_FLOW = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+ FlowspecSubsequentAddressFamily.class);
+ private static final BgpTableType IPV4_VPN_FLOW = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+ FlowspecL3vpnSubsequentAddressFamily.class);
+ private static final BgpTableType IPV6_VPN_FLOW = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+ FlowspecL3vpnSubsequentAddressFamily.class);
@Test
public void testActivator() {
private static final byte[] TRAFFIC_MARKING = {(byte)128, 9, 0, 0, 0, 0, 0, 63};
- private static final byte[] REDIRECT_IPV6 = {(byte)128, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2};
+ private static final byte[] REDIRECT_IPV6 =
+ {(byte)128, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2};
private static final byte[] REDIRECT_AS_4BYTES = {(byte)130, 8, 0, 0, 0x19, (byte) 0x94, 0, 126};
final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
final FlowspecActivator activator = new FlowspecActivator(fsContext);
- this.act= new BGPActivator(activator);
+ this.act = new BGPActivator(activator);
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
this.act.start(context);
this.registry = context.getExtendedCommunityRegistry();
@Test
public void testTrafficRateParser() throws BGPDocumentedException, BGPParsingException {
- final TrafficRateExtendedCommunityCase trafficRate = new TrafficRateExtendedCommunityCaseBuilder().setTrafficRateExtendedCommunity(
- new TrafficRateExtendedCommunityBuilder().setInformativeAs(new ShortAsNumber(72L))
- .setLocalAdministrator(new Bandwidth(new byte[] { 0, 1, 2, 3 })).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficRate).setTransitive(true).build();
+ final TrafficRateExtendedCommunityCase trafficRate = new TrafficRateExtendedCommunityCaseBuilder()
+ .setTrafficRateExtendedCommunity(new TrafficRateExtendedCommunityBuilder()
+ .setInformativeAs(new ShortAsNumber(72L))
+ .setLocalAdministrator(new Bandwidth(new byte[] { 0, 1, 2, 3 })).build()).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficRate)
+ .setTransitive(true).build();
final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(TRAFFIC_RATE));
Assert.assertEquals(expected, parsed);
@Test
public void testTrafficRateSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.TrafficRateExtendedCommunityCase trafficRate = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.TrafficRateExtendedCommunityCaseBuilder().setTrafficRateExtendedCommunity(
- new TrafficRateExtendedCommunityBuilder().setInformativeAs(new ShortAsNumber(72L))
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.TrafficRateExtendedCommunityCase trafficRate =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.TrafficRateExtendedCommunityCaseBuilder()
+ .setTrafficRateExtendedCommunity(new TrafficRateExtendedCommunityBuilder()
+ .setInformativeAs(new ShortAsNumber(72L))
.setLocalAdministrator(new Bandwidth(new byte[] { 0, 1, 2, 3 })).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficRate).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(trafficRate)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(TRAFFIC_RATE.length);
this.registry.serializeExtendedCommunity(expected, output);
@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 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);
@Test
public void testTrafficActionSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCase trafficAction = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.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 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.TrafficActionExtendedCommunityCase trafficAction =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.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);
@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 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);
@Test
public void testTrafficMarkingSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCase trafficMarking = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.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 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.TrafficMarkingExtendedCommunityCase trafficMarking =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.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);
@Test
public void testRedirect2bParser() throws BGPDocumentedException, BGPParsingException {
- final RedirectExtendedCommunityCase redirect = new RedirectExtendedCommunityCaseBuilder().setRedirectExtendedCommunity(
- new RedirectExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(35L)).setLocalAdministrator(
- new byte[] { 4, 2, 8, 7 }).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
-
- final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_2BYTES));
+ final RedirectExtendedCommunityCase redirect = new RedirectExtendedCommunityCaseBuilder()
+ .setRedirectExtendedCommunity(new RedirectExtendedCommunityBuilder()
+ .setGlobalAdministrator(new ShortAsNumber(35L))
+ .setLocalAdministrator(new byte[] { 4, 2, 8, 7 }).build()).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
+
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(
+ Unpooled.copiedBuffer(REDIRECT_AS_2BYTES));
Assert.assertEquals(expected, parsed);
}
@Test
public void testredirect2bSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectExtendedCommunityCaseBuilder().setRedirectExtendedCommunity(
- new RedirectExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(35L)).setLocalAdministrator(
- new byte[] { 4, 2, 8, 7 }).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectExtendedCommunityCaseBuilder()
+ .setRedirectExtendedCommunity(new RedirectExtendedCommunityBuilder()
+ .setGlobalAdministrator(new ShortAsNumber(35L))
+ .setLocalAdministrator(new byte[] { 4, 2, 8, 7 }).build()).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_AS_2BYTES.length);
this.registry.serializeExtendedCommunity(expected, output);
.setRedirectIpv6(new RedirectIpv6Builder()
.setGlobalAdministrator(new Ipv6Address("102:304:506:708:90a:b0c:d0e:f10"))
.setLocalAdministrator(258).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_IPV6));
Assert.assertEquals(expected, parsed);
@Test
public void testRedirectIpv6Serializer() {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpv6ExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpv6ExtendedCommunityCaseBuilder()
- .setRedirectIpv6(new RedirectIpv6Builder()
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectIpv6ExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectIpv6ExtendedCommunityCaseBuilder()
+ .setRedirectIpv6(new RedirectIpv6Builder()
.setGlobalAdministrator(new Ipv6Address("102:304:506:708:90a:b0c:d0e:f10"))
.setLocalAdministrator(258).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_IPV6.length);
this.registry.serializeExtendedCommunity(expected, output);
@Test
public void testRedirect4bParser() throws BGPDocumentedException, BGPParsingException {
final RedirectAs4ExtendedCommunityCase redirect = new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(
- new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(6548L)).setLocalAdministrator(126).build()).build();
+ new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(6548L)).setLocalAdministrator(126).build())
+ .build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
- final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(
+ Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
Assert.assertEquals(expected, parsed);
}
@Test
public void testredirect4bSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(
- new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(6548L)).setLocalAdministrator(126).build()).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder()
+ .setRedirectAs4(new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(6548L))
+ .setLocalAdministrator(126).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_AS_4BYTES.length);
this.registry.serializeExtendedCommunity(expected, output);
@Test
public void testRedirectIpv4Parser() throws BGPDocumentedException, BGPParsingException {
- final RedirectIpv4ExtendedCommunityCase redirect = new RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(
- new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4Address("127.0.0.1")).setLocalAdministrator(126).build()).build();
+ final RedirectIpv4ExtendedCommunityCase redirect = new RedirectIpv4ExtendedCommunityCaseBuilder()
+ .setRedirectIpv4(new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4Address("127.0.0.1"))
+ .setLocalAdministrator(126).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_IPV4));
Assert.assertEquals(expected, parsed);
@Test
public void testredirectIpv4Serializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder().setRedirectIpv4(
- new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4Address("127.0.0.1")).setLocalAdministrator(126).build()).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectIpv4ExtendedCommunityCaseBuilder()
+ .setRedirectIpv4(new RedirectIpv4Builder().setGlobalAdministrator(new Ipv4Address("127.0.0.1"))
+ .setLocalAdministrator(126).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_IPV4.length);
this.registry.serializeExtendedCommunity(expected, output);
@Test
public void testRedirectIpv4NhParser() throws BGPDocumentedException, BGPParsingException {
- final RedirectIpNhExtendedCommunityCase redirect = new RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(
- new RedirectIpNhExtendedCommunityBuilder().setNextHopAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).setCopy(true).build()).build();
+ final RedirectIpNhExtendedCommunityCase redirect = new RedirectIpNhExtendedCommunityCaseBuilder()
+ .setRedirectIpNhExtendedCommunity(new RedirectIpNhExtendedCommunityBuilder()
+ .setNextHopAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).setCopy(true).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
- final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV4));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(
+ Unpooled.copiedBuffer(REDIRECT_NH_IPV4));
Assert.assertEquals(expected, parsed);
}
@Test
public void testredirectIpv4NhSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(
- new RedirectIpNhExtendedCommunityBuilder().setNextHopAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).setCopy(true).build()).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder()
+ .setRedirectIpNhExtendedCommunity(new RedirectIpNhExtendedCommunityBuilder()
+ .setNextHopAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).setCopy(true).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_NH_IPV4.length);
this.registry.serializeExtendedCommunity(expected, output);
@Test
public void testRedirectIpv6NhParser() throws BGPDocumentedException, BGPParsingException {
- final RedirectIpNhExtendedCommunityCase redirect = new RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(
- new RedirectIpNhExtendedCommunityBuilder().setNextHopAddress(new IpAddress(new Ipv6Address("2001::1"))).setCopy(false).build()).build();
+ final RedirectIpNhExtendedCommunityCase redirect = new RedirectIpNhExtendedCommunityCaseBuilder()
+ .setRedirectIpNhExtendedCommunity(new RedirectIpNhExtendedCommunityBuilder()
+ .setNextHopAddress(new IpAddress(new Ipv6Address("2001::1"))).setCopy(false).build()).build();
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
- final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV6));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(
+ Unpooled.copiedBuffer(REDIRECT_NH_IPV6));
Assert.assertEquals(expected, parsed);
}
@Test
public void testredirectIpv6NhSerializer() throws BGPDocumentedException, BGPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder().setRedirectIpNhExtendedCommunity(
- new RedirectIpNhExtendedCommunityBuilder().setNextHopAddress(new IpAddress(new Ipv6Address("2001::1"))).build()).build();
-
- final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.route
+ .attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCase redirect =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib
+ .route.attributes.extended.communities.extended.community.RedirectIpNhExtendedCommunityCaseBuilder()
+ .setRedirectIpNhExtendedCommunity(new RedirectIpNhExtendedCommunityBuilder()
+ .setNextHopAddress(new IpAddress(new Ipv6Address("2001::1"))).build()).build();
+
+ final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect)
+ .setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_NH_IPV6.length);
this.registry.serializeExtendedCommunity(expected, output);
public class NumericOperandParserTest {
private static final byte[] ONE_BYTE_CODE_LIST = new byte[]{
- 0x01, 0x64,
- 0x01, 0x65,
- (byte) 0x81, 0x66, // last port in the list should have end-of-list set
+ 0x01, 0x64,
+ 0x01, 0x65,
+ (byte) 0x81, 0x66, // last port in the list should have end-of-list set
};
@Test