import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.AbstractOperandParser;
import org.opendaylight.protocol.bgp.flowspec.handlers.BitmaskOperandParser;
import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.BitmaskOperand;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.Dscp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.FlowspecSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.Fragment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.NumericOperand;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.Flowspec;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.FlowspecBuilder;
-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.flowspec.flowspec.type.DestinationPortCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.DscpCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.FragmentCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.IcmpCodeCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.IcmpTypeCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.PacketLengthCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.PacketLengthCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.PortCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.PortCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.SourcePortCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.TcpFlagsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.TcpFlagsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPortsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.dscp._case.Dscps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.dscp._case.DscpsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.fragment._case.Fragments;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.fragment._case.FragmentsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.icmp.code._case.Codes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.icmp.code._case.CodesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.icmp.type._case.TypesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengths;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengthsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.port._case.Ports;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.port._case.PortsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePortsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.tcp.flags._case.TcpFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.flowspec.flowspec.type.tcp.flags._case.TcpFlagsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.ProtocolIpCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIpsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.destination.ipv4.DestinationFlowspecIpv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.ipv4.route.FlowspecRoute;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.BitmaskOperand;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.FlowspecSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Fragment;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.NumericOperand;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.FlowspecBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.FlowspecType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DestinationPortCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.DscpCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.FragmentCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpCodeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.IcmpTypeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PacketLengthCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PacketLengthCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PortCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.PortCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.SourcePortCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.TcpFlagsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.TcpFlagsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPortsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.dscp._case.Dscps;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.dscp._case.DscpsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.fragment._case.Fragments;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.fragment._case.FragmentsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.Codes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.code._case.CodesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.Types;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.icmp.type._case.TypesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengths;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.packet.length._case.PacketLengthsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.PortsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePortsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.tcp.flags._case.TcpFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.tcp.flags._case.TcpFlagsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.DestinationPrefixCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.ProtocolIpCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.SourcePrefixCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIps;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.group.ipv4.flowspec.flowspec.type.protocol.ip._case.ProtocolIpsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.ipv4.DestinationFlowspecIpv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.ipv4.route.FlowspecRoute;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReachBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreachBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlriBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
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;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
public class SimpleFlowspecIpv4NlriParserTest {
private static final NodeIdentifier PROTOCOL_IP_NID = new NodeIdentifier(ProtocolIps.QNAME);
- static final PathId PATH_ID = new PathId(1L);
+ static final PathId PATH_ID = new PathId(Uint32.ONE);
@Mock
private PeerSpecificParserConstraint constraint;
@Mock
0x0c, (byte) 0x81, (byte) 0x0e
};
- private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
- private final SimpleFlowspecIpv4NlriParser fsParser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final SimpleFlowspecIpv4NlriParser fsParser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
}
fs.add(builder.build());
mp.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120
.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(new DestinationFlowspecIpv4Builder().setFlowspec(fs).build())
.build()).build());
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
parser.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.DestinationFlowspecCase)
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecCase)
result.getAdvertizedRoutes().getDestinationType()).getDestinationFlowspecIpv4().getFlowspec();
testFlows(flows, destinationPrefix, sourcePrefix, prots, ps, dps, sps);
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(new AttributesReachBuilder()
+ .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 "
private static FlowspecType createSps() {
final List<SourcePorts> sports = Lists.newArrayList(new SourcePortsBuilder().setOp(
- new NumericOperand(false, true, true, false, false)).setValue(8080).build());
+ new NumericOperand(false, true, true, false, false)).setValue(Uint16.valueOf(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());
+ new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(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());
+ new NumericOperand(false, false, false, true, false)).setValue(Uint16.valueOf(4089)).build(),
+ new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false))
+ .setValue(Uint16.valueOf(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.rev180329.update.attributes.mp.reach.nlri.advertized.routes
+ .opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes
.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(
new DestinationFlowspecIpv4Builder()
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
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
- .rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecCase)
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+ .DestinationFlowspecCase)
result.getAdvertizedRoutes().getDestinationType()).getDestinationFlowspecIpv4().getFlowspec();
testFlows(flows, destinationPrefix, sourcePrefix, prots, ps, dps, sps);
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(new AttributesReachBuilder()
+ .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 "
private static 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(false, false, true, true, false)).setValue(Uint16.valueOf(137))
+ .build(),
+ new PortsBuilder().setOp(new NumericOperand(true, false, true, false, true)).setValue(Uint16.valueOf(139))
+ .build(),
+ new PortsBuilder().setOp(new NumericOperand(false, true, true, false, false)).setValue(Uint16.valueOf(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.rev180329.update
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(
new DestinationFlowspecIpv4Builder()
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
parser.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.DestinationFlowspecCase)
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecCase)
result.getWithdrawnRoutes().getDestinationType()).getDestinationFlowspecIpv4().getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
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);
+ parser.serializeAttribute(new AttributesBuilder()
+ .addAugmentation(new AttributesUnreachBuilder().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 "
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());
+ .setValue(new Dscp(Uint8.valueOf(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());
+ .setValue(Uint16.valueOf(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(),
- new TcpFlagsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(22193).build());
+ final List<TcpFlags> flags = Lists.newArrayList(new TcpFlagsBuilder()
+ .setOp(new BitmaskOperand(false, false, false, true)).setValue(Uint16.valueOf(1025))
+ .build(), new TcpFlagsBuilder()
+ .setOp(new BitmaskOperand(false, true, true, false))
+ .setValue(Uint16.valueOf(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(),
- new CodesBuilder().setOp(new NumericOperand(false, true, false, false, false)).setValue((short) 5).build());
+ final List<Codes> codes = Lists.newArrayList(new CodesBuilder()
+ .setOp(new NumericOperand(false, false, false, false, true))
+ .setValue(Uint8.valueOf(4))
+ .build(), new CodesBuilder()
+ .setOp(new NumericOperand(false, true, false, false, false))
+ .setValue(Uint8.valueOf(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(),
- new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue((short) 3).build());
+ new TypesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue(Uint8.TWO)
+ .build(),
+ new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue(Uint8.valueOf(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.rev180329.update
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCaseBuilder()
.setDestinationFlowspecIpv4(
new DestinationFlowspecIpv4Builder()
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
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
- .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecCase)
+ final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .DestinationFlowspecCase)
result.getWithdrawnRoutes().getDestinationType()).getDestinationFlowspecIpv4().getFlowspec();
checkUnreachFlows(flows, icmpType, icmpCode, tcp, packet, dscp, fragment);
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);
+ parser.serializeAttribute(new AttributesBuilder()
+ .addAugmentation(new AttributesUnreachBuilder().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 "
.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())
+ .withValue(Uint8.valueOf(100)).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_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())
+ .withValue(Uint8.valueOf(200)).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_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) 240).build()).build())
+ .withValue(Uint8.valueOf(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 ProtocolIpsBuilder().setValue(Uint8.valueOf(100)).setOp(
new NumericOperand(true, true, false, false, false)).build(),
- new ProtocolIpsBuilder().setValue((short) 200).setOp(
+ new ProtocolIpsBuilder().setValue(Uint8.valueOf(200)).setOp(
new NumericOperand(true, false, false, false, false)).build(),
- new ProtocolIpsBuilder().setValue((short) 240).setOp(
+ new ProtocolIpsBuilder().setValue(Uint8.valueOf(240)).setOp(
new NumericOperand(true, true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE))
.build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue(100).build()).build())
+ .withValue(Uint16.valueOf(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());
+ final FlowspecBuilder expectedFS = new FlowspecBuilder()
+ .setFlowspecType(new PortCaseBuilder()
+ .setPorts(Lists.newArrayList(new PortsBuilder()
+ .setValue(Uint16.valueOf(100))
+ .setOp(new NumericOperand(true, true, false, false, true))
+ .build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
.withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
AbstractNumericOperandParser.EQUALS_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue(1024).build()).build())
+ .withValue(Uint16.valueOf(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(Uint16.valueOf(1024))
+ .setOp(new NumericOperand(false, true, true, false, false))
+ .build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
AbstractNumericOperandParser.GREATER_THAN_VALUE,
AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue(8080).build()).build())
+ .withValue(Uint16.valueOf(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()))
+ expectedFS.setFlowspecType(new SourcePortCaseBuilder()
+ .setSourcePorts(Lists.newArrayList(new SourcePortsBuilder()
+ .setValue(Uint16.valueOf(8080))
+ .setOp(new NumericOperand(true, true, true, true, true))
+ .build()))
.build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
AbstractNumericOperandParser.GREATER_THAN_VALUE,
AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue((short) 22).build()).build())
+ .withValue(Uint8.valueOf(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());
+ .setValue(Uint8.valueOf(22)).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
.withValue(Collections.emptySet()).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue((short) 23).build()).build())
+ .withValue(Uint8.valueOf(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());
+ .setValue(Uint8.valueOf(23)).setOp(new NumericOperand(false, false, false, false, false)).build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
.withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
AbstractOperandParser.END_OF_LIST_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue(99).build()).build())
+ .withValue(Uint16.valueOf(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(Uint16.valueOf(99))
+ .setOp(new BitmaskOperand(true, true, false, false))
+ .build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
.withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue(101).build()).build())
+ .withValue(Uint16.valueOf(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(Uint16.valueOf(101))
+ .setOp(new NumericOperand(true, false, false, true, false))
+ .build()))
+ .build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
AbstractOperandParser.END_OF_LIST_VALUE,
AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
- .withValue((short) 15).build()).build())
+ .withValue(Uint8.valueOf(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()))
+ .setValue(new Dscp(Uint8.valueOf(15))).setOp(new NumericOperand(true, true, false, true, false)).build()))
.build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
@Test
public void testBatchedFlowspecNlri() throws Exception {
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(
- flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
- SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);