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