)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Board (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 Board support class of Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2: using System.Collections.Generic;
    3:  
    4: namespace Ia.Ftn.Cl.Model.Business.Huawei
    5: {
    6:     ////////////////////////////////////////////////////////////////////////////
    7:  
    8:     /// <summary publish="true">
    9:     /// Huawei's Board support class of Fixed Telecommunications Network (FTN) business model.
   10:     /// </summary>
   11:     /// 
   12:     /// <remarks> 
   13:     /// Copyright © 2016-2021 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 Board
   26:     {
   27:         private static int sequentialEmsDevDevQueueOriginalCount;
   28:         private static Queue<Ia.Ftn.Cl.Model.Huawei.EmsBoard> sequentialEmsBoardQueue = new Queue<Ia.Ftn.Cl.Model.Huawei.EmsBoard>();
   29:  
   30:         ////////////////////////////////////////////////////////////////////////////
   31:  
   32:         /// <summary>
   33:         ///
   34:         /// </summary>
   35:         public class MduDevBoard
   36:         {
   37:             /// <summary/>
   38:             public int Did;
   39:  
   40:             /// <summary/>
   41:             public string Type;
   42:  
   43:             /// <summary/>
   44:             public string Version;
   45:  
   46:             /// <summary/>
   47:             public Ia.Ftn.Cl.Model.Business.Huawei.Dev.Type EmsDevType;
   48:  
   49:             /// <summary/>
   50:             public string EmsDevIp;
   51:  
   52:             /// <summary/>
   53:             public int Fn;
   54:  
   55:             /// <summary/>
   56:             public int Sn;
   57:  
   58:             /// <summary/>
   59:             public int TelPortCount;
   60:  
   61:             /// <summary/>
   62:             public int EthernetPortCount;
   63:  
   64:             ////////////////////////////////////////////////////////////////////////////
   65:  
   66:             /// <summary>
   67:             ///
   68:             /// </summary>
   69:             public MduDevBoard(int did, string boardBt, string boardBname, string boardBver, Ia.Ftn.Cl.Model.Business.Huawei.Dev.Type emsDevType, string emsDevIp, int fn, int sn)
   70:             {
   71:                 TelPortAndEthernetPortCountFromBoardNameAndVersion(boardBname, boardBver, out string version, out int telPorts, out int ethernetPorts);
   72:  
   73:                 this.Did = did;
   74:                 this.Type = boardBt;
   75:                 this.Version = version;
   76:                 this.EmsDevType = emsDevType;
   77:                 this.EmsDevIp = emsDevIp;
   78:                 this.Fn = fn;
   79:                 this.Sn = sn;
   80:                 this.TelPortCount = telPorts;
   81:                 this.EthernetPortCount = ethernetPorts;
   82:             }
   83:  
   84:             ////////////////////////////////////////////////////////////////////////////
   85:  
   86:             /// <summary>
   87:             ///
   88:             /// </summary>
   89:             private void TelPortAndEthernetPortCountFromBoardNameAndVersion(string boardBname, string boardBver, out string boardVersion, out int telPorts, out int ethernetPort)
   90:             {
   91:                 // select distinct BNAME,count(0) from EmsBoards where BT = 'PSTN' or BT = 'ETH' group by BNAME
   92:  
   93:                 /*
   94: select top 10 * from EmsOnts eo
   95: left outer join EmsPorts ep on ep.Id = eo.EmsPort_Id
   96: left outer join EmsBoards eb on eb.Id = ep.EmsBoard_Id
   97: where eb.BNAME like '%H801ASPB%'
   98: or eb.BNAME like '%H801ASPB%'
   99: or eb.BNAME like '%H801GICD%'
  100: or eb.BNAME like '%H801SCUB%'
  101: or eb.BNAME like '%H801X2CS%'
  102: or eb.BNAME like '%H802OPGD%'
  103: or eb.BNAME like '%H802SCUN%'
  104:                  */
  105:  
  106:                 /*
  107: BNAME    (No column name)
  108: H801ASPB    2160
  109: H801GICD    138
  110: H801SCUB    276
  111: H801X2CS    94
  112: H802OPGD    4
  113: H802SCUN    94
  114: H831EIUD    2077
  115: H838ASPB    375
  116: H838ASRB    719
  117: H848ASNB    1104
  118: HS22EPGD    552
  119:                 */
  120:  
  121:                 if (boardBname == "H848ASNB")
  122:                 {
  123:                     boardVersion = "H848ASNB";
  124:                     telPorts = 16;
  125:                     ethernetPort = 0;
  126:                 }
  127:                 else if (boardBname == "H838ASRB")
  128:                 {
  129:                     boardVersion = "H838ASRB";
  130:                     telPorts = 32;
  131:                     ethernetPort = 0;
  132:                 }
  133:                 else if (boardBname == "H838ASPB")
  134:                 {
  135:                     boardVersion = "H838ASPB";
  136:                     telPorts = 64;
  137:                     ethernetPort = 0;
  138:                 }
  139:                 else if (boardBname == "HS22EPGD")
  140:                 {
  141:                     boardVersion = "HS22EPGD";
  142:                     telPorts = 0;
  143:                     ethernetPort = 8;
  144:                 }
  145:                 else if (boardBname == "H831EIUD")
  146:                 {
  147:                     boardVersion = "H831EIUD";
  148:                     telPorts = 0;
  149:                     ethernetPort = 4;
  150:                 }
  151:                 else
  152:                 {
  153:                     throw new Exception("Unknown board version: board.Bver: " + boardBver) { };
  154:                 }
  155:             }
  156:  
  157:             ////////////////////////////////////////////////////////////////////////////
  158:         }
  159:  
  160:         /// <summary/>
  161:         public Board() { }
  162:  
  163:         ////////////////////////////////////////////////////////////////////////////
  164:  
  165:         /// <summary>
  166:         ///
  167:         /// </summary>
  168:         public static string BoardId(int devId, int fn, int sn)
  169:         {
  170:             /*
  171:              * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  172:              * FN    SN   PN   ONTID
  173:              * 
  174:              * Dev: did
  175:              * Board: FN SN
  176:              * Port: FN SN PN
  177:              * Ont: FN SN PN ONTID
  178:              * 
  179:              * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
  180:              * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
  181:              * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
  182:              * /// 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. 
  183:              */
  184:  
  185:             string id;
  186:  
  187:             if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
  188:             {
  189:                 id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
  190:             }
  191:             else
  192:             {
  193:                 throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
  194:             }
  195:  
  196:             return id;
  197:         }
  198:  
  199:         ////////////////////////////////////////////////////////////////////////////
  200:  
  201:         /// <summary>
  202:         ///
  203:         /// </summary>
  204:         public static Ia.Ftn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
  205:         {
  206:             Ia.Ftn.Cl.Model.Huawei.EmsBoard item;
  207:             List<Ia.Ftn.Cl.Model.Huawei.EmsBoard> list;
  208:  
  209:             if (sequentialEmsBoardQueue.Count == 0)
  210:             {
  211:                 list = Ia.Ftn.Cl.Model.Data.Huawei.Board.List();
  212:  
  213:                 sequentialEmsBoardQueue = new Queue<Ia.Ftn.Cl.Model.Huawei.EmsBoard>(list.Shuffle());
  214:  
  215:                 sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
  216:             }
  217:  
  218:             if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
  219:             else item = null;
  220:  
  221:             progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
  222:  
  223:             sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
  224:  
  225:             return item;
  226:         }
  227:  
  228:         ////////////////////////////////////////////////////////////////////////////
  229:         ////////////////////////////////////////////////////////////////////////////
  230:     }
  231:  
  232:     ////////////////////////////////////////////////////////////////////////////
  233:     ////////////////////////////////////////////////////////////////////////////
  234: }