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

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

Huawei's Ont support class of Fixed Telecommunications Network (FTN) business model.

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