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