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

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:  using System.Linq;
   3:   
   4:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   5:  {
   6:      ////////////////////////////////////////////////////////////////////////////
   7:   
   8:      /// <summary publish="true">
   9:      /// Huawei's Ont support class of Next Generation Network'a (NGN's) business model.
  10:      /// </summary>
  11:      /// 
  12:      /// <remarks> 
  13:      /// Copyright © 2016-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  14:      ///
  15:      /// 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
  16:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  17:      ///
  18:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  19:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  20:      /// 
  21:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  22:      /// 
  23:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  24:      /// </remarks> 
  25:      public partial class Ont
  26:      {
  27:          public class EquipmentType
  28:          {
  29:              public string Name;
  30:              public List<string> SystemNameList;
  31:              public int TelPorts;
  32:              public int EthernetPorts;
  33:              public Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType FamilyType;
  34:   
  35:              public EquipmentType() { }
  36:          }
  37:   
  38:          public static EquipmentType[] EquipmentTypeList =
  39:              {
  40:              new EquipmentType { Name = "HN8245Q-2", SystemNameList = new List<string>() { "245H" } , FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu, EthernetPorts = 4, TelPorts = 2 },
  41:              new EquipmentType { Name = "MA5672-4", SystemNameList = new List<string>() { "MA5672-G4P4", "MA5672", "ONT" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu, EthernetPorts = 4, TelPorts = 4 },
  42:              new EquipmentType { Name = "MA5616-32", SystemNameList = new List<string>() { "5616", "MDU" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 32 },
  43:              new EquipmentType { Name = "MA5616-48", SystemNameList = new List<string>() { "5616" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 48 },
  44:              new EquipmentType { Name = "MA5616-64", SystemNameList = new List<string>() { "5616", "MDU" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 64},
  45:              new EquipmentType { Name = "MA5616-96", SystemNameList = new List<string>() { "5616" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 96 },
  46:              new EquipmentType { Name = "MA5616-128", SystemNameList = new List<string>() { "5616" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 128 },
  47:              new EquipmentType { Name = "MA5616-192", SystemNameList = new List<string>() { "5616" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 4, TelPorts = 192 },
  48:              new EquipmentType { Name = "MA5878-16", SystemNameList = new List<string>() { "5878" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 16 },
  49:              new EquipmentType { Name = "MA5878-32", SystemNameList = new List<string>() { "5878" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 32 },
  50:              new EquipmentType { Name = "MA5878-48", SystemNameList = new List<string>() { "5878" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 48 },
  51:              new EquipmentType { Name = "MA5878-64", SystemNameList = new List<string>() { "5878" }, FamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, EthernetPorts = 8, TelPorts = 64 },
  52:          };
  53:   
  54:          /*
  55:  select count(EQUIPMENTID) as count, '[' + EQUIPMENTID + ']' as EmsOntEquipmentTypeName from EmsOnts group by EQUIPMENTID
  56:  count    EmsOntEquipmentTypeName
  57:  -187     [5878]
  58:  8        [MA5672]
  59:  202        [MDU]
  60:  3        [ MA5672-G4P4]
  61:  -26498    [MA5672-G4P4]
  62:  8        [ONT]
  63:  -689        [5616]
  64:  2        [245H]
  65:  */
  66:   
  67:          /*
  68:          select count(0), substring(note,1,charindex(':',note)) 
  69:          from Accesses 
  70:          where note like '%: %'
  71:          group by substring(note,1,charindex(':',note)) 
  72:  
  73:          20    MA5616-32: 5616
  74:          3    MA5616-48: 5616
  75:          -22    MA5616-64: 5616
  76:          3    MA5616-96: 5616
  77:          -6029    MA5672-4:     MA5672-G4P4
  78:          -121    MA5878-32: 5878
  79:          453    SFU:
  80:          */
  81:   
  82:          /*
  83:          ////////////////////////////////////////////////////////////////////////////
  84:  
  85:          /// <summary>
  86:          /// 
  87:          /// </summary>
  88:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentTypeFromBoardPstnMainBoardVersionString(string mainBoardVersion)
  89:          {
  90:              // this will convert string format of MDU board type from board table format 
  91:              /*
  92:               * ASRB–32 pots
  93:               * ASPB—64 pots
  94:               * Main Board: H838ASPB    
  95:  IF MDU the user DEV name to read board SN and TYPE and put in Board
  96:  LST-BOARD::DEV=MDU-FNT-806-002,FN=0:CTAG::;
  97:  
  98:  
  99:     7340724 2018-10-24 11:26:42
 100:  M  CTAG COMPLD
 101:     EN=0   ENDESC=Succeeded.
 102:     blktag=1
 103:     blkcount=5
 104:     blktotal=5
 105:  
 106:  Board information of the device MDU-FNT-806-002
 107:  ---------------------------------------------------------------
 108:  DID     FN      SN      BT      BVER    BSTAT
 109:  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
 110:  7340724 0       1       ETH     Board Name: H831EIUD     ---------------------------------------     PCB           Version: H831EIUD VER E     MAB           Version: 0001     CPLD          Version: (U8)100        Normal
 111:  7340724 0       2       ETH     Board Name: H831EIUD     ---------------------------------------     PCB           Version: H831EIUD VER E     MAB           Version: 0001     CPLD          Version: (U8)100        Normal
 112:  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
 113:  7340724 0       5       Other   --      Normal
 114:  ---------------------------------------------------------------
 115:  ;
 116:               * /
 117:  
 118:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType;
 119:  
 120:              equipmentType = (from e in EquipmentTypeList 
 121:                               where e.MainBoardVersion == mainBoardVersion && e.FamilyType == Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu 
 122:                               select e).Single();
 123:  
 124:              return equipmentType;
 125:          }
 126:          */
 127:   
 128:          public enum FamilyType { Undefined = 0, Sfu = 1, Soho = 2, Mdu = 3 };
 129:   
 130:          /// <summary/>
 131:          public Ont() { }
 132:   
 133:          ////////////////////////////////////////////////////////////////////////////
 134:   
 135:          /// <summary>
 136:          ///
 137:          /// </summary>
 138:          public static string OntId(/*int oltId, int fn, int sn, int pn,*/ string ponId, int ontSystemId)
 139:          {
 140:              /*
 141:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
 142:               * FN    SN   PN   ONTID
 143:               * 
 144:               * Dev: olt id
 145:               * Board: FN SN
 146:               * Port: FN SN PN
 147:               * Ont: FN SN PN ONTID
 148:               * 
 149:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 150:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 151:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 152:               * /// 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. 
 153:               */
 154:   
 155:              string id;//, ponId;
 156:   
 157:              //if (oltId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35 && pn >= 0 && pn <= 63 && ontSystemId >= 0 && ontSystemId <= 255)
 158:              //{
 159:              // In our NGN network the missing RACK in EMS is 0, FN is always 0, and ontSystemId has max 2 digits
 160:   
 161:              //if (fn == 0 && ontSystemId <= 99)
 162:              //{
 163:              id = Ia.Ngn.Cl.Model.Business.Default.OntId(ponId, ontSystemId);
 164:              //}
 165:              //else
 166:              //{
 167:              //throw new System.ArgumentOutOfRangeException("fn, sn, pn, ontId", "fn, sn, pn, or ontId is out of range");
 168:              //}
 169:              //}
 170:              //else
 171:              //{
 172:              //throw new System.ArgumentOutOfRangeException("fn, sn, pn, ontId", "fn, sn, pn, or ontId is out of range");
 173:              //}
 174:   
 175:              return id;
 176:          }
 177:   
 178:          ////////////////////////////////////////////////////////////////////////////
 179:   
 180:          /// <summary>
 181:          ///
 182:          /// </summary>
 183:          public static Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentTypeFromOntIdAndFamilyTypeAndEquipmentId(Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType familyType, string equipmentId, string ontId)
 184:          {
 185:              Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType equipmentType;
 186:   
 187:              if (familyType == Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu)
 188:              {
 189:                  if (Ia.Ngn.Cl.Model.Data.Huawei.Default.NddOntIdToMduDevDictionary.ContainsKey(ontId))
 190:                  {
 191:                      var mduDev = Ia.Ngn.Cl.Model.Data.Huawei.Default.NddOntIdToMduDevDictionary[ontId];
 192:   
 193:                      equipmentType = (from e in Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentTypeList where e.SystemNameList.Contains(equipmentId) && e.TelPorts == mduDev.TelPortCount select e).Single();
 194:                  }
 195:                  else equipmentType = null;
 196:              }
 197:              else // Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu
 198:              {
 199:                  equipmentType = (from e in Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentTypeList where e.SystemNameList.Contains(equipmentId) select e).Single();
 200:              }
 201:   
 202:              return equipmentType;
 203:          }
 204:   
 205:          ////////////////////////////////////////////////////////////////////////////
 206:   
 207:          /// <summary>
 208:          ///
 209:          /// </summary>
 210:          public static int SpecialIntegerParameterHandling(string parameterName, string parameterValue)
 211:          {
 212:              int i;
 213:   
 214:              if (parameterName == "AUTHTIMEOUT")
 215:              {
 216:                  // AUTHTIMEOUT
 217:                  // INTEGER
 218:                  // 1 - 168 Disable
 219:                  // 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.
 220:   
 221:                  parameterValue = parameterValue.Replace("Disable", "0");
 222:              }
 223:              else
 224:              {
 225:   
 226:              }
 227:   
 228:              i = int.Parse(parameterValue);
 229:   
 230:              return i;
 231:          }
 232:   
 233:          ////////////////////////////////////////////////////////////////////////////
 234:   
 235:          /// <summary>
 236:          ///
 237:          /// </summary>
 238:          public static bool IsValidSerialNumber(string serialNumber)
 239:          {
 240:              bool isValid;
 241:   
 242:              if (!string.IsNullOrEmpty(serialNumber))
 243:              {
 244:                  if (serialNumber.Length == 16) //485754432D08578D
 245:                  {
 246:                      isValid = Ia.Cl.Model.Default.IsHex(serialNumber);
 247:                  }
 248:                  else isValid = false;
 249:              }
 250:              else isValid = false;
 251:   
 252:              return isValid;
 253:          }
 254:   
 255:          ////////////////////////////////////////////////////////////////////////////
 256:          ////////////////////////////////////////////////////////////////////////////
 257:      }
 258:   
 259:      ////////////////////////////////////////////////////////////////////////////
 260:      ////////////////////////////////////////////////////////////////////////////
 261:  }