From 3e8fa3c3f82820167d6d7970b7efd301acbaa919 Mon Sep 17 00:00:00 2001 From: Kalvin Hom Date: Fri, 3 May 2013 15:33:06 -0700 Subject: [PATCH 1/1] Adding plugin stub: FlowProgrammerService Change-Id: Ia5a09a1dfc1547b4016296473e7751f0a23ccf50 Signed-off-by: Kalvin Hom --- .../stub/internal/Activator.java | 16 ++ .../stub/internal/FlowProgrammerService.java | 144 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java diff --git a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java index 580dabba35..ff44fd4467 100644 --- a/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/Activator.java @@ -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 props = new Hashtable(); + // 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 index 0000000000..834b3faceb --- /dev/null +++ b/opendaylight/protocol_plugins/stub/src/main/java/org/opendaylight/controller/protocol_plugins/stub/internal/FlowProgrammerService.java @@ -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 -- 2.36.6