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