use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class AclMatchesTest method buildIpv4DscpMatchTest.
@Test
public void buildIpv4DscpMatchTest() {
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(new AceIpv4Builder().build());
aceIpBuilder.setDscp(new Dscp(DSCP_VALUE));
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// There should be an IPv4 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV4));
// Check the DSCP value
IpMatch ipMatch = matchBuilder.getIpMatch();
assertNotNull(ipMatch);
assertEquals(ipMatch.getIpDscp().getValue(), Short.valueOf(DSCP_VALUE));
// The rest should be null
assertNull(matchBuilder.getLayer3Match());
assertNull(matchBuilder.getLayer4Match());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class AclMatchesTest method invertIpv6MatchTest.
@Test
public void invertIpv6MatchTest() {
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setProtocol(IPProtocols.TCP.shortValue());
aceIpBuilder.setDscp(new Dscp(DSCP_VALUE));
SourcePortRangeBuilder srcPortRange = new SourcePortRangeBuilder();
srcPortRange.setLowerPort(new PortNumber(TCP_SRC_LOWER_PORT));
srcPortRange.setUpperPort(new PortNumber(TCP_SRC_UPPER_PORT));
SourcePortRange sourcePortRange = srcPortRange.build();
aceIpBuilder.setSourcePortRange(sourcePortRange);
DestinationPortRangeBuilder dstPortRange = new DestinationPortRangeBuilder();
dstPortRange.setLowerPort(new PortNumber(TCP_DST_LOWER_PORT));
dstPortRange.setUpperPort(new PortNumber(TCP_DST_UPPER_PORT));
DestinationPortRange destinationPortRange = dstPortRange.build();
aceIpBuilder.setDestinationPortRange(destinationPortRange);
AceIpv6Builder aceIpv6Builder = new AceIpv6Builder();
aceIpv6Builder.setDestinationIpv6Network(new Ipv6Prefix(IPV6_DST_STR));
aceIpv6Builder.setSourceIpv6Network(new Ipv6Prefix(IPV6_SRC_STR));
AceIpv6 aceIpv6 = aceIpv6Builder.build();
aceIpBuilder.setAceIpVersion(aceIpv6);
MatchesBuilder matchesBuilder = new MatchesBuilder();
AceIp aceIp = aceIpBuilder.build();
matchesBuilder.setAceType(aceIp);
Matches matches = matchesBuilder.build();
Matches invertedMatches = AclMatches.invertMatches(matches);
assertNotEquals(matches, invertedMatches);
AceIp invertedAceIp = (AceIp) invertedMatches.getAceType();
assertEquals(invertedAceIp.getDscp(), aceIp.getDscp());
assertEquals(invertedAceIp.getProtocol(), aceIp.getProtocol());
DestinationPortRange invertedDestinationPortRange = invertedAceIp.getDestinationPortRange();
assertEquals(invertedDestinationPortRange.getLowerPort(), sourcePortRange.getLowerPort());
assertEquals(invertedDestinationPortRange.getUpperPort(), sourcePortRange.getUpperPort());
SourcePortRange invertedSourcePortRange = invertedAceIp.getSourcePortRange();
assertEquals(invertedSourcePortRange.getLowerPort(), destinationPortRange.getLowerPort());
assertEquals(invertedSourcePortRange.getUpperPort(), destinationPortRange.getUpperPort());
AceIpv6 invertedAceIpv6 = (AceIpv6) invertedAceIp.getAceIpVersion();
assertEquals(invertedAceIpv6.getDestinationIpv6Network(), aceIpv6.getSourceIpv6Network());
assertEquals(invertedAceIpv6.getSourceIpv6Network(), aceIpv6.getDestinationIpv6Network());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createToSMatch.
private static MatchBuilder createToSMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
final EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
match.setEthernetMatch(ethmatch.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 6);
final Dscp dscp = new Dscp((short) 8);
ipmatch.setIpDscp(dscp);
match.setIpMatch(ipmatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class MatchV10ResponseConvertorTest method testUdpMatch.
/**
* UDP match test for {@link MatchV10ResponseConvertor#convert(MatchV10, VersionDatapathIdConvertorData)}.
*/
@Test
public void testUdpMatch() {
// TP_SRC, TP_DST are wildcarded.
// NW_PROTO is not wildcarded but null.
Long dlType = 0x800L;
FlowWildcardsV10 wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, true, true);
MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.intValue());
MatchV10 match = builder.build();
BigInteger dpid = BigInteger.valueOf(12345L);
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);
datapathIdConvertorData.setDatapathId(dpid);
Match salMatch = convert(match, datapathIdConvertorData).build();
EthernetMatch etherMatch = salMatch.getEthernetMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong IP match", null, salMatch.getIpMatch());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify UDP protocol.
Short ipProto = 17;
match = builder.setNwProto(ipProto).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
IpMatch ipMatch = salMatch.getIpMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// TP_SRC is not wildcarded but null.
wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, true, false);
match = builder.setWildcards(wc).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify UDP source port.
Integer srcPort = 60000;
match = builder.setTpSrc(srcPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
UdpMatch udpMatch = (UdpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong UDP src", srcPort, udpMatch.getUdpSourcePort().getValue());
Assert.assertEquals("Wrong UDP dst", null, udpMatch.getUdpDestinationPort());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// TP_DST is not wildcarded but null.
wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, false, false);
match = builder.setWildcards(wc).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
udpMatch = (UdpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong UDP src", srcPort, udpMatch.getUdpSourcePort().getValue());
Assert.assertEquals("Wrong UDP dst", null, udpMatch.getUdpDestinationPort());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify UDP destination port only.
Integer dstPort = 6653;
match = builder.setTpSrc(null).setTpDst(dstPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
udpMatch = (UdpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong UDP src", null, udpMatch.getUdpSourcePort());
Assert.assertEquals("Wrong UDP dst", dstPort, udpMatch.getUdpDestinationPort().getValue());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify both source and destination port.
srcPort = 32767;
dstPort = 9999;
match = builder.setTpSrc(srcPort).setTpDst(dstPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
udpMatch = (UdpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong UDP src", srcPort, udpMatch.getUdpSourcePort().getValue());
Assert.assertEquals("Wrong UDP dst", dstPort, udpMatch.getUdpDestinationPort().getValue());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class MatchV10ResponseConvertorTest method testTcpMatch.
/**
* TCP match test for {@link MatchV10ResponseConvertor#convert(MatchV10, VersionDatapathIdConvertorData)}.
*/
@Test
public void testTcpMatch() {
// TP_SRC, TP_DST are wildcarded.
// NW_PROTO is not wildcarded but null.
Long dlType = 0x800L;
FlowWildcardsV10 wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, true, true);
MatchV10Builder builder = new MatchV10Builder().setWildcards(wc).setDlType(dlType.intValue());
MatchV10 match = builder.build();
BigInteger dpid = BigInteger.valueOf(12345L);
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);
datapathIdConvertorData.setDatapathId(dpid);
Match salMatch = convert(match, datapathIdConvertorData).build();
EthernetMatch etherMatch = salMatch.getEthernetMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong IP match", null, salMatch.getIpMatch());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify TCP protocol.
Short ipProto = 6;
match = builder.setNwProto(ipProto).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
IpMatch ipMatch = salMatch.getIpMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// TP_SRC is not wildcarded but null.
wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, true, false);
match = builder.setWildcards(wc).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong L4 match", null, salMatch.getLayer4Match());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify TCP source port.
Integer srcPort = 60000;
match = builder.setTpSrc(srcPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
TcpMatch tcpMatch = (TcpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong TCP src", srcPort, tcpMatch.getTcpSourcePort().getValue());
Assert.assertEquals("Wrong TCP dst", null, tcpMatch.getTcpDestinationPort());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// TP_DST is not wildcarded but null.
wc = new FlowWildcardsV10(true, true, false, true, true, true, false, true, false, false);
match = builder.setWildcards(wc).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
tcpMatch = (TcpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong TCP src", srcPort, tcpMatch.getTcpSourcePort().getValue());
Assert.assertEquals("Wrong TCP dst", null, tcpMatch.getTcpDestinationPort());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify TCP destination port only.
Integer dstPort = 6653;
match = builder.setTpSrc(null).setTpDst(dstPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
tcpMatch = (TcpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong TCP src", null, tcpMatch.getTcpSourcePort());
Assert.assertEquals("Wrong TCP dst", dstPort, tcpMatch.getTcpDestinationPort().getValue());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
// Specify both source and destination port.
srcPort = 32767;
dstPort = 9999;
match = builder.setTpSrc(srcPort).setTpDst(dstPort).build();
salMatch = convert(match, datapathIdConvertorData).build();
etherMatch = salMatch.getEthernetMatch();
ipMatch = salMatch.getIpMatch();
tcpMatch = (TcpMatch) salMatch.getLayer4Match();
Assert.assertEquals("Wrong in port", null, salMatch.getInPort());
Assert.assertEquals("Wrong dl src", null, etherMatch.getEthernetSource());
Assert.assertEquals("Wrong dl dst", null, etherMatch.getEthernetDestination());
Assert.assertEquals("Wrong dl type", dlType, etherMatch.getEthernetType().getType().getValue());
Assert.assertEquals("Wrong VLAN match", null, salMatch.getVlanMatch());
Assert.assertEquals("Wrong ip protocol", ipProto, ipMatch.getIpProtocol());
Assert.assertEquals("Wrong ip proto", null, ipMatch.getIpProto());
Assert.assertEquals("Wrong ip ecn", null, ipMatch.getIpEcn());
Assert.assertEquals("Wrong ip dscp", null, ipMatch.getIpDscp());
Assert.assertEquals("Wrong L3 match", null, salMatch.getLayer3Match());
Assert.assertEquals("Wrong TCP src", srcPort, tcpMatch.getTcpSourcePort().getValue());
Assert.assertEquals("Wrong TCP dst", dstPort, tcpMatch.getTcpDestinationPort().getValue());
Assert.assertEquals("Wrong ICMPv4 match", null, salMatch.getIcmpv4Match());
}
Aggregations