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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Board

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

Huawei's Board support class of Optical Fiber Network (OFN) business model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:   
   4:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   5:  {
   6:      ////////////////////////////////////////////////////////////////////////////
   7:   
   8:      /// <summary publish="true">
   9:      /// Huawei's Board support class of Optical Fiber Network (OFN) 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.Ngn.Cl.Model.Huawei.EmsBoard> sequentialEmsBoardQueue = new Queue<Ia.Ngn.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.Ngn.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.Ngn.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" || boardBver.Contains("H848ASNB"))
 122:                  {
 123:                      boardVersion = "H848ASNB";
 124:                      telPorts = 16;
 125:                      ethernetPort = 0;
 126:                  }
 127:                  else if (boardBname == "H838ASRB" || boardBver.Contains("H838ASRB"))
 128:                  {
 129:                      boardVersion = "H838ASRB";
 130:                      telPorts = 32;
 131:                      ethernetPort = 0;
 132:                  }
 133:                  else if (boardBname == "H838ASPB" || boardBver.Contains("H838ASPB"))
 134:                  {
 135:                      boardVersion = "H838ASPB";
 136:                      telPorts = 64;
 137:                      ethernetPort = 0;
 138:                  }
 139:                  else if (boardBname == "HS22EPGD" || boardBver.Contains("HS22EPGD"))
 140:                  {
 141:                      boardVersion = "HS22EPGD";
 142:                      telPorts = 0;
 143:                      ethernetPort = 8;
 144:                  }
 145:                  else if (boardBname == "H831EIUD" || boardBver.Contains("H831EIUD"))
 146:                  {
 147:                      boardVersion = "H831EIUD";
 148:                      telPorts = 0;
 149:                      ethernetPort = 4;
 150:                  }
 151:                  else if (boardBver.Contains("--"))
 152:                  {
 153:                      boardVersion = "--";
 154:                      telPorts = 0;
 155:                      ethernetPort = 0;
 156:                  }
 157:                  else
 158:                  {
 159:                      throw new Exception("Unknown board version: board.Bver: " + boardBver) { };
 160:                  }
 161:              }
 162:   
 163:              ////////////////////////////////////////////////////////////////////////////
 164:          }
 165:   
 166:          /// <summary/>
 167:          public Board() { }
 168:   
 169:          ////////////////////////////////////////////////////////////////////////////
 170:   
 171:          /// <summary>
 172:          ///
 173:          /// </summary>
 174:          public static string BoardId(int devId, int fn, int sn)
 175:          {
 176:              /*
 177:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
 178:               * FN    SN   PN   ONTID
 179:               * 
 180:               * Dev: did
 181:               * Board: FN SN
 182:               * Port: FN SN PN
 183:               * Ont: FN SN PN ONTID
 184:               * 
 185:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 186:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 187:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 188:               * /// 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. 
 189:               */
 190:   
 191:              string id;
 192:   
 193:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
 194:              {
 195:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
 196:              }
 197:              else
 198:              {
 199:                  throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
 200:              }
 201:   
 202:              return id;
 203:          }
 204:   
 205:          ////////////////////////////////////////////////////////////////////////////
 206:   
 207:          /// <summary>
 208:          ///
 209:          /// </summary>
 210:          public static Ia.Ngn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
 211:          {
 212:              Ia.Ngn.Cl.Model.Huawei.EmsBoard item;
 213:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
 214:   
 215:              if (sequentialEmsBoardQueue.Count == 0)
 216:              {
 217:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Board.List();
 218:   
 219:                  sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>(list.Shuffle());
 220:   
 221:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
 222:              }
 223:   
 224:              if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
 225:              else item = null;
 226:   
 227:              progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 228:   
 229:              sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
 230:   
 231:              return item;
 232:          }
 233:   
 234:          ////////////////////////////////////////////////////////////////////////////
 235:          ////////////////////////////////////////////////////////////////////////////
 236:      }
 237:   
 238:      ////////////////////////////////////////////////////////////////////////////
 239:      ////////////////////////////////////////////////////////////////////////////
 240:  }