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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ont

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

ONT support class of Next Generation Network'a (NGN's) Nokia business model.

   1:  using System.Collections.Generic;
   2:  using System.Linq;
   3:  using System.Text.RegularExpressions;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Business.Nokia
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// ONT support class of Next Generation Network'a (NGN's) Nokia business model.
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2006-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// 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
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public partial class Ont
  27:      {
  28:          /// <summary/>
  29:          public class EquipmentType
  30:          {
  31:              public string Name;
  32:              public string Model;
  33:              public int TelPorts;
  34:              public int EthernetPorts;
  35:              public Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyType;
  36:   
  37:              public EquipmentType() { }
  38:          }
  39:   
  40:          /// <summary/>
  41:          public static EquipmentType[] EquipmentTypeList =
  42:              {
  43:              new EquipmentType { Name = "BVM4X00DRAO821GD", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined, EthernetPorts = 0, TelPorts = 0 },
  44:              new EquipmentType { Name = "RVM3G00CRAO420EB", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined, EthernetPorts = 0, TelPorts = 0 },
  45:              new EquipmentType { Name = "VAMZS10BRAG440GA", Model = "G-440G-A", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Gfu, EthernetPorts = 4, TelPorts = 4 },
  46:              new EquipmentType { Name = "BVMDM00CRBG881GA", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined, EthernetPorts = 0, TelPorts = 0 },
  47:              new EquipmentType { Name = "BVM5J00CRAO820GD", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined, EthernetPorts = 0, TelPorts = 0 },
  48:              new EquipmentType { Name = "BVM4310DRAO420EB", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Mdu, EthernetPorts = 12, TelPorts = 24 },
  49:              new EquipmentType { Name = "BVM3G00CRAO420EB", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Sfu, EthernetPorts = 2, TelPorts = 4 },
  50:              new EquipmentType { Name = "BVM5F00CRAO24120", Model = "", FamilyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined, EthernetPorts = 0, TelPorts = 0 },
  51:          };
  52:   
  53:          /*
  54:  select count(EquipmentId) as Count, substring(ActiveSoftware, 1, 6) as ActiveSoftware from Onts where EquipmentId is not null group by substring([ActiveSoftware], 1, 6)
  55:  
  56:  Count    ActiveSoftware
  57:  160    3FE514
  58:  1    3FE556
  59:  4    3FE511
  60:  26705    3FE508
  61:  1    3FE559
  62:  2    3FE563         
  63:           */
  64:   
  65:          /*
  66:  select count(EquipmentId) as Count, '[' + EquipmentId + ']' as EquipmentId from Onts where EquipmentId is not null group by EquipmentId
  67:  
  68:  1    [BVM4X00DRAO821GD]
  69:  2    [RVM3G00CRAO420EB]
  70:  3    [VAMZS10BRAG440GA]
  71:  1    [BVMDM00CRBG881GA]
  72:  3    [BVM5J00CRAO820GD]
  73:  2893    [BVM4310DRAO420EB]
  74:  0    NULL
  75:  23810    [BVM3G00CRAO420EB]
  76:  160    [BVM5F00CRAO24120]
  77:          */
  78:   
  79:          /// <summary/>
  80:          public enum FamilyType { Undefined = 0, Sfu = 1, Soho = 2, Mdu = 3, Gfu = 4 };
  81:   
  82:          /// <summary/>
  83:          public Ont() { }
  84:   
  85:          ////////////////////////////////////////////////////////////////////////////
  86:   
  87:          /// <summary>
  88:          ///
  89:          /// </summary>
  90:          public static string OntId(string ponId, int ontNumber)
  91:          {
  92:              string id;
  93:   
  94:              id = Ia.Ngn.Cl.Model.Business.Default.OntId(ponId, ontNumber);
  95:   
  96:              return id;
  97:          }
  98:   
  99:          ////////////////////////////////////////////////////////////////////////////
 100:   
 101:          /// <summary>
 102:          ///
 103:          /// </summary>
 104:          public static string OntId(string amsName, string cardPortOntSequence)
 105:          {
 106:              string id;
 107:              string ontPosition;
 108:   
 109:              ontPosition = Ia.Ngn.Cl.Model.Business.Nokia.Ams.OntPositionFromAmsNameAndCardPortOntSquence(amsName, cardPortOntSequence);
 110:   
 111:              id = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Position == ontPosition select o.Id).SingleOrDefault();
 112:   
 113:              return id;
 114:          }
 115:   
 116:          ////////////////////////////////////////////////////////////////////////////
 117:   
 118:          /// <summary>
 119:          ///
 120:          /// </summary>
 121:          public static Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType EquipmentTypeFromActiveSoftware(string activeSoftware)
 122:          {
 123:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType equipmentType;
 124:   
 125:              equipmentType = null;
 126:   
 127:              return equipmentType;
 128:          }
 129:   
 130:          ////////////////////////////////////////////////////////////////////////////
 131:   
 132:          /// <summary>
 133:          /// Return the ONT family type id from the software version
 134:          /// </summary>
 135:          public static Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyTypeIdFromActiveSoftwareAndPlannedSoftware(string activeSoftware, string plannedSoftware)
 136:          {
 137:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
 138:   
 139:              if (activeSoftware != null)
 140:              {
 141:                  if (activeSoftware == plannedSoftware || plannedSoftware == "auto" || plannedSoftware == "AUTO")
 142:                  {
 143:                      if (activeSoftware.StartsWith("3FE508")) familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Sfu;
 144:                      else if (activeSoftware.StartsWith("3FE563")) familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Gfu;
 145:                      else if (activeSoftware.StartsWith("3FE511")) familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Soho;
 146:                      else if (activeSoftware.StartsWith("3FE514")) familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Mdu;
 147:                      else familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined;
 148:                  }
 149:                  else familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined;
 150:              }
 151:              else familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined;
 152:   
 153:              return familyType;
 154:          }
 155:   
 156:          ////////////////////////////////////////////////////////////////////////////
 157:   
 158:          /// <summary>
 159:          /// 
 160:          /// </summary>
 161:          public static Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyTypeFromString(string familyTypeString)
 162:          {
 163:              // this will convert string format of ONU type from both email submittals and from EMSONT EQUIPMENTID values from NCE
 164:   
 165:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
 166:   
 167:              if (!string.IsNullOrEmpty(familyTypeString))
 168:              {
 169:                  switch (familyTypeString.ToUpper())
 170:                  {
 171:                      case "SFU": familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Sfu; break;
 172:                      case "GFU": familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Gfu; break;
 173:                      case "SOHO": familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Soho; break;
 174:                      case "MDU": familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Mdu; break;
 175:   
 176:                      default: familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined; break;
 177:                  }
 178:              }
 179:              else familyType = 0;
 180:   
 181:              return familyType; // Undefined
 182:          }
 183:   
 184:          ////////////////////////////////////////////////////////////////////////////
 185:   
 186:          /// <summary>
 187:          /// 
 188:          /// </summary>
 189:          public static string FamilyTypeStringFromFamilyTypeId(int familyTypeId)
 190:          {
 191:              string familyTypeString;
 192:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
 193:   
 194:              familyType = (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)familyTypeId;
 195:   
 196:              switch (familyType)
 197:              {
 198:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Sfu: familyTypeString = "SFU"; break;
 199:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Gfu: familyTypeString = "GFU"; break;
 200:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Soho: familyTypeString = "SOHO"; break;
 201:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Mdu: familyTypeString = "MDU"; break;
 202:                  default: familyTypeString = string.Empty; break;
 203:              }
 204:   
 205:              return familyTypeString;
 206:          }
 207:   
 208:          ////////////////////////////////////////////////////////////////////////////
 209:   
 210:          /// <summary>
 211:          ///
 212:          /// </summary>
 213:          public static string OntPositionFromOntId(string ontId)
 214:          {
 215:              string rest, ontPosition, amsName;
 216:              int oltId, card, port, ont;
 217:   
 218:              oltId = int.Parse(ontId.Substring(0, 1 + 2 + 2 + 2 + 2)); // network id, site id, router id, odf id, olt id
 219:   
 220:              rest = Regex.Replace(ontId, "^" + oltId.ToString(), "");
 221:   
 222:              card = int.Parse(rest.Substring(4, 2));
 223:              port = int.Parse(rest.Substring(6, 2));
 224:              ont = int.Parse(rest.Substring(8, 2));
 225:   
 226:              amsName = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AmsNameFromOltId(oltId);
 227:   
 228:              ontPosition = amsName + "-" + card + "-" + port + "-" + ont;
 229:   
 230:              return ontPosition;
 231:          }
 232:   
 233:          ////////////////////////////////////////////////////////////////////////////
 234:   
 235:          /// <summary>
 236:          ///
 237:          /// </summary>
 238:          public static bool IsValidSerialNumber(string serialNumber)
 239:          {
 240:              bool isValid;
 241:              string s;
 242:   
 243:              if (!string.IsNullOrEmpty(serialNumber))
 244:              {
 245:                  if (serialNumber.Length == 12) // ALCLA0A23C74
 246:                  {
 247:                      s = serialNumber.ToUpper();
 248:   
 249:                      if (s.Substring(0, 7) == "ALCLA0A")
 250:                      {
 251:                          s = s.Substring(4, 8);
 252:   
 253:                          isValid = Ia.Cl.Model.Default.IsHex(s);
 254:                      }
 255:                      else isValid = false;
 256:                  }
 257:                  else isValid = false;
 258:              }
 259:              else isValid = false;
 260:   
 261:              return isValid;
 262:          }
 263:   
 264:          ////////////////////////////////////////////////////////////////////////////
 265:          ////////////////////////////////////////////////////////////////////////////
 266:      }
 267:   
 268:      ////////////////////////////////////////////////////////////////////////////
 269:      ////////////////////////////////////////////////////////////////////////////
 270:  }