aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2020-03-12 16:49:42 +0800
committerMarco Platania <platania@research.att.com>2020-03-23 12:39:21 +0000
commitebbd0c313e44fcbc7bd176371f9b33d1ecf5c97c (patch)
treef9993eee4333932a7e15fbfe0d4fe932cc1b97ff /test
parente0fe449c16bd0781840e1608e72373ac1d2cc18a (diff)
Add script and patch to build CBA file to support PNF SW upgrade
Change-Id: I8b0155a0a6022d7b6d172c1b46d1b7d189fcbe8a Issue-ID: INT-1210 Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh77
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/PNF_SW_UPGRADE_WITH_EM.json.patch148
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/RestconfSoftwareUpgrade.kt.patch192
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/TOSCA.meta.patch13
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-software-upgrade-mapping.json.patch17
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-activate-ne-sw-template.vtl.patch19
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-download-ne-sw-template.vtl.patch34
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/resources_definition_types.json.patch14
-rw-r--r--test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/restconf-mount-template.vtl.patch16
9 files changed, 530 insertions, 0 deletions
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
new file mode 100755
index 000000000..76102c3b1
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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=========================================================
+
+set -euo pipefail
+
+readonly SOURCE_CBA="PNF_CDS_RESTCONF"
+readonly TARGET_CBA="PNF_SW_UPGRADE_WITH_EM"
+readonly CDS_CODE_DIR="cds-codes-for-pnf-sw-upgrade"
+
+function use_specific_commit()
+{
+ local commit_id="$1"
+ cd ${CDS_CODE_DIR}
+ local tmp_branch="get-cba-for-pnf-sw-upgrade"
+ if ! git branch | grep -q "${tmp_branch}"; then
+ git checkout -b ${tmp_branch} ${commit_id}
+ else
+ git checkout -q ${tmp_branch}
+ fi
+ cd ${OLDPWD}
+}
+
+if [ ! -e ${CDS_CODE_DIR} ]; then
+ git clone https://gerrit.onap.org/r/ccsdk/cds ${CDS_CODE_DIR}
+else
+ cd ${CDS_CODE_DIR}
+ code_status=`git status -s`
+ if [ -n "${code_status}" ]; then
+ echo "Please keep the CDS codes are not modified."
+ exit 1
+ fi
+ cd ${OLDPWD}
+fi
+
+# Lock the version of source CBA files
+use_specific_commit f4ac359d80d043a2d0e6eaf1730813b81f2c837f
+
+if [ -e ${TARGET_CBA} -o -e ${TARGET_CBA}.zip ]; then
+ echo "${TARGET_CBA} or ${TARGET_CBA}.zip has existed, please rename or delete them."
+ exit 1
+fi
+
+cp -ir ${CDS_CODE_DIR}/components/model-catalog/blueprint-model/uat-blueprints/${SOURCE_CBA} ${TARGET_CBA}
+cp -ir patches ${TARGET_CBA}
+
+cd ${TARGET_CBA}
+
+mv Definitions/PNF_CDS_RESTCONF.json Definitions/PNF_SW_UPGRADE_WITH_EM.json
+mv Templates/pnf-swug-config-template.vtl Templates/pnf-swug-activate-ne-sw-template.vtl
+
+for p in patches/*.patch; do
+ patch -p1 -i $p
+done
+
+rm -rf patches
+
+zip -r ${TARGET_CBA}.zip .
+
+cd ${OLDPWD}
+
+mv -i ${TARGET_CBA}/${TARGET_CBA}.zip .
+
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/PNF_SW_UPGRADE_WITH_EM.json.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/PNF_SW_UPGRADE_WITH_EM.json.patch
new file mode 100644
index 000000000..f4c80624e
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/PNF_SW_UPGRADE_WITH_EM.json.patch
@@ -0,0 +1,148 @@
+--- PNF_CDS_RESTCONF/Definitions/PNF_CDS_RESTCONF.json 2020-03-14 20:54:46.677546900 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Definitions/PNF_SW_UPGRADE_WITH_EM.json 2020-03-14 22:08:47.225398400 +0800
+@@ -4,7 +4,7 @@
+ "template_author" : "Raj Gumma",
+ "author-email" : "raj.gumma@est.tech",
+ "user-groups" : "ADMIN, OPERATION",
+- "template_name" : "PNF_CDS_RESTCONF",
++ "template_name" : "PNF_SW_UPGRADE_WITH_EM",
+ "template_version" : "1.0.0",
+ "template_tags" : "PNF, Restconf, config, configuration, software upgrade"
+ },
+@@ -74,28 +74,6 @@
+ }
+ }
+ },
+- "config-deploy" : {
+- "steps" : {
+- "activate-process" : {
+- "description" : "Send a configlet to the pnf",
+- "target" : "config-deploy",
+- "activities" : [ {
+- "call_operation" : ""
+- } ]
+- }
+- },
+- "inputs" : {
+- "resolution-key" : {
+- "required" : true,
+- "type" : "string"
+- },
+- "config-deploy-properties" : {
+- "description" : "Dynamic PropertyDefinition for workflow(config-deploy).",
+- "required" : true,
+- "type" : "dt-config-deploy-properties"
+- }
+- }
+- },
+ "preCheck" : {
+ "steps" : {
+ "activate-process" : {
+@@ -220,41 +198,6 @@
+ }
+ }
+ },
+- "config-deploy" : {
+- "type" : "component-script-executor",
+- "interfaces" : {
+- "ComponentScriptExecutor" : {
+- "operations" : {
+- "process" : {
+- "implementation" : {
+- "primary" : "component-script",
+- "timeout" : 180,
+- "operation_host" : "SELF"
+- },
+- "inputs" : {
+- "script-type" : "kotlin",
+- "script-class-reference" : "cba.pnf.config.aai.RestconfConfigDeploy",
+- "dynamic-properties" : "*config-deploy-properties"
+- },
+- "outputs" : {
+- "response-data" : "",
+- "status" : "success"
+- }
+- }
+- }
+- }
+- },
+- "artifacts" : {
+- "config-deploy-template" : {
+- "type" : "artifact-template-velocity",
+- "file" : "Templates/restconf-mount-template.vtl"
+- },
+- "config-deploy-mapping" : {
+- "type" : "artifact-mapping-resource",
+- "file" : "Definitions/config-deploy-pnf-mapping.json"
+- }
+- }
+- },
+ "preCheck" : {
+ "type" : "component-script-executor",
+ "interfaces" : {
+@@ -268,7 +211,7 @@
+ },
+ "inputs" : {
+ "script-type" : "kotlin",
+- "script-class-reference" : "cba.pnf.swug.RestconfSoftwareUpgrade",
++ "script-class-reference" : "cba.pnf.swm.RestconfSoftwareUpgrade",
+ "dynamic-properties" : "*preCheck-properties"
+ },
+ "outputs" : {
+@@ -303,7 +246,7 @@
+ },
+ "inputs" : {
+ "script-type" : "kotlin",
+- "script-class-reference" : "cba.pnf.swug.RestconfSoftwareUpgrade",
++ "script-class-reference" : "cba.pnf.swm.RestconfSoftwareUpgrade",
+ "dynamic-properties" : "*downloadNESw-properties"
+ },
+ "outputs" : {
+@@ -323,14 +266,6 @@
+ "type" : "artifact-mapping-resource",
+ "file" : "Definitions/pnf-software-upgrade-mapping.json"
+ },
+- "configure-template" : {
+- "type" : "artifact-template-velocity",
+- "file" : "Templates/pnf-swug-config-template.vtl"
+- },
+- "configure-mapping" : {
+- "type" : "artifact-mapping-resource",
+- "file" : "Definitions/pnf-software-upgrade-mapping.json"
+- },
+ "download-ne-sw-template" : {
+ "type" : "artifact-template-velocity",
+ "file" : "Templates/pnf-swug-download-ne-sw-template.vtl"
+@@ -354,7 +289,7 @@
+ },
+ "inputs" : {
+ "script-type" : "kotlin",
+- "script-class-reference" : "cba.pnf.swug.RestconfSoftwareUpgrade",
++ "script-class-reference" : "cba.pnf.swm.RestconfSoftwareUpgrade",
+ "dynamic-properties" : "*activateNESw-properties"
+ },
+ "outputs" : {
+@@ -374,11 +309,11 @@
+ "type" : "artifact-mapping-resource",
+ "file" : "Definitions/pnf-software-upgrade-mapping.json"
+ },
+- "configure-template" : {
++ "activate-ne-sw-template" : {
+ "type" : "artifact-template-velocity",
+- "file" : "Templates/pnf-swug-config-template.vtl"
++ "file" : "Templates/pnf-swug-activate-ne-sw-template.vtl"
+ },
+- "configure-mapping" : {
++ "activate-ne-sw-mapping" : {
+ "type" : "artifact-mapping-resource",
+ "file" : "Definitions/pnf-software-upgrade-mapping.json"
+ }
+@@ -397,7 +332,7 @@
+ },
+ "inputs" : {
+ "script-type" : "kotlin",
+- "script-class-reference" : "cba.pnf.swug.RestconfSoftwareUpgrade",
++ "script-class-reference" : "cba.pnf.swm.RestconfSoftwareUpgrade",
+ "dynamic-properties" : "*postCheck-properties"
+ },
+ "outputs" : {
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/RestconfSoftwareUpgrade.kt.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/RestconfSoftwareUpgrade.kt.patch
new file mode 100644
index 000000000..01473f4ad
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/RestconfSoftwareUpgrade.kt.patch
@@ -0,0 +1,192 @@
+--- PNF_CDS_RESTCONF/Scripts/kotlin/RestconfSoftwareUpgrade.kt 2020-03-12 15:16:34.617000000 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Scripts/kotlin/RestconfSoftwareUpgrade.kt 2020-03-12 23:12:50.012507800 +0800
+@@ -1,6 +1,7 @@
+ /*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
++* Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,7 +18,7 @@
+ */
+
+
+-package cba.pnf.swug
++package cba.pnf.swm
+
+ import com.fasterxml.jackson.databind.node.ObjectNode
+ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+@@ -38,20 +39,27 @@
+ class RestconfSoftwareUpgrade : AbstractScriptComponentFunction() {
+
+ private val RESTCONF_SERVER_IDENTIFIER = "sdnc"
+- private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/pnf-sw-upgrade:software-upgrade"
++ private val CONFIGLET_RESOURCE_PATH = "yang-ext:mount/pnf-swm:software-management"
+ private val log = logger(AbstractScriptComponentFunction::class.java)
+- private val TARGET_SOFTWARE_PATH = "$CONFIGLET_RESOURCE_PATH/upgrade-package/"
++ private val TARGET_SOFTWARE_PATH = "$CONFIGLET_RESOURCE_PATH/pnf-software-package/"
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+
+ // Extract request properties
+- val model= validatedPayload(executionRequest)
++ var model: SoftwareManagementModel = validatedPayload(executionRequest)
+
+ log.info("Blueprint invoked for ${model.resolutionKey} for SW Upgrade : " +
+- "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.deviceId}")
++ "${model.action} for sw version ${model.targetSwVersion} on pnf: ${model.neIdentifier}")
+
+ try {
+- val mountPayload = contentFromResolvedArtifactNB("mount-node")
++ var mountPayload: String = contentFromResolvedArtifactNB("mount-node")
++
++ val mountPayloadObject = JacksonUtils.jsonNode(mountPayload) as ObjectNode
++ val emsIp = mountPayloadObject.get("node")?.get(0)?.get("netconf-node-topology:host")?.asText()
++
++ model.deviceId = "ems-" + emsIp?.replace(".", "-")
++ mountPayload = mountPayload.replace("%ems-id%", model.deviceId)
++
+ log.debug("Mount Payload : $mountPayload")
+ restconfMountDevice(model.client, model.deviceId, mountPayload, mutableMapOf("Content-Type" to "application/json"))
+
+@@ -70,40 +78,34 @@
+ }
+ }
+
+- private fun validatedPayload(executionRequest: ExecutionServiceInput): SoftwareUpgradeModel {
++ private fun validatedPayload(executionRequest: ExecutionServiceInput): SoftwareManagementModel {
+ 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(),
++ return SoftwareManagementModel(getDynamicProperties("resolution-key").asText(),
+ BluePrintDependencyService.restClientService(RESTCONF_SERVER_IDENTIFIER),
+- properties.get("pnf-id").textValue(), properties.get("target-software-version").textValue(),
++ "",
++ properties.get("pnf-id").textValue(),
++ properties.get("target-software-version").textValue(),
+ 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) {
++ private suspend fun processPreCheck(model: SoftwareManagementModel) {
+ log.debug("In PNF SW upgrade : processPreCheck")
+ //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-management")?.get("pnf-software-package")?.get(0)?.get("software-version")?.asText()}")
+ log.info("PNF is Healthy!")
+ }
+
+- private suspend fun processDownloadNESw(model: SoftwareUpgradeModel) {
++ private suspend fun processDownloadNESw(model: SoftwareManagementModel) {
+ log.debug("In PNF SW upgrade : processDownloadNESw")
+- //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 = contentFromResolvedArtifactNB("download-ne-sw")
+- model.yangId=model.targetSwVersion
+- }
++ var downloadConfigPayload: String = contentFromResolvedArtifactNB("download-ne-sw")
++ model.yangId = model.neIdentifier
+ downloadConfigPayload = downloadConfigPayload.replace("%actionName%", Action.DOWNLOAD_NE_SW.name)
+ log.info("Config Payload to start download : $downloadConfigPayload")
+
+@@ -115,14 +117,15 @@
+ checkExecution(model)
+ }
+
+- private suspend fun processActivateNESw(model: SoftwareUpgradeModel) {
++ private suspend fun processActivateNESw(model: SoftwareManagementModel) {
+ log.debug("In PNF SW upgrade : processActivateNESw")
++
+ //Check if the software is downloaded and ready to be activated
+ if (checkIfSwReadyToPerformAction(Action.DOWNLOAD_NE_SW, model)) {
+- var activateConfigPayload: String = contentFromResolvedArtifactNB("configure")
++ var activateConfigPayload: String = contentFromResolvedArtifactNB("activate-ne-sw")
+ 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"))
+@@ -134,7 +137,7 @@
+ }
+ }
+
+- private suspend fun processPostCheck(model: SoftwareUpgradeModel) {
++ private suspend fun processPostCheck(model: SoftwareManagementModel) {
+ log.info("In PNF SW upgrade : processPostCheck")
+ //Log the current configuration for the subtree
+ if (checkIfSwReadyToPerformAction(Action.POST_CHECK, model)) {
+@@ -142,35 +145,36 @@
+ }
+ }
+
+- private fun processCancel(model :SoftwareUpgradeModel) {
++ private fun processCancel(model :SoftwareManagementModel) {
+ //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{
++ private suspend fun getCurrentConfig(model: SoftwareManagementModel) : 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) {
++
++ private suspend fun checkExecution(model: SoftwareManagementModel) {
+ val checkExecutionBlock: suspend (Int) -> String = {
+ val result = restconfDeviceConfig(model.client, model.deviceId, TARGET_SOFTWARE_PATH.plus(model.yangId))
+ if (result.body.contains(model.action.completionStatus)) {
+ log.info("${model.action.name} is complete")
+ result.body
+ } else {
+- throw BluePrintRetryException("Waiting for device(${model.deviceId}) to activate sw version ${model.targetSwVersion}")
++ throw BluePrintRetryException("Waiting for device(${model.deviceId}) to complete ${model.action.name}")
+ }
+ }
+ model.client.retry<String>(10, 0, 1000, checkExecutionBlock)
+
+ }
+
+- private suspend fun checkIfSwReadyToPerformAction(action : Action, model: SoftwareUpgradeModel): Boolean {
++ private suspend fun checkIfSwReadyToPerformAction(action : Action, model: SoftwareManagementModel): Boolean {
+ val configBody = getCurrentConfig(model)
+- configBody.get("software-upgrade")?.get("upgrade-package")?.iterator()?.forEach { item ->
++ configBody.get("software-management")?.get("pnf-software-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()
++ model.yangId= item.get("neIdentifier").textValue()
+ return true
+ }
+ }
+@@ -201,5 +205,12 @@
+ }
+ }
+
+-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 SoftwareManagementModel(
++ val resolutionKey: String,
++ val client: BlueprintWebClientService,
++ var deviceId: String,
++ val neIdentifier: String,
++ val targetSwVersion: String,
++ val action: Action,
++ var yangId: String = ""
++)
+\ No newline at end of file
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/TOSCA.meta.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/TOSCA.meta.patch
new file mode 100644
index 000000000..29ce13c10
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/TOSCA.meta.patch
@@ -0,0 +1,13 @@
+--- PNF_CDS_RESTCONF/TOSCA-Metadata/TOSCA.meta 2020-03-12 12:13:38.654109400 +0800
++++ PNF_SW_UPGRADE_WITH_EM/TOSCA-Metadata/TOSCA.meta 2020-03-13 00:05:30.186335900 +0800
+@@ -1,7 +1,7 @@
+ TOSCA-Meta-File-Version: 1.0.0
+ CSAR-Version: 1.0
+ Created-By: Raj Gumma <raj.gumma@est.tech>
+-Entry-Definitions: Definitions/PNF_CDS_RESTCONF.json
+-Template-Name: PNF_CDS_RESTCONF
++Entry-Definitions: Definitions/PNF_SW_UPGRADE_WITH_EM.json
++Template-Name: PNF_SW_UPGRADE_WITH_EM
+ Template-Version: 1.0.0
+-Template-Tags: PNF_CDS_RESTCONF
++Template-Tags: PNF_SW_UPGRADE_WITH_EM
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-software-upgrade-mapping.json.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-software-upgrade-mapping.json.patch
new file mode 100644
index 000000000..74c5d184e
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-software-upgrade-mapping.json.patch
@@ -0,0 +1,17 @@
+--- PNF_CDS_RESTCONF/Definitions/pnf-software-upgrade-mapping.json 2020-03-12 12:13:38.642390600 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Definitions/pnf-software-upgrade-mapping.json 2020-03-12 23:59:44.111140600 +0800
+@@ -22,12 +22,12 @@
+ ]
+ },
+ {
+- "name": "pnf-ipv4-address",
++ "name": "ems-ipv4-address",
+ "input-param": false,
+ "property": {
+ "type": "string"
+ },
+- "dictionary-name": "pnf-ipaddress-aai",
++ "dictionary-name": "ems-ipaddress-aai",
+ "dictionary-source": "aai-data",
+ "dependencies": [
+ "pnf-id"
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-activate-ne-sw-template.vtl.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-activate-ne-sw-template.vtl.patch
new file mode 100644
index 000000000..7d8d7efe7
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-activate-ne-sw-template.vtl.patch
@@ -0,0 +1,19 @@
+--- PNF_CDS_RESTCONF/Templates/pnf-swug-config-template.vtl 2020-03-12 19:06:30.108210900 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Templates/pnf-swug-activate-ne-sw-template.vtl 2020-03-12 23:29:51.565242200 +0800
+@@ -7,11 +7,12 @@
+ "operation": "merge",
+ "target": "/",
+ "value": {
+- "software-upgrade": {
+- "upgrade-package": [
++ "software-management": {
++ "pnf-software-package": [
+ {
+- "id": "%id%",
+- "action": "%actionName%"
++ "neIdentifier": "${pnf-id}",
++ "action": "%actionName%",
++ "swVersionToBeActivated": "${target-software-version}"
+ }
+ ]
+ }
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-download-ne-sw-template.vtl.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-download-ne-sw-template.vtl.patch
new file mode 100644
index 000000000..f74ad838a
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/pnf-swug-download-ne-sw-template.vtl.patch
@@ -0,0 +1,34 @@
+--- PNF_CDS_RESTCONF/Templates/pnf-swug-download-ne-sw-template.vtl 2020-03-12 12:13:38.660945300 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Templates/pnf-swug-download-ne-sw-template.vtl 2020-03-12 23:12:49.980281200 +0800
+@@ -7,17 +7,21 @@
+ "operation": "merge",
+ "target": "/",
+ "value": {
+- "software-upgrade": {
+- "upgrade-package": [
++ "software-management": {
++ "pnf-software-package": [
+ {
+- "id": "${target-software-version}",
+- "current-status": "INITIALIZED",
+- "action": "%actionName%",
+- "user-label": "trial software update",
+- "uri": "sftp://127.0.0.1/test_software_2.img",
+- "software-version": "${target-software-version}",
+- "user": "test_user",
+- "password": "test_password"
++ "neIdentifier": "${pnf-id}",
++ "current-status": "INITIALIZED",
++ "action": "%actionName%",
++ "software-version": "${target-software-version}",
++ "swToBeDownloaded": [
++ {
++ "swLocation": "http://192.168.35.96:10080/ran_du_pkg1-v2.zip",
++ "swFileSize": "12345678",
++ "swFileCompression": "ZIP",
++ "swFileFormat": "binary"
++ }
++ ]
+ }
+ ]
+ }
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/resources_definition_types.json.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/resources_definition_types.json.patch
new file mode 100644
index 000000000..74f3fb0fb
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/resources_definition_types.json.patch
@@ -0,0 +1,14 @@
+--- PNF_CDS_RESTCONF/Definitions/resources_definition_types.json 2020-03-12 12:13:38.643367200 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Definitions/resources_definition_types.json 2020-03-12 23:55:20.636531200 +0800
+@@ -14,9 +14,9 @@
+ }
+ }
+ },
+- "pnf-ipaddress-aai" : {
++ "ems-ipaddress-aai" : {
+ "tags" : "aai-get",
+- "name" : "pnf-ipaddress-aai",
++ "name" : "ems-ipaddress-aai",
+ "property" : {
+ "description" : "primary aai data to get resource",
+ "type" : "string"
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/restconf-mount-template.vtl.patch b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/restconf-mount-template.vtl.patch
new file mode 100644
index 000000000..b5a9c5bb2
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/patches/restconf-mount-template.vtl.patch
@@ -0,0 +1,16 @@
+--- PNF_CDS_RESTCONF/Templates/restconf-mount-template.vtl 2020-03-12 12:13:38.664851500 +0800
++++ PNF_SW_UPGRADE_WITH_EM/Templates/restconf-mount-template.vtl 2020-03-12 23:36:52.209773400 +0800
+@@ -1,11 +1,11 @@
+ {
+ "node": [
+ {
+- "node-id": "${pnf-id}",
++ "node-id": "%ems-id%",
+ "netconf-node-topology:protocol": {
+ "name": "TLS"
+ },
+- "netconf-node-topology:host": "${pnf-ipv4-address}",
++ "netconf-node-topology:host": "${ems-ipv4-address}",
+ "netconf-node-topology:key-based": {
+ "username": "netconf",
+ "key-id": "ODL_private_key_0"