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