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

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