2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.aclservice.tests;
10 import org.junit.Rule;
11 import org.junit.rules.MethodRule;
12 import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule;
13 import org.opendaylight.genius.datastoreutils.testutils.TestableDataTreeChangeListenerModule;
14 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.config.rev160806.AclserviceConfig.SecurityGroupMode;
18 public class AclServiceStatefulTest extends AclServiceTestBase {
19 static String IP_1 = "10.0.0.1";
20 static String IP_2 = "10.0.0.2";
21 static String IP_3 = "10.0.0.3";
22 static String IP_100 = "10.0.0.100";
23 static String IP_101 = "10.0.0.101";
24 static String PREFIX = "32";
26 public @Rule MethodRule guice = new GuiceRule(new AclServiceModule(),
27 new AclServiceTestModule(SecurityGroupMode.Stateful),
28 new TestableDataTreeChangeListenerModule(),
29 new JobCoordinatorTestModule());
31 private final FlowEntryObjectsStateful ipv4statefulentries = new FlowEntryObjectsStateful();
34 void newInterfaceCheck() {
35 assertFlowsInAnyOrder(ipv4statefulentries.expectedFlows(PORT_MAC_1, IP_1, PREFIX));
39 void newInterfaceWithEtherTypeAclCheck() {
40 assertFlowsInAnyOrder(ipv4statefulentries.etherFlows(IP_1, IP_2, PREFIX));
44 public void newInterfaceWithTcpDstAclCheck() {
45 assertFlowsInAnyOrder(ipv4statefulentries.tcpFlows(IP_1, IP_2, PREFIX));
49 public void newInterfaceWithUdpDstAclCheck() {
50 assertFlowsInAnyOrder(ipv4statefulentries.udpFlows(IP_1, IP_2, PREFIX));
54 public void newInterfaceWithIcmpAclCheck() {
55 assertFlowsInAnyOrder(ipv4statefulentries.icmpFlows(IP_1, IP_2, PREFIX));
59 public void newInterfaceWithDstPortRangeCheck() {
60 assertFlowsInAnyOrder(ipv4statefulentries.dstRangeFlows(IP_1, PREFIX));
64 public void newInterfaceWithDstAllPortsCheck() {
65 assertFlowsInAnyOrder(ipv4statefulentries.dstAllFlows(IP_1, PREFIX));
69 void newInterfaceWithTwoAclsHavingSameRulesCheck() {
70 assertFlowsInAnyOrder(ipv4statefulentries.icmpFlowsForTwoAclsHavingSameRules(IP_3, PREFIX));
74 void newInterfaceWithAapIpv4AllCheck() {
75 assertFlowsInAnyOrder(ipv4statefulentries.aapWithIpv4AllFlows(IP_1, IP_2, PREFIX));
79 void newInterfaceWithAapCheck() {
80 assertFlowsInAnyOrder(ipv4statefulentries.aapFlows(IP_1, IP_2, IP_100, IP_101, PREFIX));
84 void newInterfaceWithMultipleAclCheck() {
85 assertFlowsInAnyOrder(ipv4statefulentries.multipleAcl(IP_1, IP_2, PREFIX));