CPS-200: Custom Model E2E Network Slicing - RAN Inventory
This page covers the groovy tests to test the ran inventory model and data. It also cover the queries that the CPS team will need to implement.
CPS-200: Custom Model E2E Network Slicing - RAN InventoryClosed
Models and data
There was an issue with the original json data provided. We corrected this issue by modifying the root element.
cps-ran-inventory-data-incorrect.json (original)
cps-ran-inventory-data.json (corrected)
Queries used for the RAN inventory model
API Path | Description of Operation |
---|---|
GET /ran-inventory/sliceProfilesList/{sNSSAI} | Find a slice profile list that has the given sNSSAI value list sliceProfilesList{
uses SliceProfile;
key "sliceProfileId";
description "List of slice profiles supported by the ran slice";
}
|
PUT /ran-inventory/{rannfnssiid}/sliceProfilesList/ | Add/update the given slice profile for the given rannfnssi |
Groovy Test - E2E Coverage Area-Tracking Area & TA-Cell mapping data can be parsed for RAN inventory
Link to code review: https://gerrit.onap.org/r/c/cps/+/117447/2/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy
def 'E2E Coverage Area-Tracking Area & TA-Cell mapping data can be parsed for RAN inventory.'() {
def result
given: 'valid yang resource as name-to-content map'
def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap(
'e2e/basic/cps-ran-inventory.yang')
def schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourcesNameToContentMap).getSchemaContext()
and : 'a valid json is provided for the model'
def jsonData = TestUtils.getResourceFileContent('e2e/basic/cps-ran-inventory-data.txt')
and : 'all the further dependencies are mocked '
mockCpsAdminService.getAnchor('someDataspace', 'someAnchor') >>
new Anchor().builder().name('someAnchor').schemaSetName('someSchemaSet').build()
mockYangTextSchemaSourceSetCache.get('someDataspace', 'someSchemaSet') >> YangTextSchemaSourceSetBuilder.of(yangResourcesNameToContentMap)
mockModuleStoreService.getYangSchemaResources('someDataspace', 'someSchemaSet') >> schemaContext
when: 'saveData method is invoked'
cpsDataServiceImple.saveData('someDataspace', 'someAnchor', jsonData)
then: 'parameters are validated and processing is delegated to persistence service'
1 * mockDataStoreService.storeDataNode('someDataspace', 'someAnchor', _) >>
{ args -> result = args[2]}
and: 'the size of the tree is correct'
def cpsRanInventory = treeToFlatMapByXpath(new HashMap<>(), result)
assert cpsRanInventory.size() == 3
and: 'ran-inventory contains the correct child node'
def ranInventory = cpsRanInventory.get('/ran-inventory')
def sliceProfilesList = cpsRanInventory.get('/ran-inventory/sliceProfilesList[@sliceProfileId=\'f33a9dd8-ae51-4acf-8073-c9390c25f6f1\']')
def pLMNIdList = cpsRanInventory.get('/ran-inventory/sliceProfilesList[@sliceProfileId=\'f33a9dd8-ae51-4acf-8073-c9390c25f6f1\']/pLMNIdList[@mcc=\'310\' and @mnc=\'410\']')
ranInventory.getChildDataNodes().size() == 1
ranInventory.getChildDataNodes().find( {it.xpath == sliceProfilesList.xpath})
and: 'sliceProfilesList contains the correct child node'
sliceProfilesList.getChildDataNodes().size() == 1
sliceProfilesList.getChildDataNodes().find( {it.xpath == pLMNIdList.xpath})
and: 'pLMNIdList contains the no child nodes'
pLMNIdList.getChildDataNodes().size() == 0
}