Wednesday, November 19, 2014

Implementing new service (CDMA) - Text format

There are a few services that are supported out of the box in BRM. These services include GSM, GPRS, IP et.c. To support  new service in BRM, lot of customization is required. This is specified in the BRM documentation,  but spread in lots of areas so it becomes pretty difficult to take help of the BRM doc to implement a new service. Here are some of the steps /guidelines to priovide support for a new service in BRM. In this context we have used CDMA service implementation.

1]. Create or extend /service storable class e.g. /service/telco/cdma
2]. Create or extend the /event class for the delayed events (if the rating is to be done by batch pipeline) e.g. /event/delayed/session/telco/cdma
3]. Map /event/delayed/session/telco/cdma event to /service/telco/cdma
     a). Edit BRM_HOME/sys/data/pricing/example/pin_event_map file
        Caution The load_event_map utility overwrites the existing event map. If you are updating the event map, you can not load new mappings only.You must load the entire event map each time you run load_event_map utility. 
If you want to load gsm events also then you should edit BRM_HOME/sys/data/config/pin_event_map_telco_gsm file

     b). Add the service - event mapping
     /service/telco/cdma : /event/delayed/session/telco/cdma : Delayed CDMA session

     c). Load the configuration to the /config/event_map using the utility load_pin_event_map
       $> load_pin_event_map -dv pin_event_map_telco_gsm

4]. Defining RUMs for new service usage events
   RUMs(Ratable Usage Metrics) are used to charge for the events. To define new RUMs(RUMs which are not already defined) for the new service, following steps should be performaed:
  a). Define new RUMs in the pin_rum configuration file
  b). Load the contents of the pin_rum file to /config/rum object by using the load_pin_rum utility

5]. Load item tags : If you want to add new/custom tag to use in the invoice/bill, you need to edit config_item_types.xml and config_item_tags.xml. In this example, we have created a new tag for CDMA service
  a). Add the new tag element in the BRM_HOME/sys/data/pricing/example/config_item_tags.xml

   <ItemTagElement>
       <ItemTag>CDMA_Telephony</ItemTag>
       <EventType>/event/delayed/session/telco/cdma</EventType>
       <ServiceType>/service/telco/cdma/*</ServiceType>
   </ItemTagElement>

  b). Load tags using load_config_item_tags
      $>. load_config_item_tags -dv config_item_tags.xml

  c). Add the item tag configuration in the config_item_types.xml

    <ItemTypeElement>
        <ItemTag>CDMA_Telephony</ItemTag>
        <ItemDescription>CDMA Telephony</ItemDescription>
        <ItemType precreate="true" type="cumulative">/item/misc</ItemType>
    </ItemTypeElement>

  d). Load using load_config_item_types
      $>. load_config_item_types -dv config_item_types.xml

 Define the new service and service class

   1). Add new service using the pipeline setup toolbox in pricing centre

     a.  Open "Pipeline Setup Tool Box" from pricing centre
     b.  Click on Product&Service
     c.  Click on Service. Make a new service
     d.  Give below entries on "Service" page:                
               

Service CodeCDMAT
NameCDMA Telephony Service
Rank1
Type of ServiceBasic(choose from drop down)
Ratable Usage Metric GroupDURATION-Duration (choose from drop down)
General Ledger Account1420-National Airtime telephony
Revenue GroupBlank
Parent ServiceBlank
BasicClick the check box
PIN Service Type/service/telco/cdma/telephony
History

       
     e.  Give below entries on "Service Class" page
           
Service CodeService ClassNameHistory
CDMAT-CDMA  Telephony Service DEFDefault Service Class for CDMA TEL 


  2. Add reference mapping
     a. Open "Pipeline Setup Toolbox" from pricing centre
     b. Click on reference mapping
     c. Click on Product & Service
     d. Enter the following entries on "Reference Mapping" page


IDCustomerData
Referenced Object/service/telco/cdma/telephony
Referenced ColumnBlank
Referenced Parameter/event/delayed/session/telco/cdma
History




  3. Map service code
     a. Open "Pipeline Setup Toolbox" from pricing centre
     b. Click on Mapping & Enhancement
     c. Click on Map group
     d. Map group looks like :


Map GroupNameHistory
ALL_RATEWireless Sample Mapping
INCOLLECTIncollect Settlement Pipeline Mapping
OUTCOLLECTIncollect Settlement Pipeline Mapping


    e. Click on ALL_RATE and edit
    f. Goto to Service Code Map and create new with the following details


Map GroupALL_RATE-Wireless Sample Mapping
NameTelephony service for CDMA
External Service CodeCDMA.*
Usage Class.*
Location Area Indicator VAS-Event.*
Quality of Service Requested.*
Quality of Service Used.*
Record Type.*
Intern Service CodeCDMAT-CDMA Telephony Service
Intern Service ClassDEF
History


Note : Make sure that in the Service Code Map, new service map should come before default service(i.e, service map with name Everything else…)

  4. Add container field for the new service
     a. Open "Pipeline Setup Toolbox" from pricing centre
     b. Click on EDR
     c. Click on EDR Container Description. This page will look like as :

EDR Container DescriptionNameHistory
ALL_RATEWIRELESS_SAMPLE contanier description
EXAMPLEExmaple container description


    d. Select ALL_RATE and edit. This will open EDR Conatiner Description with three tabs
         i. EDR Container Description
        ii. EDR Container Field
       iii. Alias Mapping
    e. Select Alias Mapping and create new Alias Mapping with the following details :


EDR Container DescriptionALL_RATE - WIRELESS_SAMPLE conatiner description
ReferenceUniData_CustA
KeyCDMAT
TypeInternal(choose from drop down)
Field IDDETAIL.A_NUMBER



Configuring Pipeline Manager to rate the events of the new service

 1. Configure the IRL_EventTypeSplitting iScript to split EDRs by service code: Add
     CDMAT:CDMAOutput
     as the last line in the PIPELINE_HOME/iScriptLib/iScriptLib_Standard/IRL_EventTypeSplitting.data

  2. Edit wireless.reg to redirect output for CDMA, add the following piece of code/configuration

#---------------------------------------- 
#The /service/cdma/telephony output stream 
#---------------------------------------- 
CDMAOutput 

   ModuleName = OUT_GenericStream 
   ProcessType = RATING_PIPELINE 
   EventType = /event/delayed/session/telco/cdma 
 
   Module
   {
     Grammar = ./formatDesc/Formats/Solution42/V670_EVENT_LOADER_OutGrammar.dsc
     DeleteEmptyStream = True 
     OutputStream
      {
        ModuleName = EXT_OutFileManager
        Module
        {
          OutputPath = ./data/out/cdma/telephony
          OutputPrefix = test_CDMA
          OutputSuffix = .out
          TempPrefix = .
          TempDataPath = ./data/out/cdma/telephony
          TemDataPrefix = cdma.tmp.
          TempDataSuffix = .data
          Replace = TRUE
        }
     }
   }
}# end of TELOutput 
 
 
CONV_CDMAOutput 

   ModuleName = OUT_GenericStream 
   ProcessType = RATING_PIPELINE 
   EventType = /event/delayed/session/telco/cdma 
   ObjectCacheType = CONVERGENT 
   Module
   {
     Grammar = ./formatDesc/Formats/Solution42/V670_EVENT_LOADER_OutGrammar.dsc
     DeleteEmptyStream = True 
     OutputStream
     {
         ModuleName = EXT_OutFileManager
         Module
         {
            OutputPath = ./data/out/cdma/telephony
            OutputPrefix = test_CDMA
            OutputSuffix = .out
            TempPrefix = .
            TempDataPath = ./data/out/cdma/telephony
            TemDataPrefix = cdma.tmp.
            TempDataSuffix = .data
            Replace = TRUE
         }
      }
   }
}# end of CONV_TELOutput


  3. Create IFW_HOME/data/out/cdma/telephony
   $>. mkdir -p IFW_HOME/data/out/cdma/telephony
 

Changes in PIN_REL for loading rated events

    1. Add the event tables for the new event in the Infranet.properties of apps/pin_rel

#/event/delayed/session/telco/cdma
infranet.rel.storable_class.event_delayed_session_telco_cdma.number_of_tables = 9
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.1.name = event_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.2.name = event_bal_impacts_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.3.name = event_essentials_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.4.name = event_dlay_sess_tlcs_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.5.name = event_dlay_sess_tlcs_svc_cds_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.6.name = event_dlyd_session_tlco_cdma_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.7.name = event_tax_jurisdictions_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.8.name = event_rum_map_t
infranet.rel.storable_class.event_delayed_session_telco_cdma.table.9.name = tmp_profile_event_ordering_t
 
     2. Create ctl file for CDMA before loading the events using pin_rel
        a. Copy the original event_dlyd_session_tlco_gsm_t.ctl to event_dlyd_session_tlco_cdma_t.ctl, as we are not changing anything on field level.
        b. Open event_dlyd_session_tlco_cdma_t.ctl file and change the following…

UNCOVERABLE
LOAD DATA
APPEND
INTO TABLE EVENT_DLYD_SESSION_TLCO_CDMA_T // table name changed
SINGLEROW
PARTITION
(first the partition utility is run to create partition for /event/delayed /session/telco/cdma class)
partition_utils -o add -c /event/delayed/session/telco/cdma



New service is ready to use. You can start by creating new products. deals, discounts and plans.

Monday, July 21, 2014

A simple Oracle DB function to convert timestamp to date



In BRM, all the time and date is stored in number format and it is required to convert them if you are reading it from the DB.
Lots of developers write functions or utilities to convert it to date. Here is a similar function:

create or replace function u2d(
v_tstamp IN number)
return date
as
v_date date;

begin
v_date := to_date('01-JAN-1970', 'DD-MON-YYYY') + (v_tstamp+19800)/86400;
RETURN V_DATE;
END;

Migrating PDC data from one system to another

Given System “A” with BRM and PDC and System “B” with BRM and PDC, following is the process for moving new or changed pricing data from ...