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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ims

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

Optical Fiber Network Management Intranet Portal (OFN) support class for Huawei's Next Generation Network (NGN) business model

   1:  using System.Collections.Generic;
   2:  using System.Configuration;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Optical Fiber Network Management Intranet Portal (OFN) support class for Huawei's Next Generation Network (NGN) business model
  11:      /// </summary>
  12:      /// 
  13:      /// <value>
  14:      ///   <appSettings>
  15:      ///     <add key="imsHuaweiServerHost" value="https://*" />
  16:      ///     <add key="imsHuaweiServerPort" value="*" />
  17:      ///     <add key="imsHuaweiServerServiceUrl" value="*" />
  18:      ///     <add key="imsHuaweiServerUser" value="*" />
  19:      ///     <add key="imsHuaweiServerUserPassword" value="*" />
  20:      ///   </appSettings>
  21:      /// </value>
  22:      /// 
  23:      /// <remarks> 
  24:      /// Copyright © 2014-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  25:      ///
  26:      /// 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
  27:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  28:      ///
  29:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  30:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  31:      /// 
  32:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  33:      /// 
  34:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  35:      /// </remarks> 
  36:      public class Ims
  37:      {
  38:          private static int allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex;
  39:          //private static int serviceRequestServiceServiceOfUnmatchedServicesListIndex;
  40:          private const string sipSubscriberRegistrationPassword = "admin"; // as per Huawei spec
  41:   
  42:          private static List<int> allPossibleServiceWithinHuaweiSwitchArrayList;
  43:   
  44:          /// <summary/>
  45:          public static string BaseAddress { get { return ConfigurationManager.AppSettings["imsHuaweiServerHost"].ToString() + ":" + ConfigurationManager.AppSettings["imsHuaweiServerPort"].ToString(); } }
  46:          /// <summary/>
  47:          public static string ServiceUrl { get { return ConfigurationManager.AppSettings["imsHuaweiServerServiceUrl"].ToString(); } }
  48:          /// <summary/>
  49:          public static string UserName { get { return ConfigurationManager.AppSettings["imsHuaweiServerUser"].ToString(); } }
  50:          /// <summary/>
  51:          public static string Password { get { return ConfigurationManager.AppSettings["imsHuaweiServerUserPassword"].ToString(); } }
  52:   
  53:          public class ImsBasicService
  54:          {
  55:              public string MgcIp;
  56:              public string MgcSecondaryIp;
  57:              public string MgcSubnetMask;
  58:              public int Service;
  59:              public string Fsdb;
  60:              public string PrimarySwitch;
  61:          }
  62:   
  63:          public static ImsBasicService[] ImsBasicServiceList =
  64:              {
  65:              new ImsBasicService { MgcIp="10.10.9.10", MgcSecondaryIp="10.10.13.10", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  66:              new ImsBasicService { MgcIp="10.10.13.10", MgcSecondaryIp="10.10.9.10", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  67:              new ImsBasicService { MgcIp="10.10.9.253", MgcSecondaryIp="10.10.13.253", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  68:              new ImsBasicService { MgcIp="10.10.9.254", MgcSecondaryIp="10.10.13.254", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  69:              new ImsBasicService { MgcIp="10.133.0.1", MgcSecondaryIp="10.133.13.1", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  70:              new ImsBasicService { MgcIp="10.16.5.142", MgcSecondaryIp="10.16.0.142", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  71:          };
  72:   
  73:          public static string SipSubscriberRegistrationPassword { get { return sipSubscriberRegistrationPassword; } }
  74:   
  75:          ////////////////////////////////////////////////////////////////////////////
  76:   
  77:          /// <summary>
  78:          ///
  79:          /// </summary>
  80:          public Ims()
  81:          {
  82:          }
  83:   
  84:          ////////////////////////////////////////////////////////////////////////////
  85:   
  86:          /// <summary>
  87:          /// Return the IMS basic service for given MGC IP
  88:          /// </summary>
  89:          public static ImsBasicService ImsBasicServiceItem(string mgcIp)
  90:          {
  91:              ImsBasicService imsBasicService;
  92:   
  93:              imsBasicService = (from ibs in ImsBasicServiceList where ibs.MgcIp == mgcIp select ibs).Single();
  94:   
  95:              return imsBasicService;
  96:          }
  97:   
  98:          ////////////////////////////////////////////////////////////////////////////
  99:   
 100:          /// <summary>
 101:          ///
 102:          /// </summary>
 103:          public static string ServiceToReadServiceData
 104:          {
 105:              get
 106:              {
 107:                  int service;
 108:   
 109:                  if (allPossibleServiceWithinHuaweiSwitchArrayList == null || allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex == 0)
 110:                  {
 111:                      allPossibleServiceWithinHuaweiSwitchArrayList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinHuaweiSwitch;
 112:   
 113:                      // below: start at a random index in ArrayList
 114:                      allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex = 0; // Ia.Cl.Model.Default.Random(allPossibleServiceWithinHuaweiSwitchArrayList.Count - 1);
 115:                  }
 116:   
 117:                  service = allPossibleServiceWithinHuaweiSwitchArrayList[allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex];
 118:   
 119:                  allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex = Ia.Cl.Model.Default.IncrementListIndexOrRestart(allPossibleServiceWithinHuaweiSwitchArrayList, allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex);
 120:   
 121:                  return service.ToString();
 122:              }
 123:          }
 124:   
 125:          ////////////////////////////////////////////////////////////////////////////
 126:   
 127:          /// <summary>
 128:          ///
 129:          /// </summary>
 130:          public static void ReadSbrForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, out string result)
 131:          {
 132:              ReadUpdateSbrAndServiceForService(client, service, null, out result);
 133:          }
 134:   
 135:          ////////////////////////////////////////////////////////////////////////////
 136:   
 137:          /// <summary>
 138:          ///
 139:          /// </summary>
 140:          public static void ReadUpdateSbrAndServiceForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, out string result)
 141:          {
 142:              bool sbrUpdated, owSbrUpdated, serviceSbrUpdated, serviceOwSbrUpdated;
 143:              string impuSipDomain;
 144:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 145:              Ia.Ngn.Cl.Model.Huawei.HuSbr sbr;
 146:   
 147:              result = "service: " + service + " ";
 148:   
 149:              sbr = client.LstSbr(service, out Client.Huawei.Ims.ResultCode lstSbrResultCode);
 150:   
 151:              if (lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 152:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 153:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 154:              {
 155:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
 156:   
 157:                  sbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateSbr(impuSipDomain, lstSbrResultCode, ref sbr);
 158:                  serviceSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceForSbr(impuSipDomain, sbr, nddOnt);
 159:   
 160:                  owsbr = client.LstOwSbr(service, out Client.Huawei.Ims.ResultCode lstOwSbrResultCode);
 161:   
 162:                  if (lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 163:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 164:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 165:                  {
 166:                      owSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateOwsbr(impuSipDomain, lstSbrResultCode, ref owsbr);
 167:                      serviceOwSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceServiceSuspensionForOwsbr(impuSipDomain, owsbr, out Ia.Cl.Model.Result result2);
 168:   
 169:                      result += "sbr: " + lstSbrResultCode.ToString() + ", owsbr: " + lstOwSbrResultCode.ToString();
 170:                  }
 171:                  else
 172:                  {
 173:                      result += " error: owsbr: " + lstOwSbrResultCode.ToString();
 174:                  }
 175:              }
 176:              else
 177:              {
 178:                  result += " error: sbr: " + lstSbrResultCode.ToString();
 179:              }
 180:          }
 181:   
 182:          ////////////////////////////////////////////////////////////////////////////
 183:          ////////////////////////////////////////////////////////////////////////////
 184:      }
 185:   
 186:      ////////////////////////////////////////////////////////////////////////////
 187:      ////////////////////////////////////////////////////////////////////////////
 188:  }