شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ont

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

Huawei's Ont support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.Text.RegularExpressions;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Huawei's Ont support class of Next Generation Network'a (NGN's) business model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2016-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet 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 partial class Ont
  30:      {
  31:          /// <summary/>
  32:          public enum EquipmentType { Undefined = 0, HN8245Q_2 = 1, MA5672_4 = 2, MA5616_32 = 3, MA5616_48 = 6, MA5616_64 = 4, MA5616_96 = 5, MA5878_16 = 7, MA5878_32 = 8, MA5878_48 = 9 };
  33:   
  34:          public enum FamilyType { Undefined = 0, Sfu = 1, Soho = 2, Mdu = 3 };
  35:   
  36:          /// <summary/>
  37:          public Ont() { }
  38:   
  39:          ////////////////////////////////////////////////////////////////////////////
  40:   
  41:          /// <summary>
  42:          ///
  43:          /// </summary>
  44:          public static string OntId(/*int oltId, int fn, int sn, int pn,*/ string ponId, int ontSystemId)
  45:          {
  46:              /*
  47:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  48:               * FN    SN   PN   ONTID
  49:               * 
  50:               * Dev: olt id
  51:               * Board: FN SN
  52:               * Port: FN SN PN
  53:               * Ont: FN SN PN ONTID
  54:               * 
  55:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
  56:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
  57:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
  58:               * /// ONTID INTEGER 0-255 NOTE If the UNI port is of 10G GPON, the value range is 0-255; if the UNI port is of 1G GPON, the value range is 0-127. Indicates the ONT ID. 
  59:               */
  60:   
  61:              string id;//, ponId;
  62:   
  63:              //if (oltId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35 && pn >= 0 && pn <= 63 && ontSystemId >= 0 && ontSystemId <= 255)
  64:              //{
  65:              // In our NGN network the missing RACK in EMS is 0, FN is always 0, and ontSystemId has max 2 digits
  66:   
  67:              //if (fn == 0 && ontSystemId <= 99)
  68:              //{
  69:              id = Ia.Ngn.Cl.Model.Business.Default.OntId(ponId, ontSystemId);
  70:              //}
  71:              //else
  72:              //{
  73:              //throw new System.ArgumentOutOfRangeException("fn, sn, pn, ontId", "fn, sn, pn, or ontId is out of range");
  74:              //}
  75:              //}
  76:              //else
  77:              //{
  78:              //throw new System.ArgumentOutOfRangeException("fn, sn, pn, ontId", "fn, sn, pn, or ontId is out of range");
  79:              //}
  80:   
  81:              return id;
  82:          }
  83:   
  84:          ////////////////////////////////////////////////////////////////////////////
  85:   
  86:          /// <summary>
  87:          /// This is used to verify the ONT type in the contactors access submittal files 
  88:          /// </summary>
  89:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentTypeFromAccessSubmittalString(string equipmentTypeString)
  90:          {
  91:              // I will not accept 5878 or 5616 as ONT type submittal. I will nullify string if it was any of the two
  92:              if (equipmentTypeString == "5616" || equipmentTypeString == "5878") equipmentTypeString = string.Empty;
  93:   
  94:              return EquipmentTypeFromString(equipmentTypeString);
  95:          }
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:   
  99:          /// <summary>
 100:          /// 
 101:          /// </summary>
 102:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentTypeFromString(string equipmentTypeString)
 103:          {
 104:              // this will convert string format of ONU type from both email submittals and from EMSONT EQUIPMENTID values from U2000
 105:   
 106:              // select count(EQUIPMENTID), EQUIPMENTID from EmsOnts group by EQUIPMENTID
 107:              /*
 108:  Count    Type
 109:  67    5878
 110:  142    MDU
 111:  1     MA5672-G4P4
 112:  1302    --
 113:  14347    MA5672-G4P4
 114:  11    ONT
 115:  355    5616
 116:  3    245H
 117:  */
 118:   
 119:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType;
 120:   
 121:              if (!string.IsNullOrEmpty(equipmentTypeString))
 122:              {
 123:                  switch (equipmentTypeString)
 124:                  {
 125:                      case "HN8245Q-2": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.HN8245Q_2; break;
 126:                      case "MA5672-4": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4; break;
 127:                      case "MA5672-G4P4": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4; break;
 128:                      case "MA5616-32": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_32; break;
 129:                      case "MA5616-48": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_48; break;
 130:                      case "MA5616-64": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64; break;
 131:                      case "MA5616-96": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_96; break;
 132:   
 133:                      case "MA5878-16": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_16; break;
 134:                      case "MA5878-32": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32; break;
 135:                      case "MA5878-48": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_48; break;
 136:   
 137:                      // do not remove below because I need them to match equipment type from system
 138:                      case "5616": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64; break;
 139:                      case "5878": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32; break;
 140:   
 141:                      default: equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.Undefined; break;
 142:                  }
 143:              }
 144:              else equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.Undefined;
 145:   
 146:              return equipmentType;
 147:          }
 148:   
 149:          ////////////////////////////////////////////////////////////////////////////
 150:   
 151:          /// <summary>
 152:          /// 
 153:          /// </summary>
 154:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType FamilyTypeFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType)
 155:          {
 156:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType familyType;
 157:   
 158:              switch (equipmentType)
 159:              {
 160:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.HN8245Q_2: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu; break;
 161:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu; break;
 162:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_32: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 163:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_48: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 164:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 165:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_96: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 166:   
 167:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_16: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 168:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 169:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_48: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu; break;
 170:   
 171:                  default: familyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Undefined; break;
 172:              }
 173:   
 174:              return familyType;
 175:          }
 176:   
 177:          ////////////////////////////////////////////////////////////////////////////
 178:   
 179:          /// <summary>
 180:          /// 
 181:          /// </summary>
 182:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentTypeFromBoardPstnMainBoardVersionString(string mainBoardVersion)
 183:          {
 184:              // this will convert string format of MDU board type from board table format 
 185:              /*
 186:               * ASRB–32 pots
 187:               * ASPB—64 pots
 188:               * Main Board: H838ASPB    
 189:  IF MDU the user DEV name to read board SN and TYPE and put in Board
 190:  LST-BOARD::DEV=MDU-FNT-806-002,FN=0:CTAG::;
 191:  
 192:  
 193:     7340724 2018-10-24 11:26:42
 194:  M  CTAG COMPLD
 195:     EN=0   ENDESC=Succeeded.
 196:     blktag=1
 197:     blkcount=5
 198:     blktotal=5
 199:  
 200:  Board information of the device MDU-FNT-806-002
 201:  ---------------------------------------------------------------
 202:  DID     FN      SN      BT      BVER    BSTAT
 203:  7340724 0       0       Other   Main Board: H831CCUD     PCB           Version: H831CCUD VER C     Base     BIOS Version: 313     Software      Version: MA5616V800R015C00     CPLD         Version: (U1022)100     MAB           Version: 0000      SubBoard[0]:       PCB           Version: H831UP2A VER A       MAB           Version: 0001       SubBoard[1]:       PCB           Version: H836ASDA VER C       MAB           Version: 0001       APP           Version: 362(2014-8-7)      BIOS          Version: (U1)309      VoiceFile     Version: CHS 010       Normal
 204:  7340724 0       1       ETH     Board Name: H831EIUD     ---------------------------------------     PCB           Version: H831EIUD VER E     MAB           Version: 0001     CPLD          Version: (U8)100        Normal
 205:  7340724 0       2       ETH     Board Name: H831EIUD     ---------------------------------------     PCB           Version: H831EIUD VER E     MAB           Version: 0001     CPLD          Version: (U8)100        Normal
 206:  7340724 0       3       PSTN    Main Board: H838ASRB    ---------------------------------------    Pcb   Version: H838ASRB VER B    Mab   Version: 0000      Main CPU :     CPU   Version: (U300)STM32F103VD    APP   Version: 639(2015-1-31)    BIOS  Version: (U300)107    Normal
 207:  7340724 0       5       Other   --      Normal
 208:  ---------------------------------------------------------------
 209:  ;
 210:               */
 211:   
 212:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType;
 213:   
 214:              if (!string.IsNullOrEmpty(mainBoardVersion))
 215:              {
 216:                  switch (mainBoardVersion)
 217:                  {
 218:                      case "H838ASRB": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_32; break;
 219:                      case "H838ASPB": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64; break;
 220:                      //case "H805GPFD": equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32; break;
 221:                      default: equipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.Undefined; break;
 222:                  }
 223:              }
 224:              else equipmentType = 0;
 225:   
 226:              return equipmentType;
 227:          }
 228:   
 229:          ////////////////////////////////////////////////////////////////////////////
 230:   
 231:          /// <summary>
 232:          /// 
 233:          /// </summary>
 234:          public static string FamilyTypeStringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType)
 235:          {
 236:              string s;
 237:   
 238:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType familyType;
 239:   
 240:              familyType = FamilyTypeFromEquipmentType(equipmentType);
 241:   
 242:              s = familyType.ToString().ToUpper();
 243:   
 244:              return s;
 245:          }
 246:   
 247:          ////////////////////////////////////////////////////////////////////////////
 248:   
 249:          /// <summary>
 250:          /// 
 251:          /// </summary>
 252:          public static List<string> EquipmentTypeStringListFromFamilyType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType familyType)
 253:          {
 254:              List<string> equipmentTypeStringList;
 255:   
 256:              equipmentTypeStringList = new List<string>(10);
 257:   
 258:              switch (familyType)
 259:              {
 260:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu:
 261:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.HN8245Q_2));
 262:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4));
 263:                      break;
 264:   
 265:                  case Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu:
 266:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_32));
 267:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_48));
 268:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64));
 269:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_96));
 270:   
 271:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_16));
 272:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32));
 273:                      equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_48));
 274:                      break;
 275:   
 276:                  default: equipmentTypeStringList.Add(StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.Undefined)); break;
 277:              }
 278:   
 279:              return equipmentTypeStringList;
 280:          }
 281:   
 282:          ////////////////////////////////////////////////////////////////////////////
 283:   
 284:          /// <summary>
 285:          /// 
 286:          /// </summary>
 287:          public static string StringFromEquipmentType(Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType)
 288:          {
 289:              string equipmentTypeString;
 290:   
 291:              if (equipmentType != Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.Undefined)
 292:              {
 293:                  switch (equipmentType)
 294:                  {
 295:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.HN8245Q_2: equipmentTypeString = "HN8245Q-2"; break;
 296:                      //case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4: equipmentTypeString = "MA5672-4"; break;
 297:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5672_4: equipmentTypeString = "MA5672-G4P4"; break;
 298:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_32: equipmentTypeString = "MA5616-32"; break;
 299:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_48: equipmentTypeString = "MA5616-48"; break;
 300:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_64: equipmentTypeString = "5616"; break; //= "MA5616-64"; break;
 301:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5616_96: equipmentTypeString = "MA5616-96"; break;
 302:   
 303:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_16: equipmentTypeString = "MA5878-16"; break;
 304:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_32: equipmentTypeString = "5878"; break; //= "MA5878-32"; break;
 305:                      case Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType.MA5878_48: equipmentTypeString = "MA5878-48"; break;
 306:   
 307:                      default: equipmentTypeString = string.Empty; break;
 308:                  }
 309:              }
 310:              else equipmentTypeString = string.Empty;
 311:   
 312:              return equipmentTypeString;
 313:          }
 314:   
 315:          /*
 316:          ////////////////////////////////////////////////////////////////////////////
 317:  
 318:          /// <summary>
 319:          ///
 320:          /// </summary>
 321:          public static string FamilyTypeFromId(int familyTypeId)
 322:          {
 323:              string s;
 324:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType familyType;
 325:  
 326:              familyType = (Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType)familyTypeId;
 327:  
 328:              s = familyType.ToString().ToUpper();
 329:  
 330:              return s;
 331:          }
 332:          */
 333:   
 334:          ////////////////////////////////////////////////////////////////////////////
 335:   
 336:          /// <summary>
 337:          ///
 338:          /// </summary>
 339:          public static int SpecialIntegerParameterHandling(string parameterName, string parameterValue)
 340:          {
 341:              int i;
 342:   
 343:              if (parameterName == "AUTHTIMEOUT")
 344:              {
 345:                  // AUTHTIMEOUT
 346:                  // INTEGER
 347:                  // 1 - 168 Disable
 348:                  // Indicates the timeout period of the authentication. This parameter is valid only when the AUTH parameter is set to ONCE_ON.If you do not set this parameter, the value is returned as Disable in the output information.Unit: h.
 349:   
 350:                  parameterValue = parameterValue.Replace("Disable", "0");
 351:              }
 352:              else
 353:              {
 354:   
 355:              }
 356:   
 357:              i = int.Parse(parameterValue);
 358:   
 359:              return i;
 360:          }
 361:   
 362:          ////////////////////////////////////////////////////////////////////////////
 363:   
 364:          /// <summary>
 365:          ///
 366:          /// </summary>
 367:          public static bool IsValidSerialNumber(string serialNumber)
 368:          {
 369:              bool isValid;
 370:   
 371:              if (!string.IsNullOrEmpty(serialNumber))
 372:              {
 373:                  if (serialNumber.Length == 16) //485754432D08578D
 374:                  {
 375:                      isValid = Ia.Cl.Model.Default.IsHex(serialNumber);
 376:                  }
 377:                  else isValid = false;
 378:              }
 379:              else isValid = false;
 380:   
 381:              return isValid;
 382:          }
 383:   
 384:          ////////////////////////////////////////////////////////////////////////////
 385:          ////////////////////////////////////////////////////////////////////////////
 386:      }
 387:   
 388:      ////////////////////////////////////////////////////////////////////////////
 389:      ////////////////////////////////////////////////////////////////////////////
 390:  }