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