Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
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.9.253", MgcSecondaryIp="10.10.13.253", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  74:              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 },
  75:              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 },
  76:              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 },
  77:          };
  78:   
  79:          public static string SipSubscriberRegistrationPassword { get { return sipSubscriberRegistrationPassword; } }
  80:   
  81:          ////////////////////////////////////////////////////////////////////////////
  82:   
  83:          /// <summary>
  84:          ///
  85:          /// </summary>
  86:          public Ims()
  87:          {
  88:          }
  89:   
  90:          ////////////////////////////////////////////////////////////////////////////
  91:   
  92:          /// <summary>
  93:          /// Return the IMS basic service for given MGC IP
  94:          /// </summary>
  95:          public static ImsBasicService ImsBasicServiceItem(string mgcIp)
  96:          {
  97:              ImsBasicService imsBasicService;
  98:   
  99:              imsBasicService = (from ibs in ImsBasicServiceList where ibs.MgcIp == mgcIp select ibs).Single();
 100:   
 101:              return imsBasicService;
 102:          }
 103:   
 104:          ////////////////////////////////////////////////////////////////////////////
 105:   
 106:          /// <summary>
 107:          ///
 108:          /// </summary>
 109:          public static string ServiceToReadServiceData
 110:          {
 111:              get
 112:              {
 113:                  int service;
 114:   
 115:                  if (allPossibleServiceWithinHuaweiSwitchArrayList == null || allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex == 0)
 116:                  {
 117:                      allPossibleServiceWithinHuaweiSwitchArrayList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinHuaweiSwitch;
 118:   
 119:                      // below: start at a random index in ArrayList
 120:                      allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex = 0; // Ia.Cl.Model.Default.Random(allPossibleServiceWithinHuaweiSwitchArrayList.Count - 1);
 121:                  }
 122:   
 123:                  service = allPossibleServiceWithinHuaweiSwitchArrayList[allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex];
 124:   
 125:                  allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex = Ia.Cl.Model.Default.IncrementListIndexOrRestart(allPossibleServiceWithinHuaweiSwitchArrayList, allPossibleServiceNumbersWithinHuaweiSwitchArrayListIndex);
 126:   
 127:                  return service.ToString();
 128:              }
 129:          }
 130:   
 131:          ////////////////////////////////////////////////////////////////////////////
 132:   
 133:          /// <summary>
 134:          ///
 135:          /// </summary>
 136:          public static void ReadSbrForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, out string result)
 137:          {
 138:              ReadSbrForService(client, service, null, out result);
 139:          }
 140:   
 141:          ////////////////////////////////////////////////////////////////////////////
 142:   
 143:          /// <summary>
 144:          ///
 145:          /// </summary>
 146:          public static void ReadSbrForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, out string result)
 147:          {
 148:              bool sbrUpdated, owSbrUpdated, serviceSbrUpdated, serviceOwSbrUpdated;//, serviceSuspensionState;
 149:              string impuSipDomain;//, messageId;
 150:              Ia.Cl.Model.Result result2;
 151:              Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode lstSbrResultCode, lstOwSbrResultCode;
 152:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 153:              Ia.Ngn.Cl.Model.Huawei.HuSbr sbr;
 154:   
 155:              //messageId = "1";
 156:   
 157:              result = "service: " + service + " ";
 158:   
 159:              sbr = client.LstSbr(service, out lstSbrResultCode);
 160:   
 161:              if (lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 162:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 163:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 164:              {
 165:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
 166:   
 167:                  sbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateSbr(impuSipDomain, lstSbrResultCode, ref sbr);
 168:                  serviceSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceForSbr(impuSipDomain, sbr, nddOnt);
 169:   
 170:                  owsbr = client.LstOwSbr(service, out lstOwSbrResultCode);
 171:   
 172:                  if (lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 173:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 174:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 175:                  {
 176:                      owSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateOwsbr(impuSipDomain, lstSbrResultCode, ref owsbr);
 177:                      serviceOwSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceServiceSuspensionForOwsbr(impuSipDomain, owsbr, out result2);
 178:   
 179:                      result += "sbr: " + lstSbrResultCode.ToString() + ", owsbr: " + lstOwSbrResultCode.ToString();
 180:                  }
 181:                  else
 182:                  {
 183:                      result += " error: owsbr: " + lstOwSbrResultCode.ToString();
 184:                  }
 185:              }
 186:              else
 187:              {
 188:                  result += " error: sbr: " + lstSbrResultCode.ToString();
 189:              }
 190:          }
 191:   
 192:          ////////////////////////////////////////////////////////////////////////////
 193:          ////////////////////////////////////////////////////////////////////////////
 194:      }
 195:   
 196:      ////////////////////////////////////////////////////////////////////////////
 197:      ////////////////////////////////////////////////////////////////////////////
 198:  }