From d7d5ea0fe2e9bf6c5222174df2bdd80192b9d6ee Mon Sep 17 00:00:00 2001 From: gaurav Date: Wed, 18 Jul 2018 19:39:10 +0530 Subject: API for RestconfClient API for RestconfClient including: - RestconfApiCallNode - RestconfDiscoveryNode Change-Id: Ieda6251b91b6d399cd0106993c3fdd1a440d5b0a Issue-ID: CCSDK-371 Signed-off-by: Gaurav Agrawal --- .../restconfapicall/RestconfapiCallNode.java | 65 ++++++++++++ .../restconfdiscovery/RestconfDiscoveryNode.java | 25 +++++ .../restconfdiscovery/SvcLogicDiscoveryPlugin.java | 110 +++++++++++++++++++++ .../META-INF/spring/restconf-client-context.xml | 48 +++++++++ .../spring/restconf-client-osgi-context.xml | 32 ++++++ .../blueprint/restconf-client-blueprint.xml | 41 ++++++++ 6 files changed, 321 insertions(+) create mode 100644 restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfapiCallNode.java create mode 100644 restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java create mode 100644 restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SvcLogicDiscoveryPlugin.java create mode 100644 restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-context.xml create mode 100644 restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-osgi-context.xml create mode 100755 restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml (limited to 'restconf-client/provider/src/main') diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfapiCallNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfapiCallNode.java new file mode 100644 index 00000000..87cb92bc --- /dev/null +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfapiCallNode.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CCSDK + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.sli.plugins.restconfapicall; + +import java.util.Map; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; + +/** + * Representation of a plugin to enable RESTCONF based CRUD operations from DG. + */ +public class RestconfapiCallNode implements SvcLogicJavaPlugin { + + public RestconfapiCallNode() { + } + + /** + * Allows Directed Graphs the ability to interact with RESTCONF APIs. + * @param parameters HashMap of parameters passed by the DG to this function + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parameterMandatory/Optionaldescriptionexample values
templateFileNameOptionalfull path to YANG directory that can be used to build a request/sdncopt/bvc/resconfapi/test
restapiUrlMandatoryurl to send the request tohttps://sdncodl:8543/restconf/operations/L3VNF-API:create-update-vnf-request
restapiUserOptionaluser name to use for http basic authenticationsdnc_ws
restapiPasswordOptionalunencrypted password to use for http basic authenticationplain_password
contentTypeOptionalhttp content type to set in the http headerusually application/json or application/xml
formatOptionalshould match request body formatjson or xml
httpMethodOptionalhttp method to use when sending the requestget post put delete patch
responsePrefixOptionallocation the response will be written to in context memorytmp.resconftapi.result
skipSendingOptionaltrue or false
convertResponse Optionalwhether the response should be convertedtrue or false
customHttpHeadersOptionala list additional http headers to be passed in, follow the format in the exampleX-CSI-MessageId=messageId,headerFieldName=headerFieldValue
dumpHeadersOptionalwhen true writes http header content to context memorytrue or false
+ * @param ctx Reference to context memory + * @throws SvcLogicException + * @since 11.0.2 + * @see String#split(String, int) + */ + public void sendRequest(Map paramMap, SvcLogicContext ctx) throws SvcLogicException { + //TODO + } + +} diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java new file mode 100644 index 00000000..9eaa6791 --- /dev/null +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java @@ -0,0 +1,25 @@ +package org.onap.ccsdk.sli.plugins.restconfdiscovery; + +import java.util.Map; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + +/** + * Created by root1 on 18/7/18. + */ +public class RestconfDiscoveryNode implements SvcLogicDiscoveryPlugin { + + @Override + public void establishSubscription(Map paramMap, SvcLogicContext ctx) { + + } + + @Override + public void modifySubscription(Map paramMap, SvcLogicContext ctx) { + + } + + @Override + public void deleteSubscription(Map paramMap, SvcLogicContext ctx) { + + } +} diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SvcLogicDiscoveryPlugin.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SvcLogicDiscoveryPlugin.java new file mode 100644 index 00000000..183d2229 --- /dev/null +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/SvcLogicDiscoveryPlugin.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CCSDK + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.sli.plugins.restconfdiscovery; + +import java.util.Map; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; + +/** + * Abstraction of a plugin to enable discovery from DG. + */ +public interface SvcLogicDiscoveryPlugin extends SvcLogicJavaPlugin { + + /** + * Allows directed graphs to establish a discovery subscription for a given subscriber. + * @param paramMap HashMap of parameters passed by the DG to this function + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parameterMandatory/Optionaldescriptionexample values
templateDirNameOptionalfull path to YANG directory that can be used to build a request/sdncopt/bvc/resconfapi/test
establishSubscriptionURLMandatoryurl to establish connection with serverhttps://127.0.0.1:8181/restconf/operations/ietf-subscribed-notifications:establish-subscription
sseConnectURLMandatoryurl to setup SSE connection with serverhttps://127.0.0.1:8181/restconf/streams/yang-push-json
callbackDGMandatorycallback DG to process the received notificationResource-Discovery:handleSOTNTopology
filterURLOptionalurl which needs to be subscribed, if null subscribe to allhttp://example.com/sample-data/1.0
subscriptionTypeOptionaltype of subscription, periodic or onDataChangeonDataChange
updateFrequencyOptionalupdate frequency in milli seconds when subscription type is periodic1000
restapiUserOptionaluser name to use for http basic authenticationsdnc_ws
restapiPasswordOptionalunencrypted password to use for http basic authenticationplain_password
contentTypeOptionalhttp content type to set in the http headerusually application/json or application/xml
formatOptionalshould match request body formatjson or xml
responsePrefixOptionallocation the notification response will be written to in context memorytmp.restconfdiscovery.result
skipSendingOptionaltrue or false
convertResponse Optionalwhether the response should be convertedtrue or false
customHttpHeadersOptionala list additional http headers to be passed in, follow the format in the exampleX-CSI-MessageId=messageId,headerFieldName=headerFieldValue
dumpHeadersOptionalwhen true writes http header content to context memorytrue or false
+ * @param ctx Reference to context memory + * @throws SvcLogicException + * @since 11.0.2 + * @see String#split(String, int) + */ + void establishSubscription(Map paramMap, SvcLogicContext ctx); + + /** + * Allows directed graphs to modify a discovery subscription for a given subscriber. + * @param paramMap HashMap of parameters passed by the DG to this function + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parameterMandatory/Optionaldescriptionexample values
subscriberIdMandatorysubscription subscriber's identifiertopologyId/1111
templateDirNameOptionalfull path to YANG directory that can be used to build a request/sdncopt/bvc/resconfapi/test
establishSubscriptionURLMandatoryurl to establish connection with serverhttps://127.0.0.1:8181/restconf/operations/ietf-subscribed-notifications:establish-subscription
sseConnectURLMandatoryurl to setup SSE connection with serverhttps://127.0.0.1:8181/restconf/streams/yang-push-json
callbackDGMandatorycallback DG to process the received notificationResource-Discovery:handleSOTNTopology
filterURLOptionalurl filter list which needs to be subscribed, if null subscribe to allhttp://example.com/sample-data/1.0
subscriptionTypeOptionaltype of subscription, periodic or onDataChangeonDataChange
updateFrequencyOptionalupdate frequency in milli seconds when subscription type is periodic1000
restapiUserOptionaluser name to use for http basic authenticationsdnc_ws
restapiPasswordOptionalunencrypted password to use for http basic authenticationplain_password
contentTypeOptionalhttp content type to set in the http headerusually application/json or application/xml
formatOptionalshould match request body formatjson or xml
responsePrefixOptionallocation the notification response will be written to in context memorytmp.restconfdiscovery.result
skipSendingOptionaltrue or false
convertResponse Optionalwhether the response should be convertedtrue or false
customHttpHeadersOptionala list additional http headers to be passed in, follow the format in the exampleX-CSI-MessageId=messageId,headerFieldName=headerFieldValue
dumpHeadersOptionalwhen true writes http header content to context memorytrue or false
+ * @param ctx Reference to context memory + * @throws SvcLogicException + * @since 11.0.2 + * @see String#split(String, int) + */ + void modifySubscription(Map paramMap, SvcLogicContext ctx); + + /** + * Allows directed graphs to delete the discovery subscription for a given subscriber. + * @param paramMap HashMap of parameters passed by the DG to this function + * + * + * + * + * + *
parameterMandatory/Optionaldescriptionexample values
subscriberIdMandatorysubscription subscriber's identifiertopologyId/1111
+ * @param ctx Reference to context memory + * @throws SvcLogicException + */ + void deleteSubscription(Map paramMap, SvcLogicContext ctx); + +} diff --git a/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-context.xml b/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-context.xml new file mode 100644 index 00000000..d7fa61c5 --- /dev/null +++ b/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-context.xml @@ -0,0 +1,48 @@ + + + + + + + + + file:${SDNC_CONFIG_DIR}/ueb.properties + file:${SDNC_CONFIG_DIR}/dme2.properties + + + + + + + + + + + + + + + + + diff --git a/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-osgi-context.xml b/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-osgi-context.xml new file mode 100644 index 00000000..d56e2fc1 --- /dev/null +++ b/restconf-client/provider/src/main/resources/META-INF/spring/restconf-client-osgi-context.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml b/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml new file mode 100755 index 00000000..149ed9fc --- /dev/null +++ b/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + org.onap.ccsdk.sli.plugins.restconfapicall.RestconfapiCallNode + + + + + + org.onap.ccsdk.sli.plugins.restconfdiscovery.RestconfDiscoveryNode + + + + \ No newline at end of file -- cgit 1.2.3-korg