VID-913 : Addition of Instance IDs in Audit Info screen

Change-Id: I7a440c6797f63588c68d490715272992e626424f
Issue-ID: VID-913
Signed-off-by: Kruthi Bhat <krutbhat@att.com>
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
index 3f25b80..0978033 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
@@ -169,7 +169,7 @@
 
     public JobAuditStatus(UUID requestId, String instanceName,
                 String modelType, String instanceType, String startTime,
-                String finishTime, String jobStatus, String additionalInfo) {
+                String finishTime, String jobStatus, String instanceId, String additionalInfo) {
          this.requestId = requestId;
          this.instanceName = instanceName;
          this.modelType = modelType;
@@ -177,7 +177,8 @@
 
          this.startTime = startTime;
          this.finishTime = finishTime;
-
+		 
+		 this.instanceId = instanceId;
          this.jobStatus = jobStatus;
          this.additionalInfo = additionalInfo;
          this.created = dateStringToDate(finishTime);
@@ -185,6 +186,17 @@
     private String modelType;
     private String startTime;
     private String finishTime;
+	
+	 @Transient
+    public String getInstanceId() {
+        return instanceId;
+    }
+
+    public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    private String instanceId;
 
     @Transient
     public String getModelType() {
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
index 09c571c..475e184 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/AsyncRequestStatus.java
@@ -83,6 +83,9 @@
     public static class InstanceReferences {
 
         public String serviceInstanceId;
+		public String vnfInstanceId;
+		public String vfModuleInstanceId;
+		public String volumeGroupInstanceId;
     }
 
     @JsonIgnoreProperties(ignoreUnknown = true)
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java
index 4f32eca..796e9de 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AuditServiceImpl.java
@@ -28,6 +28,7 @@
 import org.onap.vid.model.JobAuditStatus;
 import org.onap.vid.mso.*;
 import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.mso.rest.AsyncRequestStatus.Request;
 import org.onap.vid.mso.rest.AsyncRequestStatusList;
 import org.springframework.stereotype.Service;
 import java.text.MessageFormat;
@@ -172,6 +173,7 @@
         String instanceType = null;
         String modelType = "";
         String startTime = null;
+		String instanceId = "";
         AsyncRequestStatus.Request request = status.request;
         if (request != null) {
             if (request.requestId != null) {
@@ -182,6 +184,9 @@
             if (request.requestDetails != null && request.requestDetails.modelInfo != null) {
                 modelType = request.requestDetails.modelInfo.modelType;
             }
+			
+			instanceId = extractInstanceId(modelType,request);
+			
             startTime = request.startTime;
 
             if (request.requestStatus != null) {
@@ -197,8 +202,26 @@
             }
         }
         return new JobAuditStatus(requestId, instanceName, modelType, instanceType, startTime, finishTime,
-            jobStatus, additionalInfo);
+           jobStatus, instanceId, additionalInfo);
     }
+	
+	private String extractInstanceId(String modelType, Request request) {
+        if(null != request.instanceReferences) {
+            if("service".equalsIgnoreCase(modelType)) {
+                return request.instanceReferences.serviceInstanceId;
+            } else if("vfModule".equalsIgnoreCase(modelType)){
+                return request.instanceReferences.vfModuleInstanceId;
+            } else if("vnf".equalsIgnoreCase(modelType)) {
+                return request.instanceReferences.vnfInstanceId;
+            } else if("volumeGroup".equalsIgnoreCase(modelType)){
+                return request.instanceReferences.volumeGroupInstanceId;
+            } else {
+                return "";
+            }
+        }
+        return "";
+    }
+
     private String buildAdditionalInfo(AsyncRequestStatus.Request request) {
         String source = "";
         String statusMessage = "";
diff --git a/vid-app-common/src/test/resources/payload_jsons/Network/one_network_exists_add_another_network_expected_bulk.json b/vid-app-common/src/test/resources/payload_jsons/Network/one_network_exists_add_another_network_expected_bulk.json
index 4eb7b66..ccec6bb 100644
--- a/vid-app-common/src/test/resources/payload_jsons/Network/one_network_exists_add_another_network_expected_bulk.json
+++ b/vid-app-common/src/test/resources/payload_jsons/Network/one_network_exists_add_another_network_expected_bulk.json
@@ -2,12 +2,14 @@
   "action": "None",
   "isDirty": true,
   "vnfs": {},
+  "pnfs": {},
   "vrfs": {},
   "instanceParams": [],
   "validationCounter": 0,
   "existingNames": {
     "oam_protected_net_svc1": ""
   },
+  "existingPNFCounterMap": {},
   "existingVNFCounterMap": {},
   "existingVRFCounterMap": {},
   "existingVnfGroupCounterMap": {},
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/one_vnf_exists_add_another_vnf_expected_bulk.json b/vid-app-common/src/test/resources/payload_jsons/vnf/one_vnf_exists_add_another_vnf_expected_bulk.json
index 1eac789..f600528 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vnf/one_vnf_exists_add_another_vnf_expected_bulk.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/one_vnf_exists_add_another_vnf_expected_bulk.json
@@ -150,12 +150,14 @@
       "uuid":"c8087818-6f3e-4451-b339-111a1a3e7970"
     }
   },
+  "pnfs": {},
   "vrfs":{},
   "instanceParams":[],
   "validationCounter":0,
   "existingNames":{
     "iperf_vnf_svc1":""
   },
+  "existingPNFCounterMap": {},
   "existingVNFCounterMap":{
     "fe200ee4-96bb-4a10-9022-a188a20cf145":2
   },
diff --git a/vid-automation/src/main/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java b/vid-automation/src/main/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java
index df9d505..8fed370 100644
--- a/vid-automation/src/main/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java
+++ b/vid-automation/src/main/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java
@@ -47,6 +47,7 @@
         this.startTime = startTime;
         this.finishTime = finishTime;
         this.jobStatus = jobStatus;
+		this.instanceId = instanceId;
         this.additionalInfo = additionalInfo;
     }
 
@@ -64,6 +65,7 @@
     private String additionalInfo;
     private String instanceName;
     private String instanceType;
+	private String instanceId;
 
     public String getInstanceType() {return instanceType;}
 
@@ -71,6 +73,15 @@
 
     private Boolean isFinal;
 
+
+	public String getInstanceId() {
+		return instanceId;
+	}
+	
+	public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
+
     public String getJobStatus() {
         return jobStatus;
     }
diff --git a/vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json b/vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json
index 0f13a4d..d9b9aa4 100644
--- a/vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json
+++ b/vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json
@@ -2,7 +2,8 @@
   {
     "requestId": "7ba7900c-3e51-4d87-b1b4-3c53bdfaaa7d",
     "instanceName" : "zrdm54cfmgw01_svc",
-    "modelType": "service",
+    "instanceId":"de46c407-9f9b-4f2f-b1c3-be1c6599b957",
+  	"modelType": "service",
     "instanceType": "createInstance",
     "startTime": "Mon, 24 Aug 2020 22:37:53 GMT",
     "finishTime": "Mon, 24 Aug 2020 22:38:10 GMT",
@@ -12,7 +13,8 @@
   {
     "requestId": "f1aa7175-c237-4b56-ba64-7cb728a38ff2",
     "instanceName" : "zrdm54cfmgw01",
-    "modelType": "vnf",
+    "instanceId":"f5c72b2c-8e32-43db-9c42-f2b7901c69d8",
+	"modelType": "vnf",
     "instanceType": "createInstance",
     "startTime": "Mon, 24 Aug 2020 22:38:18 GMT",
     "finishTime": "Mon, 24 Aug 2020 22:44:24 GMT",
@@ -22,7 +24,8 @@
   {
     "requestId": "a4e43d9e-4813-42e4-94bf-c5c6f22ed0bc",
     "instanceName" : "zrdm54cfmgw01_base",
-    "modelType": "vfModule",
+    "instanceId":"5fd7eb77-34c6-4cb9-adf7-03297d85e9cc",
+	"modelType": "vfModule",
     "instanceType": "createInstance",
     "startTime": "Mon, 24 Aug 2020 22:44:42 GMT",
     "finishTime": "Mon, 24 Aug 2020 22:54:17 GMT",
@@ -32,7 +35,8 @@
   {
     "requestId": "1fc2ef3b-26f0-4e62-a00a-6a31502d39e2",
     "instanceName" : "zrdm54cfmgw01_sup_1",
-    "modelType": "vfModule",
+    "instanceId":"5fd7eb77-34c6-4cb9-adf7-03297d85e7ed",
+	"modelType": "vfModule",
     "instanceType": "createInstance",
     "startTime": "Mon, 24 Aug 2020 22:54:29 GMT",
     "finishTime": "Mon, 24 Aug 2020 22:56:35 GMT",
diff --git a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts
index d43b07e..cd7844a 100644
--- a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts
@@ -60,8 +60,9 @@
             cy.setViewportToSmallPopup();
             cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
               .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
+                let instanceColumn :any = res[index]['instanceName'] + " | undefined";
               assert.equal(row.find('#msoRequestId').text().trim(), res[index]['requestId']);
-              assert.equal(row.find('.msoInstanceName').text().trim(), res[index]['instanceName']);
+              assert.equal(row.find('.msoInstanceName').text().trim(),instanceColumn );
               assert.equal(row.find('#msoJobStatus').text().trim(), _.capitalize(res[index]['jobStatus']));
               assert.equal(row.find('#msoAdditionalInfo span').text().trim(), res[index]['additionalInfo']);
             });
@@ -107,8 +108,9 @@
             cy.setViewportToSmallPopup();
             cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
               .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
+                const instanceColumn :any = expectedResult[index]['instanceName'] + " | " +expectedResult[index]['instanceId'];
               assert.equal(row.find('#msoRequestId').text().trim(), expectedResult[index]['requestId']);
-              assert.equal(row.find('.msoInstanceName').text().trim(), expectedResult[index]['instanceName']);
+              assert.equal(row.find('.msoInstanceName').text().trim(), instanceColumn);
               assert.equal(row.find('#msostartTime').text().trim(), expectedResult[index]['startTime']);
             });
           });
diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html
index 874f13a..0de1b88 100644
--- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html
+++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html
@@ -11,7 +11,8 @@
         <br>
         <span style="font-size: 16px;">
           <!-- ServiceInstanceName(ServiceModelName/ServiceModelId) -->
-          <span title="Service Instance name">{{serviceInstanceName }}</span><span title="Service Model name"> ({{serviceModelName}}/</span>
+          <span title="Service Instance name">{{serviceInstanceName }} </span><span *ngIf= "serviceInstanceId" title="Service Instance ID"> | {{serviceInstanceId}}</span>
+          <span title="Service Model name"> ({{serviceModelName}}/</span>
           <span title="Service Model version">{{serviceModelVersion}})</span>
         </span>
       </div>
@@ -38,7 +39,7 @@
               <thead class="thead-dark row">
               <tr class="row">
                 <th scope="col" class="request-id">Request ID</th>
-                <th *ngIf="isAlaCarte&&isALaCarteFlagOn" id="instanceName" class="col-md-2" scope="col" >Instance Name</th>
+                <th *ngIf="isAlaCarte&&isALaCarteFlagOn" id="instanceName" class="col-md-2" scope="col" >Instance Name | <br>Instance ID</th>
                 <th>Model Type</th>
                 <th>Request Type</th>
                 <th>Start Time</th>
@@ -49,11 +50,11 @@
               </thead>
               <tbody>
               <tr class="row" *ngFor="let data of msoInfoData">
-                <td id="msoRequestId" style="width: 22%">
+                <td id="msoRequestId" class="col-md-2" style="width: 22%">
                   <custom-ellipsis [id]="data?.requestId" [value]="data?.requestId" [attr.data-tests-id]="'requestId'"></custom-ellipsis>
                 </td>
-                <td *ngIf="isAlaCarte && isALaCarteFlagOn" class="msoInstanceName" style="width: 10%">
-                  <custom-ellipsis [id]="data?.instanceName" [value]="data?.instanceName"></custom-ellipsis>
+                <td id="msoInstanceName" *ngIf="isAlaCarte && isALaCarteFlagOn" class="msoInstanceName col-md-2" style="width: 10%">
+                  <custom-ellipsis [id]="data?.instanceId" [value]="data?.instanceColumn"></custom-ellipsis>
                 </td>
                 <td id="msoModelType" style="width: 7%">
                   <custom-ellipsis [value]="data?.modelType"></custom-ellipsis>
diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
index 6afc8d9..41e99ae 100644
--- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
+++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts
@@ -32,7 +32,7 @@
   serviceModelId: string;
   jobId: string;
   vidInfoData: AuditStatus[] = [];
-  msoInfoData: AuditStatus[] = [];
+  msoInfoData : any= [];
   isAlaCarte: boolean;
   parentElementClassName = 'content';
   isLoading = true;
@@ -45,6 +45,7 @@
   auditInfoModalComponentService : AuditInfoModalComponentService;
   serviceInstanceName : string;
   serviceModelVersion : any;
+  serviceInstanceId : any;
   exportMSOStatusFeatureEnabled: boolean;
   dataIsReady : boolean = false;
   jobDataLocal : any;
@@ -68,6 +69,7 @@
         _iframeService.addClassOpenModal(this.parentElementClassName);
         this.serviceModelName = jobData.serviceModelName ? jobData.serviceModelName : '';
         this.serviceModelId = jobData.serviceModelId;
+        this.serviceInstanceId = jobData.serviceInstanceId;
         this.jobId = jobData.jobId;
         this.auditInfoModal.show();
         this.serviceInstanceName = jobData.serviceInstanceName;
@@ -152,6 +154,9 @@
         this.vidInfoData = res[0];
         this.msoInfoData = res[1];
         this.msoInfoData.sort(this.getSortOrder("startTime"));
+        this.msoInfoData.forEach((element ) => {
+           element.instanceColumn = element.instanceName + " | " +"<br>" + element.instanceId;
+        });
         this.isLoading = false;
       });
   }
diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
index 0f4623f..3eded91 100644
--- a/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
+++ b/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
@@ -9,6 +9,7 @@
   additionalInfo :any;
   instanceName: string;
   instanceType : string;
+  instanceId: any;
   modelType: string;
   startTime: string;
   finishTime: string;