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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Dev

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

Huawei's Dev support class of Next Generation Network'a (NGN's) business model.

   1:  using System.Collections.Generic;
   2:  using System.Linq;
   3:   
   4:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   5:  {
   6:      ////////////////////////////////////////////////////////////////////////////
   7:   
   8:      /// <summary publish="true">
   9:      /// Huawei's Dev support class of Next Generation Network'a (NGN's) business model.
  10:      /// </summary>
  11:      /// 
  12:      /// <remarks> 
  13:      /// Copyright © 2016-2018 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 partial class Dev
  26:      {
  27:          private static int sequentialEmsDevDevQueueOriginalCount;
  28:          private static Queue<Ia.Ngn.Cl.Model.Huawei.EmsDev> sequentialEmsDevDevQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsDev>();
  29:   
  30:          ////////////////////////////////////////////////////////////////////////////
  31:   
  32:          /// <summary>
  33:          ///
  34:          /// </summary>
  35:          public class MduDev
  36:          {
  37:              public int Did;
  38:              public string Dev;
  39:              public string DevType;
  40:              public string DevIp;
  41:              public string AccessName;
  42:              public string NddOntId;
  43:   
  44:              public List<Ia.Ngn.Cl.Model.Business.Huawei.Board.MduDevBoard> MduDevBoardList;
  45:   
  46:              ////////////////////////////////////////////////////////////////////////////
  47:   
  48:              /// <summary>
  49:              ///
  50:              /// </summary>
  51:              public MduDev(int did)
  52:              {
  53:                  string dev, accessName, s;
  54:   
  55:                  var didToDevDictionary = Ia.Ngn.Cl.Model.Data.Huawei.Dev.DidToDevDictionary;
  56:   
  57:                  var ontAccessNameToOntIdDictionary = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntAccessNameToOntIdDictionary;
  58:   
  59:                  if (didToDevDictionary.ContainsKey(did))
  60:                  {
  61:                      dev = didToDevDictionary[did];
  62:                      s = Ia.Ngn.Cl.Model.Business.Huawei.Ems.HuaweiAccessNameFormatFromInaccurateHuaweiFileAndEmsNameFormat(dev);
  63:                      accessName = Ia.Ngn.Cl.Model.Business.Default.StandardizeAccessNameInLegalFormatFromValue(s);
  64:   
  65:                      this.Did = did;
  66:                      this.Dev = dev;
  67:   
  68:                      this.AccessName = accessName;
  69:   
  70:                      if (ontAccessNameToOntIdDictionary.ContainsKey(accessName))
  71:                      {
  72:                          this.NddOntId = ontAccessNameToOntIdDictionary[accessName];
  73:                      }
  74:                      else this.NddOntId = string.Empty;
  75:                  }
  76:                  else
  77:                  {
  78:                      //throw new System.Exception("DidToDevDictionary does not contain did key: " + did);
  79:                  }
  80:              }
  81:   
  82:              ////////////////////////////////////////////////////////////////////////////
  83:   
  84:              /// <summary>
  85:              /// 
  86:              /// </summary>
  87:              public int TelPortCount
  88:              {
  89:                  get
  90:                  {
  91:                      return this.MduDevBoardList.Select(i => i.TelPortCount).Sum();
  92:                  }
  93:              }
  94:   
  95:              ////////////////////////////////////////////////////////////////////////////
  96:   
  97:              /// <summary>
  98:              /// 
  99:              /// </summary>
 100:              public int EthernetPortCount
 101:              {
 102:                  get
 103:                  {
 104:                      return this.MduDevBoardList.Select(i => i.EthernetPortCount).Sum();
 105:                  }
 106:              }
 107:   
 108:              ////////////////////////////////////////////////////////////////////////////
 109:   
 110:              /// <summary>
 111:              /// 
 112:              /// </summary>
 113:              public List<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn> PossibleFnSnPnList
 114:              {
 115:                  get
 116:                  {
 117:                      return Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleFnSnPnForMduDevList(this);
 118:                  }
 119:              }
 120:   
 121:              ////////////////////////////////////////////////////////////////////////////
 122:   
 123:              /// <summary>
 124:              /// 
 125:              /// </summary>
 126:              public Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn FirstFnSnPn
 127:              {
 128:                  get
 129:                  {
 130:                      return Ia.Ngn.Cl.Model.Business.Huawei.Ems.FirstFnSnPnForMduDevList(this);
 131:                  }
 132:              }
 133:   
 134:              ////////////////////////////////////////////////////////////////////////////
 135:   
 136:              /// <summary>
 137:              ///
 138:              /// </summary>
 139:              public override string ToString()
 140:              {
 141:                  string line;
 142:   
 143:                  line = "Dev: " + this.Dev + ", AccessName: " + this.AccessName;
 144:   
 145:                  return line;
 146:              }
 147:   
 148:              ////////////////////////////////////////////////////////////////////////////
 149:              ////////////////////////////////////////////////////////////////////////////
 150:          }
 151:   
 152:          /// <summary/>
 153:          public Dev() { }
 154:   
 155:          ////////////////////////////////////////////////////////////////////////////
 156:   
 157:          /// <summary>
 158:          ///
 159:          /// </summary>
 160:          public static int DevId(int did)
 161:          {
 162:              /*
 163:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
 164:               * FN    SN   PN   ONTID
 165:               * 
 166:               * Dev: did
 167:               * Board: FN SN
 168:               * Port: FN SN PN
 169:               * Ont: FN SN PN ONTID
 170:               * 
 171:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 172:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 173:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 174:               * /// 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. 
 175:               */
 176:   
 177:              int id;
 178:   
 179:              id = did;
 180:   
 181:              return id;
 182:          }
 183:   
 184:          ////////////////////////////////////////////////////////////////////////////
 185:   
 186:          /// <summary>
 187:          ///
 188:          /// </summary>
 189:          public static Ia.Ngn.Cl.Model.Huawei.EmsDev SequentialEmsDevListItem(out int sequentialEmsDevDevQueueCount, out string progressCounterString)
 190:          {
 191:              Ia.Ngn.Cl.Model.Huawei.EmsDev item;
 192:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
 193:   
 194:              if (sequentialEmsDevDevQueue.Count == 0)
 195:              {
 196:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Dev.List();
 197:                  //list = Ia.Ngn.Cl.Model.Data.Huawei.Default.AccessListBy5616Or5878OntEquipmentId();
 198:   
 199:                  sequentialEmsDevDevQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsDev>(list.Shuffle());
 200:   
 201:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsDevDevQueue.Count;
 202:              }
 203:   
 204:              if (sequentialEmsDevDevQueue.Count > 0) item = sequentialEmsDevDevQueue.Dequeue();
 205:              else item = null;
 206:   
 207:              progressCounterString = "(" + sequentialEmsDevDevQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 208:   
 209:              sequentialEmsDevDevQueueCount = sequentialEmsDevDevQueue.Count;
 210:   
 211:              return item;
 212:          }
 213:   
 214:          ////////////////////////////////////////////////////////////////////////////
 215:          ////////////////////////////////////////////////////////////////////////////
 216:      }
 217:   
 218:      ////////////////////////////////////////////////////////////////////////////
 219:      ////////////////////////////////////////////////////////////////////////////
 220:  }