From f36d89a0a6931a1175bb4300276101d920e1fa8a Mon Sep 17 00:00:00 2001 From: ary Date: Wed, 17 Dec 2014 11:19:07 -0500 Subject: [PATCH] bug 2493 - eliminate the use of xtend and remove dependecies Signed-off-by: ary Change-Id: I2b2c49d93daf90c90e024d3af727f87957a8427e --- openflowplugin-it/pom.xml | 5 - pom.xml | 29 --- test-provider/pom.xml | 9 - ...penflowpluginGroupTestServiceProvider.java | 179 ++++++++++++++++ ...enflowpluginGroupTestServiceProvider.xtend | 81 ------- ...penflowpluginMeterTestServiceProvider.java | 200 +++++++++++++++++ ...enflowpluginMeterTestServiceProvider.xtend | 84 -------- ...luginTableFeaturesTestServiceProvider.java | 148 +++++++++++++ ...uginTableFeaturesTestServiceProvider.xtend | 71 ------ .../test/OpenflowpluginTestActivator.java | 137 ++++++++++++ .../test/OpenflowpluginTestActivator.xtend | 69 ------ .../OpenflowpluginTestServiceProvider.java | 202 ++++++++++++++++++ .../OpenflowpluginTestServiceProvider.xtend | 84 -------- 13 files changed, 866 insertions(+), 432 deletions(-) create mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java delete mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.xtend create mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java delete mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.xtend create mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java delete mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.xtend create mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.java delete mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.xtend create mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java delete mode 100644 test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.xtend diff --git a/openflowplugin-it/pom.xml b/openflowplugin-it/pom.xml index ccfb159ca4..3e10e906f4 100644 --- a/openflowplugin-it/pom.xml +++ b/openflowplugin-it/pom.xml @@ -119,11 +119,6 @@ javassist test - - org.opendaylight.yangtools.thirdparty - xtend-lib-osgi - test - org.ops4j.pax.exam pax-exam-container-forked diff --git a/pom.xml b/pom.xml index 7453fef29f..270e579d3b 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,6 @@ 0.3.0-SNAPSHOT 0.3.0-SNAPSHOT 1.8 - src/main/xtend-gen src/main/yang-gen-config src/main/yang-gen-sal 0000.0002.0038.0 @@ -237,12 +236,6 @@ xml-apis 1.4.01 - - org.opendaylight.yangtools.thirdparty - xtend-lib-osgi - 2.4.3 - test - @@ -306,31 +299,10 @@ maven-paxexam-plugin 1.2.4 - - org.eclipse.xtend - xtend-maven-plugin - ${xtend.version} - - - - compile - - - ${xtend.dstdir} - - - - maven-clean-plugin - - ${xtend.dstdir} - - ** - - ${jmxGeneratorPath} @@ -361,7 +333,6 @@ ${jmxGeneratorPath} ${salGeneratorPath} - ${xtend.dstdir} diff --git a/test-provider/pom.xml b/test-provider/pom.xml index c631749116..11b3bfab8b 100644 --- a/test-provider/pom.xml +++ b/test-provider/pom.xml @@ -36,11 +36,6 @@ org.opendaylight.controller.model model-flow-statistics - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} equinoxSDK381 @@ -67,10 +62,6 @@ - - org.eclipse.xtend - xtend-maven-plugin - diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java new file mode 100644 index 0000000000..eb3f938458 --- /dev/null +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java @@ -0,0 +1,179 @@ +/** + * 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.openflowplugin.test; + +import java.util.concurrent.Future; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, + SalGroupService { + + private final static Logger LOG = LoggerFactory + .getLogger(OpenflowpluginGroupTestServiceProvider.class); + private RoutedRpcRegistration groupRegistration; + private NotificationProviderService notificationService; + + /** + * get group registration + * + * @return {@link #groupRegistration} + */ + public RoutedRpcRegistration getGroupRegistration() { + return groupRegistration; + } + + /** + * set {@link #groupRegistration} + * + * @param groupRegistration + */ + public void setGroupRegistration( + final RoutedRpcRegistration groupRegistration) { + this.groupRegistration = groupRegistration; + } + + /** + * get notification service + * + * @return {@link #notificationService} + */ + public NotificationProviderService getNotificationService() { + return notificationService; + } + + /** + * set {@link #notificationService} + * + * @param notificationService + */ + public void setNotificationService( + final NotificationProviderService notificationService) { + this.notificationService = notificationService; + } + + public void start() { + OpenflowpluginGroupTestServiceProvider.LOG + .info("SalGroupServiceProvider Started."); + } + + /* + * (non-Javadoc) + * + * @see java.lang.AutoCloseable#close() + */ + @Override + public void close() throws Exception { + OpenflowpluginGroupTestServiceProvider.LOG + .info("SalGroupServiceProvide stopped."); + groupRegistration.close(); + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918 + * .SalGroupService + * #addGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group + * .service.rev130918.AddGroupInput) + */ + @Override + public Future> addGroup(AddGroupInput input) { + String plus = ("addGroup - " + input); + OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918 + * .SalGroupService + * #removeGroup(org.opendaylight.yang.gen.v1.urn.opendaylight + * .group.service.rev130918.RemoveGroupInput) + */ + @Override + public Future> removeGroup( + RemoveGroupInput input) { + String plus = ("removeGroup - " + input); + OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918 + * .SalGroupService + * #updateGroup(org.opendaylight.yang.gen.v1.urn.opendaylight + * .group.service.rev130918.UpdateGroupInput) + */ + @Override + public Future> updateGroup( + UpdateGroupInput input) { + String plus = ("updateGroup - " + input); + OpenflowpluginGroupTestServiceProvider.LOG.info(plus); + return null; + } + + /** + * @param ctx + * @return {@link CompositeObjectRegistrationBuilder #toInstance()} + */ + public CompositeObjectRegistration register( + final ProviderContext ctx) { + CompositeObjectRegistrationBuilder builder = CompositeObjectRegistration + . builderFor(this); + + RoutedRpcRegistration addRoutedRpcImplementation = ctx + . addRoutedRpcImplementation( + SalGroupService.class, this); + setGroupRegistration(addRoutedRpcImplementation); + + InstanceIdentifierBuilder builder1 = InstanceIdentifier + . builder(Nodes.class); + + NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID); + NodeKey nodeKey = new NodeKey(nodeId); + + InstanceIdentifierBuilder nodeIndentifier = builder1 + . child(Node.class, nodeKey); + InstanceIdentifier instance = nodeIndentifier.build(); + groupRegistration.registerPath(NodeContext.class, instance); + RoutedRpcRegistration groupRegistration1 = this + .getGroupRegistration(); + builder.add(groupRegistration1); + return builder.build(); + } + +} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.xtend b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.xtend deleted file mode 100644 index 853a247d7c..0000000000 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.xtend +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.openflowplugin.test - -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey -import org.opendaylight.yangtools.concepts.CompositeObjectRegistration -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier -import org.slf4j.LoggerFactory - -class OpenflowpluginGroupTestServiceProvider implements AutoCloseable, SalGroupService { - - - static val LOG = LoggerFactory.getLogger(OpenflowpluginGroupTestServiceProvider); - - @Property - RoutedRpcRegistration groupRegistration; - - - @Property - NotificationProviderService notificationService; - - - def void start() { - LOG.info("SalGroupServiceProvider Started."); - - } - - - override close() { - LOG.info("SalGroupServiceProvide stopped."); - groupRegistration.close; - } - - override addGroup(AddGroupInput input) { - LOG.info("addGroup - " + input); - return null; - - } - - override removeGroup(RemoveGroupInput input) { - LOG.info("removeGroup - " + input); - return null; - } - - override updateGroup(UpdateGroupInput input) { - LOG.info("updateGroup - " + input); - return null; - } - - - def CompositeObjectRegistration register(ProviderContext ctx) { - val builder = CompositeObjectRegistration - . builderFor(this); - - groupRegistration = ctx.addRoutedRpcImplementation(SalGroupService, this); - val nodeIndentifier = InstanceIdentifier.builder(Nodes).child(Node, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))); - groupRegistration.registerPath(NodeContext, nodeIndentifier.toInstance()); - builder.add(groupRegistration); - - return builder.toInstance(); - } - -} - - diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java new file mode 100644 index 0000000000..c2feaf23d4 --- /dev/null +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java @@ -0,0 +1,200 @@ +/** + * 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.openflowplugin.test; + +import java.util.concurrent.Future; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable, + SalMeterService { + private final static Logger LOG = LoggerFactory + .getLogger(OpenflowpluginMeterTestServiceProvider.class); + private DataBroker dataService; + private RoutedRpcRegistration meterRegistration; + private NotificationProviderService notificationService; + + /** + * get data service + * + * @return {@link #dataService} + */ + public DataBroker getDataService() { + return this.dataService; + } + + /** + * set {@link #dataService} + * + * @param dataService + */ + public void setDataService(final DataBroker dataService) { + this.dataService = dataService; + } + + /** + * get meter registration + * + * @return {@link #meterRegistration} + */ + public RoutedRpcRegistration getMeterRegistration() { + return this.meterRegistration; + } + + /** + * set {@link #meterRegistration} + * + * @param meterRegistration + */ + public void setMeterRegistration( + final RoutedRpcRegistration meterRegistration) { + this.meterRegistration = meterRegistration; + } + + /** + * get notification service + * + * @return {@link #notificationService} + */ + public NotificationProviderService getNotificationService() { + return this.notificationService; + } + + /** + * set {@link #notificationService} + * + * @param notificationService + */ + public void setNotificationService( + final NotificationProviderService notificationService) { + this.notificationService = notificationService; + } + + public void start() { + OpenflowpluginMeterTestServiceProvider.LOG + .info("SalMeterServiceProvider Started."); + } + + /* + * (non-Javadoc) + * + * @see java.lang.AutoCloseable#close() + */ + public void close() { + OpenflowpluginMeterTestServiceProvider.LOG + .info("SalMeterServiceProvide stopped."); + meterRegistration.close(); + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918 + * .SalMeterService + * #addMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter + * .service.rev130918.AddMeterInput) + */ + public Future> addMeter(final AddMeterInput input) { + String plus = ("addMeter - " + input); + OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918 + * .SalMeterService + * #removeMeter(org.opendaylight.yang.gen.v1.urn.opendaylight + * .meter.service.rev130918.RemoveMeterInput) + */ + public Future> removeMeter( + final RemoveMeterInput input) { + String plus = ("removeMeter - " + input); + OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918 + * .SalMeterService + * #updateMeter(org.opendaylight.yang.gen.v1.urn.opendaylight + * .meter.service.rev130918.UpdateMeterInput) + */ + public Future> updateMeter( + final UpdateMeterInput input) { + String plus = ("updateMeter - " + input); + OpenflowpluginMeterTestServiceProvider.LOG.info(plus); + return null; + } + + /** + * @param ctx + * @return {@link CompositeObjectRegistrationBuilder #toInstance()} + */ + public CompositeObjectRegistration register( + final ProviderContext ctx) { + CompositeObjectRegistrationBuilder builder = CompositeObjectRegistration + . builderFor(this); + + RoutedRpcRegistration addRoutedRpcImplementation = ctx + . addRoutedRpcImplementation( + SalMeterService.class, this); + + setMeterRegistration(addRoutedRpcImplementation); + + InstanceIdentifierBuilder builder1 = InstanceIdentifier + . builder(Nodes.class); + + NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID); + NodeKey nodeKey = new NodeKey(nodeId); + + InstanceIdentifierBuilder nodeIndentifier = builder1 + . child(Node.class, nodeKey); + + InstanceIdentifier instance = nodeIndentifier.build(); + + meterRegistration.registerPath(NodeContext.class, instance); + + RoutedRpcRegistration meterRegistration1 = this + .getMeterRegistration(); + + builder.add(meterRegistration1); + + return builder.build(); + } + +} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.xtend b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.xtend deleted file mode 100644 index b87ff423d8..0000000000 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.xtend +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.openflowplugin.test - -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.md.sal.binding.api.DataBroker -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey -import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService -import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput -import org.opendaylight.yangtools.concepts.CompositeObjectRegistration -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier -import org.slf4j.LoggerFactory - -class OpenflowpluginMeterTestServiceProvider implements AutoCloseable, SalMeterService { - - - static val LOG = LoggerFactory.getLogger(OpenflowpluginMeterTestServiceProvider); - - @Property - DataBroker dataService; - - @Property - RoutedRpcRegistration meterRegistration; - - - @Property - NotificationProviderService notificationService; - - - def void start() { - LOG.info("SalMeterServiceProvider Started."); - - } - - - override close() { - LOG.info("SalMeterServiceProvide stopped."); - meterRegistration.close; - } - - override addMeter(AddMeterInput input) { - LOG.info("addMeter - " + input); - return null; - - } - - override removeMeter(RemoveMeterInput input) { - LOG.info("removeMeter - " + input); - return null; - } - - override updateMeter(UpdateMeterInput input) { - LOG.info("updateMeter - " + input); - return null; - } - - - def CompositeObjectRegistration register(ProviderContext ctx) { - val builder = CompositeObjectRegistration - . builderFor(this); - - meterRegistration = ctx.addRoutedRpcImplementation(SalMeterService, this); - val nodeIndentifier = InstanceIdentifier.builder(Nodes).child(Node, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))); - meterRegistration.registerPath(NodeContext, nodeIndentifier.toInstance()); - builder.add(meterRegistration); - return builder.toInstance(); - } - -} - - diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java new file mode 100644 index 0000000000..2d9df29857 --- /dev/null +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java @@ -0,0 +1,148 @@ +/** + * 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.openflowplugin.test; + +import java.util.concurrent.Future; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OpenflowpluginTableFeaturesTestServiceProvider implements + AutoCloseable, SalTableService { + + private final static Logger LOG = LoggerFactory + .getLogger(OpenflowpluginTableFeaturesTestServiceProvider.class); + private RoutedRpcRegistration tableRegistration; + private NotificationProviderService notificationService; + + /** + * get table registration + * + * @return {@link #tableRegistration} + */ + public RoutedRpcRegistration getTableRegistration() { + return this.tableRegistration; + } + + /** + * set {@link #tableRegistration} + * + * @param tableRegistration + */ + public void setTableRegistration( + final RoutedRpcRegistration tableRegistration) { + this.tableRegistration = tableRegistration; + } + + /** + * get notification service + * + * @return {@link #notificationService} + */ + public NotificationProviderService getNotificationService() { + return this.notificationService; + } + + /** + * set {@link #notificationService} + * + * @param notificationService + */ + public void setNotificationService( + final NotificationProviderService notificationService) { + this.notificationService = notificationService; + } + + public void start() { + OpenflowpluginTableFeaturesTestServiceProvider.LOG + .info("SalTableServiceProvider Started."); + } + + /* + * (non-Javadoc) + * + * @see java.lang.AutoCloseable#close() + */ + @Override + public void close() throws Exception { + OpenflowpluginTableFeaturesTestServiceProvider.LOG + .info("SalTableServiceProvider stopped."); + tableRegistration.close(); + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026 + * .SalTableService + * #updateTable(org.opendaylight.yang.gen.v1.urn.opendaylight + * .table.service.rev131026.UpdateTableInput) + */ + @Override + public Future> updateTable( + UpdateTableInput input) { + String plus = ("updateTable - " + input); + OpenflowpluginTableFeaturesTestServiceProvider.LOG.info(plus); + return null; + } + + /** + * @param ctx + * @return {@link CompositeObjectRegistrationBuilder #toInstance()} + */ + public CompositeObjectRegistration register( + final ProviderContext ctx) { + CompositeObjectRegistrationBuilder builder = CompositeObjectRegistration + . builderFor(this); + + RoutedRpcRegistration addRoutedRpcImplementation = ctx + . addRoutedRpcImplementation( + SalTableService.class, this); + + setTableRegistration(addRoutedRpcImplementation); + + InstanceIdentifierBuilder builder1 = InstanceIdentifier + . builder(Nodes.class); + + NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID); + NodeKey nodeKey = new NodeKey(nodeId); + + InstanceIdentifierBuilder nodeIndentifier = builder1 + . child(Node.class, nodeKey); + + InstanceIdentifier instance = nodeIndentifier.build(); + + tableRegistration.registerPath(NodeContext.class, instance); + + RoutedRpcRegistration tableRegistration1 = this + .getTableRegistration(); + + builder.add(tableRegistration1); + + return builder.build(); + } + +} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.xtend b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.xtend deleted file mode 100644 index 9bdfbc1076..0000000000 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.xtend +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.openflowplugin.test - -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.md.sal.binding.api.DataBroker - -import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService -//import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalTableService -import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey -import org.opendaylight.yangtools.concepts.CompositeObjectRegistration -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier -import org.slf4j.LoggerFactory - - -class OpenflowpluginTableFeaturesTestServiceProvider implements AutoCloseable, SalTableService { - - - static val LOG = LoggerFactory.getLogger(OpenflowpluginTableFeaturesTestServiceProvider); - - @Property - RoutedRpcRegistration tableRegistration; - - - @Property - NotificationProviderService notificationService; - - - def void start() { - LOG.info("SalTableServiceProvider Started."); - - } - - - override close() { - LOG.info("SalTableServiceProvider stopped."); - tableRegistration.close; - } - - - override updateTable(UpdateTableInput input) { - LOG.info("updateTable - " + input); - return null; - } - - - def CompositeObjectRegistration register(ProviderContext ctx) { - val builder = CompositeObjectRegistration - . builderFor(this); - - tableRegistration = ctx.addRoutedRpcImplementation(SalTableService, this); - val nodeIndentifier = InstanceIdentifier.builder(Nodes).child(Node, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))); - tableRegistration.registerPath(NodeContext, nodeIndentifier.toInstance()); - builder.add(tableRegistration); - - return builder.toInstance(); - } - -} \ No newline at end of file diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.java new file mode 100644 index 0000000000..36feb9769d --- /dev/null +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.java @@ -0,0 +1,137 @@ +/** + * 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.openflowplugin.test; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.osgi.framework.BundleContext; + +public class OpenflowpluginTestActivator extends AbstractBindingAwareProvider { + + private static OpenflowpluginTestServiceProvider provider = new OpenflowpluginTestServiceProvider(); + private static OpenflowpluginGroupTestServiceProvider groupProvider = new OpenflowpluginGroupTestServiceProvider(); + private static OpenflowpluginMeterTestServiceProvider meterProvider = new OpenflowpluginMeterTestServiceProvider(); + private static OpenflowpluginTableFeaturesTestServiceProvider tableProvider = new OpenflowpluginTableFeaturesTestServiceProvider(); + + private OpenflowpluginTestCommandProvider cmdProvider; + + private OpenflowpluginGroupTestCommandProvider cmdGroupProvider; + + private OpenflowpluginMeterTestCommandProvider cmdMeterProvider; + + private OpenflowpluginTableFeaturesTestCommandProvider cmdTableProvider; + + private OpenflowpluginStatsTestCommandProvider cmdStatsProvider; + + private OpenflowpluginTestNodeConnectorNotification cmdNodeConnectorNotification; + + private OpenflowpluginTestTopologyNotification cmdTopologyNotification; + + private OpenflowPluginBulkTransactionProvider bulkCmdProvider; + + private OpenflowPluginBulkGroupTransactionProvider groupCmdProvider; + + public final static String NODE_ID = "foo:node:1"; + + /* + * (non-Javadoc) + * + * @see org.opendaylight.controller.sal.binding.api.BindingAwareProvider# + * onSessionInitiated + * (org.opendaylight.controller.sal.binding.api.BindingAwareBroker + * .ProviderContext) + */ + @Override + public void onSessionInitiated(ProviderContext session) { + DataBroker salService = session + . getSALService(DataBroker.class); + OpenflowpluginTestActivator.provider.setDataService(salService); + + NotificationProviderService salService1 = session + . getSALService(NotificationProviderService.class); + + OpenflowpluginTestActivator.provider + .setNotificationService(salService1); + OpenflowpluginTestActivator.provider.start(); + OpenflowpluginTestActivator.provider.register(session); + + OpenflowpluginTestActivator.groupProvider.register(session); + OpenflowpluginTestActivator.meterProvider.register(session); + OpenflowpluginTestActivator.tableProvider.register(session); + + this.cmdProvider.onSessionInitiated(session); + this.cmdGroupProvider.onSessionInitiated(session); + this.cmdMeterProvider.onSessionInitiated(session); + this.cmdTableProvider.onSessionInitiated(session); + this.cmdStatsProvider.onSessionInitiated(session); + this.cmdNodeConnectorNotification.onSessionInitiated(session); + this.cmdTopologyNotification.onSessionInitiated(session); + this.bulkCmdProvider.onSessionInitiated(session); + this.groupCmdProvider.onSessionInitiated(session); + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.controller.sal.binding.api.AbstractBrokerAwareActivator + * #startImpl(org.osgi.framework.BundleContext) + */ + public void startImpl(final BundleContext ctx) { + super.startImpl(ctx); + + OpenflowpluginTestCommandProvider _openflowpluginTestCommandProvider = new OpenflowpluginTestCommandProvider( + ctx); + this.cmdProvider = _openflowpluginTestCommandProvider; + OpenflowpluginGroupTestCommandProvider _openflowpluginGroupTestCommandProvider = new OpenflowpluginGroupTestCommandProvider( + ctx); + this.cmdGroupProvider = _openflowpluginGroupTestCommandProvider; + OpenflowpluginMeterTestCommandProvider _openflowpluginMeterTestCommandProvider = new OpenflowpluginMeterTestCommandProvider( + ctx); + this.cmdMeterProvider = _openflowpluginMeterTestCommandProvider; + OpenflowpluginTableFeaturesTestCommandProvider _openflowpluginTableFeaturesTestCommandProvider = new OpenflowpluginTableFeaturesTestCommandProvider( + ctx); + this.cmdTableProvider = _openflowpluginTableFeaturesTestCommandProvider; + OpenflowpluginStatsTestCommandProvider _openflowpluginStatsTestCommandProvider = new OpenflowpluginStatsTestCommandProvider( + ctx); + this.cmdStatsProvider = _openflowpluginStatsTestCommandProvider; + OpenflowpluginTestNodeConnectorNotification _openflowpluginTestNodeConnectorNotification = new OpenflowpluginTestNodeConnectorNotification( + ctx); + this.cmdNodeConnectorNotification = _openflowpluginTestNodeConnectorNotification; + OpenflowpluginTestTopologyNotification _openflowpluginTestTopologyNotification = new OpenflowpluginTestTopologyNotification( + ctx); + this.cmdTopologyNotification = _openflowpluginTestTopologyNotification; + OpenflowPluginBulkTransactionProvider _openflowPluginBulkTransactionProvider = new OpenflowPluginBulkTransactionProvider( + ctx); + this.bulkCmdProvider = _openflowPluginBulkTransactionProvider; + OpenflowPluginBulkGroupTransactionProvider _openflowPluginBulkGroupTransactionProvider = new OpenflowPluginBulkGroupTransactionProvider( + ctx); + this.groupCmdProvider = _openflowPluginBulkGroupTransactionProvider; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.controller.sal.binding.api.AbstractBrokerAwareActivator + * #stopImpl(org.osgi.framework.BundleContext) + */ + protected void stopImpl(final BundleContext context) { + + try { + OpenflowpluginTestActivator.provider.close(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.xtend b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.xtend deleted file mode 100644 index 1231cf1ae4..0000000000 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.xtend +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.openflowplugin.test - -import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.md.sal.binding.api.DataBroker -import org.osgi.framework.BundleContext - -class OpenflowpluginTestActivator extends AbstractBindingAwareProvider { - - static var OpenflowpluginTestServiceProvider provider = new OpenflowpluginTestServiceProvider(); - static var OpenflowpluginGroupTestServiceProvider groupProvider = new OpenflowpluginGroupTestServiceProvider(); - static var OpenflowpluginMeterTestServiceProvider meterProvider = new OpenflowpluginMeterTestServiceProvider(); - static var OpenflowpluginTableFeaturesTestServiceProvider tableProvider = new OpenflowpluginTableFeaturesTestServiceProvider(); - var OpenflowpluginTestCommandProvider cmdProvider; - var OpenflowpluginGroupTestCommandProvider cmdGroupProvider; - var OpenflowpluginMeterTestCommandProvider cmdMeterProvider; - var OpenflowpluginTableFeaturesTestCommandProvider cmdTableProvider; - var OpenflowpluginStatsTestCommandProvider cmdStatsProvider; - var OpenflowpluginTestNodeConnectorNotification cmdNodeConnectorNotification; - var OpenflowpluginTestTopologyNotification cmdTopologyNotification; - var OpenflowPluginBulkTransactionProvider bulkCmdProvider; - var OpenflowPluginBulkGroupTransactionProvider groupCmdProvider; - public static final String NODE_ID = "foo:node:1"; - - override onSessionInitiated(ProviderContext session) { - provider.dataService = session.getSALService(DataBroker) - provider.notificationService = session.getSALService(NotificationProviderService) - provider.start(); - provider.register(session); - groupProvider.register(session); - meterProvider.register(session); - tableProvider.register(session); - cmdProvider.onSessionInitiated(session); - cmdGroupProvider.onSessionInitiated(session); - cmdMeterProvider.onSessionInitiated(session); - cmdTableProvider.onSessionInitiated(session); - cmdStatsProvider.onSessionInitiated(session); - cmdNodeConnectorNotification.onSessionInitiated(session); - cmdTopologyNotification.onSessionInitiated(session); - bulkCmdProvider.onSessionInitiated(session); - groupCmdProvider.onSessionInitiated(session); - } - - override startImpl(BundleContext ctx) { - super.startImpl(ctx); - cmdProvider = new OpenflowpluginTestCommandProvider(ctx); - cmdGroupProvider = new OpenflowpluginGroupTestCommandProvider(ctx); - cmdMeterProvider = new OpenflowpluginMeterTestCommandProvider(ctx); - cmdTableProvider = new OpenflowpluginTableFeaturesTestCommandProvider(ctx); - cmdStatsProvider = new OpenflowpluginStatsTestCommandProvider(ctx); - cmdNodeConnectorNotification = new OpenflowpluginTestNodeConnectorNotification(ctx); - cmdTopologyNotification = new OpenflowpluginTestTopologyNotification(ctx); - bulkCmdProvider = new OpenflowPluginBulkTransactionProvider(ctx); - groupCmdProvider = new OpenflowPluginBulkGroupTransactionProvider(ctx); - } - - override protected stopImpl(BundleContext context) { - provider.close(); - } - -} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java new file mode 100644 index 0000000000..0901b0ab27 --- /dev/null +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java @@ -0,0 +1,202 @@ +/** + * 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.openflowplugin.test; + +import java.util.concurrent.Future; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput; +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.service.rev130819.UpdateFlowInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration; +import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OpenflowpluginTestServiceProvider implements AutoCloseable, + SalFlowService { + + private final static Logger LOG = LoggerFactory + .getLogger(OpenflowpluginTestServiceProvider.class); + + private DataBroker dataService; + private RoutedRpcRegistration flowRegistration; + private NotificationProviderService notificationProviderService; + + /** + * get data service + * + * @return {@link #dataService} + */ + public DataBroker getDataService() { + return dataService; + } + + /** + * set {@link #dataService} + * + * @param dataService + */ + public void setDataService(final DataBroker dataService) { + this.dataService = dataService; + } + + /** + * get flow registration + * + * @return {@link #flowRegistration} + */ + public RoutedRpcRegistration getFlowRegistration() { + return flowRegistration; + } + + /** + * set {@link #flowRegistration} + * + * @param flowRegistration + */ + public void setFlowRegistration( + final RoutedRpcRegistration flowRegistration) { + this.flowRegistration = flowRegistration; + } + + /** + * get notification service + * + * @return {@link #notificationProviderService} + */ + public NotificationProviderService getNotificationService() { + return notificationProviderService; + } + + /** + * set {@link #notificationProviderService} + * + * @param notificationProviderService + */ + public void setNotificationService( + final NotificationProviderService notificationProviderService) { + this.notificationProviderService = notificationProviderService; + } + + public void start() { + OpenflowpluginTestServiceProvider.LOG + .info("SalFlowServiceProvider Started."); + } + + /* + * (non-Javadoc) + * + * @see java.lang.AutoCloseable#close() + */ + @Override + public void close() throws Exception { + OpenflowpluginTestServiceProvider.LOG + .info("SalFlowServiceProvide stopped."); + flowRegistration.close(); + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819. + * SalFlowService + * #addFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow. + * service.rev130819.AddFlowInput) + */ + @Override + public Future> addFlow(AddFlowInput input) { + String plus = ("addFlow - " + input); + OpenflowpluginTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819. + * SalFlowService + * #removeFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow + * .service.rev130819.RemoveFlowInput) + */ + @Override + public Future> removeFlow(RemoveFlowInput input) { + String plus = ("removeFlow - " + input); + OpenflowpluginTestServiceProvider.LOG.info(plus); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819. + * SalFlowService + * #updateFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow + * .service.rev130819.UpdateFlowInput) + */ + @Override + public Future> updateFlow(UpdateFlowInput input) { + String plus = ("updateFlow - " + input); + OpenflowpluginTestServiceProvider.LOG.info(plus); + return null; + } + + /** + * @param ctx + * @return {@link CompositeObjectRegistrationBuilder #toInstance()} + */ + public CompositeObjectRegistration register( + final ProviderContext ctx) { + CompositeObjectRegistrationBuilder builder = CompositeObjectRegistration + . builderFor(this); + + RoutedRpcRegistration addRoutedRpcImplementation = ctx + . addRoutedRpcImplementation( + SalFlowService.class, this); + + setFlowRegistration(addRoutedRpcImplementation); + + InstanceIdentifierBuilder builderII = InstanceIdentifier + . builder(Nodes.class); + + NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID); + NodeKey nodeKey = new NodeKey(nodeId); + + InstanceIdentifierBuilder nodeIdentifier = builderII + . child(Node.class, nodeKey); + + InstanceIdentifier instance = nodeIdentifier.build(); + + flowRegistration.registerPath(NodeContext.class, instance); + + RoutedRpcRegistration flowRegistration2 = getFlowRegistration(); + + builder.add(flowRegistration2); + + return builder.build(); + } +} diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.xtend b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.xtend deleted file mode 100644 index 538f633867..0000000000 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.xtend +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.openflowplugin.test - -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration -import org.opendaylight.controller.sal.binding.api.NotificationProviderService -import org.opendaylight.controller.md.sal.binding.api.DataBroker -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey -import org.opendaylight.yangtools.concepts.CompositeObjectRegistration -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier -import org.slf4j.LoggerFactory - -class OpenflowpluginTestServiceProvider implements AutoCloseable, SalFlowService { - - - static val LOG = LoggerFactory.getLogger(OpenflowpluginTestServiceProvider); - - @Property - DataBroker dataService; - - @Property - RoutedRpcRegistration flowRegistration; - - - @Property - NotificationProviderService notificationService; - - - def void start() { - LOG.info("SalFlowServiceProvider Started."); - - } - - override close() { - LOG.info("SalFlowServiceProvide stopped."); - flowRegistration.close; - } - - override addFlow(AddFlowInput input) { - LOG.info("addFlow - " + input); - return null; - - } - - override removeFlow(RemoveFlowInput input) { - LOG.info("removeFlow - " + input); - return null; - } - - override updateFlow(UpdateFlowInput input) { - LOG.info("updateFlow - " + input); - return null; - } - - - def CompositeObjectRegistration register(ProviderContext ctx) { - val builder = CompositeObjectRegistration - . builderFor(this); - - flowRegistration = ctx.addRoutedRpcImplementation(SalFlowService, this); - val nodeIndentifier = InstanceIdentifier.builder(Nodes).child(Node, new NodeKey(new NodeId(OpenflowpluginTestActivator.NODE_ID))); - flowRegistration.registerPath(NodeContext, nodeIndentifier.toInstance()); - builder.add(flowRegistration); - - return builder.toInstance(); - } - -} - - -- 2.36.6