Extend RAN connection table to handle null fields 91/991/2
authorManoop Talasila <talasila@research.att.com>
Fri, 20 Sep 2019 17:33:18 +0000 (13:33 -0400)
committerManoop Talasila <talasila@research.att.com>
Fri, 20 Sep 2019 17:34:29 +0000 (13:34 -0400)
Change-Id: Ice9fb02e012b550bd799f8ff51dd1368c7339140
Signed-off-by: Manoop Talasila <talasila@research.att.com>
docs/release-notes.rst
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/E2ManagerControllerTest.java
webapp-frontend/src/app/ran-control/ran-control.component.html

index 2912638..f9e9d09 100644 (file)
@@ -29,6 +29,7 @@ Version 1.2.1, 20 Sep 2019
 * Extend ANR mock feature to persist edits for demos
 * Block whitespace in E2 IP input field validation
 * Relax validation in E2 RAN name field validation
+* Make RAN connection table robust to missing fields
 
 Version 1.2.0, 11 Sep 2019
 --------------------------
index 15379be..a5e3b52 100644 (file)
@@ -120,6 +120,7 @@ public class E2ManagerController {
        public List<RanDetailsTransport> getRanDetails() {
                logger.debug("getRanDetails");
                List<NodebIdentity> nodebIdList = e2NodebApi.getNodebIdList();
+               logger.debug("getRanDetails: nodebIdList {}", nodebIdList);
                List<RanDetailsTransport> details = new ArrayList<>();
                for (NodebIdentity nbid : nodebIdList) {
                        GetNodebResponse nbResp = null;
index 02b2ba4..75ab01a 100644 (file)
@@ -59,7 +59,8 @@ public class E2ManagerMockConfiguration {
        @Value("${mock.config.delay:0}")
        private int delayMs;
 
-       public static final String MOCK_RAN_NAME = "Mock RAN";
+       public static final String RAN_NAME_1 = "Connected RAN";
+       public static final String RAN_NAME_2 = "Unknown RAN";
 
        private final List<NodebIdentity> nodebIdList;
        private final Map<String, GetNodebResponse> nodebResponseMap;
@@ -70,10 +71,18 @@ public class E2ManagerMockConfiguration {
                globalNbId = new NodebIdentityGlobalNbId().nbId("mockNbId").plmnId("mockPlmId");
                nodebIdList = new ArrayList<>();
                nodebResponseMap = new HashMap<>();
-               nodebIdList.add(new NodebIdentity().inventoryName(MOCK_RAN_NAME).globalNbId(globalNbId));
-               nodebResponseMap.put(MOCK_RAN_NAME,
-                               new GetNodebResponse().connectionStatus("mockConnectionStatus").failureType("mockFailureType")
-                                               .ip("127.0.0.1").nodeType("mockNodeType").port(123).ranName(MOCK_RAN_NAME));
+               // Complete entry
+               nodebIdList.add(new NodebIdentity().inventoryName(RAN_NAME_1).globalNbId(globalNbId));
+               nodebResponseMap.put(RAN_NAME_1, new GetNodebResponse().connectionStatus("CONNECTED").failureType("")
+                               .ip("127.0.0.1").nodeType("mockNodeType").port(123).ranName(RAN_NAME_1));
+               // Partial entry
+               // [{"nodebIdentity":{"globalNbId":null,"inventoryName":"AAAA123456"},
+               // "nodebStatus":{"connectionStatus":"CONNECTING","enb":null,"failureType":null,
+               // "globalNbId":null,"gnb":null,"ip":"10.2.0.6","nodeType":null,"port":36444,
+               // "ranName":"AAAA123456","setupFailure":null}}]
+               nodebIdList.add(new NodebIdentity().inventoryName(RAN_NAME_2));
+               nodebResponseMap.put(RAN_NAME_2,
+                               new GetNodebResponse().connectionStatus("CONNECTING").ip("127.0.0.2").port(456).ranName(RAN_NAME_2));
        }
 
        private ApiClient apiClient() {
index f4caee3..34729ad 100644 (file)
@@ -46,7 +46,7 @@ public class E2ManagerControllerTest extends AbstractControllerTest {
        private ResponseEntity<Void> endcSetup() {
                URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.ENDC_SETUP_METHOD);
                logger.info("Invoking {}", uri);
-               SetupRequest setup = new SetupRequest().ranName(E2ManagerMockConfiguration.MOCK_RAN_NAME);
+               SetupRequest setup = new SetupRequest().ranName(E2ManagerMockConfiguration.RAN_NAME_1);
                HttpEntity<SetupRequest> entity = new HttpEntity<>(setup);
                return testRestTemplateAdminRole().exchange(uri, HttpMethod.POST, entity, Void.class);
        }
@@ -104,7 +104,7 @@ public class E2ManagerControllerTest extends AbstractControllerTest {
        public void nodebStatusTest() {
                endcSetup();
                URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.NODEB_SHUTDOWN_METHOD,
-                               E2ManagerMockConfiguration.MOCK_RAN_NAME);
+                               E2ManagerMockConfiguration.RAN_NAME_1);
                logger.info("Invoking {}", uri);
                GetNodebResponse response = testRestTemplateStandardRole().getForObject(uri, GetNodebResponse.class);
                Assertions.assertNotNull(response.getRanName());
@@ -122,7 +122,7 @@ public class E2ManagerControllerTest extends AbstractControllerTest {
        public void x2SetupTest() {
                URI uri = buildUri(null, E2ManagerController.CONTROLLER_PATH, E2ManagerController.X2_SETUP_METHOD);
                logger.info("Invoking {}", uri);
-               SetupRequest setup = new SetupRequest().ranName(E2ManagerMockConfiguration.MOCK_RAN_NAME);
+               SetupRequest setup = new SetupRequest().ranName(E2ManagerMockConfiguration.RAN_NAME_1);
                HttpEntity<SetupRequest> entity = new HttpEntity<>(setup);
                ResponseEntity<Void> voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.POST, entity,
                                Void.class);
index d249d44..463d72c 100644 (file)
 
   <table mat-table class="ran-control-table mat-elevation-z8" [dataSource]="dataSource">
 
+    <ng-template #noValue></ng-template>
+
     <ng-container matColumnDef="nbId">
       <mat-header-cell *matHeaderCellDef>Nodeb ID</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebIdentity.globalNbId.nbId}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebIdentity.globalNbId; else noValue">{{ran.nodebIdentity.globalNbId.nbId}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="nodeType">
       <mat-header-cell *matHeaderCellDef>Node Type</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebStatus.nodeType}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebStatus; else noValue">{{ran.nodebStatus.nodeType}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="ranName">
       <mat-header-cell *matHeaderCellDef>RAN Name</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebIdentity.inventoryName}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebIdentity; else noValue">{{ran.nodebIdentity.inventoryName}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="ranIp">
       <mat-header-cell *matHeaderCellDef>IP</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebStatus.ip}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebStatus; else noValue">{{ran.nodebStatus.ip}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="ranPort">
       <mat-header-cell *matHeaderCellDef>Port</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebStatus.port}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebStatus; else noValue">{{ran.nodebStatus.port}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="connectionStatus">
       <mat-header-cell *matHeaderCellDef>Connection Status</mat-header-cell>
-      <mat-cell *matCellDef="let ran">{{ran.nodebStatus.connectionStatus}}</mat-cell>
+      <mat-cell *matCellDef="let ran">
+        <div *ngIf="ran.nodebStatus; else noValue">{{ran.nodebStatus.connectionStatus}}</div>
+      </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="noRecordsFound">
@@ -63,7 +77,8 @@
 
     <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
     <mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
-    <mat-footer-row *matFooterRowDef="['noRecordsFound']" [ngClass]="{'display-none': dataSource.rowCount > 0}"></mat-footer-row>
+    <mat-footer-row *matFooterRowDef="['noRecordsFound']" [ngClass]="{'display-none': dataSource.rowCount > 0}">
+    </mat-footer-row>
 
   </table>
 
@@ -71,4 +86,4 @@
     <mat-spinner diameter=50></mat-spinner>
   </div>
 
-</div>
+</div>
\ No newline at end of file