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

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