diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-02-03 14:09:25 +0100 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2021-02-05 22:55:34 +0000 |
commit | 2f9e781a7c3e22bf25df83dcc3ff44b885a80957 (patch) | |
tree | d14ec0201ea7012cfc6c70954dcef6475370cfc9 /sdnr/northbound/ranSlice/provider/src/main | |
parent | 80ebbf5b525b1a251f8e0eebd4a841d85716cf65 (diff) |
Adapt SDNR northbound to Aluminium
Adapt SDNR northbound to Aluminium
Issue-ID: CCSDK-3128
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: Id2dc38d4f2573d5c6aeedfb42349433f22aa86f5
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/northbound/ranSlice/provider/src/main')
6 files changed, 101 insertions, 98 deletions
diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java index f3d2a7da7..0b1d8c512 100644 --- a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java +++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceClient.java @@ -27,7 +27,7 @@ import java.util.Properties; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java index a88595bfb..fbaab938c 100644 --- a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java +++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceProvider.java @@ -27,17 +27,15 @@ import java.util.Date; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.*; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.common.header.CommonHeaderBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200806.status.StatusBuilder; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.slf4j.Logger; @@ -46,8 +44,6 @@ import org.slf4j.LoggerFactory; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceResponseCode.*; - /** * Defines a base implementation for your provider. This class extends from a * helper class which provides storage for the most commonly used components of @@ -97,43 +93,56 @@ public class RANSliceProvider implements AutoCloseable, RanSliceApiService { protected DataBroker dataBroker; protected DOMDataBroker domDataBroker; protected NotificationPublishService notificationService; - protected RpcProviderRegistry rpcRegistry; - private final RANSliceClient RANSliceClient; + protected RpcProviderService rpcProviderRegistry; + private RANSliceClient RANSliceClient; - protected BindingAwareBroker.RpcRegistration<RanSliceApiService> rpcRegistration; + private ObjectRegistration<RanSliceApiService> rpcRegistration; - public RANSliceProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, - final RpcProviderRegistry rpcProviderRegistry, final RANSliceClient rANSliceClient) { + public RANSliceProvider() { LOG.info("Creating provider for {}", APPLICATION_NAME); executor = Executors.newFixedThreadPool(1); + this.dataBroker = null; + this.domDataBroker = null; + this.notificationService = null; + this.rpcProviderRegistry = null; + this.rpcRegistration = null; + this.RANSliceClient = null; + } + + public void setDataBroker(DataBroker dataBroker) { this.dataBroker = dataBroker; - if (dataBroker instanceof AbstractForwardedDataBroker) { - domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate(); - } - notificationService = notificationPublishService; - rpcRegistry = rpcProviderRegistry; - this.RANSliceClient = rANSliceClient; - initialize(); } - public void initialize() { - LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME); + public void setDomDataBroker(DOMDataBroker domDataBroker) { + this.domDataBroker = domDataBroker; + } + + public void setRpcProviderRegistry(RpcProviderService rpcProviderRegistry) { + this.rpcProviderRegistry = rpcProviderRegistry; + } + public void setNotificationPublishService(NotificationPublishService notificationPublishService) { + this.notificationService = notificationPublishService; + } + + public void setClient(RANSliceClient client) { + this.RANSliceClient = client; + } + + public void init() { + LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME); + if (rpcRegistration == null) { - if (rpcRegistry != null) { - rpcRegistration = rpcRegistry.addRpcImplementation(RanSliceApiService.class, this); + if (rpcProviderRegistry != null) { + rpcRegistration = rpcProviderRegistry.registerRpcImplementation(RanSliceApiService.class, this); LOG.info("Initialization complete for {}", APPLICATION_NAME); } else { LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME); } } } - - protected void initializeChild() { - // Override if you have custom initialization intelligence - } - + @Override public void close() throws Exception { LOG.info("Closing provider for " + APPLICATION_NAME); diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java index 814b27e64..77c09d172 100644 --- a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java +++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceResponseCode.java @@ -1,3 +1,24 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2020 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.onap.ccsdk.features.sdnr.northbound.ranSlice; public enum RANSliceResponseCode { diff --git a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java index 18b66312d..3e6fcb4ce 100644 --- a/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java +++ b/sdnr/northbound/ranSlice/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/ranSlice/RANSliceRpcInvocationException.java @@ -1,3 +1,24 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2020 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.onap.ccsdk.features.sdnr.northbound.ranSlice; import org.onap.ccsdk.sli.core.sli.SvcLogicException; diff --git a/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index 57ebfbfcc..000000000 --- a/sdnr/northbound/ranSlice/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ ============LICENSE_START======================================================= - ~ ONAP : ccsdk features - ~ ================================================================================ - ~ Copyright (C) 2020 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======================================================= - ~ - --> - -<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" - xmlns="http://www.osgi.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.ccsdk.features.sdnr.northbound.ranSlice.RANSliceClient"> - <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.ccsdk.features.sdnr.northbound.ranSlice.RANSliceProvider"> - <argument ref="dataBroker"/> - <argument ref="rpcRegistry"/> - <argument ref="notificationService"/> - <argument ref="client"/> - </bean> - - <odl:rpc-implementation ref="provider"/> - -</blueprint> diff --git a/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index 57ebfbfcc..896c0575a 100644 --- a/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/northbound/ranSlice/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -30,21 +30,25 @@ <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.ccsdk.features.sdnr.northbound.ranSlice.RANSliceProvider"> - <argument ref="dataBroker"/> - <argument ref="rpcRegistry"/> - <argument ref="notificationService"/> - <argument ref="client"/> + <reference id="dataBroker" + interface="org.opendaylight.mdsal.binding.api.DataBroker"/> + + <reference id="domDataBroker" + interface="org.opendaylight.mdsal.dom.api.DOMDataBroker"/> + + <reference id="notificationPublishService" + interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" /> + + <reference id="rpcProviderRegistry" + interface="org.opendaylight.mdsal.binding.api.RpcProviderService" /> + + <bean id="provider" class="org.onap.ccsdk.features.sdnr.northbound.ranSlice.RANSliceProvider" + init-method="init" destroy-method="close"> + <property name="dataBroker" ref="dataBroker"/> + <property name="domDataBroker" ref="domDataBroker"/> + <property name="rpcProviderRegistry" ref="rpcProviderRegistry"/> + <property name="notificationPublishService" ref="notificationPublishService"/> + <property name="client" ref="client"/> </bean> <odl:rpc-implementation ref="provider"/> |