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