Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame^] | 1 | import {createRequest} from './mso.factory'; |
| 2 | |
| 3 | sessionStorage.setItem("msoRequestParametersTestApiValue","GR_API"); |
| 4 | describe('Vlantagging', () => { |
| 5 | it('should create a correct request', (done: DoneFn) => { |
| 6 | let userInputs_withEcompGeneratedNaming = { |
| 7 | "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 8 | "lcpRegion": "AAIAIC25", |
| 9 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 10 | "aicZone": "YYY1", |
| 11 | "platformName": "plat1", |
| 12 | "lineOfBusiness": "ecomp" |
| 13 | }; |
| 14 | let userInputs_withoutEcompGeneratedNaming = { |
| 15 | "instanceName": "New Name", |
| 16 | "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 17 | "lcpRegion": "AAIAIC25", |
| 18 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 19 | "aicZone": "YYY1", |
| 20 | "platformName": "plat1", |
| 21 | "lineOfBusiness": "ecomp" |
| 22 | }; |
| 23 | let service = { |
| 24 | "service": { |
| 25 | "uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca", |
| 26 | "invariantUuid": "9aa04749-c02c-432d-a90c-18caa361c833", |
| 27 | "name": "vDBE_srv", |
| 28 | "version": "1.0", |
| 29 | "toscaModelURL": null, |
| 30 | "category": "Network L4+", |
| 31 | "serviceType": "", |
| 32 | "serviceRole": "", |
| 33 | "description": "vDBE_srv", |
| 34 | "serviceEcompNaming": "true", |
| 35 | "instantiationType": "A-La-Carte", |
| 36 | "inputs": {} |
| 37 | }, |
| 38 | "vnfs": { |
| 39 | "vDBE 0": { |
| 40 | "uuid": "61535073-2e50-4141-9000-f66fea69b433", |
| 41 | "invariantUuid": "fcdf49ce-6f0b-4ca2-b676-a484e650e734", |
| 42 | "description": "vDBE", |
| 43 | "name": "vDBE", |
| 44 | "version": "0.2", |
| 45 | "customizationUuid": "1", |
| 46 | "inputs": {}, |
| 47 | "commands": {}, |
| 48 | "properties": { |
| 49 | "nf_naming": "{ecomp_generated_naming=true}", |
| 50 | "multi_stage_design": "false", |
| 51 | "oam_vfc_instance_group_function": "oambbb", |
| 52 | "availability_zone_max_count": "1", |
| 53 | "oam_network_collection_function": "oamaaa", |
| 54 | "ecomp_generated_naming": "true", |
| 55 | "untr_vfc_instance_group_function": "untrbbb", |
| 56 | "untr_network_collection_function": "untraaa" |
| 57 | }, |
| 58 | "type": "VF", |
| 59 | "modelCustomizationName": "vDBE 0", |
| 60 | "vfModules": { |
| 61 | "vdbe0..Vdbe..main..module-0": { |
| 62 | "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912", |
| 63 | "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781", |
| 64 | "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e", |
| 65 | "description": null, |
| 66 | "name": "Vdbe..main..module-0", |
| 67 | "version": "1", |
| 68 | "modelCustomizationName": "Vdbe..main..module-0", |
| 69 | "properties": { |
| 70 | "minCountInstances": 1, |
| 71 | "maxCountInstances": 1, |
| 72 | "initialCount": 1, |
| 73 | "vfModuleLabel": "main" |
| 74 | }, |
| 75 | "inputs": {}, |
| 76 | "volumeGroupAllowed": false |
| 77 | } |
| 78 | }, |
| 79 | "volumeGroups": {}, |
| 80 | "vfcInstanceGroups": { |
| 81 | "untr_group": { |
| 82 | "uuid": "5fca04e2-a889-4579-8338-f60f1bf285fa", |
| 83 | "invariantUuid": "fb1e384b-117a-46ae-9ad1-bf2f1ee1e49f", |
| 84 | "name": "untr_group", |
| 85 | "version": "1", |
| 86 | "vfcInstanceGroupProperties": { |
| 87 | "vfcParentPortRole": "untr", |
| 88 | "networkCollectionFunction": "untraaa", |
| 89 | "vfcInstanceGroupFunction": null, |
| 90 | "subinterfaceRole": "untr" |
| 91 | } |
| 92 | }, |
| 93 | "oam_group": { |
| 94 | "uuid": "a0efd5fc-f7be-4502-936a-a6c6392b958f", |
| 95 | "invariantUuid": "9384abf9-1231-4da4-bd8d-89e4d2f8a749", |
| 96 | "name": "oam_group", |
| 97 | "version": "1", |
| 98 | "vfcInstanceGroupProperties": { |
| 99 | "vfcParentPortRole": "untr", |
| 100 | "networkCollectionFunction": "untraaa", |
| 101 | "vfcInstanceGroupFunction": null, |
| 102 | "subinterfaceRole": "untr" |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | }, |
| 108 | "networks": {}, |
| 109 | "collectionResource": {}, |
| 110 | "configurations": {}, |
| 111 | "serviceProxies": {}, |
| 112 | "vfModules": { |
| 113 | "vdbe0..Vdbe..main..module-0": { |
| 114 | "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912", |
| 115 | "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781", |
| 116 | "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e", |
| 117 | "description": null, |
| 118 | "name": "Vdbe..main..module-0", |
| 119 | "version": "1", |
| 120 | "modelCustomizationName": "Vdbe..main..module-0", |
| 121 | "properties": { |
| 122 | "minCountInstances": 1, |
| 123 | "maxCountInstances": 1, |
| 124 | "initialCount": 1, |
| 125 | "vfModuleLabel": "main" |
| 126 | }, |
| 127 | "inputs": {}, |
| 128 | "volumeGroupAllowed": false |
| 129 | } |
| 130 | }, |
| 131 | "volumeGroups": {}, |
| 132 | "pnfs": {} |
| 133 | }; |
| 134 | let serviceInstanceId: string = "6bce7302-70bd-4057-b48e-8d5b99e686ca"; |
| 135 | let networkInstanceGroups = { |
| 136 | "untr_group": { |
| 137 | "instance-group": { |
| 138 | "instance-group-role": "JZmha7QSS4tJ", |
| 139 | "model-invariant-id": "model-id3", |
| 140 | "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f", |
| 141 | "id": "AAI-12002-test3-vm230w", |
| 142 | "description": "a9DEa0kpY", |
| 143 | "instance-group-type": "type", |
| 144 | "resource-version": "1520888659539", |
| 145 | "instance-group-name": "wKmBXiO1xm8bK", |
| 146 | "instance-group-function": "testfunction2", |
| 147 | "relationship-list": { |
| 148 | "relationship": [ |
| 149 | { |
| 150 | "relationDataList": [ |
| 151 | { |
| 152 | "relationship-key": "cloud-region.cloud-owner", |
| 153 | "relationship-value": "AAI-12002-vm230w" |
| 154 | }, |
| 155 | { |
| 156 | "relationship-key": "cloud-region.cloud-region-id", |
| 157 | "relationship-value": "AAI-region-vm230w" |
| 158 | } |
| 159 | ], |
| 160 | "relatedToPropertyList": [ |
| 161 | { |
| 162 | "property-key": "cloud-region.owner-defined-type", |
| 163 | "property-value": null |
| 164 | } |
| 165 | ], |
| 166 | "related-to": "cloud-region", |
| 167 | "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w", |
| 168 | "relationship-label": "org.onap.relationships.inventory.Uses", |
| 169 | "relationship-data": [ |
| 170 | { |
| 171 | "relationship-key": "cloud-region.cloud-owner", |
| 172 | "relationship-value": "AAI-12002-vm230w" |
| 173 | }, |
| 174 | { |
| 175 | "relationship-key": "cloud-region.cloud-region-id", |
| 176 | "relationship-value": "AAI-region-vm230w" |
| 177 | } |
| 178 | ], |
| 179 | "related-to-property": [ |
| 180 | { |
| 181 | "property-key": "cloud-region.owner-defined-type", |
| 182 | "property-value": null |
| 183 | } |
| 184 | ] |
| 185 | } |
| 186 | ] |
| 187 | } |
| 188 | } |
| 189 | }, |
| 190 | "oam_group": { |
| 191 | "instance-group": { |
| 192 | "instance-group-role": "JZmha7QSS4tJ", |
| 193 | "model-invariant-id": "model-id3", |
| 194 | "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f", |
| 195 | "id": "AAI-12002-test3-vm230w", |
| 196 | "description": "a9DEa0kpY", |
| 197 | "instance-group-type": "type", |
| 198 | "resource-version": "1520888659539", |
| 199 | "instance-group-name": "wKmBXiO1xm8bK", |
| 200 | "instance-group-function": "testfunction2", |
| 201 | "relationship-list": { |
| 202 | "relationship": [ |
| 203 | { |
| 204 | "relationDataList": [ |
| 205 | { |
| 206 | "relationship-key": "cloud-region.cloud-owner", |
| 207 | "relationship-value": "AAI-12002-vm230w" |
| 208 | }, |
| 209 | { |
| 210 | "relationship-key": "cloud-region.cloud-region-id", |
| 211 | "relationship-value": "AAI-region-vm230w" |
| 212 | } |
| 213 | ], |
| 214 | "relatedToPropertyList": [ |
| 215 | { |
| 216 | "property-key": "cloud-region.owner-defined-type", |
| 217 | "property-value": null |
| 218 | } |
| 219 | ], |
| 220 | "related-to": "cloud-region", |
| 221 | "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w", |
| 222 | "relationship-label": "org.onap.relationships.inventory.Uses", |
| 223 | "relationship-data": [ |
| 224 | { |
| 225 | "relationship-key": "cloud-region.cloud-owner", |
| 226 | "relationship-value": "AAI-12002-vm230w" |
| 227 | }, |
| 228 | { |
| 229 | "relationship-key": "cloud-region.cloud-region-id", |
| 230 | "relationship-value": "AAI-region-vm230w" |
| 231 | } |
| 232 | ], |
| 233 | "related-to-property": [ |
| 234 | { |
| 235 | "property-key": "cloud-region.owner-defined-type", |
| 236 | "property-value": null |
| 237 | } |
| 238 | ] |
| 239 | } |
| 240 | ] |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | }; |
| 245 | let expectedResult = { |
| 246 | "requestInfo": { |
| 247 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 248 | "source": "VID", |
| 249 | "requestorId": "az2016", |
| 250 | "suppressRollback": false |
| 251 | }, |
| 252 | "lineOfBusiness": Object({ lineOfBusinessName: "ecomp" }), |
| 253 | "cloudConfiguration": { |
| 254 | "lcpCloudRegionId": "AAIAIC25", |
| 255 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86" |
| 256 | }, |
| 257 | "platform": Object({ platformName: "plat1" }), |
| 258 | "modelInfo": { |
| 259 | modelCustomizationId :'1', |
| 260 | "modelVersionId": "61535073-2e50-4141-9000-f66fea69b433", |
| 261 | "modelCustomizationName": "vDBE 0", |
| 262 | "modelName": "vDBE", |
| 263 | "modelInvariantId": "fcdf49ce-6f0b-4ca2-b676-a484e650e734", |
| 264 | "modelType": "vnf", |
| 265 | "modelVersion": "0.2" |
| 266 | }, |
| 267 | "requestParameters": { |
| 268 | "userParams": [], |
| 269 | "testApi": "GR_API" |
| 270 | }, |
| 271 | "relatedInstanceList": [ |
| 272 | { |
| 273 | "relatedInstance": { |
| 274 | "instanceId": "6bce7302-70bd-4057-b48e-8d5b99e686ca", |
| 275 | "modelInfo": { |
| 276 | "modelVersionId": "6bce7302-70bd-4057-b48e-8d5b99e686ca", |
| 277 | "modelName": "vDBE_srv", |
| 278 | "modelInvariantId": "9aa04749-c02c-432d-a90c-18caa361c833", |
| 279 | "modelType": "service", |
| 280 | "modelVersion": "1.0" |
| 281 | } |
| 282 | } |
| 283 | }, |
| 284 | { |
| 285 | "relatedInstance": { |
| 286 | "instanceId": "AAI-12002-test3-vm230w", |
| 287 | "modelInfo": { |
| 288 | "modelName": "oam_group", |
| 289 | "modelType": "networkCollection", |
| 290 | "modelVersion": "1", |
| 291 | "modelVersionId": "a0efd5fc-f7be-4502-936a-a6c6392b958f", |
| 292 | "modelInvariantId": "9384abf9-1231-4da4-bd8d-89e4d2f8a749" |
| 293 | } |
| 294 | } |
| 295 | }, |
| 296 | { |
| 297 | "relatedInstance": { |
| 298 | "instanceId": "AAI-12002-test3-vm230w", |
| 299 | "modelInfo": { |
| 300 | "modelName": "oam_group", |
| 301 | "modelType": "networkCollection", |
| 302 | "modelVersion": "1", |
| 303 | "modelVersionId": "a0efd5fc-f7be-4502-936a-a6c6392b958f", |
| 304 | "modelInvariantId": "9384abf9-1231-4da4-bd8d-89e4d2f8a749" |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | ] |
| 309 | }; |
| 310 | |
| 311 | |
| 312 | let actualResult_withEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDBE 0','1'); |
| 313 | expect(actualResult_withEcompGeneratedNaming).toEqual(expectedResult); |
| 314 | expectedResult["requestInfo"]["instanceName"] = "New Name"; |
| 315 | let actualResult_withoutEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withoutEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDBE 0','1'); |
| 316 | expect(actualResult_withoutEcompGeneratedNaming).toEqual(expectedResult); |
| 317 | done(); |
| 318 | }); |
| 319 | }); |