Adding plugin stub: 91/291/3
authorKalvin Hom <kahom@cisco.com>
Fri, 3 May 2013 22:33:06 +0000 (15:33 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 8 May 2013 17:13:11 +0000 (17:13 +0000)
FlowProgrammerService

Change-Id: Ia5a09a1dfc1547b4016296473e7751f0a23ccf50
Signed-off-by: Kalvin Hom <kahom@cisco.com>
opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java
opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java [new file with mode: 0644]

index 580dabb..ff44fd4 100644 (file)
@@ -101,4 +101,20 @@ public class Activator extends ComponentActivatorAbstractBase {
             c.setInterface(IPluginInInventoryService.class.getName(), props);
         }
     }
+    
+    public Object[] getGlobalImplementations() {
+        Object[] res = { FlowProgrammerService.class };
+        return res;
+    }
+    
+    public void configureGlobalInstance(Component c, Object imp){
+        if (imp.equals(FlowProgrammerService.class)) {
+            // export the service to be used by SAL
+            Dictionary<String, Object> props = new Hashtable<String, Object>();
+            // Set the protocolPluginType property which will be used
+            // by SAL
+            props.put("protocolPluginType", "STUB");
+            c.setInterface(IPluginInFlowProgrammerService.class.getName(), props);
+        }
+    }
 }
diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java
new file mode 100644 (file)
index 0000000..834b3fa
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.protocol_plugins.stub.internal;
+
+import org.opendaylight.controller.sal.flowprogrammer.Flow;
+import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+
+
+
+/**
+ * Represents the openflow plugin component in charge of programming the flows
+ * the flow programming and relay them to functional modules above SAL.
+ */
+public class FlowProgrammerService implements IPluginInFlowProgrammerService
+  {
+    void init() {
+    }
+
+    /**
+     * Function called by the dependency manager when at least one dependency
+     * become unsatisfied or when the component is shutting down because for
+     * example bundle is being stopped.
+     * 
+     */
+    void destroy() {
+    }
+
+    /**
+     * Function called by dependency manager after "init ()" is called and after
+     * the services provided by the class are registered in the service registry
+     * 
+     */
+    void start() {
+    }
+
+    /**
+     * Function called by the dependency manager before the services exported by
+     * the component are unregistered, this will be followed by a "destroy ()"
+     * calls
+     * 
+     */
+    void stop() {
+    }
+    
+    
+    /**
+     * Synchronously add a flow to the network node
+     * 
+     * @param node
+     * @param flow
+     */
+    public Status addFlow(Node node, Flow flow){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Synchronously modify existing flow on the switch
+     * 
+     * @param node
+     * @param flow
+     */
+    public Status modifyFlow(Node node, Flow oldFlow, Flow newFlow){
+        return new Status(StatusCode.SUCCESS);
+    }
+    /**
+     * Synchronously remove the flow from the network node
+     * 
+     * @param node
+     * @param flow
+     */
+    public Status removeFlow(Node node, Flow flow){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Asynchronously add a flow to the network node
+     * 
+     * @param node
+     * @param flow
+     * @param rid
+     */
+    public Status addFlowAsync(Node node, Flow flow, long rid){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Asynchronously modify existing flow on the switch
+     * 
+     * @param node
+     * @param flow
+     * @param rid
+     */
+    public Status modifyFlowAsync(Node node, Flow oldFlow, Flow newFlow, long rid){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Asynchronously remove the flow from the network node
+     * 
+     * @param node
+     * @param flow
+     * @param rid
+     */
+    public Status removeFlowAsync(Node node, Flow flow, long rid){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Remove all flows present on the network node
+     * 
+     * @param node
+     */
+    public Status removeAllFlows(Node node){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Send Barrier message synchronously. The caller will be blocked until the
+     * Barrier reply arrives.
+     * 
+     * @param node
+     */
+    public Status syncSendBarrierMessage(Node node){
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    /**
+     * Send Barrier message asynchronously. The caller is not blocked.
+     * 
+     * @param node
+     */
+    public Status asyncSendBarrierMessage(Node node){
+        return new Status(StatusCode.SUCCESS);
+    }
+  }
\ No newline at end of file