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