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

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 Next Generation Network'a (NGN's) business model.

   1:  using System.Collections.Generic;
   2:   
   3:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   4:  {
   5:      ////////////////////////////////////////////////////////////////////////////
   6:   
   7:      /// <summary publish="true">
   8:      /// Huawei's Board support class of Next Generation Network'a (NGN's) business model.
   9:      /// </summary>
  10:      /// 
  11:      /// <remarks> 
  12:      /// Copyright © 2016-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  13:      ///
  14:      /// 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
  15:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  16:      ///
  17:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  18:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  19:      /// 
  20:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  21:      /// 
  22:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  23:      /// </remarks> 
  24:      public partial class Board
  25:      {
  26:          private static int sequentialEmsDevDevQueueOriginalCount;
  27:          private static Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard> sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>();
  28:   
  29:          ////////////////////////////////////////////////////////////////////////////
  30:   
  31:          /// <summary>
  32:          ///
  33:          /// </summary>
  34:          public class MduDevBoard
  35:          {
  36:              public string Type;
  37:              public string Version;
  38:              public int Fn;
  39:              public int Sn;
  40:              public int TelPortCount;
  41:              public int EthernetPortCount;
  42:   
  43:              ////////////////////////////////////////////////////////////////////////////
  44:   
  45:              /// <summary>
  46:              ///
  47:              /// </summary>
  48:              public MduDevBoard(string type, string boardBver, int fn, int sn)
  49:              {
  50:                  BoardVersionAndPotsAndEthernetFromBoardBver(boardBver, out string version, out int telPorts, out int ethernetPorts);
  51:   
  52:                  this.Type = type;
  53:                  this.Version = version;
  54:                  this.Fn = fn;
  55:                  this.Sn = sn;
  56:                  this.TelPortCount = telPorts;
  57:                  this.EthernetPortCount = ethernetPorts;
  58:              }
  59:   
  60:              ////////////////////////////////////////////////////////////////////////////
  61:   
  62:              /// <summary>
  63:              ///
  64:              /// </summary>
  65:              private void BoardVersionAndPotsAndEthernetFromBoardBver(string boardBver, out string boardVersion, out int telPorts, out int ethernetPort)
  66:              {
  67:                  if (boardBver.Contains("H838ASRB"))
  68:                  {
  69:                      boardVersion = "H838ASRB";
  70:                      telPorts = 32;
  71:                      ethernetPort = 8;
  72:                  }
  73:                  else if (boardBver.Contains("H838ASPB"))
  74:                  {
  75:                      boardVersion = "H838ASPB";
  76:                      telPorts = 64;
  77:                      ethernetPort = 8;
  78:                  }
  79:                  else if (boardBver.Contains("H848ASNB"))
  80:                  {
  81:                      boardVersion = "H848ASNB";
  82:                      telPorts = 32;
  83:                      ethernetPort = 8;
  84:                  }
  85:                  else
  86:                  {
  87:                      boardVersion = string.Empty;
  88:                      telPorts = ethernetPort = -1;
  89:                  }
  90:              }
  91:   
  92:              ////////////////////////////////////////////////////////////////////////////
  93:          }
  94:   
  95:          /// <summary/>
  96:          public Board() { }
  97:   
  98:          ////////////////////////////////////////////////////////////////////////////
  99:   
 100:          /// <summary>
 101:          ///
 102:          /// </summary>
 103:          public static string BoardId(int devId, int fn, int sn)
 104:          {
 105:              /*
 106:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
 107:               * FN    SN   PN   ONTID
 108:               * 
 109:               * Dev: did
 110:               * Board: FN SN
 111:               * Port: FN SN PN
 112:               * Ont: FN SN PN ONTID
 113:               * 
 114:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 115:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 116:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 117:               * /// 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. 
 118:               */
 119:   
 120:              string id;
 121:   
 122:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
 123:              {
 124:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
 125:              }
 126:              else
 127:              {
 128:                  throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
 129:              }
 130:   
 131:              return id;
 132:          }
 133:   
 134:          ////////////////////////////////////////////////////////////////////////////
 135:   
 136:          /// <summary>
 137:          ///
 138:          /// </summary>
 139:          public static Ia.Ngn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
 140:          {
 141:              Ia.Ngn.Cl.Model.Huawei.EmsBoard item;
 142:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
 143:   
 144:              if (sequentialEmsBoardQueue.Count == 0)
 145:              {
 146:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Board.List();
 147:   
 148:                  sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>(list.Shuffle());
 149:   
 150:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
 151:              }
 152:   
 153:              if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
 154:              else item = null;
 155:   
 156:              progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 157:   
 158:              sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
 159:   
 160:              return item;
 161:          }
 162:   
 163:          ////////////////////////////////////////////////////////////////////////////
 164:          ////////////////////////////////////////////////////////////////////////////
 165:      }
 166:   
 167:      ////////////////////////////////////////////////////////////////////////////
 168:      ////////////////////////////////////////////////////////////////////////////
 169:  }