use of org.opendaylight.genius.mdsalutil.MatchInfoBase in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testaddSrcIpMatches_v4.
@Test
public void testaddSrcIpMatches_v4() {
AceIpBuilder builder = new AceIpBuilder();
AceIpv4Builder v4builder = new AceIpv4Builder();
v4builder.setSourceIpv4Network(new Ipv4Prefix("10.1.1.1/24"));
builder.setAceIpVersion(v4builder.build());
List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addSrcIpMatches(builder.build());
assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
assertTrue(flowMatches.contains(new MatchIpv4Source("10.1.1.1", "24")));
}
use of org.opendaylight.genius.mdsalutil.MatchInfoBase in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testprogramOtherProtocolFlow.
@Test
public void testprogramOtherProtocolFlow() {
AceIpBuilder builder = AclServiceTestUtils.prepareAceIpBuilder("10.1.1.1/24", "20.1.1.1/24", null, null, (short) 1);
Map<String, List<MatchInfoBase>> flowMatchesMap = AclServiceOFFlowBuilder.programOtherProtocolFlow(builder.build());
List<MatchInfoBase> flowMatches = flowMatchesMap.get("OTHER_PROTO" + "1");
AclServiceTestUtils.verifyGeneralFlows(flowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
}
use of org.opendaylight.genius.mdsalutil.MatchInfoBase in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testprogramUdpFlow_WithSrcDstPortRange.
@Test
public void testprogramUdpFlow_WithSrcDstPortRange() {
AceIpBuilder builder = AclServiceTestUtils.prepareAceIpBuilder("10.1.1.1/24", "20.1.1.1/24", "1024", "1024", (short) 1);
Map<String, List<MatchInfoBase>> flowMatchesMap = AclServiceOFFlowBuilder.programUdpFlow(builder.build());
List<MatchInfoBase> srcFlowMatches = new ArrayList<>();
List<MatchInfoBase> dstFlowMatches = new ArrayList<>();
for (String flowId : flowMatchesMap.keySet()) {
if (flowId.startsWith("UDP_SOURCE_")) {
srcFlowMatches.addAll(flowMatchesMap.get(flowId));
}
if (flowId.startsWith("UDP_DESTINATION_")) {
dstFlowMatches.addAll(flowMatchesMap.get(flowId));
}
}
AclServiceTestUtils.verifyGeneralFlows(srcFlowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
List<MatchInfoBase> udpSrcMatches = srcFlowMatches.stream().filter(item -> item instanceof NxMatchUdpSourcePort).collect(Collectors.toList());
assertEquals(new NxMatchUdpSourcePort(1024, 65535), udpSrcMatches.get(0));
AclServiceTestUtils.verifyGeneralFlows(dstFlowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
List<MatchInfoBase> udpDstMatches = dstFlowMatches.stream().filter(item -> item instanceof NxMatchUdpDestinationPort).collect(Collectors.toList());
assertEquals(new NxMatchUdpDestinationPort(1024, 65535), udpDstMatches.get(0));
}
use of org.opendaylight.genius.mdsalutil.MatchInfoBase in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testaddSrcIpMatches_v4NoSrcNetwork.
@Test
public void testaddSrcIpMatches_v4NoSrcNetwork() {
AceIpBuilder builder = new AceIpBuilder();
AceIpv4Builder v4builder = new AceIpv4Builder();
v4builder.setSourceIpv4Network(null);
builder.setAceIpVersion(v4builder.build());
List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addSrcIpMatches(builder.build());
assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchIpv4Source.class);
}
use of org.opendaylight.genius.mdsalutil.MatchInfoBase in project netvirt by opendaylight.
the class AclServiceOFFlowBuilderTest method testaddDstIpMatches_v4NoDstNetwork.
@Test
public void testaddDstIpMatches_v4NoDstNetwork() {
AceIpBuilder builder = new AceIpBuilder();
AceIpv4Builder v4builder = new AceIpv4Builder();
v4builder.setDestinationIpv4Network(null);
builder.setAceIpVersion(v4builder.build());
List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addDstIpMatches(builder.build());
assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchIpv4Destination.class);
}
Aggregations