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