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

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 List<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn> PossibleFnSnPnList
 101:              {
 102:                  get
 103:                  {
 104:                      return Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleFnSnPnForMduDevList(this);
 105:                  }
 106:              }
 107:   
 108:              ////////////////////////////////////////////////////////////////////////////
 109:   
 110:              /// <summary>
 111:              /// 
 112:              /// </summary>
 113:              public Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn FirstFnSnPn
 114:              {
 115:                  get
 116:                  {
 117:                      return Ia.Ngn.Cl.Model.Business.Huawei.Ems.FirstFnSnPnForMduDevList(this);
 118:                  }
 119:              }
 120:   
 121:              ////////////////////////////////////////////////////////////////////////////
 122:   
 123:              /// <summary>
 124:              ///
 125:              /// </summary>
 126:              public override string ToString()
 127:              {
 128:                  string line;
 129:   
 130:                  line = "Dev: " + this.Dev + ", AccessName: " + this.AccessName;
 131:   
 132:                  return line;
 133:              }
 134:   
 135:              ////////////////////////////////////////////////////////////////////////////
 136:              ////////////////////////////////////////////////////////////////////////////
 137:          }
 138:   
 139:          /// <summary/>
 140:          public Dev() { }
 141:   
 142:          ////////////////////////////////////////////////////////////////////////////
 143:   
 144:          /// <summary>
 145:          ///
 146:          /// </summary>
 147:          public static int DevId(int did)
 148:          {
 149:              /*
 150:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
 151:               * FN    SN   PN   ONTID
 152:               * 
 153:               * Dev: did
 154:               * Board: FN SN
 155:               * Port: FN SN PN
 156:               * Ont: FN SN PN ONTID
 157:               * 
 158:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 159:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 160:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 161:               * /// 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. 
 162:               */
 163:   
 164:              int id;
 165:   
 166:              id = did;
 167:   
 168:              return id;
 169:          }
 170:   
 171:          ////////////////////////////////////////////////////////////////////////////
 172:   
 173:          /// <summary>
 174:          ///
 175:          /// </summary>
 176:          public static Ia.Ngn.Cl.Model.Huawei.EmsDev SequentialEmsDevListItem(out int sequentialEmsDevDevQueueCount, out string progressCounterString)
 177:          {
 178:              Ia.Ngn.Cl.Model.Huawei.EmsDev item;
 179:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
 180:   
 181:              if (sequentialEmsDevDevQueue.Count == 0)
 182:              {
 183:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Dev.List();
 184:                  //list = Ia.Ngn.Cl.Model.Data.Huawei.Default.AccessListBy5616Or5878OntEquipmentId();
 185:   
 186:                  sequentialEmsDevDevQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsDev>(list.Shuffle());
 187:   
 188:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsDevDevQueue.Count;
 189:              }
 190:   
 191:              if (sequentialEmsDevDevQueue.Count > 0) item = sequentialEmsDevDevQueue.Dequeue();
 192:              else item = null;
 193:   
 194:              progressCounterString = "(" + sequentialEmsDevDevQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 195:   
 196:              sequentialEmsDevDevQueueCount = sequentialEmsDevDevQueue.Count;
 197:   
 198:              return item;
 199:          }
 200:   
 201:          ////////////////////////////////////////////////////////////////////////////
 202:          ////////////////////////////////////////////////////////////////////////////
 203:      }
 204:   
 205:      ////////////////////////////////////////////////////////////////////////////
 206:      ////////////////////////////////////////////////////////////////////////////
 207:  }