diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 12:16:46 -0400 |
---|---|---|
committer | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 13:49:05 -0400 |
commit | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch) | |
tree | 4a821659cf3b50cf946cbb535d528be8508e9fff /components/model-catalog/blueprint-model | |
parent | d97021cd756d63402545fdc2e14ac7611c3da118 (diff) |
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation
Issue-ID: CCSDK-2852
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'components/model-catalog/blueprint-model')
14 files changed, 211 insertions, 202 deletions
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt index fe660f590..61cde0521 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt +++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt @@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -30,8 +29,6 @@ import org.springframework.http.HttpMethod import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class ConfigDeploy : AbstractScriptComponentFunction() {
@@ -53,14 +50,14 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
-
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo::class.java)
log.info("Waiting for 2 minutes until vLB intializes ...")
- //Thread.sleep(120000)
- val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
+ // Thread.sleep(120000)
+ val uri =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
@@ -71,16 +68,18 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
- val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
+ val result: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
print(result)
- basicAuthRestClientProperties.url = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ basicAuthRestClientProperties.url =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ val resultOfGet: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
print(resultOfGet)
- }
- catch (e: Exception) {
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -93,27 +92,36 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { }
class NetconfDeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -123,4 +131,4 @@ class NetconfDeviceInfo { override fun hashCode(): Int {
return javaClass.hashCode()
}
-}
\ No newline at end of file +}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt index b09a432f7..04993cdae 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt +++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt @@ -16,12 +16,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts * limitations under the License.
*/
-
import com.fasterxml.jackson.databind.node.ObjectNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -31,10 +28,6 @@ import org.springframework.http.HttpMethod import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentRemoteScriptExecutor
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class HealthCheck : AbstractScriptComponentFunction() {
@@ -50,47 +43,45 @@ open class HealthCheck : AbstractScriptComponentFunction() { val resolution_key = getDynamicProperties("resolution-key").asText()
log.info("resolution_key: $resolution_key")
- //val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
- //log.info("configuration: $payload")
-
- //val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
- //val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
+ // val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
+ // log.info("configuration: $payload")
+ // val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
+ // val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo2::class.java)
- //log.info("Waiting for 2 minutes until vLB intializes ...")
- //Thread.sleep(120000)
+ // log.info("Waiting for 2 minutes until vLB intializes ...")
+ // Thread.sleep(120000)
val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/operational/health-vnf-onap-plugin:health-vnf-onap-plugin-state/health-check"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
mapOfHeaders.put("Content-Type", "application/json")
- //mapOfHeaders.put("cache-control", " no-cache")
- //mapOfHeaders.put("Accept", "application/json")
+ // mapOfHeaders.put("cache-control", " no-cache")
+ // mapOfHeaders.put("Accept", "application/json")
val basicAuthRestClientProperties: BasicAuthRestClientProperties = BasicAuthRestClientProperties()
basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
log.info(result.body)
val resultJson = JacksonUtils.jsonNode(result.body) as ObjectNode
val health: String = resultJson.get("health-check").get("state").asText()
- super.setAttribute("response-data", resultJson)
+ super.setAttribute("response-data", resultJson)
if (health != "healthy") {
throw Exception("VNF is not healty!!")
}
-
- //basicAuthRestClientProperties.url = //"http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- //val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
- //print(resultOfGet)
- }
- catch (e: Exception) {
+
+ // basicAuthRestClientProperties.url = //"http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ // val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ // print(resultOfGet)
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -103,27 +94,36 @@ open class HealthCheck : AbstractScriptComponentFunction() { }
class NetconfDeviceInfo2 {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -133,4 +133,4 @@ class NetconfDeviceInfo2 { override fun hashCode(): Int {
return javaClass.hashCode()
}
-}
\ No newline at end of file +}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt index ef0876f96..f8ef7f804 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt +++ b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_Kotlin/Scripts/kotlin/kotlin.kt @@ -39,9 +39,9 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val resolution_key = getDynamicProperties("resolution-key").asText()
- log.info("resolution_key: $resolution_key"\n)
+ log.info("resolution_key: $resolution_key"\ n)
val payload = storedContentFromResolvedArtifactNB(resolution_key, "baseconfig")
- log.info("configuration: \n$payload"\n)
+ log.info("configuration: \n$payload"\ n)
log.info("Waiting 1 minute and 30 seconds or vLB to initialize ...")
Thread.sleep(90000)
val netconf_device = netconfDevice("netconf-connection")
@@ -58,8 +58,6 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { //var payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
//var vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
netconf_session.disconnect()
-
-
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt index 578492f33..91b985040 100644 --- a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt +++ b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt @@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
@@ -30,8 +29,6 @@ import org.springframework.http.HttpMethod import org.springframework.web.client.RestTemplate
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
open class ConfigDeploy : AbstractScriptComponentFunction() {
@@ -53,14 +50,14 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { val payloadObject = JacksonUtils.jsonNode(payload) as ObjectNode
val vdns_ip: String = payloadObject.get("vdns-instance")[0].get("ip-addr").asText()
-
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, "restconf-connection")
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement.node!!, requirement.capability!!)
val netconfDeviceInfo = JacksonUtils.getInstanceFromMap(capabilityProperties, NetconfDeviceInfo::class.java)
log.info("Waiting for 2 minutes until vLB intializes ...")
Thread.sleep(120000)
- val uri = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
+ val uri =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances/vdns-instance/$vdns_ip"
val restTemplate = RestTemplate()
val mapOfHeaders = hashMapOf<String, String>()
mapOfHeaders.put("Accept", "application/json")
@@ -71,16 +68,18 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { basicAuthRestClientProperties.username = "admin"
basicAuthRestClientProperties.password = "admin"
basicAuthRestClientProperties.url = uri
- basicAuthRestClientProperties.additionalHeaders =mapOfHeaders
- val basicAuthRestClientService: BasicAuthRestClientService= BasicAuthRestClientService(basicAuthRestClientProperties)
+ basicAuthRestClientProperties.additionalHeaders = mapOfHeaders
+ val basicAuthRestClientService: BasicAuthRestClientService = BasicAuthRestClientService(basicAuthRestClientProperties)
try {
- val result: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
+ val result: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.PUT.name, "", payload)
print(result)
- basicAuthRestClientProperties.url = "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
- val resultOfGet: BlueprintWebClientService.WebClientResponse<String> = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
+ basicAuthRestClientProperties.url =
+ "http://${netconfDeviceInfo.ipAddress}:8183/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin/vdns-instances"
+ val resultOfGet: BlueprintWebClientService.WebClientResponse<String> =
+ basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
print(resultOfGet)
- }
- catch (e: Exception) {
+ } catch (e: Exception) {
log.info("Caught exception trying to connect to vLB!!")
throw BluePrintProcessorException("${e.message}")
}
@@ -93,27 +92,36 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { }
class NetconfDeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 5
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonIgnore
var replyTimeout: Int = 5
+
@get:JsonIgnore
var idleTimeout: Int = 99999
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@@ -123,4 +131,4 @@ class NetconfDeviceInfo { override fun hashCode(): Int {
return javaClass.hashCode()
}
-}
\ No newline at end of file +}
diff --git a/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml b/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml index f39ded7e5..a737ed3e1 100644 --- a/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml +++ b/components/model-catalog/blueprint-model/test-blueprint-kotlin-parent/pom.xml @@ -89,43 +89,6 @@ </resources> <plugins> <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>validate-kotlin</id> - <phase>validate</phase> - <configuration> - <target name="ktlint"> - <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath"> - <arg value="Scripts/kotlin/**/*.kt"/> - </java> - </target> - <skip>${format.skipValidate}</skip> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - <execution> - <!-- Built-in formatter So that you wouldn't have to fix all style violations by hand.--> - <id>format-kotlin</id> - <phase>process-sources</phase> - <configuration> - <target name="ktlint"> - <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath"> - <arg value="-F"/> - <arg value="Scripts/kotlin/**/*.kt"/> - </java> - </target> - <skip>${format.skipExecute}</skip> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <executions> diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt index 698bf330f..d09244868 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt @@ -73,7 +73,8 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = } } artifact( - id = "command-template", type = "artifact-template-velocity", + id = "command-template", + type = "artifact-template-velocity", file = "Templates/check-command-template.vtl" ) } diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/Check.kt index e29055634..e29055634 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/Check.kt diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt index a0ca1676e..ee99b04f9 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/DeviceResourceDefinitions.kt @@ -59,4 +59,4 @@ val deviceResourceDefinitions = BluePrintTypes.resourceDefinitions { } } } -}
\ No newline at end of file +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt index 61783d62f..4e66a05c4 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/ResourceAuditDefinitions.kt @@ -29,55 +29,64 @@ import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions class ResourceAuditDefinitions : AbstractBluePrintDefinitions() { + override fun serviceTemplate(): ServiceTemplate { return defaultServiceTemplate() } } fun ResourceAuditDefinitions.defaultServiceTemplate() = - serviceTemplate(name = "resource-audit", - version = "1.0.0", - author = "Brinda Santh Muthuramalingam", - tags = "brinda, tosca") { + serviceTemplate( + name = "resource-audit", + version = "1.0.0", + author = "Brinda Santh Muthuramalingam", + tags = "brinda, tosca" + ) { - topologyTemplate { + topologyTemplate { - workflow(id = "config-collect", description = "Collect the configuration for Device") { - inputs { - property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "") - property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") { - entrySchema(BluePrintConstants.DATA_TYPE_STRING) - } + workflow(id = "config-collect", description = "Collect the configuration for Device") { + inputs { + property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "") + property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") { + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } - outputs { - property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { - value(getNodeTemplateAttribute(nodeTemplateId = "config-collector", - attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA)) - } - property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { - value(BluePrintConstants.STATUS_SUCCESS) - } + } + outputs { + property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { + value( + getNodeTemplateAttribute( + nodeTemplateId = "config-collector", + attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA + ) + ) + } + property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") { + value(BluePrintConstants.STATUS_SUCCESS) } - step(id = "config-collector", target = "config-collector", description = "Collect the Configuration") } + step(id = "config-collector", target = "config-collector", description = "Collect the Configuration") + } - val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor( - id = "config-collector", description = "Config collector component") { + val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor( + id = "config-collector", + description = "Config collector component" + ) { - definedOperation(description = "Config Collector Operation") { - inputs { - type(BluePrintConstants.SCRIPT_KOTLIN) - scriptClassReference("cba.resource.audit.functions.ConfigCollector") - } - outputs { - status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS)) - responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA)) - } + definedOperation(description = "Config Collector Operation") { + inputs { + type(BluePrintConstants.SCRIPT_KOTLIN) + scriptClassReference("cba.resource.audit.functions.ConfigCollector") + } + outputs { + status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS)) + responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA)) } } - nodeTemplate(configCollectorComponent) } + nodeTemplate(configCollectorComponent) + } - nodeType(BluePrintTypes.nodeTypeComponent()) - nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor()) - }
\ No newline at end of file + nodeType(BluePrintTypes.nodeTypeComponent()) + nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor()) + } diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ConfigCollector.kt index 49d0c7348..7ae27dacc 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ResourceAuditFunctions.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/functions/ConfigCollector.kt @@ -44,13 +44,15 @@ class ConfigCollector : AbstractScriptComponentFunction() { // Set the Attributes setAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive()) - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, """{ + setAttribute( + ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, + """{ "port-speed" : "10MBS" - }""".trimIndent().jsonAsJsonType()) - + } + """.trimIndent().jsonAsJsonType() + ) } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - } -}
\ No newline at end of file +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/PortSpeedRAProcessor.kt index 660f5918b..453c42933 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/RAProcessor.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/resource-audit/Scripts/kotlin/cba/resource/audit/processor/PortSpeedRAProcessor.kt @@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment class PortSpeedRAProcessor : ResourceAssignmentProcessor() { + val log = logger(PortSpeedRAProcessor::class) override fun getName(): String { return "PortSpeedRAProcessor" @@ -31,6 +32,6 @@ class PortSpeedRAProcessor : ResourceAssignmentProcessor() { } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } -}
\ No newline at end of file +} diff --git a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt index 730565959..154792873 100644 --- a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt +++ b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfConfigDeploy.kt @@ -16,10 +16,8 @@ * ============LICENSE_END========================================================= */ - package cba.pnf.config.aai - import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.contentFromResolvedArtifactNB import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB @@ -35,6 +33,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService.WebClientResponse class RestconfConfigDeploy : AbstractScriptComponentFunction() { + private val CONFIGLET_TEMPLATE_NAME = "config-assign" private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist" private val RESTCONF_SERVER_IDENTIFIER = "sdnc" @@ -57,13 +56,15 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() { log.debug("Mounting Device : $deviceID") restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json")) - //Log the current configuration for the subtree + // Log the current configuration for the subtree val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH) log.info("Current configuration subtree : $currentConfig") - //Apply configlet - val result = restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH, - storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME), - mutableMapOf("Content-Type" to "application/yang.patch+json")) as WebClientResponse<*> + // Apply configlet + val result = restconfApplyDeviceConfig( + webclientService, deviceID, CONFIGLET_RESOURCE_PATH, + storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME), + mutableMapOf("Content-Type" to "application/yang.patch+json") + ) as WebClientResponse<*> val jsonResult = mapper.readTree((result.body).toString()) @@ -72,11 +73,10 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() { } else { log.info("Device has been configured succesfully") } - } catch (err: Exception) { log.error("an error occurred while configuring device {}", err) } finally { - //Un mount device + // Un mount device restconfUnMountDevice(webclientService, deviceID, "") } } catch (bpe: BluePrintProcessorException) { @@ -84,10 +84,9 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() { } } - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { log.info("Recover function called!") log.info("Execution request : $executionRequest") log.error("Exception", runtimeException) } -}
\ No newline at end of file +} diff --git a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt index 0540efe80..e238c3e25 100644 --- a/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt +++ b/components/model-catalog/blueprint-model/uat-blueprints/PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt @@ -16,7 +16,6 @@ * ============LICENSE_END========================================================= */ - package cba.pnf.swug import com.fasterxml.jackson.databind.node.ObjectNode @@ -45,10 +44,12 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() { override suspend fun processNB(executionRequest: ExecutionServiceInput) { // Extract request properties - val model= validatedPayload(executionRequest) + val model = validatedPayload(executionRequest) - log.info("Blueprint invoked for ${model.resolutionKey} for SW Upgrade : " + - "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.deviceId}") + log.info( + "Blueprint invoked for ${model.resolutionKey} for SW Upgrade : " + + "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.deviceId}" + ) try { val mountPayload = contentFromResolvedArtifactNB("mount-node") @@ -62,7 +63,6 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() { Action.POST_CHECK -> processPostCheck(model) Action.CANCEL -> processCancel(model) } - } catch (err: Exception) { log.error("an error occurred while configuring device {}", err) } finally { @@ -72,62 +72,72 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() { private fun validatedPayload(executionRequest: ExecutionServiceInput): SoftwareUpgradeModel { val properties = requestPayloadActionProperty(executionRequest.actionIdentifiers.actionName + "-properties")!!.get(0) - if(!properties?.get("pnf-id")?.textValue().isNullOrEmpty() && - !properties?.get("target-software-version")?.textValue().isNullOrEmpty()) { - return SoftwareUpgradeModel(getDynamicProperties("resolution-key").asText(), + if (!properties?.get("pnf-id")?.textValue().isNullOrEmpty() && + !properties?.get("target-software-version")?.textValue().isNullOrEmpty() + ) { + return SoftwareUpgradeModel( + getDynamicProperties("resolution-key").asText(), BluePrintDependencyService.restClientService(RESTCONF_SERVER_IDENTIFIER), properties.get("pnf-id").textValue(), properties.get("target-software-version").textValue(), - Action.getEnumFromActionName(executionRequest.actionIdentifiers.actionName)) - }else{ + Action.getEnumFromActionName(executionRequest.actionIdentifiers.actionName) + ) + } else { throw BluePrintException("Invalid parameters sent to CDS. Request parameters pnf-id or target-software-version missing") } } private suspend fun processPreCheck(model: SoftwareUpgradeModel) { log.debug("In PNF SW upgrade : processPreCheck") - //Log the current configuration for the subtree + // Log the current configuration for the subtree val payloadObject = getCurrentConfig(model) - log.debug("Current sw version on pnf : ${payloadObject.get("software-upgrade")?.get("upgrade-package")?.get(0)?.get("software-version")?.asText()}") + log.debug( + "Current sw version on pnf : ${ + payloadObject.get("software-upgrade")?.get("upgrade-package")?.get(0)?.get("software-version")?.asText() + }" + ) log.info("PNF is Healthy!") } private suspend fun processDownloadNESw(model: SoftwareUpgradeModel) { log.debug("In PNF SW upgrade : processDownloadNESw") - //Check if there is existing config for the targeted software version + // Check if there is existing config for the targeted software version var downloadConfigPayload: String if (checkIfSwReadyToPerformAction(Action.PRE_CHECK, model)) { downloadConfigPayload = contentFromResolvedArtifactNB("configure") - downloadConfigPayload =downloadConfigPayload.replace("%id%", model.yangId) - } - else { + downloadConfigPayload = downloadConfigPayload.replace("%id%", model.yangId) + } else { downloadConfigPayload = contentFromResolvedArtifactNB("download-ne-sw") - model.yangId=model.targetSwVersion + model.yangId = model.targetSwVersion } downloadConfigPayload = downloadConfigPayload.replace("%actionName%", Action.DOWNLOAD_NE_SW.name) log.info("Config Payload to start download : $downloadConfigPayload") - //Apply configlet - restconfApplyDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, downloadConfigPayload, - mutableMapOf("Content-Type" to "application/yang.patch+json")) + // Apply configlet + restconfApplyDeviceConfig( + model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, downloadConfigPayload, + mutableMapOf("Content-Type" to "application/yang.patch+json") + ) - //Poll PNF for Download action's progress + // Poll PNF for Download action's progress checkExecution(model) } private suspend fun processActivateNESw(model: SoftwareUpgradeModel) { log.debug("In PNF SW upgrade : processActivateNESw") - //Check if the software is downloaded and ready to be activated + // Check if the software is downloaded and ready to be activated if (checkIfSwReadyToPerformAction(Action.DOWNLOAD_NE_SW, model)) { var activateConfigPayload: String = contentFromResolvedArtifactNB("configure") activateConfigPayload = activateConfigPayload.replace("%actionName%", Action.ACTIVATE_NE_SW.name) activateConfigPayload = activateConfigPayload.replace("%id%", model.yangId) log.info("Config Payload to start activate : $activateConfigPayload") - //Apply configlet - restconfApplyDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, activateConfigPayload, - mutableMapOf("Content-Type" to "application/yang.patch+json")) + // Apply configlet + restconfApplyDeviceConfig( + model.client, model.deviceId, CONFIGLET_RESOURCE_PATH, activateConfigPayload, + mutableMapOf("Content-Type" to "application/yang.patch+json") + ) - //Poll PNF for Activate action's progress + // Poll PNF for Activate action's progress checkExecution(model) } else { throw BluePrintRetryException("Software Download not completed for device(${model.deviceId}) to activate sw version: ${model.targetSwVersion}") @@ -136,21 +146,23 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() { private suspend fun processPostCheck(model: SoftwareUpgradeModel) { log.info("In PNF SW upgrade : processPostCheck") - //Log the current configuration for the subtree + // Log the current configuration for the subtree if (checkIfSwReadyToPerformAction(Action.POST_CHECK, model)) { log.info("PNF is healthy post activation!") } } - private fun processCancel(model :SoftwareUpgradeModel) { - //This is for future implementation of cancel step during software upgrade + private fun processCancel(model: SoftwareUpgradeModel) { + // This is for future implementation of cancel step during software upgrade log.info("In PNF SW upgrade : processCancel") } - private suspend fun getCurrentConfig(model: SoftwareUpgradeModel) : ObjectNode{ - val currentConfig: BlueprintWebClientService.WebClientResponse<String> = restconfDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH) + private suspend fun getCurrentConfig(model: SoftwareUpgradeModel): ObjectNode { + val currentConfig: BlueprintWebClientService.WebClientResponse<String> = + restconfDeviceConfig(model.client, model.deviceId, CONFIGLET_RESOURCE_PATH) return JacksonUtils.jsonNode(currentConfig.body) as ObjectNode } + private suspend fun checkExecution(model: SoftwareUpgradeModel) { val checkExecutionBlock: suspend (Int) -> String = { val result = restconfDeviceConfig(model.client, model.deviceId, TARGET_SOFTWARE_PATH.plus(model.yangId)) @@ -162,15 +174,15 @@ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() { } } model.client.retry<String>(10, 0, 1000, checkExecutionBlock) - } - private suspend fun checkIfSwReadyToPerformAction(action : Action, model: SoftwareUpgradeModel): Boolean { + private suspend fun checkIfSwReadyToPerformAction(action: Action, model: SoftwareUpgradeModel): Boolean { val configBody = getCurrentConfig(model) configBody.get("software-upgrade")?.get("upgrade-package")?.iterator()?.forEach { item -> if (model.targetSwVersion == item.get("software-version")?.asText() && - action.completionStatus == item?.get("current-status")?.asText()) { - model.yangId= item.get("id").textValue() + action.completionStatus == item?.get("current-status")?.asText() + ) { + model.yangId = item.get("id").textValue() return true } } @@ -191,15 +203,23 @@ enum class Action(val actionName: String, val completionStatus: String) { POST_CHECK("postCheck", "ACTIVATION_COMPLETED"), CANCEL("cancel", "CANCELLED") ; - companion object{ + + companion object { + fun getEnumFromActionName(name: String): Action { - for(value in values()){ - if (value.actionName==name) return value + for (value in values()) { + if (value.actionName == name) return value } throw BluePrintException("Invalid Action sent to CDS") } } } -data class SoftwareUpgradeModel(val resolutionKey: String, val client: BlueprintWebClientService, val deviceId: String, - val targetSwVersion: String, val action: Action, var yangId: String = "")
\ No newline at end of file +data class SoftwareUpgradeModel( + val resolutionKey: String, + val client: BlueprintWebClientService, + val deviceId: String, + val targetSwVersion: String, + val action: Action, + var yangId: String = "" +) diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt index a2372c9db..264f4f725 100644 --- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt +++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Scripts/kotlin/RestconfConfigDeploy.kt @@ -16,7 +16,6 @@ * ============LICENSE_END========================================================= */ - package cba.pnf.config import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput @@ -32,6 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.logger class RestconfConfigDeploy : AbstractScriptComponentFunction() { + private val CONFIGLET_TEMPLATE_NAME = "config-assign" private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/mynetconf:netconflist" private val RESTCONF_SERVER_IDENTIFIER = "sdnc" @@ -53,18 +53,19 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() { log.debug("Mounting Device : $deviceID") restconfMountDevice(webclientService, deviceID, mountPayload, mutableMapOf("Content-Type" to "application/json")) - //Log the current configuration for the subtree + // Log the current configuration for the subtree val currentConfig: Any = restconfDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH) log.info("Current configuration subtree : $currentConfig") - //Apply configlet - restconfApplyDeviceConfig(webclientService, deviceID, CONFIGLET_RESOURCE_PATH, - storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME), - mutableMapOf("Content-Type" to "application/yang.patch+json")) - + // Apply configlet + restconfApplyDeviceConfig( + webclientService, deviceID, CONFIGLET_RESOURCE_PATH, + storedContentFromResolvedArtifactNB(resolutionKey, CONFIGLET_TEMPLATE_NAME), + mutableMapOf("Content-Type" to "application/yang.patch+json") + ) } catch (err: Exception) { log.error("an error occurred while configuring device {}", err) } finally { - //Un mount device + // Un mount device restconfUnMountDevice(webclientService, deviceID, "") } } catch (bpe: BluePrintProcessorException) { @@ -72,10 +73,9 @@ class RestconfConfigDeploy : AbstractScriptComponentFunction() { } } - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { log.info("Recover function called!") log.info("Execution request : $executionRequest") log.error("Exception", runtimeException) } -}
\ No newline at end of file +} |