MRI version bumpup for Aluminium
[netvirt.git] / aclservice / impl / src / test / java / org / opendaylight / netvirt / aclservice / tests / AclServiceStatefulTest.java
1 /*
2  * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netvirt.aclservice.tests;
9
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;
16
17
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";
25
26     public @Rule MethodRule guice = new GuiceRule(new AclServiceModule(),
27             new AclServiceTestModule(SecurityGroupMode.Stateful),
28             new TestableDataTreeChangeListenerModule(),
29             new JobCoordinatorTestModule());
30
31     private final FlowEntryObjectsStateful ipv4statefulentries = new FlowEntryObjectsStateful();
32
33     @Override
34     void newInterfaceCheck() {
35         assertFlowsInAnyOrder(ipv4statefulentries.expectedFlows(PORT_MAC_1, IP_1, PREFIX));
36     }
37
38     @Override
39     void newInterfaceWithEtherTypeAclCheck() {
40         assertFlowsInAnyOrder(ipv4statefulentries.etherFlows(IP_1, IP_2, PREFIX));
41     }
42
43     @Override
44     public void newInterfaceWithTcpDstAclCheck() {
45         assertFlowsInAnyOrder(ipv4statefulentries.tcpFlows(IP_1, IP_2, PREFIX));
46     }
47
48     @Override
49     public void newInterfaceWithUdpDstAclCheck() {
50         assertFlowsInAnyOrder(ipv4statefulentries.udpFlows(IP_1, IP_2, PREFIX));
51     }
52
53     @Override
54     public void newInterfaceWithIcmpAclCheck() {
55         assertFlowsInAnyOrder(ipv4statefulentries.icmpFlows(IP_1, IP_2, PREFIX));
56     }
57
58     @Override
59     public void newInterfaceWithDstPortRangeCheck() {
60         assertFlowsInAnyOrder(ipv4statefulentries.dstRangeFlows(IP_1, PREFIX));
61     }
62
63     @Override
64     public void newInterfaceWithDstAllPortsCheck() {
65         assertFlowsInAnyOrder(ipv4statefulentries.dstAllFlows(IP_1, PREFIX));
66     }
67
68     @Override
69     void newInterfaceWithTwoAclsHavingSameRulesCheck() {
70         assertFlowsInAnyOrder(ipv4statefulentries.icmpFlowsForTwoAclsHavingSameRules(IP_3, PREFIX));
71     }
72
73     @Override
74     void newInterfaceWithAapIpv4AllCheck() {
75         assertFlowsInAnyOrder(ipv4statefulentries.aapWithIpv4AllFlows(IP_1, IP_2, PREFIX));
76     }
77
78     @Override
79     void newInterfaceWithAapCheck() {
80         assertFlowsInAnyOrder(ipv4statefulentries.aapFlows(IP_1, IP_2, IP_100, IP_101, PREFIX));
81     }
82
83     @Override
84     void newInterfaceWithMultipleAclCheck() {
85         assertFlowsInAnyOrder(ipv4statefulentries.multipleAcl(IP_1, IP_2, PREFIX));
86     }
87 }