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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Port

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

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

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.Text.RegularExpressions;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Huawei's Port support class of Next Generation Network'a (NGN's) business model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2016-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  18:      ///
  19:      /// 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
  20:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  21:      ///
  22:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  23:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  24:      /// 
  25:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  26:      /// 
  27:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  28:      /// </remarks> 
  29:      public partial class Port
  30:      {
  31:          /// <summary/>
  32:          public Port() { }
  33:   
  34:          ////////////////////////////////////////////////////////////////////////////
  35:   
  36:          /// <summary>
  37:          ///
  38:          /// </summary>
  39:          public static string PortId(int devId, int fn, int sn, int pn)
  40:          {
  41:              /*
  42:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  43:               * FN    SN   PN   ONTID
  44:               * 
  45:               * Dev: did
  46:               * Board: FN SN
  47:               * Port: FN SN PN
  48:               * Ont: FN SN PN ONTID
  49:               * 
  50:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
  51:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
  52:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
  53:               * /// 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. 
  54:               */
  55:   
  56:              string id;
  57:   
  58:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35 && pn >= 0 && pn <= 63)
  59:              {
  60:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0') + pn.ToString().PadLeft(2, '0');
  61:              }
  62:              else
  63:              {
  64:                  throw new System.ArgumentOutOfRangeException("fn, sn, pn", "fn, sn, or pn is out of range");
  65:              }
  66:   
  67:              return id;
  68:          }
  69:   
  70:          ////////////////////////////////////////////////////////////////////////////
  71:   
  72:          /// <summary>
  73:          ///
  74:          /// </summary>
  75:          public static string PortId(string boardId, int pn)
  76:          {
  77:              string id;
  78:   
  79:              if (boardId.Length > 0 && pn >= 0 && pn <= 63)
  80:              {
  81:                  id = boardId + pn.ToString().PadLeft(2, '0');
  82:              }
  83:              else
  84:              {
  85:                  throw new System.ArgumentOutOfRangeException("pn", "pn is out of range");
  86:              }
  87:   
  88:              return id;
  89:          }
  90:   
  91:          ////////////////////////////////////////////////////////////////////////////
  92:          ////////////////////////////////////////////////////////////////////////////
  93:      }
  94:   
  95:      ////////////////////////////////////////////////////////////////////////////
  96:      ////////////////////////////////////////////////////////////////////////////
  97:  }