fetch/display xApp instance 33/133/5
authorjh245g <jh245g@att.com>
Thu, 9 May 2019 17:55:56 +0000 (13:55 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Fri, 10 May 2019 12:44:54 +0000 (08:44 -0400)
remove front-end mock data
remove mock pendulum control from back end.
fetch all xApp data from back end
get and display xApp instances
fix api request in catalog

Change-Id: Icbf057adab954dfa4af27f946554fbbccda92cb9
Issue-id: RICPLT-953
Signed-off-by: Jun (Nicolas) Hu <jh245g@att.com>
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
docs/release-notes.rst
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java
webapp-frontend/src/app/catalog/catalog.component.ts
webapp-frontend/src/app/control/control.component.css
webapp-frontend/src/app/control/control.component.ts
webapp-frontend/src/app/services/catalog/catalog.service.ts
webapp-frontend/src/app/services/control/control.service.ts

index 6f69db9..7507f61 100644 (file)
@@ -23,6 +23,7 @@ RIC Dashboard Release Notes
 Version 1.0.2, 9 May 2019
 -------------------------
 * Add E2 response message with timestamp and status code
+* Fetch xAPP instance status information from xAPP Manager and display in dashboard
 
 Version 1.0.1, 6 May 2019
 -------------------------
index f6bb378..59f5095 100644 (file)
@@ -66,14 +66,10 @@ public class XappManagerMockConfiguration {
                Xapp dc = new Xapp().name("Dual Connectivity").version("v2").status(StatusEnum.DELETED);
                dc.addInstancesItem(
                                new XappInstance().name("def0-6789").ip("6.7.8.9").port(300).status(XappInstance.StatusEnum.COMPLETED));
-               Xapp pc = new Xapp().name("Pendulum Control").version("v1").status(StatusEnum.DEPLOYED);
-               pc.addInstancesItem(
-                               new XappInstance().name("abcd-1234").ip("1.2.3.4").port(100).status(XappInstance.StatusEnum.RUNNING));
                allXapps = new AllXapps();
                allXapps.add(ac);
                allXapps.add(an);
                allXapps.add(dc);
-               allXapps.add(pc);
        }
 
        @Bean
index 5bff77d..726183e 100644 (file)
@@ -101,7 +101,7 @@ export class AppCatalogDeployDialog{
     }
 
     deployXapp(): void {
-        this.service.deployXapp(this.data.name).subscribe((val: any[]) => console.log(val));;
+        this.service.deployXapp(this.data.name).subscribe((val: any[]) => { });
         this.dialogRef.close();
     }
 
index 472f822..f4cd56c 100644 (file)
@@ -19,7 +19,7 @@
  */
 .control__section {
     position: relative;
-    top: -50px;
+    top: -150px;
 }
 
 .control__header {
index fb987d4..b493587 100644 (file)
@@ -22,6 +22,7 @@ import { LocalDataSource } from 'ng2-smart-table';
 import { ControlService } from '../services/control/control.service';
 import { Router } from '@angular/router';
 
+
 @Component({
   selector: 'app-control',
   templateUrl: './control.component.html',
@@ -43,50 +44,46 @@ export class ControlComponent {
 
     },
     columns: {
-      id: {
-        title: 'ID',
-        type: 'number',
-      },
-      xAppName: {
-        title: 'xApp Name',
+      xapp: {
+        title:'xApp Name',
         type: 'string',
       },
-      xAppType: {
-        title: 'xApp Type',
+      name: {
+        title:'Instance Name',
         type: 'string',
       },
-      podId: {
-        title: 'Pod ID',
-        type: 'number',
-      },
-      k8Status: {
-        title: 'k8 Status',
+        status: {
+        title: 'Status',
         type: 'string',
       },
-      age: {
-        title: 'Age',
+      ip: {
+        title: 'IP',
         type: 'string',
       },
+      port: {
+        title: 'Port',
+        type: 'integer',
+      },
+      txMessages: {
+        title: 'txMessages',
+        type: 'array',
+        },
+      rxMessages: {
+          title: 'rxMessages',
+          type: 'array',
+      },
     },
   };
 
   source: LocalDataSource = new LocalDataSource();
 
-  constructor(private service: ControlService, private router: Router) {
-    const data = this.service.getData();
-    this.source.load(data);
+    constructor(private service: ControlService, private router: Router) {
+        this.service.getxAppInstances((instances) => { this.source.load(instances); } );
   }
 
   view(event): void {
       const url = '/xapp';
-      this.router.navigate([url, event]).then( (e) => {
-            if (e) {
-                console.log(event.data);
-                console.log('Navigation is successful!');
-            } else {
-                console.log('Navigation has failed!');
-            }
-        });
+      this.router.navigate([url, event]);
   }
 
 
index a5b2f9a..fac75d8 100644 (file)
@@ -32,11 +32,9 @@ export class CatalogService {
   }
 
     deployXapp(name) {
-        console.log(name);
         return this.http.post('api/xappmgr/xapps',
             {
-                "xAppName": "string",
-                "xappName": name
+                "xAppName": name
             });
     }
     
index b2bdc5f..1a1dc22 100644 (file)
  * ========================LICENSE_END===================================
  */
 import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
 
 @Injectable()
 export class ControlService {
 
-data = [{
-    id: 1,
-    xAppName: 'Pendulum Control',
-    xAppType: 'Type1',
-    podId: 'dc-ric-app-b8c6668d8-56bjb',
-    k8Status: 'running',
-    age: '25 mins',
-  }, {
-    id: 2,
-    xAppName: 'Dual Connectivity',
-    xAppType: 'Type2',
-    podId: 'ac-ric-app-5ddbc59ffd-qc6rp',
-    k8Status: 'failed',
-    age: '5 mins',
+    constructor(private http: HttpClient) {
+    }
+
+    getxAppInstances(xAppInstances) {  
+    return this.http.get('api/xappmgr/xapps').subscribe(
+        (val: any[]) => {
+            xAppInstances(this.fetchInstance(val));
+            } 
+        );
+        
+    }
+
+    fetchInstance(allxappdata) {
+        var xAppInstances = []
+        for (const  xappindex in allxappdata) {
+            var instancelist = allxappdata[xappindex].instances;
+            for (const instanceindex in instancelist) {
+                var instance = instancelist[instanceindex];
+                instance.xapp = allxappdata[xappindex].name;
+                xAppInstances.push(instance);
+            }          
+        }
+        return xAppInstances;
+    }
 
-  }, {
-    id: 3,
-    xAppName: 'ANR',
-    xAppType: 'Type1',
-    podId: 'dc-ric-app-694c45b75f-nqdtt',
-    k8Status: 'pending',
-    age: '55 mins',
-  }, {
-    id: 4,
-    xAppName: 'Admission Control',
-    xAppType: 'Type2',
-    podId: 'ac-ric-app-4ddfc59ffd-qc7tp',
-    k8Status: 'unkown',
-    age: '5 mins',
-
-  }, {
-    id: 5,
-    xAppName: 'Admission Control',
-    xAppType: 'Type2',
-    podId: 'ac-ric-app-3ffgc59ffd-qc5rp',
-    k8Status: 'crashLoopBackoff',
-    age: '5 mins',
-
-  }, {
-    id: 6,
-    xAppName: 'ANR',
-    xAppType: 'Type1',
-    podId: 'dc-ric-app-345f44r75f-nertt',
-    k8Status: 'completed',
-    age: '55 mins',
-  }, {
-    id: 7,
-    xAppName: 'Admission Control',
-    xAppType: 'Type2',
-    podId: 'ac-ric-app-5ddbc67ffd-qc6rp',
-    k8Status: 'completed',
-    age: '5 mins',
-
-  }, {
-    id: 8,
-    xAppName: 'ANR',
-    xAppType: 'Type1',
-    podId: 'dc-ric-app-694c23b75f-nqdtt',
-    k8Status: 'completed',
-    age: '55 mins',
-
-  }];
-
-  getData() {
-    return this.data; // @TODO implement the service to fetch the backend data
-  }
 }