Implementing portrange in L4Classifier.
[groupbasedpolicy.git] / renderers / ofoverlay / src / main / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / sf / SubjectFeatures.java
index 7d8377d7f95dabfbdbe95a2a3bba6de24948e1eb..7ad60df97c32180eb6e5df9d0d151bfeb461140d 100644 (file)
@@ -46,16 +46,24 @@ public class SubjectFeatures {
                 }
             ));
     
-    public static final ActionDefinition ALLOW = 
-            new ActionDefinitionBuilder()
-                .setId(new ActionDefinitionId("f942e8fd-e957-42b7-bd18-f73d11266d17"))
-                .setName(new ActionName("allow"))
-                .setDescription(new Description("Allow the specified traffic to pass"))
-                .build();
+    private static final Map<ActionDefinitionId, Action> actions =
+            ImmutableMap.<ActionDefinitionId, Action>
+                of(AllowAction.ID, new AllowAction());
+
+    public static final List<ActionDefinition> actionDefs =
+            ImmutableList.copyOf(Collections2.transform(actions.values(),
+                new Function<Action, ActionDefinition>() {
+                    @Override
+                    public ActionDefinition apply(Action input) {
+                        return input.getActionDef();
+                    }
+                }
+             ));
+
 
     public static final SubjectFeatureDefinitions OF_OVERLAY_FEATURES =
             new SubjectFeatureDefinitionsBuilder()
-                .setActionDefinition(ImmutableList.of(ALLOW))
+                .setActionDefinition(actionDefs)
                 .setClassifierDefinition(classifierDefs)
                 .build();
 
@@ -69,5 +77,16 @@ public class SubjectFeatures {
     public static Classifier getClassifier(ClassifierDefinitionId id) {
         return classifiers.get(id);
     }
+
+    /**
+     * Get the {@link Action} associated with the given
+     * {@link ActionDefinitionId}
+     * @param id the {@link ActionDefinitionId} to look up
+     * @return the {@link Action} if one exists, or <code>null</code>
+     * otherwise
+     */
+    public static Action getAction(ActionDefinitionId id) {
+        return actions.get(id);
+    }
                                            
 }