import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import io.netty.buffer.ByteBuf;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
public class SimpleFlowspecIpv4NlriParserTest {
+ private static final NodeIdentifier PROTOCOL_IP_NID = new NodeIdentifier(ProtocolIps.QNAME);
+
static final PathId PATH_ID = new PathId(1L);
@Mock
private PeerSpecificParserConstraint constraint;
@Mock
private MultiPathSupport muliPathSupport;
- private static final byte[] REACHED_NLRI = new byte[]{
+ private static final byte[] REACHED_NLRI = new byte[] {
0x21, // NLRI length: 33
01, 0x20, 0x0a, 00, 01, 00,
02, 0x20, 01, 02, 03, 04,
06, (byte) 0x91, 0x1f, (byte) 0x90
};
- private static final byte[] REACHED_NLRI_ADD_PATH = new byte[]{
+ private static final byte[] REACHED_NLRI_ADD_PATH = new byte[] {
0x0, 0x0, 0x0, 0x1,
0x21, // NLRI length: 33
01, 0x20, 0x0a, 00, 01, 00,
06, (byte) 0x91, 0x1f, (byte) 0x90
};
- private static final byte[] UNREACHED_NLRI = new byte[]{
+ private static final byte[] UNREACHED_NLRI = new byte[] {
0x1B, // NLRI length: 27
07, 4, 2, (byte) 0x84, 3,
0x08, 4, 04, (byte) 0x80, 05,
0x0c, (byte) 0x81, (byte) 0x0e
};
- private static final byte[] UNREACHED_NLRI_ADD_PATH = new byte[]{
+ private static final byte[] UNREACHED_NLRI_ADD_PATH = new byte[] {
0x0, 0x0, 0x0, 0x1,
0x1B, // NLRI length: 27
07, 4, 2, (byte) 0x84, 3,
fs.add(builder.build());
mp.setAdvertizedRoutes(
- new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
- .setDestinationFlowspec(
- new DestinationFlowspecBuilder()
- .setFlowspec(fs)
- .build()
- ).build()
- ).build()
+ new AdvertizedRoutesBuilder().setDestinationType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspec(
+ new DestinationFlowspecBuilder()
+ .setFlowspec(fs)
+ .build()
+ ).build()
+ ).build()
);
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase) (result.getAdvertizedRoutes().getDestinationType()))
- .getDestinationFlowspec()
- .getFlowspec();
+ .getDestinationFlowspec()
+ .getFlowspec();
testFlows(flows, destinationPrefix, sourcePrefix, prots, prots, ps, dps, sps);
final ByteBuf buffer = Unpooled.buffer();
private 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());
+ new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(179).build());
return new DestinationPortCaseBuilder().setDestinationPorts(destports).build();
}
fs.add(builder.build());
mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
- .setDestinationFlowspec(
- new DestinationFlowspecBuilder()
- .setPathId(PATH_ID)
- .setFlowspec(fs)
- .build()
- ).build()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspec(
+ new DestinationFlowspecBuilder()
+ .setPathId(PATH_ID)
+ .setFlowspec(fs)
+ .build()
).build()
+ ).build()
);
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
parser.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.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase) (result.getAdvertizedRoutes().getDestinationType()))
- .getDestinationFlowspec()
- .getFlowspec();
+ .getDestinationFlowspec()
+ .getFlowspec();
testFlows(flows, destinationPrefix, sourcePrefix, prots, prots, ps, dps, sps);
final ByteBuf buffer = Unpooled.buffer();
private PortCase createPorts() {
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());
+ 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());
return new PortCaseBuilder().setPorts(ports).build();
}
fs.add(builder.build());
mp.setAfi(Ipv4AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
- .setDestinationFlowspec(
- new DestinationFlowspecBuilder()
- .setFlowspec(fs)
- .build()
- ).build()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspec(
+ new DestinationFlowspecBuilder()
+ .setFlowspec(fs)
+ .build()
).build()
+ ).build()
);
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase) (result.getWithdrawnRoutes().getDestinationType()))
- .getDestinationFlowspec()
- .getFlowspec();
+ .getDestinationFlowspec()
+ .getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeNlri(flows, null, buffer);
+ parser.serializeNlri(new Object[] {flows}, null, buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
private PacketLengthCase createPackets() {
final List<PacketLengths> packets = Lists.newArrayList(new PacketLengthsBuilder().setOp(new NumericOperand(false, true, false, false, true))
- .setValue(57005).build());
+ .setValue(57005).build());
return new PacketLengthCaseBuilder().setPacketLengths(packets).build();
}
private TcpFlagsCase createTcp() {
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());
+ new TcpFlagsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(22193).build());
return new TcpFlagsCaseBuilder().setTcpFlags(flags).build();
}
private FlowspecType createIcmpCode() {
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());
+ new CodesBuilder().setOp(new NumericOperand(false, true, false, false, false)).setValue((short) 5).build());
return new IcmpCodeCaseBuilder().setCodes(codes).build();
}
private FlowspecType createIcmpType() {
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());
+ new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue((short) 3).build());
return new IcmpTypeCaseBuilder().setTypes(types).build();
}
fs.add(builder.build());
mp.setAfi(Ipv4AddressFamily.class).setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
- .setDestinationFlowspec(
- new DestinationFlowspecBuilder()
- .setPathId(PATH_ID)
- .setFlowspec(fs)
- .build()
- ).build()
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
+ .setDestinationFlowspec(
+ new DestinationFlowspecBuilder()
+ .setPathId(PATH_ID)
+ .setFlowspec(fs)
+ .build()
).build()
+ ).build()
);
final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
parser.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.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase) (result.getWithdrawnRoutes().getDestinationType()))
- .getDestinationFlowspec()
- .getFlowspec();
+ .getDestinationFlowspec()
+ .getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeNlri(flows, PATH_ID, buffer);
+ parser.serializeNlri(new Object[] {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);
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .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.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .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());
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .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.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .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());
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PROTOCOL_IP_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 100).build()).build())
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 200).build()).build())
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 240).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>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(PROTOCOL_IP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 200).build()).build())
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 240).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(Lists.<ProtocolIps>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, FS_PARSER.extractFlowspec(entry.build()));
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PORTS_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(100).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PORTS_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(100).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new PortCaseBuilder().setPorts(Lists.<Ports>newArrayList(new PortsBuilder().setValue(100).setOp(new NumericOperand(true, true, false, false, true)).build())).build());
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.DEST_PORT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(1024).build()).build())
- .build()).build()).build()).build());
+ .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.<String>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.<DestinationPorts>newArrayList(new DestinationPortsBuilder().setValue(1024).setOp(new NumericOperand(false, true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.SOURCE_PORT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>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(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(8080).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PORT_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>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(AbstractFlowspecNlriParser.VALUE_NID).withValue(8080).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(Lists.<SourcePorts>newArrayList(new SourcePortsBuilder().setValue(8080).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.ICMP_TYPE_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>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(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 22).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_TYPE_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>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(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 22).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.<Types>newArrayList(new TypesBuilder().setValue((short) 22).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.ICMP_CODE_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet()).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 23).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_CODE_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet()).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 23).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.<Codes>newArrayList(new CodesBuilder().setValue((short) 23).setOp(new NumericOperand(false, false, false, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.TCP_FLAGS_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(99).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.TCP_FLAGS_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(99).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.<TcpFlags>newArrayList(new TcpFlagsBuilder().setValue(99).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.PACKET_LENGTHS_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(101).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PACKET_LENGTHS_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(101).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.<PacketLengths>newArrayList(new PacketLengthsBuilder().setValue(101).setOp(new NumericOperand(true, false, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.DSCP_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue((short) 15).build()).build())
- .build()).build()).build()).build());
+ .withChild(Builders.choiceBuilder()
+ .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
+ .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DSCP_NID)
+ .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 15).build()).build())
+ .build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.<Dscps>newArrayList(new DscpsBuilder().setValue(new Dscp((short) 15)).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
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.unkeyedListEntryBuilder()
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.unkeyedListEntryBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_NID)
- .withChild(Builders.choiceBuilder()
- .withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
- .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.FRAGMENT_NID)
- .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
- .withChild(Builders.leafBuilder().withNodeIdentifier(SimpleFlowspecIpv4NlriParser.VALUE_NID).withValue(Sets.newHashSet(SimpleFlowspecIpv4NlriParser.DO_NOT_VALUE, SimpleFlowspecIpv4NlriParser.FIRST_VALUE, SimpleFlowspecIpv4NlriParser.IS_A_VALUE, SimpleFlowspecIpv4NlriParser.LAST_VALUE)).build()).build())
- .build()).build()).build()).build());
+ .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.<String>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.<Fragments>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<>();
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
}
}
+