1: using Ia.Cl.Model;
2: using System;
3: using System.Collections.Generic;
4: using System.Configuration;
5: using System.Data;
6: using System.Linq;
7:
8: namespace Ia.Ngn.Cl.Model.Business.Huawei
9: {
10: ////////////////////////////////////////////////////////////////////////////
11:
12: /// <summary publish="true">
13: /// Signaling Service Processing System (SPS) support class for Huawei's Optical Fiber Network (OFN) business model.
14: /// </summary>
15:
16: /// <remarks>
17: /// Copyright © 2018-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
18: ///
19: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
20: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
21: ///
22: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
23: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24: ///
25: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
26: ///
27: /// Copyright notice: This notice may not be removed or altered from any source distribution.
28: /// </remarks>
29: public class Sps
30: {
31: private static List<string> properlySelectedSpsCommandList = new List<string>();
32: private static Queue<ProvisioningWorkflow> synchronizationCommandQueue = new Queue<ProvisioningWorkflow>();
33:
34: private static Ia.Ngn.Cl.Model.Client.Huawei.Sps sps = new Cl.Model.Client.Huawei.Sps();
35:
36: /// <summary/>
37: public enum SpsOpcode { LstSeruattr, ModSeruattr }
38:
39: /// <summary/>
40: public enum Mode { NUM = 0, IMSINUM = 1 };
41:
42: /// <summary/>
43: public enum Servattr { OMNP = 0 };
44:
45: /// <summary/>
46: public enum NumType { TYPE0 = 0, TYPE1 = 1, TYPE2 = 2, TYPE3 = 3, TYPE4 = 4, TYPE5 = 5, TYPE8 = 8, TYPE9 = 9 };
47:
48: /// <summary/>
49: public class FieldIdNameExplanation
50: {
51: public int Id;
52: public string FieldName;
53: public string FieldExplanation;
54: }
55:
56: /// <summary/>
57: public static FieldIdNameExplanation[] NumTypeFieldIdExplanationList =
58: {
59: new FieldIdNameExplanation {Id = (int)NumType.TYPE0, FieldExplanation="In local network" },
60: new FieldIdNameExplanation {Id = (int)NumType.TYPE1, FieldExplanation="Moved out of local network" },
61: new FieldIdNameExplanation {Id = (int)NumType.TYPE2, FieldExplanation="Moved in from external network" },
62: new FieldIdNameExplanation {Id = (int)NumType.TYPE3, FieldExplanation="Moved to another non-local number" },
63: new FieldIdNameExplanation {Id = (int)NumType.TYPE4, FieldExplanation="Flexible number" },
64: new FieldIdNameExplanation {Id = (int)NumType.TYPE5, FieldExplanation="Moved from GSM to CDMA network" },
65: new FieldIdNameExplanation {Id = (int)NumType.TYPE8, FieldExplanation="Moved from CDMA to GSM network" },
66: new FieldIdNameExplanation {Id = (int)NumType.TYPE9, FieldExplanation="Local fixed network" }
67: };
68:
69: /// <summary/>
70: public enum RnidxType { HLR = 0, RN = 1, ALL = 2 };
71:
72: /// <summary/>
73: public static FieldIdNameExplanation[] RnidxTypeFieldIdExplanationList =
74: {
75: new FieldIdNameExplanation { Id = (int)RnidxType.HLR,FieldExplanation="HLR number index" },
76: new FieldIdNameExplanation { Id = (int)RnidxType.RN,FieldExplanation="Route number index" },
77: new FieldIdNameExplanation { Id = (int)RnidxType.ALL,FieldExplanation="HLR+RN" },
78: };
79:
80: /// <summary/>
81: public static FieldIdNameExplanation[] ParameterFieldNameExplanationList =
82: {
83: new FieldIdNameExplanation { FieldName = "USRNUM",FieldExplanation="MSISDN" },
84: new FieldIdNameExplanation { FieldName = "SERVATTR",FieldExplanation="Whether enable Related services" },
85: new FieldIdNameExplanation { FieldName = "IMSINUM",FieldExplanation="User IMSI number" },
86: new FieldIdNameExplanation { FieldName = "NUMTYPE",FieldExplanation="Number type" },
87: new FieldIdNameExplanation { FieldName = "RNIDXTYPE",FieldExplanation="Route index type" },
88: new FieldIdNameExplanation { FieldName = "HLRIDX",FieldExplanation="HLR address index" },
89: new FieldIdNameExplanation { FieldName = "RNIDX",FieldExplanation="NP route index" },
90: new FieldIdNameExplanation { FieldName = "RNIDX2",FieldExplanation="Routing Number Index" },
91: new FieldIdNameExplanation { FieldName = "RN",FieldExplanation="Routing number" },
92: new FieldIdNameExplanation { FieldName = "DESC",FieldExplanation="Description" }
93: };
94:
95: /// <summary/>
96: public class ProvisioningWorkflow
97: {
98: /// <summary/>
99: public string Service { get; set; }
100:
101: /// <summary/>
102: public string ReadCommand { get; set; }
103:
104: /// <summary/>
105: public string UpdateCommand { get; set; }
106:
107: /// <summary/>
108: public ProvisioningWorkflow()
109: {
110:
111: }
112: }
113:
114: /// <summary/>
115: public static string Host { get { return ConfigurationManager.AppSettings["spsHuaweiServerHost"].ToString(); } }
116:
117: /// <summary/>
118: public static int Port { get { return int.Parse(ConfigurationManager.AppSettings["spsHuaweiServerPort"].ToString()); } }
119:
120: /// <summary/>
121: public static string LoginUser { get { return ConfigurationManager.AppSettings["spsHuaweiServerLoginUser"].ToString(); } }
122:
123: /// <summary/>
124: public static string LogoutUser { get { return ConfigurationManager.AppSettings["spsHuaweiServerLogoutUser"].ToString(); } }
125:
126: /// <summary/>
127: public static string SemiColon { get { return ";"; } }
128:
129: ////////////////////////////////////////////////////////////////////////////
130:
131: /// <summary>
132: /// Response class of NCE TL1 NBI following the "10.3 Response Format Description standard" in iManager NCE Unified Network Management System Guide.
133: /// </summary>
134: public class Response
135: {
136: /// <summary/>
137: public bool IsSuccess { get { return ReturnCode == Ia.Ngn.Cl.Model.Client.Huawei.Sps.ResultCode.OperationIsSuccessful; } }
138:
139: /// <summary/>
140: public Ia.Ngn.Cl.Model.Client.Huawei.Sps.ResultCode ReturnCode { get; set; }
141:
142: /// <summary/>
143: public string CodeExplanation { get; set; }
144:
145: /// <summary/>
146: public string CommandString { get; set; }
147:
148: /// <summary/>
149: public int Count { get; set; }
150:
151: /// <summary/>
152: public Dictionary<string, string> QueryDictionary { get; set; }
153:
154: /// <summary/>
155: public Response() { }
156: }
157:
158: ////////////////////////////////////////////////////////////////////////////
159:
160: /// <summary>
161: ///
162: /// </summary>
163: public Sps() { }
164:
165: ////////////////////////////////////////////////////////////////////////////
166:
167: /// <summary>
168: ///
169: /// </summary>
170: public static Ia.Cl.Model.Result Connect()
171: {
172: var result = new Ia.Cl.Model.Result();
173:
174: if (sps != null && !sps.IsConnected)
175: {
176: sps.Connect(out result);
177: }
178: else
179: {
180: result.AddWarning("SPS is already connected.");
181: }
182:
183: return result;
184: }
185:
186: ////////////////////////////////////////////////////////////////////////////
187:
188: /// <summary>
189: ///
190: /// </summary>
191: public static Ia.Cl.Model.Result Disconnect()
192: {
193: var result = new Ia.Cl.Model.Result();
194:
195: if (sps != null && sps.IsConnected)
196: {
197: sps.Disconnect(out result);
198: }
199: else
200: {
201: result.AddWarning("SPS is already disconnected.");
202: }
203:
204: return result;
205: }
206:
207: ////////////////////////////////////////////////////////////////////////////
208:
209: /// <summary>
210: ///
211: /// </summary>
212: public static void Login()
213: {
214: sps.Login();
215: }
216:
217: ////////////////////////////////////////////////////////////////////////////
218:
219: /// <summary>
220: ///
221: /// </summary>
222: public static void Logout()
223: {
224: sps.Logout();
225: }
226:
227: ////////////////////////////////////////////////////////////////////////////
228:
229: /// <summary>
230: ///
231: /// </summary>
232: public static Queue<string> ReceiveQueue
233: {
234: get
235: {
236: return sps.ReceiveQueue;
237: }
238: }
239:
240: ////////////////////////////////////////////////////////////////////////////
241:
242: /// <summary>
243: ///
244: /// </summary>
245: public static Queue<string> SendQueue
246: {
247: get
248: {
249: return sps.SendQueue;
250: }
251: }
252:
253: ////////////////////////////////////////////////////////////////////////////
254:
255: /// <summary>
256: ///
257: /// </summary>
258: public static bool IsConnected
259: {
260: get
261: {
262: return sps != null && sps.IsConnected;
263: }
264: }
265:
266: ////////////////////////////////////////////////////////////////////////////
267:
268: /// <summary>
269: ///
270: /// </summary>
271: public static void ManageReceiveQueue(out Ia.Cl.Model.Result result)
272: {
273: string rowString, formattedString;
274:
275: result = new Ia.Cl.Model.Result();
276:
277: try
278: {
279: while (sps.ReceiveQueue.Count > 0)
280: {
281: rowString = sps.ReceiveQueue.Dequeue();
282:
283: //Debug.WriteLine("ManageReceiveQueue(): rowString: " + rowString);
284:
285: formattedString = rowString;
286:
287: sps.Update(formattedString, ref sps, out result);
288: }
289: }
290: catch (Exception ex)
291: {
292: result.AddError("ManageReceiveQueue: Exception: " + ex.Message);
293: }
294: }
295:
296: ////////////////////////////////////////////////////////////////////////////
297:
298: /// <summary>
299: ///
300: /// </summary>
301: public static string ManageSendQueue(out Ia.Cl.Model.Result result)
302: {
303: string command;
304:
305: command = string.Empty;
306: result = new Ia.Cl.Model.Result();
307:
308: try
309: {
310: if (sps.SendQueue.Count > 0)
311: {
312: command = sps.SendQueue.Dequeue();
313:
314: //Debug.WriteLine("ManageSendQueue(): command: " + command);
315:
316: sps.Send(command, out Ia.Cl.Model.Result r);
317:
318: if (r.IsSuccessful) result.AddSuccess(r.Message);
319: else result.AddError(r.Message);
320: }
321: }
322: catch (Exception ex)
323: {
324: result.AddError("ManageSendQueue: Exception: " + ex.Message);
325: }
326:
327: return result.IsSuccessful ? command : string.Empty;
328: }
329:
330: ////////////////////////////////////////////////////////////////////////////
331:
332: /// <summary>
333: ///
334: /// </summary>
335: public static Ia.Cl.Model.Result ManageUpdate(string service, int rnidx)
336: {
337: string command;
338: var result = new Ia.Cl.Model.Result();
339:
340: command = Ia.Ngn.Cl.Model.Business.Huawei.Sps.UpdateCommand(service, rnidx);
341:
342: sps.SendQueue.Enqueue(command);
343:
344: result.AddSuccess("service: " + service + ", rnidx: " + rnidx + ", sent: " + command);
345:
346: return result;
347: }
348:
349: ////////////////////////////////////////////////////////////////////////////
350:
351: /// <summary>
352: ///
353: /// </summary>
354: public static string KeepAliveShakeHandCommand
355: {
356: get
357: {
358: return "SHK HND:;";
359: }
360: }
361:
362: ////////////////////////////////////////////////////////////////////////////
363:
364: /// <summary>
365: ///
366: /// </summary>
367: public static string ManageProperly(ref int properlySelectedSpsCommandListIndex)
368: {
369: var command = Ia.Ngn.Cl.Model.Business.Huawei.Sps.ProperlySelectedSingleSpsCommandQueueCommand(ref properlySelectedSpsCommandListIndex, out int itemIndex, out int listCount);
370:
371: sps.SendQueue.Enqueue(command);
372:
373: var r = command + " (" + itemIndex + "/" + listCount + ")";
374:
375: return r;
376: }
377:
378: ////////////////////////////////////////////////////////////////////////////
379:
380: /// <summary>
381: ///
382: /// </summary>
383: public static Ia.Cl.Model.Result ManageMsmqQueue()
384: {
385: string command;
386:
387: var result = new Ia.Cl.Model.Result();
388:
389: var queueCount = Ia.Ngn.Cl.Model.Data.Msmq.SpsApplication.Count;
390:
391: if (queueCount > 0)
392: {
393: var message = Ia.Ngn.Cl.Model.Data.Msmq.SpsApplication.Dequeue;
394:
395: if (message.Process == Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadService)
396: {
397: if (Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinPstnThatUsesNpServerDomainList(message.Service))
398: {
399: command = Ia.Ngn.Cl.Model.Business.Huawei.Sps.ReadCommand(message.Service);
400:
401: sps.SendQueue.Enqueue(command);
402:
403: result.AddSuccess(message.Service);
404: }
405: else result.AddError("Service: " + message.Service + " is not within SPS server.");
406: }
407: else if (message.Process == Ia.Ngn.Cl.Model.Business.Msmq.Process.Synchronize)
408: {
409: var r0 = ManageSynchronization(Ia.Ngn.Cl.Model.Business.Default.Procedure.InitializeOrIterate);
410:
411: result.AddSuccess("Synchronize: InitializeOrIterate: " + r0.Message);
412: }
413: else if (message.Process == Ia.Ngn.Cl.Model.Business.Msmq.Process.ActiveApplicationRunningPermissionState)
414: {
415: Ia.Ngn.Cl.Model.Business.Default.PermitActiveApplicationsToRun = message.State;
416:
417: result.AddSuccess("PermitActiveApplicationsToRun: " + message.State);
418: }
419: else
420: {
421: throw new ArgumentOutOfRangeException("MSMQ process " + message.Process.ToString() + " is undefined");
422: }
423: }
424: else
425: {
426: }
427:
428: return result;
429: }
430:
431: ////////////////////////////////////////////////////////////////////////////
432:
433: /// <summary>
434: ///
435: /// </summary>
436: public static Ia.Cl.Model.Result ManageSynchronization(Ia.Ngn.Cl.Model.Business.Default.Procedure procedure)
437: {
438: Ia.Ngn.Cl.Model.Business.Huawei.Sps.ProvisioningWorkflow provisioningWorkflow;
439:
440: var result = new Ia.Cl.Model.Result();
441:
442: provisioningWorkflow = Ia.Ngn.Cl.Model.Business.Huawei.Sps.SynchronizeSpsServiceRnidxRouteToMatchImsServiceRouterVendorQueueCommand(procedure);
443:
444: if (provisioningWorkflow != null)
445: {
446: sps.SendQueue.Enqueue(provisioningWorkflow.UpdateCommand);
447: sps.SendQueue.Enqueue(provisioningWorkflow.ReadCommand);
448:
449: // no easy access to send here Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.ResetAccess, provisioningWorkflow input);
450:
451: Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.SpsApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.SynchronizeCompleted, provisioningWorkflow.Service);
452:
453: result.AddSuccess("Update: " + provisioningWorkflow.UpdateCommand + ", Read: " + provisioningWorkflow.ReadCommand);
454: }
455: else
456: {
457: result.AddWarning("No rerouting. ");
458: }
459:
460: return result;
461: }
462:
463: ////////////////////////////////////////////////////////////////////////////
464:
465: /// <summary>
466: ///
467: /// </summary>
468: public static Ia.Cl.Model.Result ManageKeepAliveShakeHand()
469: {
470: var result = new Ia.Cl.Model.Result();
471:
472: var c = Ia.Ngn.Cl.Model.Business.Huawei.Sps.KeepAliveShakeHandCommand;
473:
474: sps.SendQueue.Enqueue(c);
475:
476: result.AddSuccess(c);
477:
478: return result;
479: }
480:
481: ////////////////////////////////////////////////////////////////////////////
482:
483: /// <summary>
484: ///
485: /// </summary>
486: public static string ProperlySelectedSingleSpsCommandQueueCommand(ref int referenceIndex, out int itemIndex, out int listCount)
487: {
488: if (properlySelectedSpsCommandList.JustStartedOrRolledOver())
489: {
490: properlySelectedSpsCommandList = SpsCommandToRetrieveAllPossiblePstnServiceNumbersPreferablyNotInSpsTableWithinPstn();
491: }
492:
493: var command = properlySelectedSpsCommandList.Next(ref referenceIndex, out itemIndex, out listCount);
494:
495: return command;
496: }
497:
498: ////////////////////////////////////////////////////////////////////////////
499:
500: /// <summary>
501: ///
502: /// </summary>
503: public static ProvisioningWorkflow SynchronizeSpsServiceRnidxRouteToMatchImsServiceRouterVendorQueueCommand(Ia.Ngn.Cl.Model.Business.Default.Procedure procedure)
504: {
505: ProvisioningWorkflow provisioningWorkflow;
506: List<ProvisioningWorkflow> list;
507:
508: provisioningWorkflow = null;
509:
510: if (synchronizationCommandQueue.Count == 0 && procedure == Ia.Ngn.Cl.Model.Business.Default.Procedure.InitializeOrIterate)
511: {
512: list = ModifyAndReadTwoCommandItemOfSpsServiceRnidxRouteToMatchImsServiceRouterVendorList();
513:
514: synchronizationCommandQueue = new Queue<ProvisioningWorkflow>(list); // don't shuffle because a modify command is followed by a read .Shuffle());
515: }
516:
517: if (synchronizationCommandQueue.Count > 0) provisioningWorkflow = synchronizationCommandQueue.Dequeue();
518:
519: return provisioningWorkflow;
520: }
521:
522: ////////////////////////////////////////////////////////////////////////////
523:
524: /// <summary>
525: ///
526: /// </summary>
527: public static List<ProvisioningWorkflow> ModifyAndReadTwoCommandItemOfSpsServiceRnidxRouteToMatchImsServiceRouterVendorList()
528: {
529: int rnidxRoute;
530: string service;
531: Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
532: Ia.Ngn.Cl.Model.Business.Default.SwitchRoute pstnSwitchRoute, switchRouteToMigratedRouterVendor;
533: ProvisioningWorkflow provisioningWorkflow;
534: List<ProvisioningWorkflow> provisioningWorkflowList;
535:
536: provisioningWorkflowList = new List<ProvisioningWorkflow>();
537:
538: //var imsServiceToRouterVendorDictionary = Ia.Ngn.Cl.Model.Data.Service.ImsServiceToOntRouterVendorInAllowedToBeMigratedOltDictionary;
539: var imsServiceToRouterVendorDictionary = Ia.Ngn.Cl.Model.Data.Service.ImsServiceToOntAndMsanRouterVendorInAllowedToBeMigratedOltAndDomainDictionary;
540:
541: var pstnServiceToSwitchRouteDictionary = Ia.Ngn.Cl.Model.Data.Huawei.Seruattr.PstnThatUsesNpServerServiceToSwitchRouteDictionary();
542:
543: // will exclude exempt numbers
544: var serviceExemptionList = Ia.Ngn.Cl.Model.Data.Provision.ServiceOfServiceExemptFromProvisionProcessingList();
545:
546: foreach (KeyValuePair<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> kvp in imsServiceToRouterVendorDictionary)
547: {
548: service = kvp.Key;
549: vendor = kvp.Value;
550:
551: if (pstnServiceToSwitchRouteDictionary.ContainsKey(service))
552: {
553: pstnSwitchRoute = pstnServiceToSwitchRouteDictionary[service];
554:
555: if (vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia) switchRouteToMigratedRouterVendor = Ia.Ngn.Cl.Model.Business.Default.SwitchRoute.NokiaIms;
556: else if (vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei) switchRouteToMigratedRouterVendor = Ia.Ngn.Cl.Model.Business.Default.SwitchRoute.HuaweiIms;
557: else switchRouteToMigratedRouterVendor = Ia.Ngn.Cl.Model.Business.Default.SwitchRoute.Unknown;
558:
559: if (pstnSwitchRoute != switchRouteToMigratedRouterVendor && switchRouteToMigratedRouterVendor != Ia.Ngn.Cl.Model.Business.Default.SwitchRoute.Unknown)
560: {
561: if (!serviceExemptionList.Contains(service))
562: {
563: provisioningWorkflow = new ProvisioningWorkflow();
564:
565: rnidxRoute = Ia.Ngn.Cl.Model.Business.Huawei.Seruattr.SwitchRouteToRnidxRoute(switchRouteToMigratedRouterVendor);
566:
567: provisioningWorkflow.Service = service;
568: provisioningWorkflow.UpdateCommand = UpdateCommand(service, rnidxRoute);
569: provisioningWorkflow.ReadCommand = ReadCommand(service);
570:
571: provisioningWorkflowList.Add(provisioningWorkflow);
572: }
573: }
574: }
575: }
576:
577: return provisioningWorkflowList;
578: }
579:
580: ////////////////////////////////////////////////////////////////////////////
581: ////////////////////////////////////////////////////////////////////////////
582:
583: /// <summary>
584: ///
585: /// </summary>
586: public static string ReadCommand(string service)
587: {
588: return FormatSpsLstCommand(SpsOpcode.LstSeruattr, service);
589: }
590:
591: ////////////////////////////////////////////////////////////////////////////
592:
593: /// <summary>
594: ///
595: /// </summary>
596: public static string UpdateCommand(string service, int rnidxRoute)
597: {
598: return FormatSpsModCommand(SpsOpcode.ModSeruattr, service, rnidxRoute);
599: }
600:
601: ////////////////////////////////////////////////////////////////////////////
602: ////////////////////////////////////////////////////////////////////////////
603:
604: /// <summary>
605: ///
606: /// </summary>
607: private static string FormatSpsLstCommand(SpsOpcode amsOpcode, string service)
608: {
609: string command;
610:
611: if (amsOpcode == SpsOpcode.LstSeruattr)
612: {
613: command = @"LST SERUATTR:MODE=NUM,USRNUM=""" + service + @""";";
614: }
615: else command = string.Empty;
616:
617: return command;
618: }
619:
620: ////////////////////////////////////////////////////////////////////////////
621:
622: /// <summary>
623: ///
624: /// </summary>
625: private static string FormatSpsModCommand(SpsOpcode amsOpcode, string service, int rnidxRoute)
626: {
627: string command;
628:
629: if (amsOpcode == SpsOpcode.ModSeruattr)
630: {
631: command = @"MOD SERUATTR:MODE=NUM,USRNUM=""" + service + @""",RNIDXTYPE=RN,RNIDX=" + rnidxRoute + ";";
632: }
633: else command = string.Empty;
634:
635: return command;
636: }
637:
638: ////////////////////////////////////////////////////////////////////////////
639:
640: /// <summary>
641: ///
642: /// </summary>
643: public static List<string> SpsCommandToRetrieveAllPossiblePstnServiceNumbersPreferablyNotInSpsTableWithinPstn()
644: {
645: HashSet<string> hashSet;
646:
647: var list0 = new List<int>();
648:
649: var siteList = (from o in Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedOltList
650: select o.Odf.Router.Site).Distinct().ToList();
651:
652: var pstnNameList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnThatUsesNpServerList
653: where siteList.Contains(p.Site)
654: select p.Name).ToList();
655:
656: hashSet = new HashSet<string>();
657:
658: foreach (string pstnName in pstnNameList)
659: {
660: list0.AddRange(Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumbersWithinPstn(pstnName));
661: }
662:
663: var usrnumList = Ia.Ngn.Cl.Model.Data.Huawei.Seruattr.UsrnumList();
664:
665: var list = list0.Except(usrnumList).ToList();
666:
667: // if list is empty then will use the all list
668: //if (list.Count == 0) list = list0;
669: if (list.Count < 6) list = list0; // bug with some hanging numbers 25382383, 25392538
670:
671: var servicelist = list.ConvertAll<string>(u => u.ToString());
672:
673: var commandList = new List<string>();
674:
675: foreach (string s in servicelist)
676: {
677: commandList.Add(Ia.Ngn.Cl.Model.Business.Huawei.Sps.FormatSpsLstCommand(SpsOpcode.LstSeruattr, s));
678: }
679:
680: hashSet.UnionWith(new HashSet<string>(commandList));
681:
682: return hashSet.OrderBy(u => u).ToList();
683: }
684:
685: ////////////////////////////////////////////////////////////////////////////
686: ////////////////////////////////////////////////////////////////////////////
687: }
688:
689: ////////////////////////////////////////////////////////////////////////////
690: ////////////////////////////////////////////////////////////////////////////
691: }