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