Migrate modules in alto-core to blueprint 03/49703/2
authorjensenzhang <jingxuan.n.zhang@gmail.com>
Wed, 21 Dec 2016 14:36:38 +0000 (22:36 +0800)
committerJensen Zhang <jingxuan.n.zhang@gmail.com>
Thu, 22 Dec 2016 07:12:48 +0000 (07:12 +0000)
- Migrate northbound and standard-northbound-routes
- Create a script in utils for automatic migration

Change-Id: I5e939a1d403f7710cbec75ac9d65d7038fa1e2e4
Signed-off-by: jensenzhang <jingxuan.n.zhang@gmail.com>
49 files changed:
alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRoute.java
alto-core/northbound/api/src/main/java/org/opendaylight/alto/core/northbound/api/AltoNorthboundRouter.java
alto-core/northbound/impl/src/main/config/default-config.xml [deleted file]
alto-core/northbound/impl/src/main/config/maven-metadata-local.xml [deleted file]
alto-core/northbound/impl/src/main/java/org/opendaylight/alto/core/northbound/impl/AltoNorthboundProvider.java
alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModule.java [deleted file]
alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactory.java [deleted file]
alto-core/northbound/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml [new file with mode: 0644]
alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang [deleted file]
alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java [deleted file]
alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleTest.java [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/main/config/default-config.xml [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/main/config/maven-metadata-local.xml [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/alto/core/northbound/route/costmap/impl/AltoNorthboundRouteCostmap.java
alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModule.java [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModuleFactory.java [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/costmap/impl/src/main/yang/alto-northbound-route-costmap-impl.yang [deleted file]
alto-core/standard-northbound-routes/costmap/impl/src/test/java/org/opendaylight/alto/core/northbound/route/costmap/impl/AltoNorthboundCostmapTest.java
alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/default-config.xml [deleted file]
alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/maven-metadata-local.xml [deleted file]
alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/alto/core/northbound/route/endpointcost/impl/AltoNorthboundRouteEndpointcost.java
alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModule.java [deleted file]
alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModuleFactory.java [deleted file]
alto-core/standard-northbound-routes/endpointcost/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/endpointcost/impl/src/main/yang/alto-northbound-route-endpointcost-impl.yang [deleted file]
alto-core/standard-northbound-routes/endpointcost/impl/src/test/java/org/opendaylight/alto/core/northbound/route/endpointcost/impl/AltoNorthboundEndpointcostTest.java
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/default-config.xml [deleted file]
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/maven-metadata-local.xml [deleted file]
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/alto/core/northbound/route/endpointproperty/impl/AltoNorthboundRouteEndpointproperty.java
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModule.java [deleted file]
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModuleFactory.java [deleted file]
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/endpointproperty/impl/src/main/yang/alto-northbound-route-endpointproperty-impl.yang [deleted file]
alto-core/standard-northbound-routes/endpointproperty/impl/src/test/java/org/opendaylight/alto/core/northbound/route/endpointproperty/impl/AltoNorthboundRouteEndpointpropertyTest.java
alto-core/standard-northbound-routes/networkmap/impl/src/main/config/default-config.xml [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/main/config/maven-metadata-local.xml [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/alto/core/northbound/route/networkmap/impl/AltoNorthboundRouteNetworkmap.java
alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModule.java [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactory.java [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml [new file with mode: 0644]
alto-core/standard-northbound-routes/networkmap/impl/src/main/yang/alto-northbound-route-networkmap-impl.yang [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/alto/core/northbound/route/networkmap/impl/AltoNorthboundNetworkmapTest.java
alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactoryTest.java [deleted file]
alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleTest.java [deleted file]
alto-release-features/pom.xml
alto-release-features/src/main/features/features.xml
utils/migrate_blueprint.sh [new file with mode: 0755]
utils/migrate_namespace.sh [moved from migrate_namespace.sh with 94% similarity]

index 9ffb1d3a3f02158340c666c0e68de1af4254f26c..7e16b04007fa5393656d550708b72d8289c978e9 100644 (file)
@@ -9,6 +9,6 @@ package org.opendaylight.alto.core.northbound.api;
 
 public interface AltoNorthboundRoute {
 
-    public static final String ALTO_ERROR = "application/alto-error+json";
+    String ALTO_ERROR = "application/alto-error+json";
 
 }
index e4441fefb53e3fd45f88f2c43e1e8859bc7d7c6b..ad09a016d55933f8a41b393f5c3c6a599a21b389 100644 (file)
@@ -11,10 +11,10 @@ public interface AltoNorthboundRouter {
 
     /*
      * @return The relative path of the route if successful or null if failing */
-    public String addRoute(String routeName, AltoNorthboundRoute route);
+    String addRoute(String routeName, AltoNorthboundRoute route);
 
-    public void removeRoute(String routeName);
+    void removeRoute(String routeName);
 
-    public AltoNorthboundRoute getRoute(String routeName);
+    AltoNorthboundRoute getRoute(String routeName);
 
 }
diff --git a/alto-core/northbound/impl/src/main/config/default-config.xml b/alto-core/northbound/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index 2867989..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 Yale University 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:alto:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
-      <capability>urn:alto:northbound:impl?module=alto-northbound-impl&amp;revision=2015-10-21</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-  </required-capabilities>
-  <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:alto:northbound:impl">prefix:alto-northbound</type>
-          <name>alto-northbound-default</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-        </module>
-      </modules>
-
-      <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-        <service>
-          <type xmlns:alto-northbound="urn:alto:northbound">alto-northbound:alto-northbound-router</type>
-          <instance>
-            <name>alto-northbound-router</name>
-            <provider>/modules/module[type='alto-northbound'][name='alto-northbound-default']</provider>
-          </instance>
-        </service>
-      </services>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/alto-core/northbound/impl/src/main/config/maven-metadata-local.xml b/alto-core/northbound/impl/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index a48a9a5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.alto.core</groupId>
-  <artifactId>alto-northbound-impl</artifactId>
-  <version>0.2.1-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151105030453</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>0.2.1-SNAPSHOT</value>
-        <updated>20151105030453</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
index 989043a4cc6dafbcc202c081d33e592a9588dfba..9992eff039bf1717518233f04bdc57bb824489b9 100644 (file)
@@ -10,23 +10,19 @@ package org.opendaylight.alto.core.northbound.impl;
 import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
 import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
 
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class AltoNorthboundProvider implements BindingAwareProvider, AutoCloseable, AltoNorthboundRouter{
+public class AltoNorthboundProvider implements AltoNorthboundRouter{
 
     private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundProvider.class);
 
     private AltoNorthboundRouterImpl router = AltoNorthboundRouterImpl.getInstance();
 
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
+    public void init() {
         LOG.info("AltoNorthboundProvider Session Initiated");
     }
 
-    @Override
     public void close() throws Exception {
         LOG.info("AltoNorthboundProvider Closed");
     }
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModule.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModule.java
deleted file mode 100644 (file)
index 6f17e3b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.impl.rev151021;
-
-import org.opendaylight.alto.core.northbound.impl.AltoNorthboundProvider;
-
-public class AltoNorthboundModule extends org.opendaylight.yang.gen.v1.urn.alto.northbound.impl.rev151021.AbstractAltoNorthboundModule {
-    public AltoNorthboundModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AltoNorthboundModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.alto.northbound.impl.rev151021.AltoNorthboundModule 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() {
-        AltoNorthboundProvider provider = new AltoNorthboundProvider();
-
-        getBrokerDependency().registerProvider(provider);
-        return provider;
-    }
-
-}
diff --git a/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactory.java b/alto-core/northbound/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactory.java
deleted file mode 100644 (file)
index ecba747..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: northbound-impl yang module local name: alto-northbound
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Nov 05 10:05:41 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.impl.rev151021;
-public class AltoNorthboundModuleFactory extends org.opendaylight.yang.gen.v1.urn.alto.northbound.impl.rev151021.AbstractAltoNorthboundModuleFactory {
-
-}
diff --git a/alto-core/northbound/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/alto-core/northbound/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644 (file)
index 0000000..d3e2990
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+  <bean id="provider"
+    class="org.opendaylight.alto.core.northbound.impl.AltoNorthboundProvider"
+    init-method="init" destroy-method="close">
+  </bean>
+</blueprint>
diff --git a/alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang b/alto-core/northbound/impl/src/main/yang/alto-northbound-impl.yang
deleted file mode 100644 (file)
index 3254e6d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-module alto-northbound-impl {
-    yang-version 1;
-    namespace "urn:alto:northbound:impl";
-    prefix "alto-northbound-impl";
-
-    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for northbound project";
-
-    revision "2015-10-21" {
-        description
-            "Initial revision";
-    }
-
-    identity alto-northbound {
-        base config:module-type;
-        config:provided-service alto-northbound:alto-northbound-router;
-        config:java-name-prefix AltoNorthbound;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case alto-northbound {
-            when "/config:modules/config:module/config:type = 'alto-northbound'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java b/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleFactoryTest.java
deleted file mode 100644 (file)
index c0a6ed9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright © 2015 Yale University 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.yang.gen.v1.urn.alto.northbound.impl.rev151021;
-
-import org.junit.Test;
-
-public class AltoNorthboundModuleFactoryTest {
-    @Test
-    public void testFactoryConstructor() {
-        // ensure no exceptions on construction
-        new AltoNorthboundModuleFactory();
-    }
-}
diff --git a/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleTest.java b/alto-core/northbound/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/impl/rev151021/AltoNorthboundModuleTest.java
deleted file mode 100644 (file)
index 5f41277..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2015 Yale University 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.yang.gen.v1.urn.alto.northbound.impl.rev151021;
-
-import org.junit.Test;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.alto.core.northbound.impl.AltoNorthboundProvider;
-
-import javax.management.ObjectName;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class AltoNorthboundModuleTest {
-    @Test
-    public void testCustomValidation() {
-        AltoNorthboundModule module = new AltoNorthboundModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
-
-        // ensure no exceptions on validation
-        // currently this method is empty
-        module.customValidation();
-    }
-
-    @Test
-    public void testCreateInstance() throws Exception {
-        // configure mocks
-        DependencyResolver dependencyResolver = mock(DependencyResolver.class);
-        BindingAwareBroker broker = mock(BindingAwareBroker.class);
-        when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
-
-        // create instance of module with injected mocks
-        AltoNorthboundModule module = new AltoNorthboundModule(mock(ModuleIdentifier.class), dependencyResolver);
-
-        // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
-        AutoCloseable closeable = module.getInstance();
-
-        // verify that the module registered the returned provider with the broker
-        verify(broker).registerProvider((AltoNorthboundProvider)closeable);
-
-        // ensure no exceptions on close
-        closeable.close();
-    }
-}
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/config/default-config.xml b/alto-core/standard-northbound-routes/costmap/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index 40567b8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 Yale University 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:alto:northbound:route:costmap:impl?module=alto-northbound-route-costmap-impl&amp;revision=2015-10-21</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-      <capability>urn:alto:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
-  </required-capabilities>
-  <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:alto:northbound:route:costmap:impl">prefix:alto-northbound-route-costmap-impl</type>
-          <name>alto-northbound-route-costmap</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-          <alto-northbound-router>
-            <type xmlns:alto-northbound-router="urn:alto:northbound">alto-northbound-router:alto-northbound-router</type>
-            <name>alto-northbound-router</name>
-          </alto-northbound-router>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/config/maven-metadata-local.xml b/alto-core/standard-northbound-routes/costmap/impl/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index a48a9a5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.alto.core</groupId>
-  <artifactId>alto-northbound-impl</artifactId>
-  <version>0.2.1-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151105030453</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>0.2.1-SNAPSHOT</value>
-        <updated>20151105030453</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
index 960552e6ed071b1f3c7dd785bfac4e42494b60bf..4e45ad76d3dbae1b5381444b38d365babc6522db 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.alto.core.northbound.route.costmap.impl;
 
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -18,7 +21,7 @@ import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285CostMap;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285CostType;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285VersionTag;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -69,7 +72,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
 
-public class AltoNorthboundRouteCostmap implements BindingAwareProvider, AutoCloseable, AltoNorthboundRoute {
+public class AltoNorthboundRouteCostmap implements AltoNorthboundRoute {
     public static final String COSTMAP_ROUTE = "costmap";
 
     public static final String ALTO_COSTMAP_FILTER = "application/alto-costmapfilter+json";
@@ -84,18 +87,27 @@ public class AltoNorthboundRouteCostmap implements BindingAwareProvider, AutoClo
 
     private ObjectMapper mapper = new ObjectMapper();
     private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundRouteCostmap.class);
-    private static DataBroker m_dataBroker = null;
+
+    private DataBroker dataBroker = null;
+
     private AltoNorthboundRouter m_router = null;
 
     private  static AltoModelCostmapService mapService = null;
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        m_dataBroker = session.getSALService(DataBroker.class);
-        if (m_dataBroker == null) {
+    public void setDataBroker(DataBroker dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    public void setMapService(final AltoModelCostmapService mapService) {
+        this.mapService = mapService;
+    }
+
+    public void init() {
+
+        if (dataBroker == null) {
             LOG.error("Failed to init: data broker is null");
         }
 
-        mapService = session.getRpcService(AltoModelCostmapService.class);
+
         LOG.info("AltoNorthboundRouteCostmap initiated");
 
     }
@@ -105,7 +117,6 @@ public class AltoNorthboundRouteCostmap implements BindingAwareProvider, AutoClo
         m_router.addRoute("costmap", new AltoNorthboundRouteCostmap());
     }
 
-    @Override
     public void close() {
         m_router.removeRoute("costmap");
     }
@@ -300,7 +311,7 @@ public class AltoNorthboundRouteCostmap implements BindingAwareProvider, AutoClo
 
         costmapRequestBuilder.setCostmapParams(costmapParamsBuilder.build());
 
-        ReadOnlyTransaction rtx = m_dataBroker.newReadOnlyTransaction();
+        ReadOnlyTransaction rtx = dataBroker.newReadOnlyTransaction();
         InstanceIdentifier<ContextTag> ctagIID = getResourceByPath(path, rtx);
         if(ctagIID == null){
             return null;
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModule.java b/alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModule.java
deleted file mode 100644 (file)
index efd4574..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.costmap.impl.rev151021;
-
-import org.opendaylight.alto.core.northbound.route.costmap.impl.AltoNorthboundRouteCostmap;
-
-public class AltoNorthboundRouteCostmapModule extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.costmap.impl.rev151021.AbstractAltoNorthboundRouteCostmapModule {
-    public AltoNorthboundRouteCostmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AltoNorthboundRouteCostmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.alto.northbound.route.costmap.impl.rev151021.AltoNorthboundRouteCostmapModule 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() {
-        AltoNorthboundRouteCostmap costmap = new AltoNorthboundRouteCostmap();
-        getBrokerDependency().registerProvider(costmap);
-        costmap.register(getAltoNorthboundRouterDependency());
-        return costmap;
-    }
-
-}
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModuleFactory.java b/alto-core/standard-northbound-routes/costmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/costmap/impl/rev151021/AltoNorthboundRouteCostmapModuleFactory.java
deleted file mode 100644 (file)
index 207e675..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: alto-northbound-route-costmap-impl yang module local name: alto-northbound-route-costmap-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Dec 08 16:37:14 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.costmap.impl.rev151021;
-public class AltoNorthboundRouteCostmapModuleFactory extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.costmap.impl.rev151021.AbstractAltoNorthboundRouteCostmapModuleFactory {
-
-}
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/alto-core/standard-northbound-routes/costmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644 (file)
index 0000000..bfa1763
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+  <odl:rpc-service id='altoModelCostmapService'
+    interface='org.opendaylight.alto.core.northbound.route.costmap.impl.AltoModelCostmapService' />
+  <bean id="provider"
+    class="org.opendaylight.alto.core.northbound.route.costmap.impl.AltoNorthboundRouteCostmap"
+    init-method="init" destroy-method="close">
+    <property name='mapService' ref='altoModelCostmapService' />
+  </bean>
+</blueprint>
diff --git a/alto-core/standard-northbound-routes/costmap/impl/src/main/yang/alto-northbound-route-costmap-impl.yang b/alto-core/standard-northbound-routes/costmap/impl/src/main/yang/alto-northbound-route-costmap-impl.yang
deleted file mode 100644 (file)
index af8c831..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-module alto-northbound-route-costmap-impl {
-    yang-version 1;
-    namespace "urn:alto:northbound:route:costmap:impl";
-    prefix "alto-northbound-router-costmap-impl";
-
-    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for northbound project";
-
-    revision "2015-10-21" {
-        description
-            "Initial revision";
-    }
-
-    identity alto-northbound-route-costmap-impl {
-        base config:module-type;
-        config:java-name-prefix AltoNorthboundRouteCostmap;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case alto-northbound-route-costmap {
-            when "/config:modules/config:module/config:type = 'alto-northbound-route-costmap-impl'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container alto-northbound-router {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity alto-northbound:alto-northbound-router;
-                    }
-                }
-            }
-        }
-    }
-}
index 8a00544f8a1c00956efe0c5349711f9052131515..dd9b8f60da0babff62aef45df0c8b9c1fa759190 100644 (file)
@@ -91,13 +91,11 @@ public class AltoNorthboundCostmapTest {
         AltoNorthboundRouteCostmap costmap = new AltoNorthboundRouteCostmap();
         AltoNorthboundRouteCostmap costmapSpy = spy(costmap);
         AltoModelCostmapService mapService = mock(AltoModelCostmapService.class);
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
-//        doReturn("").when(mapService).query()
 
         //configure mock
         doReturn(ctagIID).when(costmapSpy).getResourceByPath(eq(path),(ReadOnlyTransaction) anyObject());
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        costmapSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -129,7 +127,7 @@ public class AltoNorthboundCostmapTest {
                 return null;
             }
         });
-        when(session.getRpcService(AltoModelCostmapService.class)).thenReturn(new AltoModelCostmapService() {
+        costmapSpy.setMapService(new AltoModelCostmapService() {
             @Override
             public Future<RpcResult<QueryOutput>> query(QueryInput queryInput) {
                 return null;
@@ -137,7 +135,7 @@ public class AltoNorthboundCostmapTest {
         });
 
         //start test
-        costmapSpy.onSessionInitiated(session);
+        costmapSpy.init();
         QueryInput input = costmapSpy.prepareInput(path,costmode,costmetri,pid_source,pid_destination);
 
         CostmapRequest request = (CostmapRequest)input.getRequest();
@@ -173,7 +171,6 @@ public class AltoNorthboundCostmapTest {
         //mock config
         final AltoNorthboundRouteCostmap costmap = new AltoNorthboundRouteCostmap();
         AltoNorthboundRouteCostmap costmapSpy = spy(costmap);
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
 
         AltoModelCostmapService costmapService = mock(AltoModelCostmapService.class);
@@ -212,9 +209,9 @@ public class AltoNorthboundCostmapTest {
         when(future.get()).thenReturn(rpcResult);
         when(costmapService.query((QueryInput) anyObject())).thenReturn(future);
 
-        when(session.getRpcService(AltoModelCostmapService.class)).thenReturn(costmapService);
+        costmapSpy.setMapService(costmapService);
 
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        costmapSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -255,7 +252,7 @@ public class AltoNorthboundCostmapTest {
         doReturn(meta).when(costmapSpy).buildMeta((InstanceIdentifier<?>) anyObject(), (RFC7285CostType)anyObject());
 
         //start test
-        costmapSpy.onSessionInitiated(session);
+        costmapSpy.init();
         Response response = costmapSpy.getFilteredMap(path,filter);
         String responseStr = response.getEntity().toString();
         ObjectMapper mapper = new ObjectMapper();
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/default-config.xml b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index 5f300b2..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 Yale University 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:alto:northbound:route:endpointcost:impl?module=alto-northbound-route-endpointcost-impl&amp;revision=2015-10-21</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-      <capability>urn:alto:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
-  </required-capabilities>
-  <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:alto:northbound:route:endpointcost:impl">prefix:alto-northbound-route-endpointcost-impl</type>
-          <name>alto-northbound-route-endpointcost</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-          <alto-northbound-router>
-            <type xmlns:alto-northbound-router="urn:alto:northbound">alto-northbound-router:alto-northbound-router</type>
-            <name>alto-northbound-router</name>
-          </alto-northbound-router>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/maven-metadata-local.xml b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index 8896458..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.alto.core</groupId>
-  <artifactId>alto-northbound-impl</artifactId>
-  <version>0.3.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151105030453</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>0.3.0-SNAPSHOT</value>
-        <updated>20151105030453</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
index 94094286e8be9d17f2ad0b24c2d60c73f788a1a0..2fdb4282823ce77498bd4402cec4f0a6edfa0646 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.alto.core.northbound.route.endpointcost.impl;
 
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -17,7 +20,7 @@ import org.opendaylight.alto.core.northbound.api.AltoNorthboundRoute;
 import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285CostType;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285Endpoint;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -84,7 +87,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
 
-public class AltoNorthboundRouteEndpointcost implements BindingAwareProvider, AutoCloseable, AltoNorthboundRoute {
+public class AltoNorthboundRouteEndpointcost implements AltoNorthboundRoute {
     public static final String ENDPOINTCOST_ROUTE = "endpointcost";
 
     public static final String ALTO_ENDPOINTCOST_FILTER = "application/alto-endpointcostfilter+json";
@@ -99,18 +102,27 @@ public class AltoNorthboundRouteEndpointcost implements BindingAwareProvider, Au
 
     private ObjectMapper mapper = new ObjectMapper();
     private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundRouteEndpointcost.class);
-    private static DataBroker m_dataBroker = null;
+
+    private DataBroker dataBroker = null;
+
     private AltoNorthboundRouter m_router = null;
 
     private  static AltoModelEndpointcostService mapService = null;
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        m_dataBroker = session.getSALService(DataBroker.class);
-        if (m_dataBroker == null) {
+    public void setDataBroker(DataBroker dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    public void setMapService(final AltoModelEndpointcostService mapService) {
+        this.mapService = mapService;
+    }
+
+    public void init() {
+
+        if (dataBroker == null) {
             LOG.error("Failed to init: data broker is null");
         }
 
-        mapService = session.getRpcService(AltoModelEndpointcostService.class);
+
         LOG.info("AltoNorthboundRouteEndpointcost initiated");
 
     }
@@ -120,7 +132,6 @@ public class AltoNorthboundRouteEndpointcost implements BindingAwareProvider, Au
         m_router.addRoute("endpointcost", new AltoNorthboundRouteEndpointcost());
     }
 
-    @Override
     public void close() {
         m_router.removeRoute("endpointcost");
     }
@@ -296,7 +307,7 @@ public class AltoNorthboundRouteEndpointcost implements BindingAwareProvider, Au
         endpointcostRequestBuilder.setEndpointcostParams(endpointcostParamsBuilder.build());
 
         //create servicereference by getting contexttag from resourcepool
-        ReadOnlyTransaction rtx = m_dataBroker.newReadOnlyTransaction();
+        ReadOnlyTransaction rtx = dataBroker.newReadOnlyTransaction();
         InstanceIdentifier<ContextTag> ctagIID = getResourceByPath(path, rtx);
         if(ctagIID == null){
             return null;
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModule.java b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModule.java
deleted file mode 100644 (file)
index c5e3bcf..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointcost.impl.rev151021;
-
-import org.opendaylight.alto.core.northbound.route.endpointcost.impl.AltoNorthboundRouteEndpointcost;
-
-public class AltoNorthboundRouteEndpointcostModule extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointcost.impl.rev151021.AbstractAltoNorthboundRouteEndpointcostModule {
-    public AltoNorthboundRouteEndpointcostModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AltoNorthboundRouteEndpointcostModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointcost.impl.rev151021.AltoNorthboundRouteEndpointcostModule 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() {
-        AltoNorthboundRouteEndpointcost endpointcost = new AltoNorthboundRouteEndpointcost();
-        getBrokerDependency().registerProvider(endpointcost);
-        endpointcost.register(getAltoNorthboundRouterDependency());
-        return endpointcost;
-    }
-
-}
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModuleFactory.java b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointcost/impl/rev151021/AltoNorthboundRouteEndpointcostModuleFactory.java
deleted file mode 100644 (file)
index 82915cc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: alto-northbound-route-endpointcost-impl yang module local name: alto-northbound-route-endpointcost-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Sat Jan 02 16:06:35 CST 2016
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointcost.impl.rev151021;
-public class AltoNorthboundRouteEndpointcostModuleFactory extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointcost.impl.rev151021.AbstractAltoNorthboundRouteEndpointcostModuleFactory {
-
-}
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644 (file)
index 0000000..0dafeb6
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+  <odl:rpc-service id='altoModelEndpointcostService'
+    interface='org.opendaylight.alto.core.northbound.route.endpointcost.impl.AltoModelEndpointcostService' />
+  <bean id="provider"
+    class="org.opendaylight.alto.core.northbound.route.endpointcost.impl.AltoNorthboundRouteEndpointcost"
+    init-method="init" destroy-method="close">
+    <property name='mapService' ref='altoModelEndpointcostService' />
+  </bean>
+</blueprint>
diff --git a/alto-core/standard-northbound-routes/endpointcost/impl/src/main/yang/alto-northbound-route-endpointcost-impl.yang b/alto-core/standard-northbound-routes/endpointcost/impl/src/main/yang/alto-northbound-route-endpointcost-impl.yang
deleted file mode 100644 (file)
index b30828e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-module alto-northbound-route-endpointcost-impl {
-    yang-version 1;
-    namespace "urn:alto:northbound:route:endpointcost:impl";
-    prefix "alto-northbound-router-endpointcost-impl";
-
-    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for northbound project";
-
-    revision "2015-10-21" {
-        description
-            "Initial revision";
-    }
-
-    identity alto-northbound-route-endpointcost-impl {
-        base config:module-type;
-        config:java-name-prefix AltoNorthboundRouteEndpointcost;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case alto-northbound-route-endpointcost {
-            when "/config:modules/config:module/config:type = 'alto-northbound-route-endpointcost-impl'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container alto-northbound-router {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity alto-northbound:alto-northbound-router;
-                    }
-                }
-            }
-        }
-    }
-}
index 6f36932217910fc165987396fb0a8cef6507c521..da5f16fea6fee5e93f75b07099730a3906ddf2bb 100644 (file)
@@ -114,12 +114,11 @@ public class AltoNorthboundEndpointcostTest {
         AltoNorthboundRouteEndpointcost endpointcost = new AltoNorthboundRouteEndpointcost();
         AltoNorthboundRouteEndpointcost endpointcostSpy = spy(endpointcost);
 
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
 
         //configure mock
         doReturn(ctagIID).when(endpointcostSpy).getResourceByPath(eq(path),(ReadOnlyTransaction) anyObject());
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        endpointcostSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -151,7 +150,7 @@ public class AltoNorthboundEndpointcostTest {
                 return null;
             }
         });
-        when(session.getRpcService(AltoModelEndpointcostService.class)).thenReturn(new AltoModelEndpointcostService() {
+        endpointcostSpy.setMapService(new AltoModelEndpointcostService() {
             @Override
             public Future<RpcResult<QueryOutput>> query(QueryInput queryInput) {
                 return null;
@@ -159,7 +158,7 @@ public class AltoNorthboundEndpointcostTest {
         });
 
         //start test
-        endpointcostSpy.onSessionInitiated(session);
+        endpointcostSpy.init();
         QueryInput input = endpointcostSpy.prepareInput(path,costmode,costmetri,endpoints_source,endpoints_destination);
         EndpointcostRequest request = (EndpointcostRequest)input.getRequest();
         EndpointcostParams params = request.getEndpointcostParams();
@@ -219,7 +218,6 @@ public class AltoNorthboundEndpointcostTest {
         //mock config
         AltoNorthboundRouteEndpointcost endpointcost = new AltoNorthboundRouteEndpointcost();
         AltoNorthboundRouteEndpointcost endpointcostSpy = spy(endpointcost);
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
 
         AltoModelEndpointcostService endpointcostService = mock(AltoModelEndpointcostService.class);
@@ -283,7 +281,7 @@ public class AltoNorthboundEndpointcostTest {
         when(future.get()).thenReturn(rpcResult);
         when(endpointcostService.query((QueryInput)anyObject())).thenReturn(future);
 
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        endpointcostSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -315,12 +313,12 @@ public class AltoNorthboundEndpointcostTest {
                 return null;
             }
         });
-        when(session.getRpcService(AltoModelEndpointcostService.class)).thenReturn(endpointcostService);
+        endpointcostSpy.setMapService(endpointcostService);
 
         doReturn(ctagIID).when(endpointcostSpy).getResourceByPath(eq(path), (ReadOnlyTransaction)anyObject());
 
         //start test
-        endpointcostSpy.onSessionInitiated(session);
+        endpointcostSpy.init();
         Response response = endpointcostSpy.getFilteredMap(path, filter);
         String surex = response.getEntity().toString();
         ObjectMapper mapper = new ObjectMapper();
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/default-config.xml b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index f89e2cb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 Yale University 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:alto:northbound:route:endpointproperty:impl?module=alto-northbound-route-endpointproperty-impl&amp;revision=2015-10-21</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-      <capability>urn:alto:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
-  </required-capabilities>
-  <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:alto:northbound:route:endpointproperty:impl">prefix:alto-northbound-route-endpointproperty-impl</type>
-          <name>alto-northbound-route-endpointproperty</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-          <alto-northbound-router>
-            <type xmlns:alto-northbound-router="urn:alto:northbound">alto-northbound-router:alto-northbound-router</type>
-            <name>alto-northbound-router</name>
-          </alto-northbound-router>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/maven-metadata-local.xml b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index f403e79..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.alto.core</groupId>
-  <artifactId>alto-northbound-impl</artifactId>
-  <version>0.2.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151105030453</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>0.2.0-SNAPSHOT</value>
-        <updated>20151105030453</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
index 25ec7591834aef72841747706157b45d26a7ccb5..007264a79daf0d8723cfccbef41c307a5fe3ec1b 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.alto.core.northbound.route.endpointproperty.impl;
 
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -15,7 +18,7 @@ import com.google.common.base.Optional;
 import org.opendaylight.alto.core.northbound.api.exception.AltoErrorInvalidFieldValue;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285EndpointPropertyMap;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285VersionTag;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
@@ -81,7 +84,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;
 
-public class AltoNorthboundRouteEndpointproperty implements BindingAwareProvider, AutoCloseable, AltoNorthboundRoute {
+public class AltoNorthboundRouteEndpointproperty implements AltoNorthboundRoute {
     public static final String ALTO_ENDPOINTPROPERTY_FILTER = "application/alto-endpointpropparams+json";
     public static final String ALTO_ENDPOINTPROPERTY = "application/alto-endpointprop+json";
     public static final String FIELD_PROPERTIES = "properties";
@@ -92,17 +95,26 @@ public class AltoNorthboundRouteEndpointproperty implements BindingAwareProvider
 
     private ObjectMapper mapper = new ObjectMapper();
     private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundRouteEndpointproperty.class);
-    private static DataBroker m_dataBroker = null;
+
+    private DataBroker dataBroker = null;
+
     private AltoNorthboundRouter m_router = null;
 
     private  static AltoModelEndpointpropertyService mapService = null;
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        m_dataBroker = session.getSALService(DataBroker.class);
-        if (m_dataBroker == null) {
+    public void setDataBroker(DataBroker dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    public void setMapService(final AltoModelEndpointpropertyService mapService) {
+        this.mapService = mapService;
+    }
+
+    public void init() {
+
+        if (dataBroker == null) {
             LOG.error("Failed to init: data broker is null");
         }
-        mapService = session.getRpcService(AltoModelEndpointpropertyService.class);
+
         LOG.info("AltoNorthboundRouteEndpointProperty initiated");
     }
 
@@ -111,7 +123,6 @@ public class AltoNorthboundRouteEndpointproperty implements BindingAwareProvider
         m_router.addRoute("endpointproperty", new AltoNorthboundRouteEndpointproperty());
     }
 
-    @Override
     public void close() {
         m_router.removeRoute("endpointproperty");
     }
@@ -233,7 +244,7 @@ public class AltoNorthboundRouteEndpointproperty implements BindingAwareProvider
     }
 
     protected QueryInput prepareInput(String path, Iterator<JsonNode> properties, Iterator<JsonNode> endpoints) {
-        ReadOnlyTransaction rtx = m_dataBroker.newReadOnlyTransaction();
+        ReadOnlyTransaction rtx = dataBroker.newReadOnlyTransaction();
         InstanceIdentifier<ContextTag> ctagIID = getResourceByPath(path, rtx);
         if(ctagIID == null){
             return null;
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModule.java b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModule.java
deleted file mode 100644 (file)
index 46b7896..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointproperty.impl.rev151021;
-
-import org.opendaylight.alto.core.northbound.route.endpointproperty.impl.AltoNorthboundRouteEndpointproperty;
-
-public class AltoNorthboundRouteEndpointpropertyModule extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointproperty.impl.rev151021.AbstractAltoNorthboundRouteEndpointpropertyModule {
-    public AltoNorthboundRouteEndpointpropertyModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AltoNorthboundRouteEndpointpropertyModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointproperty.impl.rev151021.AltoNorthboundRouteEndpointpropertyModule 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() {
-        AltoNorthboundRouteEndpointproperty endpointproperty = new AltoNorthboundRouteEndpointproperty();
-        getBrokerDependency().registerProvider(endpointproperty);
-        endpointproperty.register(getAltoNorthboundRouterDependency());
-        return endpointproperty;
-    }
-
-}
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModuleFactory.java b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/endpointproperty/impl/rev151021/AltoNorthboundRouteEndpointpropertyModuleFactory.java
deleted file mode 100644 (file)
index b83b7a9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: alto-northbound-route-endpointproperty-impl yang module local name: alto-northbound-route-endpointproperty-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Dec 08 16:37:14 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointproperty.impl.rev151021;
-public class AltoNorthboundRouteEndpointpropertyModuleFactory extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.endpointproperty.impl.rev151021.AbstractAltoNorthboundRouteEndpointpropertyModuleFactory {
-
-}
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644 (file)
index 0000000..307b267
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+  <odl:rpc-service id='altoModelEndpointpropertyService'
+    interface='org.opendaylight.alto.core.northbound.route.endpointproperty.impl.AltoModelEndpointpropertyService' />
+  <bean id="provider"
+    class="org.opendaylight.alto.core.northbound.route.endpointproperty.impl.AltoNorthboundRouteEndpointproperty"
+    init-method="init" destroy-method="close">
+    <property name='mapService' ref='altoModelEndpointpropertyService' />
+  </bean>
+</blueprint>
diff --git a/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/yang/alto-northbound-route-endpointproperty-impl.yang b/alto-core/standard-northbound-routes/endpointproperty/impl/src/main/yang/alto-northbound-route-endpointproperty-impl.yang
deleted file mode 100644 (file)
index f43aa06..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-module alto-northbound-route-endpointproperty-impl {
-    yang-version 1;
-    namespace "urn:alto:northbound:route:endpointproperty:impl";
-    prefix "alto-northbound-router-endpointproperty-impl";
-
-    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for northbound project";
-
-    revision "2015-10-21" {
-        description
-            "Initial revision";
-    }
-
-    identity alto-northbound-route-endpointproperty-impl {
-        base config:module-type;
-        config:java-name-prefix AltoNorthboundRouteEndpointproperty;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case alto-northbound-route-endpointproperty {
-            when "/config:modules/config:module/config:type = 'alto-northbound-route-endpointproperty-impl'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container alto-northbound-router {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity alto-northbound:alto-northbound-router;
-                    }
-                }
-            }
-        }
-
-    }
-}
index 3fdddf3ca3894b636db5c8a44a3246c2992638d7..9a4916ebb4e1d4171a170994d1ac674a39787ffc 100644 (file)
@@ -104,7 +104,6 @@ public class AltoNorthboundRouteEndpointpropertyTest {
     public void testPrepareInput() {
 
         AltoNorthboundRouteEndpointproperty anbreSpy = spy(anbre);
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
         JsonNode filterNode = EndpointpropertyRouteChecker.checkJsonSyntax(ENDPOINTPROPERTY_FILTER);
         JsonNode _properties = filterNode.get(AltoNorthboundRouteEndpointproperty.FIELD_PROPERTIES);
@@ -113,7 +112,7 @@ public class AltoNorthboundRouteEndpointpropertyTest {
         doReturn(ctagIID)
             .when(anbreSpy)
             .getResourceByPath(eq(PATH), (ReadOnlyTransaction) anyObject());
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        anbreSpy.setDataBroker(new DataBroker() {
             @Override public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
             }
@@ -144,7 +143,7 @@ public class AltoNorthboundRouteEndpointpropertyTest {
             }
         });
 
-        anbreSpy.onSessionInitiated(session);
+        anbreSpy.init();
         QueryInput input = anbreSpy.prepareInput(PATH, _properties.elements(), _endpoints.elements());
         EndpointpropertyRequest request = (EndpointpropertyRequest)input.getRequest();
         EndpointpropertyParams params = request.getEndpointpropertyParams();
@@ -190,7 +189,6 @@ public class AltoNorthboundRouteEndpointpropertyTest {
     @Test
     public void testBuildOutput() throws IOException, ExecutionException, InterruptedException{
         AltoNorthboundRouteEndpointproperty anbreSpy = spy(anbre);
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
 
         AltoModelEndpointpropertyService epService = mock(AltoModelEndpointpropertyService.class);
@@ -269,8 +267,8 @@ public class AltoNorthboundRouteEndpointpropertyTest {
         when(rpcResult.getResult()).thenReturn(queryOutputBuilder.build());
         when(future.get()).thenReturn(rpcResult);
         when(epService.query((QueryInput) anyObject())).thenReturn(future);
-        when(session.getRpcService(AltoModelEndpointpropertyService.class)).thenReturn(epService);
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        anbreSpy.setMapService(epService);
+        anbreSpy.setDataBroker(new DataBroker() {
             @Override public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
             }
@@ -309,7 +307,7 @@ public class AltoNorthboundRouteEndpointpropertyTest {
         meta.netmap_tags.add(vtag);
         doReturn(meta).when(anbreSpy).buildMeta((InstanceIdentifier<?>) anyObject());
 
-        anbreSpy.onSessionInitiated(session);
+        anbreSpy.init();
         Response response = anbreSpy.getEndpointProperty(PATH, ENDPOINTPROPERTY_FILTER);
         String stringResponse = response.getEntity().toString();
         ObjectMapper mapper = new ObjectMapper();
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/config/default-config.xml b/alto-core/standard-northbound-routes/networkmap/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index cee0140..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 Yale University 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:alto:northbound:route:networkmap:impl?module=alto-northbound-route-networkmap-impl&amp;revision=2015-10-21</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-      <capability>urn:alto:northbound?module=alto-northbound&amp;revision=2015-10-21</capability>
-  </required-capabilities>
-  <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:alto:northbound:route:networkmap:impl">prefix:alto-northbound-route-networkmap-impl</type>
-          <name>alto-northbound-route-networkmap</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-          <alto-northbound-router>
-            <type xmlns:alto-northbound-router="urn:alto:northbound">alto-northbound-router:alto-northbound-router</type>
-            <name>alto-northbound-router</name>
-          </alto-northbound-router>
-        </module>
-      </modules>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/config/maven-metadata-local.xml b/alto-core/standard-northbound-routes/networkmap/impl/src/main/config/maven-metadata-local.xml
deleted file mode 100644 (file)
index a48a9a5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.opendaylight.alto.core</groupId>
-  <artifactId>alto-northbound-impl</artifactId>
-  <version>0.2.1-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <localCopy>true</localCopy>
-    </snapshot>
-    <lastUpdated>20151105030453</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <classifier>config</classifier>
-        <extension>xml</extension>
-        <value>0.2.1-SNAPSHOT</value>
-        <updated>20151105030453</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
index c323ce36d08649b9b802bede8363c1b6c5052e29..5bda889a0c1b539a3c1e81929adf6786e37e5f6c 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.alto.core.northbound.route.networkmap.impl;
 
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -38,7 +41,7 @@ import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285NetworkMap;
 import org.opendaylight.alto.core.northbound.api.utils.rfc7285.RFC7285Endpoint.AddressGroup;
 
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -78,7 +81,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class AltoNorthboundRouteNetworkmap implements BindingAwareProvider, AutoCloseable, AltoNorthboundRoute {
+public class AltoNorthboundRouteNetworkmap implements AltoNorthboundRoute {
     public static final String NETWORKMAP_ROUTE = "networkmap";
 
     public static final String ALTO_NETWORKMAP_FILTER = "application/alto-networkmapfilter+json";
@@ -89,17 +92,26 @@ public class AltoNorthboundRouteNetworkmap implements BindingAwareProvider, Auto
 
     private ObjectMapper mapper = new ObjectMapper();
     private static final Logger LOG = LoggerFactory.getLogger(AltoNorthboundRouteNetworkmap.class);
-    private static DataBroker m_dataBroker = null;
+
+    private DataBroker dataBroker = null;
+
     private AltoNorthboundRouter m_router = null;
 
     private  static AltoModelNetworkmapService mapService = null;
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        m_dataBroker = session.getSALService(DataBroker.class);
-        if (m_dataBroker == null) {
+    public void setDataBroker(DataBroker dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    public void setMapService(final AltoModelNetworkmapService mapService) {
+        this.mapService = mapService;
+    }
+
+    public void init() {
+
+        if (dataBroker == null) {
             LOG.error("Failed to init: data broker is null");
         }
-        mapService = session.getRpcService(AltoModelNetworkmapService.class);
+
         LOG.info("AltoNorthboundRouteNetworkmap initiated");
     }
 
@@ -108,7 +120,6 @@ public class AltoNorthboundRouteNetworkmap implements BindingAwareProvider, Auto
         m_router.addRoute("networkmap", new AltoNorthboundRouteNetworkmap());
     }
 
-    @Override
     public void close() {
         m_router.removeRoute("networkmap");
     }
@@ -216,7 +227,7 @@ public class AltoNorthboundRouteNetworkmap implements BindingAwareProvider, Auto
         //TODO
         QueryInputBuilder queryInputBuilder = new QueryInputBuilder();
 
-        ReadOnlyTransaction rtx = m_dataBroker.newReadOnlyTransaction();
+        ReadOnlyTransaction rtx = dataBroker.newReadOnlyTransaction();
         InstanceIdentifier<ContextTag> ctagIID = getResourceByPath(path, rtx);
         if(ctagIID == null){
             return null;
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModule.java b/alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModule.java
deleted file mode 100644 (file)
index 4890142..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021;
-
-import org.opendaylight.alto.core.northbound.route.networkmap.impl.AltoNorthboundRouteNetworkmap;
-
-public class AltoNorthboundRouteNetworkmapModule extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021.AbstractAltoNorthboundRouteNetworkmapModule {
-    public AltoNorthboundRouteNetworkmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public AltoNorthboundRouteNetworkmapModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021.AltoNorthboundRouteNetworkmapModule 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() {
-        AltoNorthboundRouteNetworkmap networkmap = new AltoNorthboundRouteNetworkmap();
-        getBrokerDependency().registerProvider(networkmap);
-        networkmap.register(getAltoNorthboundRouterDependency());
-
-        return networkmap;
-    }
-
-}
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactory.java b/alto-core/standard-northbound-routes/networkmap/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactory.java
deleted file mode 100644 (file)
index 3bb0317..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: alto-northbound-route-networkmap-impl yang module local name: alto-northbound-route-networkmap-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Nov 05 12:06:09 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021;
-public class AltoNorthboundRouteNetworkmapModuleFactory extends org.opendaylight.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021.AbstractAltoNorthboundRouteNetworkmapModuleFactory {
-
-}
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/alto-core/standard-northbound-routes/networkmap/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644 (file)
index 0000000..c5f45f8
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+  <odl:rpc-service id='altoModelNetworkmapService'
+    interface='org.opendaylight.alto.core.northbound.route.networkmap.impl.AltoModelNetworkmapService' />
+  <bean id="provider"
+    class="org.opendaylight.alto.core.northbound.route.networkmap.impl.AltoNorthboundRouteNetworkmap"
+    init-method="init" destroy-method="close">
+    <property name='mapService' ref='altoModelNetworkmapService' />
+  </bean>
+</blueprint>
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/main/yang/alto-northbound-route-networkmap-impl.yang b/alto-core/standard-northbound-routes/networkmap/impl/src/main/yang/alto-northbound-route-networkmap-impl.yang
deleted file mode 100644 (file)
index 7cb874f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-module alto-northbound-route-networkmap-impl {
-    yang-version 1;
-    namespace "urn:alto:northbound:route:networkmap:impl";
-    prefix "alto-northbound-router-networkmap-impl";
-
-    import alto-northbound { prefix alto-northbound; revision-date 2015-10-21; }
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for northbound project";
-
-    revision "2015-10-21" {
-        description
-            "Initial revision";
-    }
-
-    identity alto-northbound-route-networkmap-impl {
-        base config:module-type;
-        config:java-name-prefix AltoNorthboundRouteNetworkmap;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case alto-northbound-route-networkmap {
-            when "/config:modules/config:module/config:type = 'alto-northbound-route-networkmap-impl'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container alto-northbound-router {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity alto-northbound:alto-northbound-router;
-                    }
-                }
-            }
-        }
-    }
-}
index 18fb8d7b0d96db2b9062a25c289377e2f3e09843..f4d555eb7af5dee33f5c6f2ce69b92e6c7744509 100644 (file)
@@ -22,7 +22,6 @@ import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 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.TransactionChainListener;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.alto.resourcepool.rev150921.context.resource.ContextTag;
@@ -85,17 +84,15 @@ public class AltoNorthboundNetworkmapTest {
     @Test
     public void testprepareInput() throws JsonProcessingException{
 
-
         //configure the mock
         AltoNorthboundRouteNetworkmap networkmap = new AltoNorthboundRouteNetworkmap();
         AltoNorthboundRouteNetworkmap networkmapSpy = spy(networkmap);
 
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
         doReturn(ctagIID).when(networkmapSpy).getResourceByPath(eq(path), (ReadOnlyTransaction) anyObject());
         doReturn( AddressTypeIpv4.class).when(networkmapSpy).getAddressTypeByName(eq("ipv4"), eq(path), (ReadOnlyTransaction)anyObject());
         doReturn( AddressTypeIpv6.class).when(networkmapSpy).getAddressTypeByName(eq("ipv6"), eq(path), (ReadOnlyTransaction)anyObject());
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        networkmapSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -127,14 +124,13 @@ public class AltoNorthboundNetworkmapTest {
                 return null;
             }
         });
-        when(session.getRpcService(AltoModelNetworkmapService.class)).thenReturn(new AltoModelNetworkmapService() {
+        networkmapSpy.setMapService(new AltoModelNetworkmapService() {
             @Override
             public Future<RpcResult<QueryOutput>> query(QueryInput queryInput) {
                 return null;
             }
         });
 
-        networkmapSpy.onSessionInitiated(session);
         QueryInput input = networkmapSpy.prepareInput(path, pids, addressTypes);
         NetworkmapRequest request = (NetworkmapRequest)input.getRequest();
         PidName pid1 = request.getNetworkmapFilter().getPid().get(0);
@@ -153,7 +149,6 @@ public class AltoNorthboundNetworkmapTest {
         AltoNorthboundRouteNetworkmap networkmap = new AltoNorthboundRouteNetworkmap();
         AltoNorthboundRouteNetworkmap networkmapSpy = spy(networkmap);
 
-        BindingAwareBroker.ProviderContext session = mock(BindingAwareBroker.ProviderContext.class);
         InstanceIdentifier<ContextTag> ctagIID = InstanceIdentifier.create(ContextTag.class);
         doReturn(ctagIID).when(networkmapSpy).getResourceByPath(eq(path), (ReadOnlyTransaction) anyObject());
         doReturn( AddressTypeIpv4.class).when(networkmapSpy).getAddressTypeByName(eq("ipv4"), eq(path), (ReadOnlyTransaction)anyObject());
@@ -209,8 +204,8 @@ public class AltoNorthboundNetworkmapTest {
         when(rpcResult.getResult()).thenReturn(queryOutputBuilder.build());
         when(future.get()).thenReturn(rpcResult);
         when(networkmapService.query((QueryInput)anyObject())).thenReturn(future);
-        when(session.getRpcService(AltoModelNetworkmapService.class)).thenReturn(networkmapService);
-        when(session.getSALService(DataBroker.class)).thenReturn(new DataBroker() {
+        networkmapSpy.setMapService(networkmapService);
+        networkmapSpy.setDataBroker(new DataBroker() {
             @Override
             public ReadOnlyTransaction newReadOnlyTransaction() {
                 return null;
@@ -245,7 +240,7 @@ public class AltoNorthboundNetworkmapTest {
 
         doReturn(new RFC7285NetworkMap.Meta()).when(networkmapSpy).buildMeta((InstanceIdentifier<?>)anyObject());
         //start test
-        networkmapSpy.onSessionInitiated(session);
+        networkmapSpy.init();
         Response response = networkmapSpy.getFilteredMap(path, filter);
         String surex = response.getEntity().toString();
         ObjectMapper mapper = new ObjectMapper();
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactoryTest.java b/alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleFactoryTest.java
deleted file mode 100644 (file)
index 1887c9b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright © 2015 Yale University 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.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021;
-
-import org.junit.Test;
-
-public class AltoNorthboundRouteNetworkmapModuleFactoryTest {
-    @Test
-    public void testFactoryConstructor() {
-        // ensure no exceptions on construction
-        new AltoNorthboundRouteNetworkmapModuleFactory();
-    }
-}
diff --git a/alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleTest.java b/alto-core/standard-northbound-routes/networkmap/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/alto/northbound/route/networkmap/impl/rev151021/AltoNorthboundRouteNetworkmapModuleTest.java
deleted file mode 100644 (file)
index d9eabb6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2015 Yale University 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.yang.gen.v1.urn.alto.northbound.route.networkmap.impl.rev151021;
-
-import org.junit.Test;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.alto.core.northbound.api.AltoNorthboundRouter;
-
-import javax.management.ObjectName;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class AltoNorthboundRouteNetworkmapModuleTest {
-    @Test
-    public void testCustomValidation() {
-        AltoNorthboundRouteNetworkmapModule module = new AltoNorthboundRouteNetworkmapModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
-
-        // ensure no exceptions on validation
-        // currently this method is empty
-        module.customValidation();
-    }
-
-    @Test
-    public void testCreateInstance() throws Exception {
-        // configure mocks
-        DependencyResolver dependencyResolver = mock(DependencyResolver.class);
-        BindingAwareBroker broker = mock(BindingAwareBroker.class);
-        AltoNorthboundRouter router = mock(AltoNorthboundRouter.class);
-        when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
-        when(dependencyResolver.resolveInstance(eq(AltoNorthboundRouter.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(router);
-
-        // create instance of module with injected mocks
-        AltoNorthboundRouteNetworkmapModule module = new AltoNorthboundRouteNetworkmapModule(mock(ModuleIdentifier.class), dependencyResolver);
-
-        // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
-        AutoCloseable closeable = module.getInstance();
-
-        // ensure no exceptions on close
-        closeable.close();
-
-        // verify that the route is released after closed
-        verify(router).removeRoute("networkmap");
-    }
-}
index 3adc1119d17f804aada70c6612789ec3554c0be5..26f9e74909da4ba10ef00bb9b0064a910e1abccd 100644 (file)
@@ -127,14 +127,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <version>${project.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.alto.core</groupId>
-      <artifactId>alto-northbound-impl</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
-
     <dependency>
       <groupId>org.opendaylight.alto.core</groupId>
       <artifactId>alto-northbound-route-networkmap-api</artifactId>
@@ -147,14 +139,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <version>${project.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.alto.core</groupId>
-      <artifactId>alto-northbound-route-networkmap-impl</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
-
     <dependency>
       <groupId>org.opendaylight.alto.core</groupId>
       <artifactId>alto-northbound-route-costmap-api</artifactId>
@@ -167,14 +151,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <version>${project.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.alto.core</groupId>
-      <artifactId>alto-northbound-route-costmap-impl</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
-
     <dependency>
       <groupId>org.opendaylight.alto.core</groupId>
       <artifactId>alto-northbound-route-endpointcost-api</artifactId>
@@ -187,14 +163,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <version>${project.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.alto.core</groupId>
-      <artifactId>alto-northbound-route-endpointcost-impl</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
-
     <dependency>
       <groupId>org.opendaylight.alto.core</groupId>
       <artifactId>alto-northbound-route-endpointproperty-api</artifactId>
@@ -207,14 +175,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <version>${project.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.opendaylight.alto.core</groupId>
-      <artifactId>alto-northbound-route-endpointproperty-impl</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
-
     <dependency>
       <groupId>org.opendaylight.alto.core</groupId>
       <artifactId>alto-service-model-ird-api</artifactId>
index 5fb19fa72e84aa974d5d79347dad4af9fdfc56a6..7f039e116d36bca20f30294d0ac4352dd43830c5 100644 (file)
@@ -101,9 +101,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-impl/${project.version}</bundle>
-    <configfile finalname="${configfile.directory}/alto-northbound.xml">
-      mvn:org.opendaylight.alto.core/alto-northbound-impl/${project.version}/xml/config
-    </configfile>
   </feature>
 
   <feature name='odl-alto-standard-service-models' version='${project.version}'
@@ -129,27 +126,15 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-networkmap-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-networkmap-impl/${project.version}</bundle>
-    <configfile finalname="${configfile.directory}/alto-northbound-route-networkmap.xml">
-        mvn:org.opendaylight.alto.core/alto-northbound-route-networkmap-impl/${project.version}/xml/config
-    </configfile>
 
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-impl/${project.version}</bundle>
-    <configfile finalname="${configfile.directory}/alto-northbound-route-costmap.xml">
-      mvn:org.opendaylight.alto.core/alto-northbound-route-costmap-impl/${project.version}/xml/config
-    </configfile>
 
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-impl/${project.version}</bundle>
-    <configfile finalname="${configfile.directory}/alto-northbound-route-endpointcost.xml">
-      mvn:org.opendaylight.alto.core/alto-northbound-route-endpointcost-impl/${project.version}/xml/config
-    </configfile>
 
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointproperty-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.alto.core/alto-northbound-route-endpointproperty-impl/${project.version}</bundle>
-    <configfile finalname="${configfile.directory}/alto-northbound-route-endpointproperty.xml">
-      mvn:org.opendaylight.alto.core/alto-northbound-route-endpointproperty-impl/${project.version}/xml/config
-    </configfile>
   </feature>
 
   <feature name='odl-alto-standard-resource-translator' version='${project.version}'
diff --git a/utils/migrate_blueprint.sh b/utils/migrate_blueprint.sh
new file mode 100755 (executable)
index 0000000..2182159
--- /dev/null
@@ -0,0 +1,201 @@
+##############################################################################
+# Copyright (c) 2016 SNLab. 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
+##############################################################################
+#!/bin/bash
+
+recursive_remove() {
+    DIR=$1
+
+    rmdir $DIR
+    while [ $? = 0 ]; do
+        DIR=$(dirname $DIR)
+        if [ $DIR = . ]; then
+            break
+        fi
+        rmdir $DIR
+    done
+}
+
+migrate_blueprint() {
+    pushd $1
+
+    PROVIDER=$(grep -rnl src/main/java -e '^\W*public void onSessionInitiated.*$')
+    PROVIDER_CLASS=$(echo $PROVIDER | sed 's_src/main/java/__;s/.java//;s_/_._g')
+    PROVIDER_NAME=$(basename $PROVIDER | sed 's/.java//')
+    PACKAGE=$(dirname $PROVIDER | sed 's_src/main/java/__;s_/_._g')
+
+    #----------------------
+    # extract flags
+    DB_FLAG=$(grep 'DataBroker' $PROVIDER)
+    RPC_FLAG=$(grep 'RpcRegistration' $PROVIDER)
+    ROUTED_RPC_FLAG=$(grep 'RoutedRpcRegistration' $PROVIDER)
+    RPC_CONSUME_LIST=$(grep 'getRpcService' $PROVIDER | \
+        sed 's/^\W*\([a-zA-Z_]\+\) *=.*getRpcService( *\([a-zA-Z]\+\)\.class *).*$/\1,\2/')
+
+    #----------------------
+    # remove redundancy
+    rm -rf src/main/config src/main/yang
+    for mf in $(find src/main -name '*Module.java'); do
+        rm $mf
+        recursive_remove $(dirname $mf)
+    done;
+
+    for mf in $(find src/main -name '*ModuleFactory.java'); do
+        rm $mf
+        recursive_remove $(dirname $mf)
+    done;
+
+    for mf in $(find src/test -name '*ModuleTest.java'); do
+        rm $mf
+        recursive_remove $(dirname $mf)
+    done;
+
+    for mf in $(find src/test -name '*ModuleFactoryTest.java'); do
+        rm $mf
+        recursive_remove $(dirname $mf)
+    done;
+
+    #----------------------
+    # insert blueprint
+    BLUEPRINT_DIR=src/main/resources/org/opendaylight/blueprint
+    mkdir -p $BLUEPRINT_DIR
+    echo '<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2016 SNLab 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">' > $BLUEPRINT_DIR/impl-blueprint.xml
+
+    ## insert dataBroker
+    if [[ $DB_FLAGS ]]; then
+        echo '  <reference id="dataBroker"
+    interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+    odl:type="default" />' >> $BLUEPRINT_DIR/impl-blueprint.xml
+    fi
+
+    ## insert rpcRegistry
+    ## TODO:
+
+    ## insert routedRpcRegistry
+    ## TODO:
+
+    ## insert rpcService
+    for rpc in $RPC_CONSUME_LIST; do
+        SERV_NAME=$(echo $rpc | sed 's/^.*,//')
+        SERV_CLASS=$(grep "^import .*\.$SERV_NAME;" $PROVIDER | sed 's/^import \(.*\);$/\1/')
+        if [[ $SERV_CLASS ]]; then
+            SERV_CLASS="$PACKAGE.$SERV_NAME"
+        fi
+        SERV_ID=$(echo ${SERV_NAME:0:1} | tr '[:upper:]' '[:lower:]')${SERV_NAME:1}
+        echo "  <odl:rpc-service id='$SERV_ID'
+    interface='$SERV_CLASS' />" >> $BLUEPRINT_DIR/impl-blueprint.xml
+    done
+
+    ## insert provider
+    echo '  <bean id="provider"
+    class="'$PROVIDER_CLASS'"
+    init-method="init" destroy-method="close">' >> $BLUEPRINT_DIR/impl-blueprint.xml
+    if [[ $DB_FLAGS ]]; then
+        echo '    <property name="dataBroker" ref="dataBroker" />' >> $BLUEPRINT_DIR/impl-blueprint.xml
+    fi
+    for rpc in $RPC_CONSUME_LIST; do
+        SERV_VAL=$(echo $rpc | sed 's/,.*$//')
+        SERV_NAME=$(echo $rpc | sed 's/^.*,//')
+        SERV_ID=$(echo ${SERV_NAME:0:1} | tr '[:upper:]' '[:lower:]')${SERV_NAME:1}
+        echo "    <property name='$SERV_VAL' ref='$SERV_ID' />" >> $BLUEPRINT_DIR/impl-blueprint.xml
+    done
+    echo '  </bean>
+</blueprint>' >> $BLUEPRINT_DIR/impl-blueprint.xml
+
+    #----------------------
+    # refactor init class
+    sed -i '
+        s/^import .*ProviderContext;\n$//
+        s/^import .*BindingAwareProvider;\n$//
+        /@Override/{
+            N
+            s/^\W*@Override\n *public void onSessionInitiated.*/    public void init() {/
+            s/^\W*@Override\n\( *public void close().*\)/\1/
+        }
+        s/ BindingAwareProvider,\?//
+        s/ AutoCloseable,\?//
+        s/implements *{/{/
+    ' $PROVIDER
+
+    ## refactor dataBroke
+    if [[ $DB_FLAG ]]; then
+        ### refactor dataBroker variable name
+        DB_VAL=$(grep '^\W*private .* DataBroker' $PROVIDER | \
+            sed 's/^\W*private.* DataBroker *\([a-zA-Z_]\+\).*$/\1/')
+        sed -i "
+            s/^.*DataBroker.*$//
+            /^package/a\\\n\nimport org.opendaylight.controller.md.sal.binding.api.DataBroker;
+            /private static final Logger/a\\\n    private DataBroker dataBroker = null;
+            /public void init()/i\    public void setDataBroker(DataBroker dataBroker) {\n        this.dataBroker = dataBroker;\n    }\n
+            s/$DB_VAL/dataBroker/g
+        " $PROVIDER
+    fi
+
+    ## refactor rpcService
+    sed -i 's/^\W*\([a-zA-Z_]\+\) *=.*getRpcService.*$//' $PROVIDER
+    for rpc in $RPC_CONSUME_LIST; do
+        SERV_VAL=$(echo $rpc | sed 's/,.*$//')
+        SERV_NAME=$(echo $rpc | sed 's/^.*,//')
+        SERV_SET_VAL=set$(echo ${SERV_VAL:0:1} | tr '[:lower:]' '[:upper:]')${SERV_VAL:1}
+        sed -i "
+            /public void init()/i\    public void $SERV_SET_VAL(final $SERV_NAME $SERV_VAL) {\n        this.$SERV_VAL = $SERV_VAL;\n    }\n
+        " $PROVIDER
+    done
+
+    popd
+}
+
+usage() {
+    echo "Usage: $0 [option]"
+    echo ""
+    echo "Options:"
+    echo "    all        migrate all subprojects"
+    echo "    <dir>      only migrate subprojects in <dir>"
+    echo "    help       display help information"
+}
+
+if [ -z $1 ]; then
+    usage
+    exit 0
+fi
+
+case $1 in
+    all)
+        # Migrate all subproject
+        cd $(dirname $0)/..
+        PROJECT_ROOT=$(pwd)
+
+        for suffix in alto-{core,basic,extensions}; do
+            for f in $(find $PROJECT_ROOT -name pom.xml); do
+                if [ $(basename $(dirname $f)) = impl ]; then
+                    migrate_blueprint $(dirname $f)
+                fi
+            done
+        done
+    ;;
+    help)
+        usage
+        ;;
+    *)
+        # Migrate a specific directory
+        for f in $(find $1 -name pom.xml); do
+            if [ $(basename $(dirname $f)) = impl ]; then
+                migrate_blueprint $(dirname $f)
+            fi
+        done
+esac
similarity index 94%
rename from migrate_namespace.sh
rename to utils/migrate_namespace.sh
index bc9cff1bea96b7c9fe40d19c9525fec40e061583..43ea1e01bfdac342bb52ca7f6dc0811b12366846 100755 (executable)
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2016 <Company or Individual>. All rights reserved.
+# Copyright (c) 2016 SNLab. 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,