aboutsummaryrefslogtreecommitdiffstats
path: root/vnfapi/provider
diff options
context:
space:
mode:
Diffstat (limited to 'vnfapi/provider')
-rw-r--r--vnfapi/provider/pom.xml65
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java22
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java16
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java56
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java34
-rw-r--r--vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml72
-rw-r--r--vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml34
-rw-r--r--vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang65
8 files changed, 46 insertions, 318 deletions
diff --git a/vnfapi/provider/pom.xml b/vnfapi/provider/pom.xml
index c603b4dd..50ceb45e 100644
--- a/vnfapi/provider/pom.xml
+++ b/vnfapi/provider/pom.xml
@@ -21,70 +21,7 @@
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <version>${odl.yangtools.yang.maven.plugin.version}</version>
- <executions>
- <execution>
- <id>config</id>
- <goals>
- <goal>generate-sources</goal>
- </goals>
- <configuration>
- <codeGenerators>
- <generator>
- <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
- <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
- <additionalConfiguration>
- <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
- </additionalConfiguration>
- </generator>
- <generator>
- <codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
- <outputBaseDir>${salGeneratorPath}</outputBaseDir>
- </generator>
- </codeGenerators>
- <inspectDependencies>true</inspectDependencies>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>${odl.sal.api.gen.plugin.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator-plugin</artifactId>
- <version>${odl.yang.jmx.generator.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/classes/initial/vnfapi-provider.xml</file>
- <type>xml</type>
- <classifier>config</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
+
</plugins>
</build>
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
index 9f8696fe..a9f051a2 100644
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
+++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,24 +43,12 @@ public class VNFSDNSvcLogicServiceClient {
private static final Logger LOG = LoggerFactory
.getLogger(VNFSDNSvcLogicServiceClient.class);
- private SvcLogicService svcLogic = null;
+ private final SvcLogicService svcLogic;
- public VNFSDNSvcLogicServiceClient()
+ public VNFSDNSvcLogicServiceClient(final SvcLogicService svcLogicService)
{
- BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+ this.svcLogic = svcLogicService;
- // Get SvcLogicService reference
- ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
- if (sref != null)
- {
- svcLogic = (SvcLogicService) bctx.getService(sref);
-
- }
- else
- {
- LOG.warn("Cannot find service reference for "+SvcLogicService.NAME);
-
- }
}
public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
index 9dd1a2a2..f64cb0be 100644
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
+++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
@@ -169,15 +169,18 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
protected RpcProviderRegistry rpcRegistry;
protected BindingAwareBroker.RpcRegistration<VNFAPIService> rpcRegistration;
+ private VNFSDNSvcLogicServiceClient svcLogicClient;
+
public vnfapiProvider(DataBroker dataBroker2, NotificationPublishService notificationPublishService,
- RpcProviderRegistry rpcProviderRegistry) {
+ RpcProviderRegistry rpcProviderRegistry, VNFSDNSvcLogicServiceClient client) {
this.log.info( "Creating provider for " + appName );
executor = Executors.newFixedThreadPool(1);
dataBroker = dataBroker2;
notificationService = notificationPublishService;
rpcRegistry = rpcProviderRegistry;
+ this.svcLogicClient = client;
initialize();
}
@@ -191,7 +194,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
} catch (Exception e) {
log.error("Caught Exception while trying to load properties file: ", e);
}
- rpcRegistration = rpcRegistry.addRpcImplementation(VNFAPIService.class, this);
+ // rpcRegistration = rpcRegistry.addRpcImplementation(VNFAPIService.class, this);
log.info( "Initialization complete for " + appName );
}
@@ -1104,7 +1107,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -1357,7 +1359,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -1587,7 +1588,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -1797,7 +1797,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -1973,7 +1972,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -2168,7 +2166,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
@@ -2364,7 +2361,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+
Properties respProps = null;
String errorCode = "200";
@@ -2554,7 +2551,6 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
// Call SLI sync method
// Get SvcLogicService reference
- VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
Properties respProps = null;
String errorCode = "200";
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
deleted file mode 100644
index 5150d085..00000000
--- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.opendaylight.yang.gen.v1.org.onap.sdnc.vnfapi.provider.impl.rev140523;
-
-import org.onap.sdnc.vnfapi.vnfapiProvider;
-
-public class VnfapiProviderModule extends org.opendaylight.yang.gen.v1.org.onap.sdnc.vnfapi.provider.impl.rev140523.AbstractVnfapiProviderModule {
- public VnfapiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public VnfapiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.onap.sdnc.vnfapi.provider.impl.rev140523.VnfapiProviderModule 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() {
- final vnfapiProvider provider = new vnfapiProvider(getDataBrokerDependency()
- , getNotificationPublishAdapterDependency()
- , getRpcRegistryDependency());
-
- return new AutoCloseable() {
-
- @Override
- public void close() throws Exception {
- provider.close();
- }
- };
-
- }
-
-}
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
deleted file mode 100644
index bb8eac5a..00000000
--- a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: vnfapi-provider-impl yang module local name: vnfapi-provider-impl
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Nov 08 09:03:40 EST 2016
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.org.onap.sdnc.vnfapi.provider.impl.rev140523;
-public class VnfapiProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.onap.sdnc.vnfapi.provider.impl.rev140523.AbstractVnfapiProviderModuleFactory {
-
-}
diff --git a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
deleted file mode 100644
index 3883f674..00000000
--- a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- openECOMP : SDN-C
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights
- reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<snapshot>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
-
- <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file
- The prefix: inside type should match the prefix of the yang file. -->
- <type xmlns:prefix="org:openecomp:sdnc:vnfapi:provider:impl">
- prefix:vnfapi-provider-impl
- </type>
- <name>vnfapi-provider-impl</name>
-
- <!-- The following sections contain bindings to services defined in the
- *-provider-impl yang file. For example the rpc-registry is required
- because we have a dependency (or augmentation) named "rpc-registry"
- and which binds to the md-sa-binding-registry. If you remove those
- dependencies from the yang file then you can remove them from here. -->
- <rpc-registry>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
- <name>binding-rpc-broker</name>
- </rpc-registry>
-
- <data-broker>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
- <name>binding-data-broker</name>
- </data-broker>
-
- <notification-service>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
- binding:binding-new-notification-publish-service
- </type>
- <name>binding-notification-broker</name>
- </notification-service>
- </module>
-
- </modules>
- </data>
-
- </configuration>
-
- <!-- Required capabilities are basically a listing of all modules that need to be imported before
- our service can be resolved. Capabilities for dependencies defined above are implied which is
- why we do not have define a required capability for the data broker, for example. -->
- <required-capabilities>
- <capability>org:openecomp:sdnc:vnfapi:provider:impl?module=vnfapi-provider-impl&amp;revision=2014-05-23</capability>
- </required-capabilities>
-
-</snapshot>
diff --git a/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml b/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml
new file mode 100644
index 00000000..8741a09f
--- /dev/null
+++ b/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+ <bean id="client" class="org.onap.sdnc.vnfapi.VNFSDNSvcLogicServiceClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.sdnc.vnfapi.vnfapiProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+ <argument ref="client" />
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+
+</blueprint> \ No newline at end of file
diff --git a/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang b/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang
deleted file mode 100644
index 183fa901..00000000
--- a/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang
+++ /dev/null
@@ -1,65 +0,0 @@
-module vnfapi-provider-impl {
-
- yang-version 1;
- namespace "org:onap:sdnc:vnfapi:provider:impl";
- prefix "vnfapi-provider-impl";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
- import opendaylight-sal-binding-broker-impl {
- prefix binding-impl;
- revision-date 2013-10-28;
- }
-
- description
- "This module contains the base YANG definitions for
- vnfapi-provider impl implementation.";
-
- revision "2014-05-23" {
- description
- "Initial revision.";
- }
-
- // This is the definition of the service implementation as a module identity.
- identity vnfapi-provider-impl {
- base config:module-type;
-
- // Specifies the prefix for generated java classes.
- config:java-name-prefix vnfapiProvider;
- }
-
- // Augments the 'configuration' choice node under modules/module.
- // We consume the three main services, RPCs, DataStore, and Notifications
- augment "/config:modules/config:module/config:configuration" {
- case vnfapi-provider-impl {
- when "/config:modules/config:module/config:type = 'vnfapi-provider-impl'";
-
- container rpc-registry {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity mdsal:binding-rpc-registry;
- }
- }
- }
-
- container notification-publish-adapter {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity binding-impl:binding-new-notification-publish-service;
- }
- }
- }
-
- container data-broker {
- uses config:service-ref {
- refine type {
- mandatory false;
- config:required-identity mdsal:binding-async-data-broker;
- }
- }
- }
- }
- }
-}