From: Rashmi Pujar Date: Fri, 9 Sep 2016 21:02:06 +0000 (-0400) Subject: Add BP wiring for sfc-sb-rest X-Git-Tag: release/carbon~163 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=8a6be46e6ad1b41db5d852861c8413b62a77d886;p=sfc.git Add BP wiring for sfc-sb-rest Change-Id: I5d55db2e18842e7f915b383a2c9976fca76e980e Signed-off-by: Rashmi Pujar --- diff --git a/features/pom.xml b/features/pom.xml index e524dc065..0a1434b85 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -270,14 +270,6 @@ Put dependencies for configfiles directly referenced in your features.xml file. For every reference in your features.xml file, you need a corresponding dependency here. --> - - - ${project.groupId} - sfc-sb-rest - ${project.version} - xml - config - ${project.groupId} diff --git a/features/src/main/features/features.xml b/features/src/main/features/features.xml index 4bc9792c3..b94ec92b5 100644 --- a/features/src/main/features/features.xml +++ b/features/src/main/features/features.xml @@ -110,7 +110,6 @@ mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/{{VERSION}} mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/{{VERSION}} mvn:org.glassfish/javax.json/{{VERSION}} - mvn:org.opendaylight.sfc/sfc-sb-rest/{{VERSION}}/xml/config diff --git a/sfc-sb-rest/pom.xml b/sfc-sb-rest/pom.xml index aefd4043e..fec1836f7 100644 --- a/sfc-sb-rest/pom.xml +++ b/sfc-sb-rest/pom.xml @@ -14,7 +14,6 @@ ${project.build.directory}/generated-sources/config - configuration/initial/sfc-sb-rest-initial.xml @@ -72,24 +71,6 @@ org.codehaus.mojo build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/${configfile} - xml - config - - - - - diff --git a/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModule.java b/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModule.java index c8e6351c7..ad3a2a185 100755 --- a/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModule.java +++ b/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModule.java @@ -8,78 +8,29 @@ package org.opendaylight.controller.config.yang.config.sfc_sb_rest_provider.impl; import java.util.concurrent.ExecutionException; + import org.opendaylight.sfc.provider.OpendaylightSfc; import org.opendaylight.sfc.sbrest.provider.keepalive.SbRestKeepAliveSocket; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestAclEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestRspEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestScfEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestSfEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestSffEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestSfgEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestSfstEntryDataListener; -import org.opendaylight.sfc.sbrest.provider.listener.SbRestSfstateEntryDataListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SfcSbRestProviderModule extends AbstractSfcSbRestProviderModule { +public class SfcSbRestProviderModule implements AutoCloseable{ private static final Logger LOG = LoggerFactory.getLogger(SfcSbRestProviderModule.class); + private static OpendaylightSfc opendaylightSfc; - public SfcSbRestProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public SfcSbRestProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.sfc_sb_rest_provider.impl.SfcSbRestProviderModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); + public void startSbRestKeepAliveSocket() { + opendaylightSfc = OpendaylightSfc.getOpendaylightSfcObj(); + opendaylightSfc.getExecutor().execute(new SbRestKeepAliveSocket()); } @Override - public void customValidation() { - // add custom validation form module attributes here. - } - - @Override - public java.lang.AutoCloseable createInstance() { - - final OpendaylightSfc opendaylightSfc = OpendaylightSfc.getOpendaylightSfcObj(); - - final SbRestSfEntryDataListener sbRestSfEntryDataListener = new SbRestSfEntryDataListener(opendaylightSfc); - final SbRestSfgEntryDataListener sbRestSfgEntryDataListener = new SbRestSfgEntryDataListener(opendaylightSfc); - final SbRestSffEntryDataListener sbRestSffEntryDataListener = new SbRestSffEntryDataListener(opendaylightSfc); - final SbRestRspEntryDataListener sbRestRspEntryDataListener = new SbRestRspEntryDataListener(opendaylightSfc); - final SbRestAclEntryDataListener sbRestAclEntryDataListener = new SbRestAclEntryDataListener(opendaylightSfc); - final SbRestScfEntryDataListener sbRestScfEntryDataListener = new SbRestScfEntryDataListener(opendaylightSfc); - final SbRestSfstEntryDataListener sbRestSfstEntryDataListener = new SbRestSfstEntryDataListener(opendaylightSfc); - final SbRestSfstateEntryDataListener sbRestSfstateEntryDataListener = new SbRestSfstateEntryDataListener(opendaylightSfc); - final SbRestKeepAliveSocket sbRestKeepAliveSocket = new SbRestKeepAliveSocket(); - opendaylightSfc.getExecutor().execute(sbRestKeepAliveSocket); - - - // close() - final class AutoCloseableSfcSbRest implements AutoCloseable { - - @Override - public void close() { - sbRestSfEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestSfgEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestSffEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestRspEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestAclEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestScfEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestSfstEntryDataListener.getDataChangeListenerRegistration().close(); - sbRestSfstateEntryDataListener.getDataChangeListenerRegistration().close(); - - try { - opendaylightSfc.close(); - } catch (ExecutionException | InterruptedException e) { - LOG.error("\nFailed to close SfcSbRestProvider instance {} cleanly", this); - } - LOG.info("SfcSbRestProvider (instance {}) torn down", this); - } + public void close() throws Exception { + try { + opendaylightSfc.close(); + } catch (ExecutionException | InterruptedException e) { + LOG.error("Failed to close OpendaylightSfc instance {} cleanly", this); } - - return new AutoCloseableSfcSbRest(); } - -} +} \ No newline at end of file diff --git a/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModuleFactory.java b/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModuleFactory.java deleted file mode 100755 index 085d2db36..000000000 --- a/sfc-sb-rest/src/main/java/org/opendaylight/controller/config/yang/config/sfc_sb_rest_provider/impl/SfcSbRestProviderModuleFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -/* -* Generated file -* -* Generated from: yang module name: sfc-sb-rest-provider-impl yang module local name: sfc-sb-rest-provider-impl -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Tue Oct 21 13:03:57 CEST 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ -package org.opendaylight.controller.config.yang.config.sfc_sb_rest_provider.impl; -public class SfcSbRestProviderModuleFactory extends org.opendaylight.controller.config.yang.config.sfc_sb_rest_provider.impl.AbstractSfcSbRestProviderModuleFactory { - -} diff --git a/sfc-sb-rest/src/main/resources/configuration/initial/sfc-sb-rest-initial.xml b/sfc-sb-rest/src/main/resources/configuration/initial/sfc-sb-rest-initial.xml deleted file mode 100644 index 80c8f2a11..000000000 --- a/sfc-sb-rest/src/main/resources/configuration/initial/sfc-sb-rest-initial.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - sbrest:sfc-sb-rest-provider-impl - - sfc-sb-rest-provider-impl - - - binding:binding-async-data-broker - binding-data-broker - - - - - - - - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28 - urn:opendaylight:params:xml:ns:yang:controller:config:sfc-provider:impl?module=sfc-provider-impl&revision=2014-06-30 - urn:opendaylight:params:xml:ns:yang:controller:config:sfc-sb-rest-provider:impl?module=sfc-sb-rest-provider-impl&revision=2014-10-20 - - - \ No newline at end of file diff --git a/sfc-sb-rest/src/main/resources/org/opendaylight/blueprint/sfc-sb-rest.xml b/sfc-sb-rest/src/main/resources/org/opendaylight/blueprint/sfc-sb-rest.xml new file mode 100644 index 000000000..5af9ef315 --- /dev/null +++ b/sfc-sb-rest/src/main/resources/org/opendaylight/blueprint/sfc-sb-rest.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sfc-sb-rest/src/main/yang/sfc-sb-rest-provider-impl.yang b/sfc-sb-rest/src/main/yang/sfc-sb-rest-provider-impl.yang deleted file mode 100755 index 742848a2f..000000000 --- a/sfc-sb-rest/src/main/yang/sfc-sb-rest-provider-impl.yang +++ /dev/null @@ -1,46 +0,0 @@ -module sfc-sb-rest-provider-impl { - - yang-version 1; - namespace "urn:opendaylight:params:xml:ns:yang:controller:config:sfc-sb-rest-provider:impl"; - prefix "sfc-sb-rest-provider-impl"; - - import config { prefix config; revision-date 2013-04-05; } - import rpc-context { prefix rpcx; revision-date 2013-06-17; } - import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } - - - description - "This module contains the base YANG definitions for - sfc-sb-rest-provider implementation."; - - revision "2014-10-20" { - description - "Initial revision."; - } - - // This is the definition of the service implementation as a module identity - identity sfc-sb-rest-provider-impl { - base config:module-type; - - // Specifies the prefix for generated java classes. - config:java-name-prefix SfcSbRestProvider; - } - - - // Augments the 'configuration' choice node under modules/module. - augment "/config:modules/config:module/config:configuration" { - case sfc-sb-rest-provider-impl { - when "/config:modules/config:module/config:type = 'sfc-sb-rest-provider-impl'"; - - //wires in the data-broker service - container data-broker { - uses config:service-ref { - refine type { - mandatory false; - config:required-identity mdsal:binding-async-data-broker; - } - } - } - } - } -}