aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/test
diff options
context:
space:
mode:
authorsr20255772 <sravya.sherla@wipro.com>2022-03-04 05:16:45 +0000
committersr20255772 <sravya.sherla@wipro.com>2022-03-14 08:55:42 +0000
commit7455d3001d9f6ed252106f83ef30a501c5470349 (patch)
tree36407aed4d684c2cc9fe941d67356b7aea9ccc27 /bpmn/so-bpmn-infrastructure-common/src/test
parenteb21762c6bff948136ed1157787759a44c13745c (diff)
Implemented OOF call in TN NSSMF for allocate flow
Issue-ID: SO-3866 Change-Id: I40f55a4cbd2c886a98cc7fefa49ddd478a4a1cca Signed-off-by: sr20255772 <sravya.sherla@wipro.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy54
1 files changed, 54 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
index 6ea2be8e55..b7cddd2d5a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
@@ -31,9 +31,12 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.beans.nsmf.oof.TemplateInfo
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.common.scripts.OofUtils
import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertEquals
import static org.mockito.ArgumentMatchers.eq
import static org.mockito.Mockito.*
@@ -166,4 +169,55 @@ class DoAllocateTnNssiTest extends MsoGroovyTest {
}"""
return expect.replaceAll("\\\\s+", "")
}
+
+ @Test
+ void testPrepareOofSelection() {
+ when(mockExecution.getVariable("msoRequestId")).thenReturn("10dad82d-4bd9-467a-b113-5f8ea7eaae3c")
+ when(mockExecution.getVariable("modelUuid")).thenReturn("e2eb2fe3-92a7-447b-8582-077db5cd0862")
+ when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("22e6ce80-a55f-4171-a457-a7ecb1865669")
+ when(mockExecution.getVariable("tnModelName")).thenReturn("Tn_ONAP_internal_BH")
+ when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("")
+ TnAllocateNssi obj = spy(TnAllocateNssi.class)
+ OofUtils oofUtils = spy(OofUtils.class)
+ String requestId = "10dad82d-4bd9-467a-b113-5f8ea7eaae3c"
+ String nsstInfo = "\"{\"UUID\":\"e2eb2fe3-92a7-447b-8582-077db5cd0862\",\"invariantUUID\":\"22e6ce80-a55f-4171-a457-a7ecb1865669\",\"name\":\"Tn_ONAP_internal_BH\"}"
+ String messageType = "NSSISelectionResponse"
+ String sliceProfile = "{\"maxBandwidth\":3000,\"sliceProfileId\":\"ab9af40f13f721b5f13539d87484098\",\"latency\":10,\"snssaiList\":[\"001-100001\"],\"pLMNIdList\":[\"460-00\",\"460-01\"],\"perfReq\":{},\"coverageAreaTAList\":[],\"resourceSharingLevel\":\"shared\"}}"
+ Integer timeout = 600
+
+ when(oofUtils.buildSelectNSSIRequest(requestId, nsstInfo as TemplateInfo, messageType, sliceProfile, timeout)).thenReturn("""
+ {
+ "apiPath": "/api/oof/selection/nssi/v1",
+ "requestDetails": "{\\"requestInfo\\":{\\"transactionId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"requestId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"callbackUrl\\":\\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/NSSISelectionResponse/10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"sourceId\\":\\"SO\\",\\"timeout\\":600,\\"numSolutions\\":1},\\"NSSTInfo\\":{\\"UUID\\":\\"e2eb2fe3-92a7-447b-8582-077db5cd0862\\",\\"invariantUUID\\":\\"22e6ce80-a55f-4171-a457-a7ecb1865669\\",\\"name\\":\\"Tn_ONAP_internal_BH\\"},\\"sliceProfile\\":{\\"maxBandwidth\\":3000,\\"sliceProfileId\\":\\"ab9af40f13f721b5f13539d87484098\\",\\"latency\\":10,\\"snssaiList\\":[\\"001-100001\\"],\\"pLMNIdList\\":[\\"460-00\\",\\"460-01\\"],\\"perfReq\\":{},\\"coverageAreaTAList\\":[],\\"resourceSharingLevel\\":\\"shared\\"}}"
+ }""".replaceAll("\\\\s+", ""))
+ obj.prepareOofSelection(mockExecution)
+ verify(mockExecution, times(1)).setVariable(eq("nssiSelection_oofRequest"), captor.capture())
+ String nssiSelection_oofRequest = captor.getValue()
+ assertNotNull(nssiSelection_oofRequest)
+ }
+
+ @Test
+ void testprocessOofSelection() {
+ when(mockExecution.getVariable("nssiSelection_oofRequest")).thenReturn("""
+ {
+ "requestId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7",
+ "transactionId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7",
+ "requestStatus": "completed",
+ "statusMessage": "",
+ "solutions": [
+ {
+ "UUID": "e2eb2fe3-92a7-447b-8582-077db5cd0862",
+ "invariantUUID": "22e6ce80-a55f-4171-a457-a7ecb1865669",
+ "NSSIName": "nssi_tnservice12",
+ "NSSIId": "fe26a924-3845-4001-b84e-a439a27a88c0"
+ }
+ ]
+ }""".replaceAll("\\\\s+", ""))
+ TnAllocateNssi obj = spy(TnAllocateNssi.class)
+ ArrayList<String> solution = new ArrayList<>()
+ assertEquals(1, solution.size())
+ verify(mockExecution, times(1)).setVariable(eq("isOofTnNssiSelected"), captor.capture())
+ String isOofTnNssiSelected = captor.getValue()
+ assertEquals("true", isOofTnNssiSelected)
+ }
}