Merge "Upgrade epsdk version to 2.6.0 (but keep overlay 2.5.0) (fix)"
[vid.git] / vid-webpack-master / src / app / shared / components / genericForm / formControlsServices / vnfGenerator / vnf.control.generator.spec.ts
1 import {getTestBed, TestBed} from '@angular/core/testing';
2 import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
3 import {NgRedux} from '@angular-redux/store';
4 import {FormControlNames} from "../service.control.generator";
5 import {ControlGeneratorUtil} from "../control.generator.util.service";
6 import {AaiService} from "../../../../services/aaiService/aai.service";
7 import {GenericFormService} from "../../generic-form.service";
8 import {FormBuilder} from "@angular/forms";
9 import {FormControlModel, ValidatorModel, ValidatorOptions} from "../../../../models/formControlModels/formControl.model";
10 import {LogService} from "../../../../utils/log/log.service";
11 import {VnfControlGenerator} from "./vnf.control.generator";
12 import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
13 import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
14 import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
15
16 class MockAppStore<T> {
17   getState(){
18     return {
19       "global": {
20         "name": null,
21         "flags": {
22           "FLAG_NETWORK_TO_ASYNC_INSTANTIATION": false,
23           "FLAG_SHOW_ASSIGNMENTS": true,
24           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
25           "FLAG_SHOW_VERIFY_SERVICE": false,
26           "FLAG_SERVICE_MODEL_CACHE": true,
27           "FLAG_ADD_MSO_TESTAPI_FIELD": true
28         },
29         "type": "[FLAGS] Update"
30       },
31       "service": {
32         "serviceHierarchy": {
33           "6e59c5de-f052-46fa-aa7e-2fca9d674c44": {
34             "service": {
35               "uuid": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
36               "invariantUuid": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
37               "name": "ComplexService",
38               "version": "1.0",
39               "toscaModelURL": null,
40               "category": "Emanuel",
41               "serviceType": "",
42               "serviceRole": "",
43               "description": "ComplexService",
44               "serviceEcompNaming": "false",
45               "instantiationType": "Macro",
46               "inputs": {}
47             },
48             "vnfs": {
49               "VF_vGeraldine 0": {
50                 "uuid": "d6557200-ecf2-4641-8094-5393ae3aae60",
51                 "invariantUuid": "4160458e-f648-4b30-a176-43881ffffe9e",
52                 "description": "VSP_vGeraldine",
53                 "name": "VF_vGeraldine",
54                 "version": "2.0",
55                 "customizationUuid": "91415b44-753d-494c-926a-456a9172bbb9",
56                 "inputs": {},
57                 "commands": {},
58                 "properties": {
59                   "max_instances": 10,
60                   "min_instances": 1,
61                   "gpb2_Internal2_mac": "00:11:22:EF:AC:DF",
62                   "sctp-b-ipv6-egress_src_start_port": "0",
63                   "sctp-a-ipv6-egress_rule_application": "any",
64                   "Internal2_allow_transit": "true",
65                   "sctp-b-IPv6_ethertype": "IPv6",
66                   "sctp-a-egress_rule_application": "any",
67                   "sctp-b-ingress_action": "pass",
68                   "sctp-b-ingress_rule_protocol": "icmp",
69                   "ncb2_Internal1_mac": "00:11:22:EF:AC:DF",
70                   "sctp-b-ipv6-ingress-src_start_port": "0.0",
71                   "ncb1_Internal2_mac": "00:11:22:EF:AC:DF",
72                   "fsb_volume_size_0": "320.0",
73                   "sctp-b-egress_src_addresses": "local",
74                   "sctp-a-ipv6-ingress_ethertype": "IPv4",
75                   "sctp-a-ipv6-ingress-dst_start_port": "0",
76                   "sctp-b-ipv6-ingress_rule_application": "any",
77                   "domain_name": "default-domain",
78                   "sctp-a-ingress_rule_protocol": "icmp",
79                   "sctp-b-egress-src_start_port": "0.0",
80                   "sctp-a-egress_src_addresses": "local",
81                   "sctp-b-display_name": "epc-sctp-b-ipv4v6-sec-group",
82                   "sctp-a-egress-src_start_port": "0.0",
83                   "sctp-a-ingress_ethertype": "IPv4",
84                   "sctp-b-ipv6-ingress-dst_end_port": "65535",
85                   "sctp-b-dst_subnet_prefix_v6": "::",
86                   "nf_naming": "{ecomp_generated_naming=true}",
87                   "sctp-a-ipv6-ingress_src_subnet_prefix": "0.0.0.0",
88                   "sctp-b-egress-dst_start_port": "0.0",
89                   "ncb_flavor_name": "nv.c20r64d1",
90                   "gpb1_Internal1_mac": "00:11:22:EF:AC:DF",
91                   "sctp-b-egress_dst_subnet_prefix_len": "0.0",
92                   "Internal2_net_cidr": "10.0.0.10",
93                   "sctp-a-ingress-dst_start_port": "0.0",
94                   "sctp-a-egress-dst_start_port": "0.0",
95                   "fsb1_Internal2_mac": "00:11:22:EF:AC:DF",
96                   "sctp-a-egress_ethertype": "IPv4",
97                   "vlc_st_service_mode": "in-network-nat",
98                   "sctp-a-ipv6-egress_ethertype": "IPv4",
99                   "sctp-a-egress-src_end_port": "65535.0",
100                   "sctp-b-ipv6-egress_rule_application": "any",
101                   "sctp-b-egress_action": "pass",
102                   "sctp-a-ingress-src_subnet_prefix_len": "0.0",
103                   "sctp-b-ipv6-ingress-src_end_port": "65535.0",
104                   "sctp-b-name": "epc-sctp-b-ipv4v6-sec-group",
105                   "fsb2_Internal1_mac": "00:11:22:EF:AC:DF",
106                   "sctp-a-ipv6-ingress-src_start_port": "0.0",
107                   "sctp-b-ipv6-egress_ethertype": "IPv4",
108                   "Internal1_net_cidr": "10.0.0.10",
109                   "sctp-a-egress_dst_subnet_prefix": "0.0.0.0",
110                   "fsb_flavor_name": "nv.c20r64d1",
111                   "sctp_rule_protocol": "132",
112                   "sctp-b-ipv6-ingress_src_subnet_prefix_len": "0",
113                   "sctp-a-ipv6-ingress_rule_application": "any",
114                   "ecomp_generated_naming": "false",
115                   "sctp-a-IPv6_ethertype": "IPv6",
116                   "vlc2_Internal1_mac": "00:11:22:EF:AC:DF",
117                   "vlc_st_virtualization_type": "virtual-machine",
118                   "sctp-b-ingress-dst_start_port": "0.0",
119                   "sctp-b-ingress-dst_end_port": "65535.0",
120                   "sctp-a-ipv6-ingress-src_end_port": "65535.0",
121                   "sctp-a-display_name": "epc-sctp-a-ipv4v6-sec-group",
122                   "sctp-b-ingress_rule_application": "any",
123                   "int2_sec_group_name": "int2-sec-group",
124                   "vlc_flavor_name": "nd.c16r64d1",
125                   "sctp-b-ipv6-egress_src_addresses": "local",
126                   "vlc_st_interface_type_int1": "other1",
127                   "sctp-b-egress-src_end_port": "65535.0",
128                   "sctp-a-ipv6-egress-dst_start_port": "0",
129                   "vlc_st_interface_type_int2": "other2",
130                   "sctp-a-ipv6-egress_rule_protocol": "any",
131                   "Internal2_shared": "false",
132                   "sctp-a-ipv6-egress_dst_subnet_prefix_len": "0",
133                   "Internal2_rpf": "disable",
134                   "vlc1_Internal1_mac": "00:11:22:EF:AC:DF",
135                   "sctp-b-ipv6-egress_src_end_port": "65535",
136                   "sctp-a-ipv6-egress_src_addresses": "local",
137                   "sctp-a-ingress-dst_end_port": "65535.0",
138                   "sctp-a-ipv6-egress_src_end_port": "65535",
139                   "Internal1_forwarding_mode": "l2",
140                   "Internal2_dhcp": "false",
141                   "sctp-a-dst_subnet_prefix_v6": "::",
142                   "pxe_image_name": "MME_PXE-Boot_16ACP04_GA.qcow2",
143                   "vlc_st_interface_type_gtp": "other0",
144                   "ncb1_Internal1_mac": "00:11:22:EF:AC:DF",
145                   "sctp-b-src_subnet_prefix_v6": "::",
146                   "sctp-a-egress_dst_subnet_prefix_len": "0.0",
147                   "int1_sec_group_name": "int1-sec-group",
148                   "Internal1_dhcp": "false",
149                   "sctp-a-ipv6-egress_dst_end_port": "65535",
150                   "Internal2_forwarding_mode": "l2",
151                   "fsb2_Internal2_mac": "00:11:22:EF:AC:DF",
152                   "sctp-b-egress_dst_subnet_prefix": "0.0.0.0",
153                   "Internal1_net_cidr_len": "17",
154                   "gpb2_Internal1_mac": "00:11:22:EF:AC:DF",
155                   "sctp-b-ingress-src_subnet_prefix_len": "0.0",
156                   "sctp-a-ingress_dst_addresses": "local",
157                   "sctp-a-egress_action": "pass",
158                   "fsb_volume_type_0": "SF-Default-SSD",
159                   "ncb2_Internal2_mac": "00:11:22:EF:AC:DF",
160                   "vlc_st_interface_type_sctp_a": "left",
161                   "vlc_st_interface_type_sctp_b": "right",
162                   "sctp-a-src_subnet_prefix_v6": "::",
163                   "vlc_st_version": "2",
164                   "sctp-b-egress_ethertype": "IPv4",
165                   "sctp-a-ingress_rule_application": "any",
166                   "gpb1_Internal2_mac": "00:11:22:EF:AC:DF",
167                   "instance_ip_family_v6": "v6",
168                   "sctp-a-ipv6-egress_src_start_port": "0",
169                   "sctp-b-ingress-src_start_port": "0.0",
170                   "sctp-b-ingress_dst_addresses": "local",
171                   "fsb1_Internal1_mac": "00:11:22:EF:AC:DF",
172                   "vlc_st_interface_type_oam": "management",
173                   "multi_stage_design": "true",
174                   "oam_sec_group_name": "oam-sec-group",
175                   "Internal2_net_gateway": "10.0.0.10",
176                   "sctp-a-ipv6-ingress-dst_end_port": "65535",
177                   "sctp-b-ipv6-egress-dst_start_port": "0",
178                   "Internal1_net_gateway": "10.0.0.10",
179                   "sctp-b-ipv6-egress_rule_protocol": "any",
180                   "gtp_sec_group_name": "gtp-sec-group",
181                   "sctp-a-ipv6-egress_dst_subnet_prefix": "0.0.0.0",
182                   "sctp-b-ipv6-egress_dst_subnet_prefix_len": "0",
183                   "sctp-a-ipv6-ingress_dst_addresses": "local",
184                   "sctp-a-egress_rule_protocol": "icmp",
185                   "sctp-b-ipv6-egress_action": "pass",
186                   "sctp-a-ipv6-egress_action": "pass",
187                   "Internal1_shared": "false",
188                   "sctp-b-ipv6-ingress_rule_protocol": "any",
189                   "Internal2_net_cidr_len": "17",
190                   "sctp-a-name": "epc-sctp-a-ipv4v6-sec-group",
191                   "sctp-a-ingress-src_end_port": "65535.0",
192                   "sctp-b-ipv6-ingress_src_subnet_prefix": "0.0.0.0",
193                   "sctp-a-egress-dst_end_port": "65535.0",
194                   "sctp-a-ingress_action": "pass",
195                   "sctp-b-egress_rule_protocol": "icmp",
196                   "sctp-b-ipv6-ingress_action": "pass",
197                   "vlc_st_service_type": "firewall",
198                   "sctp-b-ipv6-egress_dst_end_port": "65535",
199                   "sctp-b-ipv6-ingress-dst_start_port": "0",
200                   "vlc2_Internal2_mac": "00:11:22:EF:AC:DF",
201                   "vlc_st_availability_zone": "true",
202                   "fsb_volume_image_name_1": "MME_FSB2_16ACP04_GA.qcow2",
203                   "sctp-b-ingress-src_subnet_prefix": "0.0.0.0",
204                   "sctp-a-ipv6-ingress_src_subnet_prefix_len": "0",
205                   "Internal1_allow_transit": "true",
206                   "gpb_flavor_name": "nv.c20r64d1",
207                   "availability_zone_max_count": "1",
208                   "fsb_volume_image_name_0": "MME_FSB1_16ACP04_GA.qcow2",
209                   "sctp-b-ipv6-ingress_dst_addresses": "local",
210                   "sctp-b-ipv6-egress_dst_subnet_prefix": "0.0.0.0",
211                   "sctp-b-ipv6-ingress_ethertype": "IPv4",
212                   "vlc1_Internal2_mac": "00:11:22:EF:AC:DF",
213                   "sctp-a-ingress-src_subnet_prefix": "0.0.0.0",
214                   "sctp-a-ipv6-ingress_action": "pass",
215                   "Internal1_rpf": "disable",
216                   "sctp-b-ingress_ethertype": "IPv4",
217                   "sctp-b-egress_rule_application": "any",
218                   "sctp-b-ingress-src_end_port": "65535.0",
219                   "sctp-a-ipv6-ingress_rule_protocol": "any",
220                   "sctp-a-ingress-src_start_port": "0.0",
221                   "sctp-b-egress-dst_end_port": "65535.0"
222                 },
223                 "type": "VF",
224                 "modelCustomizationName": "VF_vGeraldine 0",
225                 "vfModules": {
226                   "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1": {
227                     "uuid": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
228                     "invariantUuid": "98a7c88b-b577-476a-90e4-e25a5871e02b",
229                     "customizationUuid": "55b1be94-671a-403e-a26c-667e9c47d091",
230                     "description": null,
231                     "name": "VfVgeraldine..vflorence_vlc..module-1",
232                     "version": "2",
233                     "modelCustomizationName": "VfVgeraldine..vflorence_vlc..module-1",
234                     "properties": {
235                       "minCountInstances": 0,
236                       "maxCountInstances": null,
237                       "initialCount": 0,
238                       "vfModuleLabel": "vflorence_vlc"
239                     },
240                     "inputs": {},
241                     "volumeGroupAllowed": true
242                   },
243                   "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2": {
244                     "uuid": "41708296-e443-4c71-953f-d9a010f059e1",
245                     "invariantUuid": "1cca90b8-3490-495e-87da-3f3e4c57d5b9",
246                     "customizationUuid": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
247                     "description": null,
248                     "name": "VfVgeraldine..vflorence_gpb..module-2",
249                     "version": "2",
250                     "modelCustomizationName": "VfVgeraldine..vflorence_gpb..module-2",
251                     "properties": {
252                       "minCountInstances": 0,
253                       "maxCountInstances": null,
254                       "initialCount": 0,
255                       "vfModuleLabel": "vflorence_gpb"
256                     },
257                     "inputs": {},
258                     "volumeGroupAllowed": false
259                   },
260                   "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
261                     "uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
262                     "invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
263                     "customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
264                     "description": null,
265                     "name": "VfVgeraldine..base_vflorence..module-0",
266                     "version": "2",
267                     "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
268                     "properties": {
269                       "minCountInstances": 1,
270                       "maxCountInstances": 1,
271                       "initialCount": 1,
272                       "vfModuleLabel": "base_vflorence"
273                     },
274                     "inputs": {},
275                     "volumeGroupAllowed": true
276                   }
277                 },
278                 "volumeGroups": {
279                   "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
280                     "uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
281                     "invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
282                     "customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
283                     "description": null,
284                     "name": "VfVgeraldine..base_vflorence..module-0",
285                     "version": "2",
286                     "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
287                     "properties": {
288                       "minCountInstances": 1,
289                       "maxCountInstances": 1,
290                       "initialCount": 1,
291                       "vfModuleLabel": "base_vflorence"
292                     },
293                     "inputs": {}
294                   }
295                 },
296                 "vfcInstanceGroups": {}
297               }
298             },
299             "networks": {
300               "ExtVL 0": {
301                 "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
302                 "invariantUuid": "379f816b-a7aa-422f-be30-17114ff50b7c",
303                 "description": "ECOMP generic virtual link (network) base type for all other service-level and global networks",
304                 "name": "ExtVL",
305                 "version": "37.0",
306                 "customizationUuid": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
307                 "inputs": {},
308                 "commands": {},
309                 "properties": {
310                   "network_assignments": "{is_external_network=false, ipv4_subnet_default_assignment={min_subnets_count=1}, ecomp_generated_network_assignment=false, ipv6_subnet_default_assignment={min_subnets_count=1}}",
311                   "exVL_naming": "{ecomp_generated_naming=true}",
312                   "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
313                   "network_homing": "{ecomp_selected_instance_node_target=false}"
314                 },
315                 "type": "VL",
316                 "modelCustomizationName": "ExtVL 0"
317               }
318             },
319             "collectionResources": {},
320             "configurations": {
321               "Port Mirroring Configuration By Policy 0": {
322                 "uuid": "b4398538-e89d-4f13-b33d-ca323434ba50",
323                 "invariantUuid": "6ef0ca40-f366-4897-951f-abd65d25f6f7",
324                 "description": "A port mirroring configuration by policy object",
325                 "name": "Port Mirroring Configuration By Policy",
326                 "version": "27.0",
327                 "customizationUuid": "3c3b7b8d-8669-4b3b-8664-61970041fad2",
328                 "inputs": {},
329                 "commands": {},
330                 "properties": {},
331                 "type": "Configuration",
332                 "modelCustomizationName": "Port Mirroring Configuration By Policy 0",
333                 "sourceNodes": [],
334                 "collectorNodes": null,
335                 "configurationByPolicy": false
336               }
337             },
338             "serviceProxies": {},
339             "vfModules": {
340               "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1": {
341                 "uuid": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
342                 "invariantUuid": "98a7c88b-b577-476a-90e4-e25a5871e02b",
343                 "customizationUuid": "55b1be94-671a-403e-a26c-667e9c47d091",
344                 "description": null,
345                 "name": "VfVgeraldine..vflorence_vlc..module-1",
346                 "version": "2",
347                 "modelCustomizationName": "VfVgeraldine..vflorence_vlc..module-1",
348                 "properties": {
349                   "minCountInstances": 0,
350                   "maxCountInstances": null,
351                   "initialCount": 0,
352                   "vfModuleLabel": "vflorence_vlc"
353                 },
354                 "inputs": {},
355                 "volumeGroupAllowed": true
356               },
357               "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2": {
358                 "uuid": "41708296-e443-4c71-953f-d9a010f059e1",
359                 "invariantUuid": "1cca90b8-3490-495e-87da-3f3e4c57d5b9",
360                 "customizationUuid": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
361                 "description": null,
362                 "name": "VfVgeraldine..vflorence_gpb..module-2",
363                 "version": "2",
364                 "modelCustomizationName": "VfVgeraldine..vflorence_gpb..module-2",
365                 "properties": {
366                   "minCountInstances": 0,
367                   "maxCountInstances": null,
368                   "initialCount": 0,
369                   "vfModuleLabel": "vflorence_gpb"
370                 },
371                 "inputs": {},
372                 "volumeGroupAllowed": false
373               },
374               "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
375                 "uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
376                 "invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
377                 "customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
378                 "description": null,
379                 "name": "VfVgeraldine..base_vflorence..module-0",
380                 "version": "2",
381                 "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
382                 "properties": {
383                   "minCountInstances": 1,
384                   "maxCountInstances": 1,
385                   "initialCount": 1,
386                   "vfModuleLabel": "base_vflorence"
387                 },
388                 "inputs": {},
389                 "volumeGroupAllowed": true
390               }
391             },
392             "volumeGroups": {
393               "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
394                 "uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
395                 "invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
396                 "customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
397                 "description": null,
398                 "name": "VfVgeraldine..base_vflorence..module-0",
399                 "version": "2",
400                 "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
401                 "properties": {
402                   "minCountInstances": 1,
403                   "maxCountInstances": 1,
404                   "initialCount": 1,
405                   "vfModuleLabel": "base_vflorence"
406                 },
407                 "inputs": {}
408               }
409             },
410             "pnfs": {}
411           }
412         },
413         "serviceInstance": {
414           "6e59c5de-f052-46fa-aa7e-2fca9d674c44": {
415             "vnfs": {
416               "VF_vGeraldine 0": {
417                 "rollbackOnFailure": "true",
418                 "vfModules": {
419                   "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
420                     "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo": {
421                       "isMissingData": false,
422                       "sdncPreReload": null,
423                       "modelInfo": {
424                         "modelType": "VFmodule",
425                         "modelInvariantId": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
426                         "modelVersionId": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
427                         "modelName": "VfVgeraldine..base_vflorence..module-0",
428                         "modelVersion": "2",
429                         "modelCustomizationId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
430                         "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0"
431                       },
432                       "instanceParams": [
433                         {}
434                       ],
435                       "trackById": "wmtm6sy2uj"
436                     }
437                   }
438                 },
439                 "isMissingData": true,
440                 "originalName": "VF_vGeraldine 0",
441                 "vnfStoreKey": "VF_vGeraldine 0",
442                 "trackById": "p3wk448m5do",
443                 "uuid": "d6557200-ecf2-4641-8094-5393ae3aae60",
444                 "productFamilyId": "36b4733a-53f4-4cc8-8ff0-9172e5fc4b8e",
445                 "lcpCloudRegionId": null,
446                 "tenantId": null,
447                 "lineOfBusiness": null,
448                 "platformName": null,
449                 "modelInfo": {
450                   "modelType": "VF",
451                   "modelInvariantId": "4160458e-f648-4b30-a176-43881ffffe9e",
452                   "modelVersionId": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
453                   "modelName": "VF_vGeraldine",
454                   "modelVersion": "2.0",
455                   "modelCustomizationName": "VF_vGeraldine 0"
456                 }
457               }
458             },
459             "instanceParams": [
460               {}
461             ],
462             "validationCounter": 1,
463             "existingNames": {},
464             "existingVNFCounterMap": {
465               "d6557200-ecf2-4641-8094-5393ae3aae60": 1
466             },
467             "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
468             "subscriptionServiceType": "TYLER SILVIA",
469             "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
470             "productFamilyId": "36b4733a-53f4-4cc8-8ff0-9172e5fc4b8e",
471             "lcpCloudRegionId": "hvf6",
472             "tenantId": "229bcdc6eaeb4ca59d55221141d01f8e",
473             "aicZoneId": "JAG1",
474             "projectName": "x1",
475             "rollbackOnFailure": "true",
476             "bulkSize": 1,
477             "modelInfo": {
478               "modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
479               "modelVersionId": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
480               "modelName": "ComplexService",
481               "modelVersion": "1.0",
482               "uuid": "6e59c5de-f052-46fa-aa7e-2fca9d674c44"
483             },
484             "isALaCarte": false,
485             "name": "ComplexService",
486             "version": "1.0",
487             "description": "ComplexService",
488             "category": "Emanuel",
489             "uuid": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
490             "invariantUuid": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
491             "serviceType": "",
492             "serviceRole": "",
493             "isMultiStepDesign": false
494           }
495         },
496         "lcpRegionsAndTenants": {
497           "lcpRegionList": [
498             {
499               "id": "AAIAIC25",
500               "name": "AAIAIC25",
501               "isPermitted": true
502             },
503             {
504               "id": "hvf6",
505               "name": "hvf6",
506               "isPermitted": true
507             }
508           ],
509           "lcpRegionsTenantsMap": {
510             "AAIAIC25": [
511               {
512                 "id": "092eb9e8e4b7412e8787dd091bc58e86",
513                 "name": "USP-SIP-IC-24335-T-01",
514                 "isPermitted": true
515               }
516             ],
517             "hvf6": [
518               {
519                 "id": "bae71557c5bb4d5aac6743a4e5f1d054",
520                 "name": "AIN Web Tool-15-D-testalexandria",
521                 "isPermitted": true
522               },
523               {
524                 "id": "d0a3e3f2964542259d155a81c41aadc3",
525                 "name": "test-hvf6-09",
526                 "isPermitted": true
527               },
528               {
529                 "id": "fa45ca53c80b492fa8be5477cd84fc2b",
530                 "name": "ro-T112",
531                 "isPermitted": true
532               },
533               {
534                 "id": "cbb99fe4ada84631b7baf046b6fd2044",
535                 "name": "DN5242-Nov16-T3",
536                 "isPermitted": true
537               }
538             ]
539           }
540         },
541         "productFamilies": [
542           {
543             "id": "ebc3bc3d-62fd-4a3f-a037-f619df4ff034",
544             "name": "ERICA",
545             "isPermitted": true
546           },
547           {
548             "id": "17cc1042-527b-11e6-beb8-9e71128cae77",
549             "name": "IGNACIO",
550             "isPermitted": true
551           },
552           {
553             "id": "36b4733a-53f4-4cc8-8ff0-9172e5fc4b8e",
554             "name": "Christie",
555             "isPermitted": true
556           },
557           {
558             "id": "a4f6f2ae-9bf5-4ed7-b904-06b2099c4bd7",
559             "name": "Enhanced Services",
560             "isPermitted": true
561           },
562           {
563             "id": "vTerrance",
564             "name": "vTerrance",
565             "isPermitted": true
566           },
567           {
568             "id": "323d69d9-2efe-4r45-ay0a-89ea7ard4e6f",
569             "name": "vEsmeralda",
570             "isPermitted": true
571           },
572           {
573             "id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
574             "name": "Emanuel",
575             "isPermitted": true
576           },
577           {
578             "id": "d8a6ed93-251c-47ca-adc9-86671fd19f4c",
579             "name": "BVOIP",
580             "isPermitted": true
581           },
582           {
583             "id": "db171b8f-115c-4992-a2e3-ee04cae357e0",
584             "name": "LINDSEY",
585             "isPermitted": true
586           },
587           {
588             "id": "LRSI-OSPF",
589             "name": "LRSI-OSPF",
590             "isPermitted": true
591           },
592           {
593             "id": "vRosemarie",
594             "name": "HNGATEWAY",
595             "isPermitted": true
596           },
597           {
598             "id": "vHNPaas",
599             "name": "WILKINS",
600             "isPermitted": true
601           },
602           {
603             "id": "e433710f-9217-458d-a79d-1c7aff376d89",
604             "name": "TYLER SILVIA",
605             "isPermitted": true
606           },
607           {
608             "id": "b6a3f28c-eebf-494c-a900-055cc7c874ce",
609             "name": "VROUTER",
610             "isPermitted": true
611           },
612           {
613             "id": "vMuriel",
614             "name": "vMuriel",
615             "isPermitted": true
616           },
617           {
618             "id": "0ee8c1bc-7cbd-4b0a-a1ac-e9999255abc1",
619             "name": "CARA Griffin",
620             "isPermitted": true
621           },
622           {
623             "id": "c7611ebe-c324-48f1-8085-94aef0c6ef3d",
624             "name": "DARREN MCGEE",
625             "isPermitted": true
626           },
627           {
628             "id": "e30755dc-5673-4b6b-9dcf-9abdd96b93d1",
629             "name": "Transport",
630             "isPermitted": true
631           },
632           {
633             "id": "vSalvatore",
634             "name": "vSalvatore",
635             "isPermitted": true
636           },
637           {
638             "id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4",
639             "name": "JOSEFINA",
640             "isPermitted": true
641           },
642           {
643             "id": "vHubbard",
644             "name": "vHubbard",
645             "isPermitted": true
646           },
647           {
648             "id": "12a96a9d-4b4c-4349-a950-fe1159602621",
649             "name": "DARREN MCGEE",
650             "isPermitted": true
651           }
652         ],
653         "serviceTypes": {
654           "e433710f-9217-458d-a79d-1c7aff376d89": [
655             {
656               "id": "0",
657               "name": "vRichardson",
658               "isPermitted": false
659             },
660             {
661               "id": "1",
662               "name": "TYLER SILVIA",
663               "isPermitted": true
664             },
665             {
666               "id": "2",
667               "name": "Emanuel",
668               "isPermitted": false
669             },
670             {
671               "id": "3",
672               "name": "vJamie",
673               "isPermitted": false
674             },
675             {
676               "id": "4",
677               "name": "vVoiceMail",
678               "isPermitted": false
679             },
680             {
681               "id": "5",
682               "name": "Kennedy",
683               "isPermitted": false
684             },
685             {
686               "id": "6",
687               "name": "vPorfirio",
688               "isPermitted": false
689             },
690             {
691               "id": "7",
692               "name": "vVM",
693               "isPermitted": false
694             },
695             {
696               "id": "8",
697               "name": "vOTA",
698               "isPermitted": false
699             },
700             {
701               "id": "9",
702               "name": "vFLORENCE",
703               "isPermitted": false
704             },
705             {
706               "id": "10",
707               "name": "vMNS",
708               "isPermitted": false
709             },
710             {
711               "id": "11",
712               "name": "vEsmeralda",
713               "isPermitted": false
714             },
715             {
716               "id": "12",
717               "name": "VPMS",
718               "isPermitted": false
719             },
720             {
721               "id": "13",
722               "name": "vWINIFRED",
723               "isPermitted": false
724             },
725             {
726               "id": "14",
727               "name": "SSD",
728               "isPermitted": false
729             },
730             {
731               "id": "15",
732               "name": "vMOG",
733               "isPermitted": false
734             },
735             {
736               "id": "16",
737               "name": "LINDSEY",
738               "isPermitted": false
739             },
740             {
741               "id": "17",
742               "name": "JOHANNA_SANTOS",
743               "isPermitted": false
744             },
745             {
746               "id": "18",
747               "name": "vCarroll",
748               "isPermitted": false
749             }
750           ]
751         },
752         "aicZones": [
753           {
754             "id": "NFT1",
755             "name": "NFTJSSSS-NFT1"
756           },
757           {
758             "id": "JAG1",
759             "name": "YUDFJULP-JAG1"
760           },
761           {
762             "id": "YYY1",
763             "name": "UUUAIAAI-YYY1"
764           },
765           {
766             "id": "AVT1",
767             "name": "AVTRFLHD-AVT1"
768           },
769           {
770             "id": "ATL34",
771             "name": "ATLSANAI-ATL34"
772           }
773         ],
774         "categoryParameters": {
775           "owningEntityList": [
776             {
777               "id": "aaa1",
778               "name": "aaa1"
779             },
780             {
781               "id": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
782               "name": "WayneHolland"
783             },
784             {
785               "id": "Melissa",
786               "name": "Melissa"
787             }
788           ],
789           "projectList": [
790             {
791               "id": "WATKINS",
792               "name": "WATKINS"
793             },
794             {
795               "id": "x1",
796               "name": "x1"
797             },
798             {
799               "id": "yyy1",
800               "name": "yyy1"
801             }
802           ],
803           "lineOfBusinessList": [
804             {
805               "id": "ONAP",
806               "name": "ONAP"
807             },
808             {
809               "id": "zzz1",
810               "name": "zzz1"
811             }
812           ],
813           "platformList": [
814             {
815               "id": "platform",
816               "name": "platform"
817             },
818             {
819               "id": "xxx1",
820               "name": "xxx1"
821             }
822           ]
823         },
824         "type": "[LCP_REGIONS_AND_TENANTS] Update",
825         "subscribers": [
826           {
827             "id": "CAR_2020_ER",
828             "name": "CAR_2020_ER",
829             "isPermitted": true
830           },
831           {
832             "id": "21014aa2-526b-11e6-beb8-9e71128cae77",
833             "name": "JULIO ERICKSON",
834             "isPermitted": false
835           },
836           {
837             "id": "DHV1707-TestSubscriber-2",
838             "name": "DALE BRIDGES",
839             "isPermitted": false
840           },
841           {
842             "id": "DHV1707-TestSubscriber-1",
843             "name": "LLOYD BRIDGES",
844             "isPermitted": false
845           },
846           {
847             "id": "jimmy-example",
848             "name": "JimmyExampleCust-20161102",
849             "isPermitted": false
850           },
851           {
852             "id": "jimmy-example2",
853             "name": "JimmyExampleCust-20161103",
854             "isPermitted": false
855           },
856           {
857             "id": "ERICA5779-TestSub-PWT-102",
858             "name": "ERICA5779-TestSub-PWT-102",
859             "isPermitted": false
860           },
861           {
862             "id": "ERICA5779-TestSub-PWT-101",
863             "name": "ERICA5779-TestSub-PWT-101",
864             "isPermitted": false
865           },
866           {
867             "id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
868             "name": "Emanuel",
869             "isPermitted": false
870           },
871           {
872             "id": "ERICA5779-Subscriber-4",
873             "name": "ERICA5779-Subscriber-5",
874             "isPermitted": false
875           },
876           {
877             "id": "ERICA5779-TestSub-PWT-103",
878             "name": "ERICA5779-TestSub-PWT-103",
879             "isPermitted": false
880           },
881           {
882             "id": "ERICA5779-Subscriber-2",
883             "name": "ERICA5779-Subscriber-2",
884             "isPermitted": false
885           },
886           {
887             "id": "e433710f-9217-458d-a79d-1c7aff376d89",
888             "name": "SILVIA ROBBINS",
889             "isPermitted": true
890           },
891           {
892             "id": "ERICA5779-Subscriber-3",
893             "name": "ERICA5779-Subscriber-3",
894             "isPermitted": false
895           },
896           {
897             "id": "31739f3e-526b-11e6-beb8-9e71128cae77",
898             "name": "CRAIG/ROBERTS",
899             "isPermitted": false
900           }
901         ]
902       }
903     }
904   }
905 }
906
907 class MockFeatureFlagsService {}
908
909 describe('VNF Control Generator', () => {
910   let injector;
911   let service: VnfControlGenerator;
912   let httpMock: HttpTestingController;
913
914
915   beforeAll(done => (async () => {
916     TestBed.configureTestingModule({
917       imports: [HttpClientTestingModule],
918       providers: [VnfControlGenerator,
919         GenericFormService,
920         ControlGeneratorUtil,
921         SharedControllersService,
922         AaiService,
923         FormBuilder,
924         LogService,
925         {provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
926         {provide: NgRedux, useClass: MockAppStore}]
927     });
928     await TestBed.compileComponents();
929
930
931     injector = getTestBed();
932     service = injector.get(VnfControlGenerator);
933     httpMock = injector.get(HttpTestingController);
934
935   })().then(done).catch(done.fail));
936
937
938   test('should generate platform multi select control', ()=>{
939     const control = service.getPlatformMultiselectControl(null, [],false);
940     expect(control.type).toEqual(FormControlType.MULTI_SELECT);
941     expect(control.controlName).toEqual('platformName');
942     expect(control.displayName).toEqual('Platform');
943     expect(control.dataTestId).toEqual('multi-selectPlatform');
944     expect(control.selectedFieldName).toEqual('name');
945     expect(control.value).toEqual('');
946     expect(control.onChange).toBeDefined();
947     expect(control.convertOriginalDataToArray).toBeDefined();
948   });
949
950   test('getMacroFormControls check for mandatory controls', () => {
951     const serviceId : string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
952     const vnfName : string = "VF_vGeraldine 0";
953     const vnfStoreKey : string = "VF_vGeraldine 0";
954     const controls :FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vnfName, []);
955
956     const mandatoryControls : string[] = [
957       FormControlNames.INSTANCE_NAME,
958       FormControlNames.LCPCLOUD_REGION_ID,
959       FormControlNames.TENANT_ID,
960       'platformName',
961       FormControlNames.PRODUCT_FAMILY_ID
962     ];
963
964     for(let i = 0 ; i < mandatoryControls.length ; i++){
965       let requiredExist = controls.find(ctrl => ctrl.controlName === mandatoryControls[i]).validations.find(item => item.validatorName === 'required');
966       expect(requiredExist).toBeDefined();
967     }
968   });
969
970   test('should provide empty array on getMacroFormControls when serviceId, vnfName and vnfStoreKey equals to null', () => {
971
972     let vnfStoreKey = null;
973     const serviceId = null;
974     const vnfName : string = null;
975     const result:FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vnfName, []);
976     expect(result).toEqual([]);
977   });
978
979   test('should provide empty array on getAlaCarteFormControls when serviceId, vnfName and vnfStoreKey equals to null', () => {
980     let vnfStoreKey = null;
981     const serviceId = null;
982     const vnfName : string = null;
983     const result:FormControlModel[] = service.getAlaCarteFormControls(serviceId, vnfStoreKey, vnfName, []);
984     expect(result).toEqual([]);
985   });
986
987   function getALaCarteFormControls(vnfStoreKey: string): FormControlModel[] {
988     const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
989     const vnfName: string = "VF_vGeraldine 0";
990     const controls: FormControlModel[] = service.getAlaCarteFormControls(serviceId, vnfStoreKey, vnfName, []);
991     return controls;
992   }
993
994   test('getMacroFormControls should return the correct order of controls', () => {
995     const serviceId : string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
996     const vnfName : string = "VF_vGeraldine 0";
997     const vnfStoreKey : string = null;
998     const controls :FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vnfName, []);
999
1000     const controlsOrderNames = [
1001       FormControlNames.INSTANCE_NAME,
1002       FormControlNames.PRODUCT_FAMILY_ID,
1003       FormControlNames.LCPCLOUD_REGION_ID ,
1004       'legacyRegion',
1005       'tenantId',
1006       'platformName',
1007       'lineOfBusiness'];
1008
1009     expect(controls.length).toEqual(7);
1010     for(let i = 0 ; i < controls.length ; i++){
1011       expect(controls[i].controlName).toEqual(controlsOrderNames[i]);
1012     }
1013   });
1014
1015   test('getAlacartFormControls should return the correct order of controls', () => {
1016     const controls = getALaCarteFormControls(null);
1017
1018     const controlsOrderNames = [
1019       FormControlNames.INSTANCE_NAME,
1020       FormControlNames.PRODUCT_FAMILY_ID,
1021       FormControlNames.LCPCLOUD_REGION_ID,
1022       'legacyRegion',
1023       'tenantId',
1024       'platformName',
1025       'lineOfBusiness',
1026       'rollbackOnFailure'];
1027     expect(controls.length).toEqual(8);
1028     for(let i = 0 ; i < controls.length ; i++) {
1029       expect(controls[i].controlName).toEqual(controlsOrderNames[i]);
1030     }
1031   });
1032
1033
1034   test('getAlacartFormControls check for mandatory controls', () => {
1035     const controls = getALaCarteFormControls("VF_vGeraldine 0");
1036     const mandatoryControls : string[] = [
1037       FormControlNames.INSTANCE_NAME,
1038       FormControlNames.LCPCLOUD_REGION_ID,
1039       'tenantId',
1040       'platformName',
1041       'lineOfBusiness',
1042       'rollbackOnFailure'
1043     ];
1044     for(let i = 0 ; i < mandatoryControls.length ; i++){
1045       let requiredExist = controls.find(ctrl => ctrl.controlName === mandatoryControls[i]).validations.find(item => item.validatorName === 'required');
1046       expect(requiredExist).toBeDefined();
1047     }
1048   });
1049
1050   test('getAlacartFormControls instance name control validator shall have the expected regex', () => {
1051     const controls:FormControlModel[] = getALaCarteFormControls("VF_vGeraldine 0");
1052
1053     const instanceNameControl: FormControlModel = <FormControlModel>controls.find(item => item.controlName === FormControlNames.INSTANCE_NAME);
1054     const instanceNameValidator: ValidatorModel = instanceNameControl.validations.find(val => val.validatorName === ValidatorOptions.pattern);
1055     expect(instanceNameValidator.validatorArg).toEqual(/^[a-zA-Z0-9._-]*$/);
1056   });
1057 });
1058