OF-overlay PolicyEnforcer tests, refactoring
[groupbasedpolicy.git] / renderers / ofoverlay / src / test / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / mapper / MapperUtilsTest.java
index fefcecd65aa00ec0952c816d2c5ca1548500e3c2..280f8434dc0e225c8d4cf1f5536b8464f76cace6 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowTable;
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils;\r
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.node.SwitchManager;\r
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.AllowAction;\r
+import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.ChainAction;\r
 import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.Classifier;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;\r
@@ -50,6 +51,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.ofoverlay.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValueBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.TenantBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.ForwardingContextBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.Policy;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.PolicyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2BridgeDomain;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2BridgeDomainBuilder;\r
@@ -65,6 +67,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.SubjectFeatureInstancesBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ConsumerNamedSelectorBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ProviderNamedSelectorBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ActionInstance;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ActionInstanceBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ClassifierInstanceBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;\r
@@ -106,6 +109,7 @@ public abstract class MapperUtilsTest {
     protected static final ContextId CONTEXT_ID = new L3ContextId("ctxId");\r
     // Often used strings\r
     protected static final String ALLOW = "allow";\r
+    protected static final String CHAIN = "chain";\r
     protected static final String L2 = "L2";\r
     protected static final String OPENFLOW = "openflow:";\r
     protected static final String DROP_ALL = "dropAll";\r
@@ -121,35 +125,33 @@ public abstract class MapperUtilsTest {
     protected PolicyInfo policyInfo;\r
     protected FlowTable table;\r
 \r
-    protected FlowBuilder buildFlow(FlowId flowId, short tableId, Integer priority, Match match, Instructions instructions) {\r
-        FlowBuilder flowBuilder = FlowUtils.base(tableId);\r
-        flowBuilder.setId(flowId)\r
-                .setPriority(priority)\r
-                .setMatch(match)\r
-                .setInstructions(instructions);\r
-        return flowBuilder;\r
+    protected FlowBuilder buildFlow(FlowId flowId, short tableId, Integer priority, Match match,\r
+            Instructions instructions) {\r
+        return FlowUtils.base(tableId)\r
+            .setId(flowId)\r
+            .setPriority(priority)\r
+            .setMatch(match)\r
+            .setInstructions(instructions);\r
     }\r
 \r
     protected EndpointL3Builder buildL3Endpoint(Ipv4Address natIp, Ipv4Address ip, MacAddress mac, String l2bd) {\r
         Preconditions.checkNotNull(natIp);\r
         Preconditions.checkNotNull(ip);\r
         Preconditions.checkNotNull(mac);\r
-        EndpointL3Builder endpointL3Builder = new EndpointL3Builder();\r
-        NatAddressBuilder natAddressBuilder = new NatAddressBuilder();\r
-        natAddressBuilder.setNatAddress(new IpAddress(new Ipv4Address(natIp)));\r
-        endpointL3Builder.addAugmentation(NatAddress.class, natAddressBuilder.build());\r
-        endpointL3Builder.setIpAddress(new IpAddress(ip));\r
-        endpointL3Builder.setMacAddress(new MacAddress(mac));\r
+\r
+        NatAddress natAddress = new NatAddressBuilder().setNatAddress(new IpAddress(new Ipv4Address(natIp))).build();\r
+\r
+        EndpointL3Builder endpointL3Builder = new EndpointL3Builder().addAugmentation(NatAddress.class, natAddress)\r
+            .setIpAddress(new IpAddress(ip))\r
+            .setMacAddress(new MacAddress(mac));\r
         if (l2bd != null) {\r
             endpointL3Builder.setL2Context(new L2BridgeDomainId(l2bd));\r
         }\r
-        if(ip.equals(IPV4_0)) {\r
+        if (ip.equals(IPV4_0)) {\r
             endpointL3Builder.setNetworkContainment(SUBNET_0);\r
-        }\r
-        else if(ip.equals(IPV4_1)) {\r
+        } else if (ip.equals(IPV4_1)) {\r
             endpointL3Builder.setNetworkContainment(SUBNET_1);\r
-        }\r
-        else if(ip.equals(IPV4_2)) {\r
+        } else if (ip.equals(IPV4_2)) {\r
             endpointL3Builder.setNetworkContainment(SUBNET_2);\r
         }\r
         return endpointL3Builder;\r
@@ -159,13 +161,12 @@ public abstract class MapperUtilsTest {
         Preconditions.checkNotNull(natIp);\r
         Preconditions.checkNotNull(ip);\r
         Preconditions.checkNotNull(mac);\r
-        EndpointL3Builder endpointL3Builder = new EndpointL3Builder();\r
-        NatAddressBuilder natAddressBuilder = new NatAddressBuilder();\r
-        natAddressBuilder.setNatAddress(new IpAddress(new Ipv6Address(natIp)));\r
-        endpointL3Builder.addAugmentation(NatAddress.class, natAddressBuilder.build());\r
-        endpointL3Builder.setIpAddress(new IpAddress(ip));\r
 \r
-        endpointL3Builder.setMacAddress(new MacAddress(mac));\r
+        NatAddress natAddress = new NatAddressBuilder().setNatAddress(new IpAddress(new Ipv6Address(natIp))).build();\r
+\r
+        EndpointL3Builder endpointL3Builder = new EndpointL3Builder().addAugmentation(NatAddress.class, natAddress)\r
+            .setIpAddress(new IpAddress(ip))\r
+            .setMacAddress(new MacAddress(mac));\r
         if (l2bd != null) {\r
             endpointL3Builder.setL2Context(new L2BridgeDomainId(l2bd));\r
         }\r
@@ -173,186 +174,201 @@ public abstract class MapperUtilsTest {
     }\r
 \r
     public SegmentationBuilder buildSegmentation() {\r
-        SegmentationBuilder segmentationBuilder = new SegmentationBuilder();\r
-        segmentationBuilder.setSegmentationId(1);\r
-        return  segmentationBuilder;\r
+        return new SegmentationBuilder().setSegmentationId(1);\r
     }\r
 \r
     protected TenantBuilder buildTenant() {\r
-        TenantBuilder tenantBuilder = new TenantBuilder();\r
-        tenantBuilder.setId(TENANT_ID);\r
-        tenantBuilder.setForwardingContext(buildForwardingContext().build());\r
-        PolicyBuilder policyBuilder = new PolicyBuilder();\r
-        policyBuilder.setEndpointGroup(getEndpointGroups());\r
-        policyBuilder.setSubjectFeatureInstances(getSubjectFeatureInstances());\r
-        tenantBuilder.setPolicy(policyBuilder.build());\r
-        return tenantBuilder;\r
+        Policy policy = new PolicyBuilder().setEndpointGroup(getEndpointGroups())\r
+            .setSubjectFeatureInstances(getSubjectFeatureInstances())\r
+            .build();\r
+\r
+        return new TenantBuilder().setId(TENANT_ID)\r
+            .setForwardingContext(buildForwardingContext().build())\r
+            .setPolicy(policy);\r
+    }\r
+\r
+    protected TenantBuilder buildTenant(ActionInstance actionInstance) {\r
+        Policy policy = new PolicyBuilder().setEndpointGroup(getEndpointGroups())\r
+            .setSubjectFeatureInstances(getSubjectFeatureInstances(actionInstance))\r
+            .build();\r
+\r
+        return new TenantBuilder().setId(TENANT_ID)\r
+            .setForwardingContext(buildForwardingContext().build())\r
+            .setPolicy(policy);\r
     }\r
 \r
     protected IndexedTenant getTestIndexedTenant() {\r
         return new IndexedTenant(buildTenant().build());\r
     }\r
 \r
+    protected IndexedTenant getTestIndexedTenant(ActionInstance actionInstance) {\r
+        return new IndexedTenant(buildTenant(actionInstance).build());\r
+    }\r
+\r
     protected ForwardingContextBuilder buildForwardingContext() {\r
-        ForwardingContextBuilder forwardingContextBuilder = new ForwardingContextBuilder();\r
-        forwardingContextBuilder.setL2FloodDomain(getL2FloodDomainList(false));\r
-        forwardingContextBuilder.setL2BridgeDomain(getL2BridgeDomainList());\r
-        forwardingContextBuilder.setL3Context(getL3ContextList());\r
-        forwardingContextBuilder.setSubnet(getSubnetList());\r
-        return forwardingContextBuilder;\r
+        return new ForwardingContextBuilder().setL2FloodDomain(getL2FloodDomainList(false))\r
+            .setL2BridgeDomain(getL2BridgeDomainList())\r
+            .setL3Context(getL3ContextList())\r
+            .setSubnet(getSubnetList());\r
     }\r
 \r
     protected List<L3Context> getL3ContextList() {\r
-        List<L3Context> l3Contexts = new ArrayList<>();\r
-        L3ContextBuilder l3ContextBuilder = new L3ContextBuilder();\r
-        l3ContextBuilder.setId(L3C_ID);\r
-        l3Contexts.add(l3ContextBuilder.build());\r
-        return l3Contexts;\r
+        L3Context l3Context = new L3ContextBuilder().setId(L3C_ID).build();\r
+        return ImmutableList.of(l3Context);\r
     }\r
 \r
     protected List<L2BridgeDomain> getL2BridgeDomainList() {\r
-        List<L2BridgeDomain> l2BridgeDomains = new ArrayList<>();\r
-        L2BridgeDomainBuilder l2BridgeDomainBuilder = new L2BridgeDomainBuilder();\r
-        l2BridgeDomainBuilder.setId(L2BD_ID);\r
-        l2BridgeDomainBuilder.setParent(L3C_ID);\r
-        l2BridgeDomains.add(l2BridgeDomainBuilder.build());\r
-        return l2BridgeDomains;\r
+        L2BridgeDomain l2BridgeDomain = new L2BridgeDomainBuilder().setId(L2BD_ID).setParent(L3C_ID).build();\r
+        return ImmutableList.of(l2BridgeDomain);\r
     }\r
 \r
     protected List<L2FloodDomain> getL2FloodDomainList(boolean external) {\r
-        List<L2FloodDomain> l2FloodDomains = new ArrayList<>();\r
-        L2FloodDomainBuilder l2FloodDomainBuilder = new L2FloodDomainBuilder();\r
-        l2FloodDomainBuilder.setId(L2FD_ID);\r
+        L2FloodDomainBuilder l2FloodDomainBuilder = new L2FloodDomainBuilder().setId(L2FD_ID)\r
+            .setParent(new L2BridgeDomainId(L2BD_ID))\r
+            .addAugmentation(Segmentation.class, buildSegmentation().build());\r
         if (external) {\r
             l2FloodDomainBuilder.setId(L2_FD_ID_EXT);\r
         }\r
-        l2FloodDomainBuilder.setParent(new L2BridgeDomainId(L2BD_ID));\r
-        l2FloodDomainBuilder.addAugmentation(Segmentation.class, buildSegmentation().build());\r
-        l2FloodDomains.add(l2FloodDomainBuilder.build());\r
-        return l2FloodDomains;\r
+        return ImmutableList.of(l2FloodDomainBuilder.build());\r
     }\r
 \r
     protected List<L3Address> getL3AddressList(Ipv4Address l3IpAddress, L3ContextId l3ContextId) {\r
-        List<L3Address> l3Addresses = new ArrayList<>();\r
-        L3AddressBuilder l3AddressBuilder = new L3AddressBuilder();\r
-        l3AddressBuilder.setIpAddress(new IpAddress(l3IpAddress));\r
-        l3AddressBuilder.setL3Context(new L3ContextId(l3ContextId));\r
-        l3Addresses.add(l3AddressBuilder.build());\r
-        return l3Addresses;\r
+        L3Address l3Address = new L3AddressBuilder().setIpAddress(new IpAddress(l3IpAddress))\r
+            .setL3Context(new L3ContextId(l3ContextId))\r
+            .build();\r
+        return ImmutableList.of(l3Address);\r
     }\r
 \r
     protected List<L3Address> getL3AddressList(Ipv6Address l3IpAddress) {\r
-        List<L3Address> l3Addresses = new ArrayList<>();\r
-        L3AddressBuilder l3AddressBuilder = new L3AddressBuilder();\r
-        l3AddressBuilder.setIpAddress(new IpAddress(l3IpAddress));\r
-        l3Addresses.add(l3AddressBuilder.build());\r
-        return l3Addresses;\r
+        L3Address l3Address = new L3AddressBuilder().setIpAddress(new IpAddress(l3IpAddress)).build();\r
+        return ImmutableList.of(l3Address);\r
     }\r
 \r
     protected OfOverlayContextBuilder getOfOverlayContext(NodeConnectorId connector) {\r
-        OfOverlayContextBuilder ofOverlayContextBuilder = new OfOverlayContextBuilder();\r
-        ofOverlayContextBuilder.setNodeConnectorId(connector);\r
-        ofOverlayContextBuilder.setNodeId(NODE_ID);\r
-        return ofOverlayContextBuilder;\r
+        return new OfOverlayContextBuilder().setNodeConnectorId(connector).setNodeId(NODE_ID);\r
     }\r
 \r
     protected EndpointBuilder buildEndpoint(Ipv4Address l3IpAddress, MacAddress mac, NodeConnectorId connector) {\r
-        EndpointBuilder endpointBuilder = new EndpointBuilder();\r
-        endpointBuilder.setTenant(TENANT_ID);\r
-        endpointBuilder.setL3Address(getL3AddressList(l3IpAddress, L3C_ID));\r
-        endpointBuilder.setMacAddress(new MacAddress(mac));\r
-        endpointBuilder.setL2Context(new L2BridgeDomainId(L2BD_ID));\r
-        endpointBuilder.setEndpointGroup(ENDPOINT_GROUP_0);\r
-        endpointBuilder.addAugmentation(OfOverlayContext.class, getOfOverlayContext(connector).build());\r
-        if(l3IpAddress.equals(IPV4_0)) {\r
+        EndpointBuilder endpointBuilder = new EndpointBuilder().setTenant(TENANT_ID)\r
+            .setL3Address(getL3AddressList(l3IpAddress, L3C_ID))\r
+            .setMacAddress(new MacAddress(mac))\r
+            .setL2Context(new L2BridgeDomainId(L2BD_ID))\r
+            .setEndpointGroup(ENDPOINT_GROUP_0)\r
+            .addAugmentation(OfOverlayContext.class, getOfOverlayContext(connector).build());\r
+        if (l3IpAddress.equals(IPV4_0)) {\r
             endpointBuilder.setNetworkContainment(SUBNET_0);\r
-        }\r
-        else if(l3IpAddress.equals(IPV4_1)) {\r
+        } else if (l3IpAddress.equals(IPV4_1)) {\r
             endpointBuilder.setNetworkContainment(SUBNET_1);\r
-        }\r
-        else if(l3IpAddress.equals(IPV4_2)) {\r
+        } else if (l3IpAddress.equals(IPV4_2)) {\r
             endpointBuilder.setNetworkContainment(SUBNET_2);\r
         }\r
         return endpointBuilder;\r
     }\r
 \r
     protected EndpointBuilder buildEndpoint(Ipv6Address l3IpAddress, MacAddress mac, NodeConnectorId connector) {\r
-        EndpointBuilder endpointBuilder = new EndpointBuilder();\r
-        endpointBuilder.setTenant(TENANT_ID);\r
-        endpointBuilder.setL3Address(getL3AddressList(l3IpAddress));\r
-        endpointBuilder.setMacAddress(new MacAddress(mac));\r
-        endpointBuilder.setL2Context(new L2BridgeDomainId(L2BD_ID));\r
-        endpointBuilder.setEndpointGroup(ENDPOINT_GROUP_0);\r
-        endpointBuilder.addAugmentation(OfOverlayContext.class, getOfOverlayContext(connector).build());\r
-        endpointBuilder.setNetworkContainment(NET_DOMAIN_ID);\r
-        return endpointBuilder;\r
+        return new EndpointBuilder().setTenant(TENANT_ID)\r
+            .setL3Address(getL3AddressList(l3IpAddress))\r
+            .setMacAddress(new MacAddress(mac))\r
+            .setL2Context(new L2BridgeDomainId(L2BD_ID))\r
+            .setEndpointGroup(ENDPOINT_GROUP_0)\r
+            .setNetworkContainment(NET_DOMAIN_ID)\r
+            .addAugmentation(OfOverlayContext.class, getOfOverlayContext(connector).build());\r
     }\r
 \r
     public List<EndpointGroup> getEndpointGroups() {\r
         return ImmutableList.of(\r
                 new EndpointGroupBuilder().setId(ENDPOINT_GROUP_0)\r
-                        .setNetworkDomain(SUBNET_0)\r
-                        .setConsumerNamedSelector(ImmutableList.of(new ConsumerNamedSelectorBuilder()\r
-                                .setName(new SelectorName("cns1")).setContract(ImmutableList.of(CONTRACT_ID)).build()))\r
-                        .build(),\r
+                    .setNetworkDomain(SUBNET_0)\r
+                    .setConsumerNamedSelector(ImmutableList.of(new ConsumerNamedSelectorBuilder()\r
+                        .setName(new SelectorName("cns1")).setContract(ImmutableList.of(CONTRACT_ID)).build()))\r
+                    .build(),\r
                 new EndpointGroupBuilder().setId(ENDPOINT_GROUP_1)\r
-                        .setNetworkDomain(SUBNET_1)\r
-                        .setProviderNamedSelector(ImmutableList.of(new ProviderNamedSelectorBuilder()\r
-                                .setName(new SelectorName("pns1")).setContract(ImmutableList.of(CONTRACT_ID)).build()))\r
-                        .build());\r
+                    .setNetworkDomain(SUBNET_1)\r
+                    .setProviderNamedSelector(ImmutableList.of(new ProviderNamedSelectorBuilder()\r
+                        .setName(new SelectorName("pns1")).setContract(ImmutableList.of(CONTRACT_ID)).build()))\r
+                    .build());\r
     }\r
 \r
     protected SubjectFeatureInstances getSubjectFeatureInstances() {\r
         SubjectFeatureInstancesBuilder builder = new SubjectFeatureInstancesBuilder();\r
-        return builder.setClassifierInstance(ImmutableList.of(new ClassifierInstanceBuilder()\r
-                .setName(new ClassifierName("tcp_dst_80"))\r
-                .setClassifierDefinitionId(L4ClassifierDefinition.DEFINITION.getId())\r
-                .setParameterValue(ImmutableList.of(new ParameterValueBuilder().setName(new ParameterName("destport"))\r
-                        .setIntValue(80L)        // Endpoint\r
-\r
-                        .build(), new ParameterValueBuilder().setName(new ParameterName("proto"))\r
-                        .setIntValue(6L)\r
-                        .build()))\r
-                .build(), new ClassifierInstanceBuilder().setName(new ClassifierName(TCP_SRC))\r
-                .setClassifierDefinitionId(Classifier.L4_CL.getId())\r
-                .setParameterValue(ImmutableList.of(new ParameterValueBuilder().setName(new ParameterName("sourceport"))\r
-                        .setIntValue(80L)\r
-                        .build(), new ParameterValueBuilder().setName(new ParameterName("proto"))\r
-                        .setIntValue(6L)\r
-                        .build()))\r
-                .build(), new ClassifierInstanceBuilder().setName(new ClassifierName("ether_type"))\r
-                .setClassifierDefinitionId(Classifier.ETHER_TYPE_CL.getId())\r
-                .setParameterValue(ImmutableList.of(new ParameterValueBuilder()\r
-                        .setName(new ParameterName("ethertype"))\r
-                        .setIntValue(FlowUtils.IPv4)\r
-                        .build()))\r
+        return builder.setClassifierInstance(ImmutableList.of(\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName("tcp_dst_80"))\r
+                    .setClassifierDefinitionId(L4ClassifierDefinition.DEFINITION.getId())\r
+                    .setParameterValue(ImmutableList.of(\r
+                            new ParameterValueBuilder().setName(new ParameterName("destport"))\r
+                                .setIntValue(80L) // Endpoint\r
+\r
+                                .build(),\r
+                            new ParameterValueBuilder().setName(new ParameterName("proto")).setIntValue(6L).build()))\r
+                    .build(),\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName(TCP_SRC))\r
+                    .setClassifierDefinitionId(Classifier.L4_CL.getId())\r
+                    .setParameterValue(ImmutableList.of(\r
+                            new ParameterValueBuilder().setName(new ParameterName("sourceport"))\r
+                                .setIntValue(80L)\r
+                                .build(),\r
+                            new ParameterValueBuilder().setName(new ParameterName("proto")).setIntValue(6L).build()))\r
+                    .build(),\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName("ether_type"))\r
+                    .setClassifierDefinitionId(Classifier.ETHER_TYPE_CL.getId())\r
+                    .setParameterValue(ImmutableList.of(new ParameterValueBuilder()\r
+                        .setName(new ParameterName("ethertype")).setIntValue(FlowUtils.IPv4).build()))\r
+                    .build()))\r
+            .setActionInstance(ImmutableList.of(new ActionInstanceBuilder().setName(new ActionName("allow"))\r
+                .setActionDefinitionId(new AllowAction().getId())\r
                 .build()))\r
-                .setActionInstance(ImmutableList.of(new ActionInstanceBuilder().setName(new ActionName("allow"))\r
-                        .setActionDefinitionId(new AllowAction().getId())\r
-                        .build()))\r
-                .build();\r
+            .build();\r
+    }\r
+\r
+    protected SubjectFeatureInstances getSubjectFeatureInstances(ActionInstance actionInstance) {\r
+        SubjectFeatureInstancesBuilder builder = new SubjectFeatureInstancesBuilder();\r
+        return builder.setClassifierInstance(ImmutableList.of(\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName("tcp_dst_80"))\r
+                    .setClassifierDefinitionId(L4ClassifierDefinition.DEFINITION.getId())\r
+                    .setParameterValue(ImmutableList.of(\r
+                            new ParameterValueBuilder().setName(new ParameterName("destport"))\r
+                                .setIntValue(80L) // Endpoint\r
+\r
+                                .build(),\r
+                            new ParameterValueBuilder().setName(new ParameterName("proto")).setIntValue(6L).build()))\r
+                    .build(),\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName(TCP_SRC))\r
+                    .setClassifierDefinitionId(Classifier.L4_CL.getId())\r
+                    .setParameterValue(ImmutableList.of(\r
+                            new ParameterValueBuilder().setName(new ParameterName("sourceport"))\r
+                                .setIntValue(80L)\r
+                                .build(),\r
+                            new ParameterValueBuilder().setName(new ParameterName("proto")).setIntValue(6L).build()))\r
+                    .build(),\r
+                new ClassifierInstanceBuilder().setName(new ClassifierName("ether_type"))\r
+                    .setClassifierDefinitionId(Classifier.ETHER_TYPE_CL.getId())\r
+                    .setParameterValue(ImmutableList.of(new ParameterValueBuilder()\r
+                        .setName(new ParameterName("ethertype")).setIntValue(FlowUtils.IPv4).build()))\r
+                    .build()))\r
+            .setActionInstance(ImmutableList.of(actionInstance))\r
+            .build();\r
     }\r
 \r
     protected List<Subnet> getSubnetList() {\r
         return ImmutableList.of(\r
                 new SubnetBuilder().setId(SUBNET_0)\r
-                        .setParent(L2FD_ID)\r
-                        .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.1.0/24")))\r
-                        .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.1.1")))\r
-                        .build(),\r
+                    .setParent(L2FD_ID)\r
+                    .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.1.0/24")))\r
+                    .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.1.1")))\r
+                    .build(),\r
                 new SubnetBuilder().setId(SUBNET_1)\r
-                        .setParent(L2FD_ID)\r
-                        .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.0.0/24")))\r
-                        .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.0.1")))\r
-                        .build(),\r
+                    .setParent(L2FD_ID)\r
+                    .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.0.0/24")))\r
+                    .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.0.1")))\r
+                    .build(),\r
                 new SubnetBuilder().setId(SUBNET_2)\r
-                        .setParent(L2BD_ID)\r
-                        .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.2.0/24")))\r
-                        .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.2.1")))\r
-                        .build(),\r
+                    .setParent(L2BD_ID)\r
+                    .setIpPrefix(new IpPrefix(new Ipv4Prefix("10.0.2.0/24")))\r
+                    .setVirtualRouterIp(new IpAddress(new Ipv4Address("10.0.2.1")))\r
+                    .build(),\r
                 new SubnetBuilder().setId(SUBNET_EXT)\r
-                        .setParent(L2_FD_ID_EXT)\r
-                        .setIpPrefix(new IpPrefix(new Ipv4Prefix("192.168.111.0/24")))\r
-                        .build());\r
+                    .setParent(L2_FD_ID_EXT)\r
+                    .setIpPrefix(new IpPrefix(new Ipv4Prefix("192.168.111.0/24")))\r
+                    .build());\r
     }\r
 }\r