From 111f6428fea584ce6342c84e6c623945b900addd Mon Sep 17 00:00:00 2001 From: Niranjana Date: Thu, 28 Apr 2022 14:14:44 +0000 Subject: [SLICEANALYSIS] Filter RAN related service instances in AAI and Fetch CU Cells data for intelligent slicing Issue-ID: DCAEGEN2-3145 Issue-ID: DCAEGEN2-3146 Signed-off-by: Niranjana Change-Id: I5c53bc05f43de09554b02a763d7f5c22435c9962 --- .../ms/configdb/ConfigDbInterfaceServiceTest.java | 32 +++++++++++++++++++++- .../ms/service/MLMessageProcessorTest.java | 2 +- .../src/test/resources/aaiDetailsList.json | 4 +-- 3 files changed, 34 insertions(+), 4 deletions(-) (limited to 'components/slice-analysis-ms/src/test') diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/configdb/ConfigDbInterfaceServiceTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/configdb/ConfigDbInterfaceServiceTest.java index 885a9171..28e157c8 100644 --- a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/configdb/ConfigDbInterfaceServiceTest.java +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/configdb/ConfigDbInterfaceServiceTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * slice-analysis-ms * ================================================================================ - * Copyright (C) 2020-2021 Wipro Limited. + * Copyright (C) 2020-2022 Wipro Limited. * ============================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,6 +126,7 @@ public class ConfigDbInterfaceServiceTest { } + @Test public void fetchServiceProfile() { Map responseMap=new HashMap(); responseMap.put("sNSSAI", "001-010"); @@ -136,5 +137,34 @@ public class ConfigDbInterfaceServiceTest { .thenReturn(new ResponseEntity(responseMap, HttpStatus.OK)); assertEquals(responseMap, configdbservice.fetchServiceDetails("snssai")); } + + @Test + public void fetchCUCPCellsOfSnssaiTest() { + Map> response = new HashMap<>(); + List cellslist = new ArrayList<>(); + List cellslist1 = new ArrayList<>(); + CellsModel cellsmodel1 = new CellsModel(); + cellsmodel1.setCellLocalId("1111"); + CellsModel cellsmodel2 = new CellsModel(); + cellsmodel2.setCellLocalId("2222"); + cellslist.add(cellsmodel1); + cellslist.add(cellsmodel2); + response.put("1", cellslist); + CellsModel cellsmodel3 = new CellsModel(); + cellsmodel3.setCellLocalId("3333"); + CellsModel cellsmodel4 = new CellsModel(); + cellsmodel4.setCellLocalId("4444"); + cellslist1.add(cellsmodel3); + cellslist1.add(cellsmodel4); + response.put("2", cellslist1); + Mockito.when(restclient.sendGetRequest(Mockito.anyString(), Mockito.any())) + .thenReturn(new ResponseEntity(response, HttpStatus.OK)); + List outputlist = new ArrayList<>(); + outputlist.add("1111"); + outputlist.add("2222"); + Map> output = configdbservice.fetchCUCPCellsOfSnssai("snssai"); + assertEquals(outputlist, output.get("1")); + + } } diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/MLMessageProcessorTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/MLMessageProcessorTest.java index 387b5fd0..708ba7e4 100644 --- a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/MLMessageProcessorTest.java +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/MLMessageProcessorTest.java @@ -97,7 +97,7 @@ public class MLMessageProcessorTest { } catch (IOException e) { e.printStackTrace(); } - when(configDbService.fetchRICsOfSnssai("0001-0111")).thenReturn(ricToCellMapping); + when(configDbService.fetchCUCPCellsOfSnssai("0001-0111")).thenReturn(ricToCellMapping); AdditionalProperties addProps = new AdditionalProperties<>(); addProps.setResourceConfig(mloutputExp); doNothing().when(policyService).sendOnsetMessageToPolicy(anyString(), any(AdditionalProperties.class), diff --git a/components/slice-analysis-ms/src/test/resources/aaiDetailsList.json b/components/slice-analysis-ms/src/test/resources/aaiDetailsList.json index e538e220..4f306f34 100644 --- a/components/slice-analysis-ms/src/test/resources/aaiDetailsList.json +++ b/components/slice-analysis-ms/src/test/resources/aaiDetailsList.json @@ -44,9 +44,9 @@ "service-instance-id":"ab9af40f13f7219099333", "service-instance-name":"an_sp_1", "service-type":"00-000", - "service-role":"slice-profile-instance", + "service-role":"slice-profile", "environment-context":"001-00110", - "workload-context":"ÁN-NF", + "workload-context":"AN-NF", "service-instance-location-id":"[\"460-00\",\"460-01\"]", "resource-version":"1613715676282", "orchestration-status":"deactivated" -- cgit 1.2.3-korg