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