diff options
Diffstat (limited to 'ms/blueprintsprocessor')
9 files changed, 46 insertions, 59 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt index a0f653591..69b9d70bf 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt @@ -66,8 +66,15 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ } override fun disconnect() { - if (rpcService.closeSession(false).status.equals( - RpcStatus.FAILURE, true)) { + var retryNum = 3 + while(rpcService.closeSession(false).status + .equals(RpcStatus.FAILURE, true) &&retryNum>0) { + log.error("disconnect: graceful disconnect failed, attempt $retryNum") + retryNum--; + } + //if we can't close the session, try to force terminate. + if(retryNum == 0) { + log.error("disconnect: trying to force-terminate the session.") rpcService.closeSession(true) } try { @@ -276,6 +283,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ */ @Throws(IOException::class) private fun close() { + log.debug("close was called.") session.close() // Closes the socket which should interrupt the streamHandler channel.close() diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties index 320b08e85..b44dba30a 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/resources/event.properties @@ -18,7 +18,7 @@ # ============LICENSE_END========================================================= # -#TransportType-Specify which way user want to use. I.e. <HTTPAAF,DME2,HTTPAUTH > +#TransportType-Specify which way user want to use. I.e. <HTTPAAF,HTTPAUTH > Protocol =http partition=1 contenttype = application/json diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt index b68627fec..182d5defa 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt @@ -57,7 +57,6 @@ class RestLibConstants { const val TYPE_SSL_BASIC_AUTH = "ssl-basic-auth" const val TYPE_SSL_TOKEN_AUTH = "ssl-token-auth" const val TYPE_SSL_NO_AUTH = "ssl-no-auth" - const val TYPE_DME2_PROXY = "dme2-proxy" const val TYPE_POLICY_MANAGER = "policy-manager" } -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt index 1e6e23b86..ea32a1635 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt @@ -52,16 +52,6 @@ open class TokenAuthRestClientProperties : RestClientProperties() { var token: String? = null } -open class DME2RestClientProperties : RestClientProperties() { - lateinit var service: String - lateinit var subContext: String - lateinit var version: String - lateinit var envContext: String - lateinit var routeOffer: String - var partner: String? = null - lateinit var appId: String -} - open class PolicyManagerRestClientProperties : RestClientProperties() { lateinit var env: String lateinit var clientAuth: String diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt index 384946ae8..9a7b3c303 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt @@ -76,9 +76,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: RestLibConstants.TYPE_SSL_NO_AUTH -> { sslNoAuthRestClientProperties(prefix) } - RestLibConstants.TYPE_DME2_PROXY -> { - dme2ProxyClientProperties(prefix) - } + RestLibConstants.TYPE_POLICY_MANAGER -> { policyManagerRestClientProperties(prefix) } @@ -99,9 +97,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: RestLibConstants.TYPE_BASIC_AUTH -> { JacksonUtils.readValue(jsonNode, BasicAuthRestClientProperties::class.java)!! } - RestLibConstants.TYPE_DME2_PROXY -> { - JacksonUtils.readValue(jsonNode, DME2RestClientProperties::class.java)!! - } + RestLibConstants.TYPE_POLICY_MANAGER -> { JacksonUtils.readValue(jsonNode, PolicyManagerRestClientProperties::class.java)!! } @@ -134,9 +130,6 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: is BasicAuthRestClientProperties -> { return BasicAuthRestClientService(restClientProperties) } - is DME2RestClientProperties -> { - return DME2ProxyRestClientService(restClientProperties) - } else -> { throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type} uri: ${restClientProperties.url}") } @@ -187,12 +180,6 @@ open class BluePrintRestLibPropertyService(private var bluePrintProperties: prefix, SSLRestClientProperties::class.java) } - private fun dme2ProxyClientProperties(prefix: String): - DME2RestClientProperties { - return bluePrintProperties.propertyBeanType( - prefix, DME2RestClientProperties::class.java) - } - private fun policyManagerRestClientProperties(prefix: String): PolicyManagerRestClientProperties { return bluePrintProperties.propertyBeanType( diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt deleted file mode 100644 index 8e0a2d3f0..000000000 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/DME2ProxyRestClientService.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © 2017-2019 AT&T, Bell Canada - * - * 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. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor.rest.service - -import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties - -class DME2ProxyRestClientService(restClientProperties: RestClientProperties) : BlueprintWebClientService { - override fun defaultHeaders(): Map<String, String> { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun host(uri: String): String { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } -}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt index bf251f6c3..10cc0a44a 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt @@ -21,9 +21,13 @@ import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BlueprintSortByOption import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.monoMdc import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.springframework.core.io.Resource +import org.springframework.data.domain.Page +import org.springframework.data.domain.PageRequest +import org.springframework.data.domain.Sort import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.http.codec.multipart.FilePart @@ -56,6 +60,16 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint return this.bluePrintModelHandler.allBlueprintModel() } + @GetMapping("/paged", produces = [MediaType.APPLICATION_JSON_VALUE]) + @ResponseBody + @PreAuthorize("hasRole('USER')") + fun allBlueprintModel(@RequestParam(defaultValue = "20") limit: Int, + @RequestParam(defaultValue = "0") offset: Int, + @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption): Page<BlueprintModelSearch> { + val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName) + return this.bluePrintModelHandler.allBlueprintModel(pageRequest) + } + @DeleteMapping("/{id}") @Throws(BluePrintException::class) @PreAuthorize("hasRole('USER')") diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt index 526e92cea..f4b006867 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt @@ -33,6 +33,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCach import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils import org.springframework.core.io.ByteArrayResource import org.springframework.core.io.Resource +import org.springframework.data.domain.Page import org.springframework.http.HttpHeaders import org.springframework.http.MediaType import org.springframework.http.ResponseEntity @@ -41,6 +42,8 @@ import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional import java.io.IOException import java.util.* +import org.springframework.data.domain.Pageable + /** * BlueprintModelHandler Purpose: Handler service to handle the request from BlurPrintModelRest @@ -69,6 +72,15 @@ open class BluePrintModelHandler(private val blueprintsProcessorCatalogService: } /** + * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database + * + * @return List<BlueprintModelSearch> list of the controller blueprint archives + </BlueprintModelSearch> */ + open fun allBlueprintModel(pageRequest: Pageable): Page<BlueprintModelSearch> { + return blueprintModelSearchRepository.findAll(pageRequest) + } + + /** * This is a saveBlueprintModel method * * @param filePart filePart diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt new file mode 100644 index 000000000..6f5636516 --- /dev/null +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt @@ -0,0 +1,6 @@ +package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils + +enum class BlueprintSortByOption(val columnName: String) { + DATE("createdDate"), + NAME("artifactName") +}
\ No newline at end of file |