)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Ims (Ia.Ftn.Cl.Model.Business)

Public general use code classes and xml files that we've compiled and used over the years:

Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Fixed Telecommunications Network (FTN) business model

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4:  
    5: namespace Ia.Ftn.Cl.Model.Business
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Fixed Telecommunications Network (FTN) business model
   11:     /// </summary>
   12:     /// 
   13:     /// <value>
   14:     ///   <appSettings>
   15:     ///     <add key="imsHuaweiServerHost" value="https://*" />
   16:     ///     <add key="imsHuaweiServerPort" value="*" />
   17:     ///     <add key="imsHuaweiServerServiceUrl" value="*" />
   18:     ///     <add key="imsHuaweiServerUser" value="*" />
   19:     ///     <add key="imsHuaweiServerUserPassword" value="*" />
   20:     ///   </appSettings>
   21:     /// </value>
   22:     /// 
   23:     /// <remarks> 
   24:     /// Copyright © 2014-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   25:     ///
   26:     /// 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
   27:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   28:     ///
   29:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   30:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   31:     /// 
   32:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   33:     /// 
   34:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   35:     /// </remarks> 
   36:     public class Ims
   37:     {
   38:         public class ImsBasicService
   39:         {
   40:             public string MgcIp;
   41:             public string MgcSecondaryIp;
   42:             public string MgcSubnetMask;
   43:             public int Service;
   44:             public string Fsdb;
   45:             public string PrimarySwitch;
   46:         }
   47:  
   48:         ////////////////////////////////////////////////////////////////////////////
   49:  
   50:         /// <summary>
   51:         ///
   52:         /// </summary>
   53:         public Ims()
   54:         {
   55:         }
   56:  
   57:         ////////////////////////////////////////////////////////////////////////////
   58:  
   59:         /// <summary>
   60:         ///
   61:         /// </summary>
   62:         public static int NextVacantFlatTermIdFromAgcfEndpointUsingGwIdForOnt(Ia.Ftn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType, int gwId)
   63:         {
   64:             int ft;
   65:             List<int> list;
   66:  
   67:             list = Ia.Ftn.Cl.Model.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
   68:  
   69:             if (list.Count == 0) ft = 1; // this means agcfEndpoint does not exist for any number and the box is empty, and we should create agcfEndpoint at 1
   70:             else
   71:             {
   72:                 // change this later to accommodate the Huawei ONT type
   73:                 list = Ia.Cl.Models.Default.ExcludedNumberListFromNumberListWithinRange(list, equipmentType.TelPorts);
   74:  
   75:                 if (list.Count > 0) ft = list[0];
   76:                 else ft = 0; // something went wrong
   77:             }
   78:  
   79:             return ft;
   80:         }
   81:  
   82:         ////////////////////////////////////////////////////////////////////////////
   83:  
   84:         /// <summary>
   85:         ///
   86:         /// </summary>
   87:         public static Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService NokiaImsBasicServiceItemForAccessWithPbx(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont ont)
   88:         {
   89:             string primarySwitch;
   90:  
   91:             Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService imsBasicService;
   92:             Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService nokiaImsBasicService;
   93:  
   94:             primarySwitch = (from ibs in Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceList where ibs.MgcIp == ont.Pon.PonGroup.MgcIp select ibs.PrimarySwitch).SingleOrDefault();
   95:  
   96:             if (!string.IsNullOrEmpty(primarySwitch))
   97:             {
   98:                 nokiaImsBasicService = (from ibs in Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceList where ibs.Fsdb == "fsdb0" && ibs.PrimarySwitch == primarySwitch select ibs).Single();
   99:             }
  100:             else
  101:             {
  102:                 if (ont.Pon.PonGroup.MgcIp == "10.16.1.142")
  103:                 {
  104:                     nokiaImsBasicService = new Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService { MgcIp = "10.16.1.142", MgcSecondaryIp = "10.16.5.142", MgcSubnetMask = "255.255.224.0", Service = 0, Fsdb = "fsdb0", PrimarySwitch = Ia.Ftn.Cl.Model.Business.Nokia.Ims.TEC };
  105:                 }
  106:                 else throw new ArgumentOutOfRangeException(@"ont.Pon.PonGroup.MgcIp != 10.16.1.142");
  107:             }
  108:  
  109:             imsBasicService = new ImsBasicService()
  110:             {
  111:                 PrimarySwitch = nokiaImsBasicService.PrimarySwitch,
  112:                 Fsdb = nokiaImsBasicService.Fsdb,
  113:                 MgcIp = nokiaImsBasicService.MgcIp,
  114:                 MgcSecondaryIp = nokiaImsBasicService.MgcSecondaryIp,
  115:                 MgcSubnetMask = nokiaImsBasicService.MgcSubnetMask,
  116:                 Service = nokiaImsBasicService.Service
  117:             };
  118:  
  119:             return imsBasicService;
  120:         }
  121:  
  122:         ////////////////////////////////////////////////////////////////////////////
  123:  
  124:         /// <summary>
  125:         ///
  126:         /// </summary>
  127:         public static Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService NokiaImsBasicServiceItem(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.PonGroup ponGroup)
  128:         {
  129:             Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService imsBasicService;
  130:             Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService nokiaImsBasicService;
  131:  
  132:             nokiaImsBasicService = (from ibs in Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceList where ibs.MgcIp == ponGroup.MgcIp select ibs).Single();
  133:  
  134:             imsBasicService = new ImsBasicService()
  135:             {
  136:                 PrimarySwitch = nokiaImsBasicService.PrimarySwitch,
  137:                 Fsdb = nokiaImsBasicService.Fsdb,
  138:                 MgcIp = nokiaImsBasicService.MgcIp,
  139:                 MgcSecondaryIp = nokiaImsBasicService.MgcSecondaryIp,
  140:                 MgcSubnetMask = nokiaImsBasicService.MgcSubnetMask,
  141:                 Service = nokiaImsBasicService.Service
  142:             };
  143:  
  144:             return imsBasicService;
  145:         }
  146:  
  147:         ////////////////////////////////////////////////////////////////////////////
  148:  
  149:         /// <summary>
  150:         ///
  151:         /// </summary>
  152:         public static bool OntHasAPbxDesignatedSubParty(string ip)
  153:         {
  154:             bool hasPbx;
  155:             List<string> list;
  156:  
  157:             list = Ia.Ftn.Cl.Model.Data.Nokia.Ims.AgcfGatewayRecordIp1sWithinWhichSubPartiesHaveServiceBundle2CategoryList;
  158:  
  159:             if (list.Count > 0) hasPbx = list.Contains(ip);
  160:             else hasPbx = false;
  161:  
  162:             return hasPbx;
  163:         }
  164:  
  165:         ////////////////////////////////////////////////////////////////////////////
  166:  
  167:         /// <summary>
  168:         ///
  169:         /// </summary>
  170:         public static bool OntIpIsDesignatedFsdb0InAgcfGatewayRecord(string ip)
  171:         {
  172:             bool isFsdb0;
  173:             List<string> list;
  174:  
  175:             list = Ia.Ftn.Cl.Model.Data.Nokia.Ims.AgcfGatewayRecordIp1sThatIndicateFsdb0List;
  176:  
  177:             if (list.Count > 0) isFsdb0 = list.Contains(ip);
  178:             else isFsdb0 = false;
  179:  
  180:             return isFsdb0;
  181:         }
  182:  
  183:         ////////////////////////////////////////////////////////////////////////////
  184:  
  185:         /// <summary>
  186:         ///
  187:         /// </summary>
  188:         public static bool OntAccessHasAPbxDesignatedSubParty(string accessId)
  189:         {
  190:             bool hasPbx;
  191:             List<string> list;
  192:  
  193:             list = Ia.Ftn.Cl.Model.Data.Ims.AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  194:  
  195:             if (list.Count > 0) hasPbx = list.Contains(accessId);
  196:             else hasPbx = false;
  197:  
  198:             return hasPbx;
  199:         }
  200:  
  201:         ////////////////////////////////////////////////////////////////////////////
  202:  
  203:         /// <summary>
  204:         ///
  205:         /// </summary>
  206:         public static Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService HuaweiImsBasicServiceItem(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.PonGroup ponGroup)
  207:         {
  208:             Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService imsBasicService;
  209:             Ia.Ftn.Cl.Model.Business.Huawei.Ims.ImsBasicService huaweiImsBasicService;
  210:  
  211:             huaweiImsBasicService = (from ibs in Ia.Ftn.Cl.Model.Business.Huawei.Ims.ImsBasicServiceList where ibs.MgcIp == ponGroup.MgcIp select ibs).Single();
  212:  
  213:             imsBasicService = new ImsBasicService()
  214:             {
  215:                 PrimarySwitch = huaweiImsBasicService.PrimarySwitch,
  216:                 Fsdb = huaweiImsBasicService.Fsdb,
  217:                 MgcIp = huaweiImsBasicService.MgcIp,
  218:                 MgcSecondaryIp = huaweiImsBasicService.MgcSecondaryIp,
  219:                 MgcSubnetMask = huaweiImsBasicService.MgcSubnetMask,
  220:                 Service = huaweiImsBasicService.Service
  221:             };
  222:  
  223:             return imsBasicService;
  224:         }
  225:  
  226:         ////////////////////////////////////////////////////////////////////////////
  227:  
  228:         /// <summary>
  229:         ///
  230:         /// </summary>
  231:         public static Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService SpecialHuaweiIpHandlingForNokiaImsBasicServiceItem(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt)
  232:         {
  233:             Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService imsBasicService;
  234:             Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService nokiaImsBasicService;
  235:  
  236:             if (nddOnt.Pon.PonGroup.Olt.Odf.Name == "SAA")
  237:             {
  238:                 /*
  239:                  * SAA:
  240:                  * Cable        MGC Primary IP  MGC Secondary
  241:                  * Cable 5        10.16.1.38        10.16.5.38
  242:                  * Cable 6        10.16.1.34        10.16.5.34
  243:                  * Cable 7        10.16.1.31        10.16.5.31
  244:                  * Cable 8        10.16.1.33        10.16.5.33
  245:                  */
  246:  
  247:                 if (Ia.Ftn.Cl.Model.Data.Huawei.Default.ListOfHuaweiOntThatWereIntiallyInstalledAndProvisionedWithNokiaMgcIp10_16_5_37BeforeNewMgcIpToCableDistributionAgreement.Contains(nddOnt.Access.Name))
  248:                 {
  249:                     nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.5.37");
  250:                 }
  251:                 else if (nddOnt.Pon.Number >= 500 && nddOnt.Pon.Number < 600) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.1.38");
  252:                 else if (nddOnt.Pon.Number >= 600 && nddOnt.Pon.Number < 700) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.1.34");
  253:                 else if (nddOnt.Pon.Number >= 700 && nddOnt.Pon.Number < 800) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.1.31");
  254:                 else if (nddOnt.Pon.Number >= 800 && nddOnt.Pon.Number < 900) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.1.33");
  255:                 // below: fake
  256:                 else if (nddOnt.Pon.Number >= 900 && nddOnt.Pon.Number < 1000) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.1.33");
  257:                 else
  258:                 {
  259:                     throw new Exception("Huawei imsBasicService undefined for access: " + nddOnt.Access.Name + ". ");
  260:                 }
  261:             }
  262:             else if (nddOnt.Pon.PonGroup.Olt.Odf.Name == "SDQ")
  263:             {
  264:                 /*
  265:                  * SDQ:
  266:                  * Cable        MGC Primary IP  MGC Secondary
  267:                  * Cable 7      10.16.5.32    10.16.1.32
  268:                  * Cable 8        10.16.5.35    10.16.1.35
  269:                  * Cable 9        10.16.5.36    10.16.1.36
  270:                  */
  271:  
  272:                 if (nddOnt.Pon.Number >= 700 && nddOnt.Pon.Number < 800) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.5.32");
  273:                 else if (nddOnt.Pon.Number >= 800 && nddOnt.Pon.Number < 900) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.5.35");
  274:                 else if (nddOnt.Pon.Number >= 900 && nddOnt.Pon.Number < 1000) nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem("10.16.5.36");
  275:                 else
  276:                 {
  277:                     throw new Exception("Huawei imsBasicService undefined for access: " + nddOnt.Access.Name + ". ");
  278:                 }
  279:             }
  280:             else
  281:             {
  282:                 nokiaImsBasicService = null;
  283:             }
  284:  
  285:             if (nokiaImsBasicService != null)
  286:             {
  287:                 imsBasicService = new ImsBasicService()
  288:                 {
  289:                     PrimarySwitch = nokiaImsBasicService.PrimarySwitch,
  290:                     Fsdb = nokiaImsBasicService.Fsdb,
  291:                     MgcIp = nokiaImsBasicService.MgcIp,
  292:                     MgcSecondaryIp = nokiaImsBasicService.MgcSecondaryIp,
  293:                     MgcSubnetMask = nokiaImsBasicService.MgcSubnetMask,
  294:                     Service = nokiaImsBasicService.Service
  295:                 };
  296:             }
  297:             else imsBasicService = null;
  298:  
  299:             return imsBasicService;
  300:         }
  301:  
  302:         ////////////////////////////////////////////////////////////////////////////
  303:  
  304:         /// <summary>
  305:         ///
  306:         /// </summary>
  307:         public static Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService SpecialHuaweiIpHandlingForNokiaImsBasicServiceItem(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.PonGroup ponGroup)
  308:         {
  309:             Ia.Ftn.Cl.Model.Business.Ims.ImsBasicService imsBasicService;
  310:             Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService nokiaImsBasicService;
  311:  
  312:             nokiaImsBasicService = Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceItem(ponGroup.MgcIp);
  313:  
  314:             if (nokiaImsBasicService == null)
  315:             {
  316:                 if (ponGroup.MgcIp == "10.16.1.142")
  317:                 {
  318:                     nokiaImsBasicService = new Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService { MgcIp = "10.16.1.142", MgcSecondaryIp = "10.16.5.142", MgcSubnetMask = "255.255.224.0", Service = 0, Fsdb = string.Empty, PrimarySwitch = Ia.Ftn.Cl.Model.Business.Nokia.Ims.TEC };
  319:                 }
  320:                 else if (ponGroup.MgcIp == "10.16.5.142")
  321:                 {
  322:                     nokiaImsBasicService = new Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService { MgcIp = "10.16.5.142", MgcSecondaryIp = "10.16.1.142", MgcSubnetMask = "255.255.224.0", Service = 0, Fsdb = string.Empty, PrimarySwitch = Ia.Ftn.Cl.Model.Business.Nokia.Ims.SKB };
  323:                 }
  324:                 else if (ponGroup.MgcIp == "10.10.9.254")
  325:                 {
  326:                     nokiaImsBasicService = new Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService { MgcIp = "10.10.9.254", MgcSecondaryIp = "10.10.1.254", MgcSubnetMask = "255.255.224.0", Service = 0, Fsdb = string.Empty, PrimarySwitch = Ia.Ftn.Cl.Model.Business.Nokia.Ims.TEC };
  327:                 }
  328:                 else if (ponGroup.MgcIp == "10.10.1.254")
  329:                 {
  330:                     nokiaImsBasicService = new Ia.Ftn.Cl.Model.Business.Nokia.Ims.ImsBasicService { MgcIp = "10.10.1.254", MgcSecondaryIp = "10.10.9.254", MgcSubnetMask = "255.255.224.0", Service = 0, Fsdb = string.Empty, PrimarySwitch = Ia.Ftn.Cl.Model.Business.Nokia.Ims.SKB };
  331:                 }
  332:  
  333:                 // Use fixed random to assign fsdb values from fsdb0-fsdb3 randomly to passed area with nddOnt
  334:  
  335:                 switch (Ia.Cl.Models.Default.AlphanumericStringToInt(ponGroup.Symbol) % 4)
  336:                 {
  337:                     case 0: nokiaImsBasicService.Fsdb = "fsdb0"; break;
  338:                     case 1: nokiaImsBasicService.Fsdb = "fsdb1"; break;
  339:                     case 2: nokiaImsBasicService.Fsdb = "fsdb2"; break;
  340:                     case 3: nokiaImsBasicService.Fsdb = "fsdb3"; break;
  341:                     default: nokiaImsBasicService.Fsdb = "fsdb0"; break;
  342:                 }
  343:  
  344:                 nokiaImsBasicService.Fsdb = "fsdb0";
  345:             }
  346:  
  347:             imsBasicService = new ImsBasicService()
  348:             {
  349:                 PrimarySwitch = nokiaImsBasicService.PrimarySwitch,
  350:                 Fsdb = nokiaImsBasicService.Fsdb,
  351:                 MgcIp = nokiaImsBasicService.MgcIp,
  352:                 MgcSecondaryIp = nokiaImsBasicService.MgcSecondaryIp,
  353:                 MgcSubnetMask = nokiaImsBasicService.MgcSubnetMask,
  354:                 Service = nokiaImsBasicService.Service
  355:             };
  356:  
  357:             return imsBasicService;
  358:         }
  359:  
  360:         ////////////////////////////////////////////////////////////////////////////
  361:         ////////////////////////////////////////////////////////////////////////////
  362:     }
  363:  
  364:     ////////////////////////////////////////////////////////////////////////////
  365:     ////////////////////////////////////////////////////////////////////////////
  366: }