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