summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/factories/mso.factory.spec.ts
blob: 16efd2970c9df2189da2c0aecad60e5bf89ad225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
import {createRequest} from './mso.factory';

sessionStorage.setItem("msoRequestParametersTestApiValue","GR_API");
describe('Vlantagging', () => {
  it('should create a correct request', (done: DoneFn) => {
    let userInputs_withEcompGeneratedNaming = {
      "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89",
      "lcpRegion": "AAIAIC25",
      "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
      "aicZone": "YYY1",
      "platformName": "plat1",
      "lineOfBusiness": "ecomp"
    };
    let userInputs_withoutEcompGeneratedNaming = {
      "instanceName": "New Name",
      "productFamily": "e433710f-9217-458d-a79d-1c7aff376d89",
      "lcpRegion": "AAIAIC25",
      "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
      "aicZone": "YYY1",
      "platformName": "plat1",
      "lineOfBusiness": "ecomp"
    };
    let service = {
      "service": {
        "uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
        "invariantUuid": "9aa04749-c02c-432d-a90c-18caa361c833",
        "name": "vDBE_srv",
        "version": "1.0",
        "toscaModelURL": null,
        "category": "Network L4+",
        "serviceType": "",
        "serviceRole": "",
        "description": "vDBE_srv",
        "serviceEcompNaming": "true",
        "instantiationType": "A-La-Carte",
        "inputs": {}
      },
      "vnfs": {
        "vDBE 0": {
          "uuid": "61535073-2e50-4141-9000-f66fea69b433",
          "invariantUuid": "fcdf49ce-6f0b-4ca2-b676-a484e650e734",
          "description": "vDBE",
          "name": "vDBE",
          "version": "0.2",
          "customizationUuid": "1",
          "inputs": {},
          "commands": {},
          "properties": {
            "nf_naming": "{ecomp_generated_naming=true}",
            "multi_stage_design": "false",
            "oam_vfc_instance_group_function": "oambbb",
            "availability_zone_max_count": "1",
            "oam_network_collection_function": "oamaaa",
            "ecomp_generated_naming": "true",
            "untr_vfc_instance_group_function": "untrbbb",
            "untr_network_collection_function": "untraaa"
          },
          "type": "VF",
          "modelCustomizationName": "vDBE 0",
          "vfModules": {
            "vdbe0..Vdbe..main..module-0": {
              "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
              "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
              "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
              "description": null,
              "name": "Vdbe..main..module-0",
              "version": "1",
              "modelCustomizationName": "Vdbe..main..module-0",
              "properties": {
                "minCountInstances": 1,
                "maxCountInstances": 1,
                "initialCount": 1,
                "vfModuleLabel": "main"
              },
              "inputs": {},
              "volumeGroupAllowed": false
            }
          },
          "volumeGroups": {},
          "vfcInstanceGroups": {
            "untr_group": {
              "uuid": "5fca04e2-a889-4579-8338-f60f1bf285fa",
              "invariantUuid": "fb1e384b-117a-46ae-9ad1-bf2f1ee1e49f",
              "name": "untr_group",
              "version": "1",
              "vfcInstanceGroupProperties": {
                "vfcParentPortRole": "untr",
                "networkCollectionFunction": "untraaa",
                "vfcInstanceGroupFunction": null,
                "subinterfaceRole": "untr"
              }
            },
            "oam_group": {
              "uuid": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
              "invariantUuid": "9384abf9-1231-4da4-bd8d-89e4d2f8a749",
              "name": "oam_group",
              "version": "1",
              "vfcInstanceGroupProperties": {
                "vfcParentPortRole": "untr",
                "networkCollectionFunction": "untraaa",
                "vfcInstanceGroupFunction": null,
                "subinterfaceRole": "untr"
              }
            }
          }
        }
      },
      "networks": {},
      "collectionResource": {},
      "configurations": {},
      "serviceProxies": {},
      "vfModules": {
        "vdbe0..Vdbe..main..module-0": {
          "uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
          "invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
          "customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
          "description": null,
          "name": "Vdbe..main..module-0",
          "version": "1",
          "modelCustomizationName": "Vdbe..main..module-0",
          "properties": {
            "minCountInstances": 1,
            "maxCountInstances": 1,
            "initialCount": 1,
            "vfModuleLabel": "main"
          },
          "inputs": {},
          "volumeGroupAllowed": false
        }
      },
      "volumeGroups": {},
      "pnfs": {}
    };
    let serviceInstanceId: string = "6bce7302-70bd-4057-b48e-8d5b99e686ca";
    let networkInstanceGroups = {
      "untr_group": {
        "instance-group": {
          "instance-group-role": "JZmha7QSS4tJ",
          "model-invariant-id": "model-id3",
          "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
          "id": "AAI-12002-test3-vm230w",
          "description": "a9DEa0kpY",
          "instance-group-type": "type",
          "resource-version": "1520888659539",
          "instance-group-name": "wKmBXiO1xm8bK",
          "instance-group-function": "testfunction2",
          "relationship-list": {
            "relationship": [
              {
                "relationDataList": [
                  {
                    "relationship-key": "cloud-region.cloud-owner",
                    "relationship-value": "AAI-12002-vm230w"
                  },
                  {
                    "relationship-key": "cloud-region.cloud-region-id",
                    "relationship-value": "AAI-region-vm230w"
                  }
                ],
                "relatedToPropertyList": [
                  {
                    "property-key": "cloud-region.owner-defined-type",
                    "property-value": null
                  }
                ],
                "related-to": "cloud-region",
                "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w",
                "relationship-label": "org.onap.relationships.inventory.Uses",
                "relationship-data": [
                  {
                    "relationship-key": "cloud-region.cloud-owner",
                    "relationship-value": "AAI-12002-vm230w"
                  },
                  {
                    "relationship-key": "cloud-region.cloud-region-id",
                    "relationship-value": "AAI-region-vm230w"
                  }
                ],
                "related-to-property": [
                  {
                    "property-key": "cloud-region.owner-defined-type",
                    "property-value": null
                  }
                ]
              }
            ]
          }
        }
      },
      "oam_group": {
        "instance-group": {
          "instance-group-role": "JZmha7QSS4tJ",
          "model-invariant-id": "model-id3",
          "model-version-id": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
          "id": "AAI-12002-test3-vm230w",
          "description": "a9DEa0kpY",
          "instance-group-type": "type",
          "resource-version": "1520888659539",
          "instance-group-name": "wKmBXiO1xm8bK",
          "instance-group-function": "testfunction2",
          "relationship-list": {
            "relationship": [
              {
                "relationDataList": [
                  {
                    "relationship-key": "cloud-region.cloud-owner",
                    "relationship-value": "AAI-12002-vm230w"
                  },
                  {
                    "relationship-key": "cloud-region.cloud-region-id",
                    "relationship-value": "AAI-region-vm230w"
                  }
                ],
                "relatedToPropertyList": [
                  {
                    "property-key": "cloud-region.owner-defined-type",
                    "property-value": null
                  }
                ],
                "related-to": "cloud-region",
                "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/AAI-12002-vm230w/AAI-region-vm230w",
                "relationship-label": "org.onap.relationships.inventory.Uses",
                "relationship-data": [
                  {
                    "relationship-key": "cloud-region.cloud-owner",
                    "relationship-value": "AAI-12002-vm230w"
                  },
                  {
                    "relationship-key": "cloud-region.cloud-region-id",
                    "relationship-value": "AAI-region-vm230w"
                  }
                ],
                "related-to-property": [
                  {
                    "property-key": "cloud-region.owner-defined-type",
                    "property-value": null
                  }
                ]
              }
            ]
          }
        }
      }
    };
    let expectedResult = {
      "requestInfo": {
        "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
        "source": "VID",
        "requestorId": "az2016",
        "suppressRollback": false
      },
      "lineOfBusiness": Object({ lineOfBusinessName: "ecomp" }),
      "cloudConfiguration": {
        "lcpCloudRegionId": "AAIAIC25",
        "tenantId": "092eb9e8e4b7412e8787dd091bc58e86"
      },
      "platform": Object({ platformName: "plat1" }),
      "modelInfo": {
        modelCustomizationId :'1',
        "modelVersionId": "61535073-2e50-4141-9000-f66fea69b433",
        "modelCustomizationName": "vDBE 0",
        "modelName": "vDBE",
        "modelInvariantId": "fcdf49ce-6f0b-4ca2-b676-a484e650e734",
        "modelType": "vnf",
        "modelVersion": "0.2"
      },
      "requestParameters": {
        "userParams": [],
        "testApi": "GR_API"
      },
      "relatedInstanceList": [
        {
          "relatedInstance": {
            "instanceId": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
            "modelInfo": {
              "modelVersionId": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
              "modelName": "vDBE_srv",
              "modelInvariantId": "9aa04749-c02c-432d-a90c-18caa361c833",
              "modelType": "service",
              "modelVersion": "1.0"
            }
          }
        },
        {
          "relatedInstance": {
            "instanceId": "AAI-12002-test3-vm230w",
            "modelInfo": {
              "modelName": "oam_group",
              "modelType": "networkCollection",
              "modelVersion": "1",
              "modelVersionId": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
              "modelInvariantId": "9384abf9-1231-4da4-bd8d-89e4d2f8a749"
            }
          }
        },
        {
          "relatedInstance": {
            "instanceId": "AAI-12002-test3-vm230w",
            "modelInfo": {
              "modelName": "oam_group",
              "modelType": "networkCollection",
              "modelVersion": "1",
              "modelVersionId": "a0efd5fc-f7be-4502-936a-a6c6392b958f",
              "modelInvariantId": "9384abf9-1231-4da4-bd8d-89e4d2f8a749"
            }
          }
        }
      ]
    };


    let actualResult_withEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDBE 0','1');
    expect(actualResult_withEcompGeneratedNaming).toEqual(expectedResult);
    expectedResult["requestInfo"]["instanceName"] = "New Name";
    let actualResult_withoutEcompGeneratedNaming = <any>createRequest("az2016",userInputs_withoutEcompGeneratedNaming, service, serviceInstanceId, networkInstanceGroups,'vDBE 0','1');
    expect(actualResult_withoutEcompGeneratedNaming).toEqual(expectedResult);
    done();
  });
});