bulk support application - initial proposal 53/23053/2
authorMartin Bobak <mbobak@cisco.com>
Mon, 8 Jun 2015 16:44:34 +0000 (18:44 +0200)
committerMichal Rehak <mirehak@cisco.com>
Mon, 22 Jun 2015 08:02:21 +0000 (10:02 +0200)
 - added models to config subsystem config file
 - created simple implementation
 - added to ofp-li features
 - workarounded restconf bugs (flow-ref related)
 - added parents creation for dataStore way (all or first only)
 - clean up rpc intput models
 - fixed version

Change-Id: I1716b32738c8e430d674ff5f0476d55ab10b43fb
Signed-off-by: Martin Bobak <mbobak@cisco.com>
(cherry picked from commit 45c121d507dbd45995fa3efa56a9cef5154dee62)

13 files changed:
applications/bulk-o-matic/pom.xml [new file with mode: 0644]
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProvider.java [new file with mode: 0644]
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProviderImpl.java [new file with mode: 0644]
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java [new file with mode: 0644]
applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModule.java [new file with mode: 0644]
applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModuleFactory.java [new file with mode: 0644]
applications/bulk-o-matic/src/main/resources/initial/71-bulk-o-matic.xml [new file with mode: 0644]
applications/bulk-o-matic/src/main/yang/bulk-o-matic.yang [new file with mode: 0644]
applications/bulk-o-matic/src/main/yang/sal-bulk-flow.yang [new file with mode: 0644]
applications/pom.xml
artifacts/pom.xml
features-li/pom.xml
features-li/src/main/resources/features.xml

diff --git a/applications/bulk-o-matic/pom.xml b/applications/bulk-o-matic/pom.xml
new file mode 100644 (file)
index 0000000..150b3d4
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.openflowplugin</groupId>
+        <artifactId>applications</artifactId>
+        <version>0.2.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.opendaylight.openflowplugin.applications</groupId>
+    <artifactId>bulk-o-matic</artifactId>
+    <packaging>bundle</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin</groupId>
+            <artifactId>openflowplugin-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-broker-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.model</groupId>
+            <artifactId>model-inventory</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin.model</groupId>
+            <artifactId>model-flow-base</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>config-api</artifactId>
+        </dependency>
+
+        <!-- Test dependencies -->
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>${project.build.directory}/classes/initial/71-bulk-o-matic.xml</file>
+                                    <type>xml</type>
+                                    <classifier>config</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProvider.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProvider.java
new file mode 100644 (file)
index 0000000..44afd9f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2015 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.openflowplugin.applications.bulk.o.matic;
+
+/**
+ * Created by mirehak on 6/8/15.
+ */
+public interface BulkOMaticProvider extends AutoCloseable {
+    // NOBODY
+}
diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProviderImpl.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticProviderImpl.java
new file mode 100644 (file)
index 0000000..f8be7d7
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015 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.openflowplugin.applications.bulk.o.matic;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.SalBulkFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by mirehak on 6/8/15.
+ */
+public class BulkOMaticProviderImpl implements BulkOMaticProvider {
+
+    private static final Logger LOG = LoggerFactory.getLogger(BulkOMaticProviderImpl.class);
+
+    private final BindingAwareBroker.RpcRegistration<SalBulkFlowService> serviceRpcRegistration;
+
+    public BulkOMaticProviderImpl(RpcProviderRegistry rpcRegistry, DataBroker dataBroker) {
+        LOG.info("creating bulk-o-matic");
+        SalFlowService flowService = rpcRegistry.getRpcService(SalFlowService.class);
+        SalBulkFlowService bulkOMaticService = new SalBulkFlowServiceImpl(flowService, dataBroker);
+        serviceRpcRegistration = rpcRegistry.addRpcImplementation(SalBulkFlowService.class, bulkOMaticService);
+    }
+
+    @Override
+    public void close() {
+        LOG.info("destroying bulk-o-matic");
+        serviceRpcRegistration.close();
+    }
+}
diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java
new file mode 100644 (file)
index 0000000..db1f12d
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2015 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.openflowplugin.applications.bulk.o.matic;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Future;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsDsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsRpcInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.BulkFlowBaseContentGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsDsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.SalBulkFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.bulk.flow.ds.list.grouping.BulkFlowDsItem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
+/**
+ * Simple implementation providing bulk flows operations.
+ */
+public class SalBulkFlowServiceImpl implements SalBulkFlowService {
+
+    private final SalFlowService flowService;
+    private final DataBroker dataBroker;
+
+    public SalBulkFlowServiceImpl(SalFlowService flowService, DataBroker dataBroker) {
+        this.flowService = Preconditions.checkNotNull(flowService);
+        this.dataBroker = Preconditions.checkNotNull(dataBroker);
+    }
+
+
+    @Override
+    public Future<RpcResult<Void>> addFlowsDs(AddFlowsDsInput input) {
+        WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
+        boolean createParentsNextTime = MoreObjects.firstNonNull(input.isAlwaysCreateParents(), Boolean.FALSE);
+        boolean createParents = true;
+        for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) {
+            FlowBuilder flowBuilder = new FlowBuilder(bulkFlow);
+            flowBuilder.setTableId(bulkFlow.getTableId());
+            flowBuilder.setId(new FlowId(bulkFlow.getFlowId()));
+            writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow), flowBuilder.build(), createParents);
+            createParents = createParentsNextTime;
+        }
+        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+        return handleResultFuture(submitFuture);
+    }
+
+    private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow> getFlowInstanceIdentifier(BulkFlowDsItem bulkFlow) {
+        final NodeRef nodeRef = bulkFlow.getNode();
+        return ((InstanceIdentifier<Node>) nodeRef.getValue())
+                .augmentation(FlowCapableNode.class)
+                .child(Table.class, new TableKey(bulkFlow.getTableId()))
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow.class,
+                        new FlowKey(new FlowId(bulkFlow.getFlowId())));
+    }
+
+    @Override
+    public Future<RpcResult<Void>> removeFlowsDs(RemoveFlowsDsInput input) {
+        WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
+        for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) {
+            writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow));
+        }
+        CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
+        return handleResultFuture(submitFuture);
+    }
+
+    private ListenableFuture<RpcResult<Void>> handleResultFuture(CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
+        final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
+        Futures.addCallback(submitFuture, new FutureCallback<Void>() {
+            @Override
+            public void onSuccess(Void result) {
+                rpcResult.set(RpcResultBuilder.success(result).build());
+            }
+
+            @Override
+            public void onFailure(Throwable t) {
+                RpcResultBuilder<Void> rpcResultBld = RpcResultBuilder.<Void>failed()
+                        .withRpcErrors(Collections.singleton(
+                                RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, null, t.getMessage())
+                        ));
+                rpcResult.set(rpcResultBld.build());
+            }
+        });
+        return rpcResult;
+    }
+
+    private <T> ListenableFuture<RpcResult<Void>> handleResultFuture(ListenableFuture<List<T>> submitFuture) {
+        final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
+        Futures.addCallback(submitFuture, new FutureCallback<List<T>>() {
+            @Override
+            public void onSuccess(List<T> result) {
+                rpcResult.set(RpcResultBuilder.success((Void) null).build());
+            }
+
+            @Override
+            public void onFailure(Throwable t) {
+                RpcResultBuilder<Void> rpcResultBld = RpcResultBuilder.<Void>failed()
+                        .withRpcErrors(Collections.singleton(
+                                RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, null, t.getMessage())
+                        ));
+                rpcResult.set(rpcResultBld.build());
+            }
+        });
+        return rpcResult;
+    }
+
+    @Override
+    public Future<RpcResult<Void>> addFlowsRpc(AddFlowsRpcInput input) {
+        List<ListenableFuture<RpcResult<AddFlowOutput>>> bulkResults = new ArrayList<>();
+
+        for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
+            AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder((Flow) bulkFlow);
+            final NodeRef nodeRef = bulkFlow.getNode();
+            flowInputBuilder.setNode(nodeRef);
+            flowInputBuilder.setTableId(bulkFlow.getTableId());
+            Future<RpcResult<AddFlowOutput>> rpcAddFlowResult = flowService.addFlow(flowInputBuilder.build());
+            bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
+        }
+        return handleResultFuture(Futures.allAsList(bulkResults));
+    }
+
+    @Override
+    public Future<RpcResult<Void>> removeFlowsRpc(RemoveFlowsRpcInput input) {
+        List<ListenableFuture<RpcResult<RemoveFlowOutput>>> bulkResults = new ArrayList<>();
+
+        for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
+            RemoveFlowInputBuilder flowInputBuilder = new RemoveFlowInputBuilder((Flow) bulkFlow);
+            final NodeRef nodeRef = bulkFlow.getNode();
+            flowInputBuilder.setNode(nodeRef);
+            flowInputBuilder.setTableId(bulkFlow.getTableId());
+            Future<RpcResult<RemoveFlowOutput>> rpcAddFlowResult = flowService.removeFlow(flowInputBuilder.build());
+            bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
+        }
+        return handleResultFuture(Futures.allAsList(bulkResults));
+    }
+}
diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModule.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModule.java
new file mode 100644 (file)
index 0000000..f977ae2
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.bulk.o.matic.rev150608;
+
+import org.opendaylight.openflowplugin.applications.bulk.o.matic.BulkOMaticProviderImpl;
+
+public class BulkOMaticModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.bulk.o.matic.rev150608.AbstractBulkOMaticModule {
+    public BulkOMaticModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public BulkOMaticModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.bulk.o.matic.rev150608.BulkOMaticModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        return new BulkOMaticProviderImpl(getRpcRegistryDependency(), getDataBrokerDependency());
+    }
+
+}
diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModuleFactory.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/bulk/o/matic/rev150608/BulkOMaticModuleFactory.java
new file mode 100644 (file)
index 0000000..b5dba7c
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: bulk-o-matic yang module local name: bulk-o-matic
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Jun 08 16:32:10 CEST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.bulk.o.matic.rev150608;
+public class BulkOMaticModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.bulk.o.matic.rev150608.AbstractBulkOMaticModuleFactory {
+
+}
diff --git a/applications/bulk-o-matic/src/main/resources/initial/71-bulk-o-matic.xml b/applications/bulk-o-matic/src/main/resources/initial/71-bulk-o-matic.xml
new file mode 100644 (file)
index 0000000..f2cfa3a
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2015 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
+  -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflow:applications:bulk-o-matic">prefix:bulk-o-matic</type>
+                    <name>bulk-o-matic</name>
+                    <data-broker>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+                        <name>binding-data-broker</name>
+                    </data-broker>
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+                </module>
+
+            </modules>
+        </data>
+    </configuration>
+
+    <required-capabilities>
+        <capability>urn:opendaylight:flow:inventory?module=flow-node-inventory&amp;revision=2013-08-19</capability>
+        <capability>urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&amp;revision=2010-09-24</capability>
+        <capability>urn:opendaylight:inventory?module=opendaylight-inventory&amp;revision=2013-08-19</capability>
+        <capability>urn:opendaylight:flow:types?module=opendaylight-flow-types&amp;revision=2013-10-26</capability>
+    </required-capabilities>
+</snapshot>
diff --git a/applications/bulk-o-matic/src/main/yang/bulk-o-matic.yang b/applications/bulk-o-matic/src/main/yang/bulk-o-matic.yang
new file mode 100644 (file)
index 0000000..92ee4a2
--- /dev/null
@@ -0,0 +1,42 @@
+module bulk-o-matic {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:openflow:applications:bulk-o-matic";
+    prefix "bulk";
+    import config {prefix config; revision-date 2013-04-05;}
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28;}
+
+    description
+        "End point application providing bulk operation via DS and via rpc";
+
+    revision "2015-06-08" {
+        description
+            "Initial revision";
+    }
+
+    identity bulk-o-matic {
+        base "config:module-type";
+        config:java-name-prefix BulkOMatic;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case bulk-o-matic {
+            when "/config:modules/config:module/config:type = 'bulk-o-matic'";
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity mdsal:binding-rpc-registry;
+                    }
+                }
+            }
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity mdsal:binding-async-data-broker;
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/applications/bulk-o-matic/src/main/yang/sal-bulk-flow.yang b/applications/bulk-o-matic/src/main/yang/sal-bulk-flow.yang
new file mode 100644 (file)
index 0000000..ef7b557
--- /dev/null
@@ -0,0 +1,70 @@
+module sal-bulk-flow {
+    namespace "urn:opendaylight:bulk-flow:service";
+    prefix bflow;
+
+    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+    import opendaylight-flow-types {prefix types;revision-date "2013-10-26";}
+    import flow-node-inventory {prefix flow-inv; revision-date "2013-08-19";}
+
+    description "Openflow bulk flow management.";
+
+    revision "2015-06-08" {
+        description "Initial revision of bulk flow service";
+    }
+
+
+    grouping bulk-flow-base-content-grouping {
+        uses inv:node-context-ref;
+        uses types:flow;
+    }
+
+    grouping bulk-flow-list-grouping {
+        description "Suitable for rpc way";
+        list bulk-flow-item {
+            uses bulk-flow-base-content-grouping;
+        }
+    }
+
+    grouping bulk-flow-ds-list-grouping {
+        description "Suitable for dataStore way - includes flowId";
+        list bulk-flow-ds-item {
+            uses bulk-flow-base-content-grouping;
+            leaf flow-id {
+                mandatory true;
+                type flow-inv:flow-id;
+            }
+        }
+    }
+
+
+    rpc add-flows-rpc {
+        description "Adding multiple flows to openflow device via direct rpc invocation.";
+        input {
+            uses bulk-flow-list-grouping;
+        }
+    }
+    rpc remove-flows-rpc {
+        description "Removing multiple flows from openflow device via direct rpc invocation.";
+        input {
+            uses bulk-flow-list-grouping;
+        }
+    }
+
+    rpc add-flows-ds {
+        description "Adding multiple flows to openflow device via dataStore.";
+        input {
+            leaf always-create-parents {
+                description "true if all items must take care of parent structure";
+                type boolean;
+                default false;
+            }
+            uses bulk-flow-ds-list-grouping;
+        }
+    }
+    rpc remove-flows-ds {
+        description "Removing multiple flows from openflow device via dataStore.";
+        input {
+            uses bulk-flow-ds-list-grouping;
+        }
+    }
+}
index 84af92ca8d2942fa88ed1a57a6919e7e2857092a..2500696a81fc1d3021b554ba99891213bebf2922 100644 (file)
@@ -95,6 +95,8 @@
         <module>forwardingrules-manager</module>
         <module>forwardingrules-manager-config</module>
         <module>topology-lldp-discovery</module>
+        <!-- experimental apps -->
+        <module>bulk-o-matic</module>
     </modules>
 
 </project>
index 3666cace456dcbae13c7b1398b96fa4832c11bff..3932f3fe747913f7a97bc9883b73745f6ae98dae 100644 (file)
                 <classifier>features</classifier>
                 <type>xml</type>
             </dependency>
+            <dependency>
+                <groupId>${project.groupId}.applications</groupId>
+                <artifactId>bulk-o-matic</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}.applications</groupId>
+                <artifactId>bulk-o-matic</artifactId>
+                <version>${project.version}</version>
+                <type>xml</type>
+                <classifier>config</classifier>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 </project>
index ccf77a8a04a15da460f20a12098a0f673d157269..2863fff9bbc22a3d29c4d32db92c1a7e733b29b4 100644 (file)
             <groupId>org.opendaylight.openflowplugin</groupId>
             <artifactId>openflowplugin-common</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin.applications</groupId>
+            <artifactId>bulk-o-matic</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin.applications</groupId>
+            <artifactId>bulk-o-matic</artifactId>
+            <type>xml</type>
+            <classifier>config</classifier>
+        </dependency>
+
 
         <!-- test the features.xml -->
         <dependency>
index c9eb7f51c48dca977a43d845b2162c252a78dadb..b14794f43adcf9c6db426b7e05fad7004af9681b 100644 (file)
         <configfile finalname="etc/opendaylight/karaf/72-topology-lldp-discovery.xml">mvn:org.opendaylight.openflowplugin.applications/topology-lldp-discovery/${project.version}/xml/config</configfile>
     </feature>
 
+    <feature name='odl-openflowplugin-app-bulk-o-matic' description="OpenDaylight :: Openflow Plugin :: app bulk flow operations support" version='${project.version}'>
+        <feature version="${project.version}">odl-openflowplugin-southbound-li</feature>
+        <bundle>mvn:org.opendaylight.openflowplugin.applications/bulk-o-matic/${project.version}</bundle>
+        <configfile finalname="etc/opendaylight/karaf/71-bulk-o-matic.xml">mvn:org.opendaylight.openflowplugin.applications/bulk-o-matic/${project.version}/xml/config</configfile>
+    </feature>
+
 </features>