Tuesday, June 25, 2019

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 system A to system B.
    1.  Load new/changed BRM configuration objects from BRM A to BRM B, in particular, the following objects that are mastered in BRM:
         a. Provisioning Tags
         b. GLIDs
         c. Tax Codes
         d. Tax Supplier
         e. Events
         f. Service
         g. Account

    2. Follow this step if you have made any name changes in PDC for these objects. If no name changes have been made, you can skip this step and go directly to Step 3. Export the Event attribute spec, Customer attribute spec, Product (aka Service) attribute spec and Profile attribute spec [if using ECE] from PDC A.
        ImportExportPricing -export -config EVENT_ATTRIBUTE_SPEC
        ImportExportPricing -export -config CUSTOMER_ATTRIBUTE_SPEC
        ImportExportPricing -export -config PRODUCT_ATTRIBUTE_SPEC
        ImportExportPricing -export –config PROFILE_ATTRIBUTE_SPEC [Applicable for ECE only]

These commands will generate 3 export files. (4 if ECE is used)
Import the exported attribute specs into PDC B
         a. The internal IDs for the objects should not be changed.
         b. Make sure that the transformation engines are running in so that the xref tables are updated.
         c. Follow the same order as export.

        ImportExportPricing -import -config export_config_attributes.xml

    3. Start SyncPDC
If the Event, Service, and Account objects have already been moved from PDC A to PDC B (steps 2 and 3), this will only sync the other 4 objects from BRM because SyncPDC will know that the Event, Service, and Account objects have already been sync’ed.

    4. Move configuration objects mastered in PDC.
         a. Export configuration objects: This export should NOT include the objects mastered in BRM which have already been moved in steps 1-4.

         ImportExportPricing -export -config <TYPE>

Types are: GEO_ZONE_MODEL, STANDARD_ZONE_MODEL, ZONE_MAP, ZONE_RESULT_CONFIGURATION, RUM_CONFIGURATION, ATTRIBUTE_SPEC_MAP, BALANCE_ELEMENT, HOLIDAY_CALENDAR, CUSTOM_ANALYZER_RULE[Applicable for ECE only]

Invoke these commands up to 9 times, generating as many export files.
         b. Import configuration objects into PDC B. Observe the following ordering when importing:

  • Import the service event map (AttributeSpecMap) last
  • Load ZONE_RESULT_CONFIGURATION before both GEO_ZONE_MODEL and STANDARD_ZONE_MODEL

ImportExportPricing -import -config <exported file name>

5. Move pricing objects.
         a. Export all pricing from PDC A

                  ImportExportPricing -export -pricing

This creates a file called: export_pricing.xml
       
         b. Import all pricing into PDC B
                  ImportExportPricing -import -pricing <exported file name>

Tuesday, December 12, 2017

PDC issues and fixes




    Issues#1: PDC import is failing with the following error:

 [exec] Error during- Import
     [exec] EJBException: Unknown reason: BEA1-047E79AE2C611898D0B8; nested exception is:
     [exec]     javax.transaction.HeuristicMixedException: (PricingDB_pdc_domain, HeuristicHazard, ()) ; nested exception is: javax.transaction.HeuristicMixedException: (PricingDB_pdc_domain, HeuristicHazard, ())
     [echo] Waiting 30 seconds for import to finish.

    Solution: Change XA Retry Interval to 0 in
     



    Issues#2: Sequential Discount configuration doesn't work when discounts configured using PDC
    Solution: Set the grant_period_offset for the discounts which need sequential discount configurations:

                 update ifw_dscbalimpact set grant_period_offset=-1;
                 commit;


Issues#3: Prorate discounts for fixed discount configurations        
Solution: Add ProrateFixedDiscount entry in the discount pipeline's registry:

            ApolloDiscountModule
            {
              ModuleName = FCT_Discount
              Module
              {
                Active                   = TRUE
                DiscountDataModule       = ifw.DataPool.DiscountModelDataModule
                BalanceDataModule        = ifw.DataPool.BalanceDataModule
                AccountDataModule        = ifw.DataPool.CustomerData
                CurrencyDataModule       = ifw.DataPool.CurrencyDataModule
                DiscountMoreThanPossible = False
                TaxationMode             = 3   #[0-3] needs to in sync with 'taxation_switch' entry in pin.conf
                DiscountTrace            = FALSE
                ProrateFixedDiscount     = true
              }
            }

Monday, October 23, 2017

Realtime Discounting Pipeline Reports "discount model: () is invalid" In Discount Trace






Debugging Realtime Discounting Pipeline Reports "discount model: () is invalid" In Discount Trace


#### BEGIN transaction: 3169

-----> DETAIL Container::isValidDetail: 1, Pipeline: 0
Account DB#: 1, ID: 234522
discount model: () is invalid, valid flag: 3


The VALID_FLAG values, see below for the different values and their meaning :
1 ==> valid
2 ==> invalid purchase start or end time
3 ==> invalid usage start or end time
4 ==> invalid sponsorship start or end time
5 ==> invalid discount/sponsorship object id
6 ==> no usage map for event type
7 ==> invalid usage map for event type

If it fails with valid flag: 5, it could be a problem with the way pipeline is restarted. CM should start after pipeline and you should not see listen with the port using following command:

lsof -i|grep 10803
ifw       24438 pin08   35u  IPv6 447623857      0t0  TCP *:10803 (LISTEN)

Check for any extra RTP processes running before start RTP

Tuesday, November 8, 2016

Dequeuing in Oracle BRM



Although it is not recommended, but sometimes in the test environment where there is no interface to dequeue the message from advance queue, the queue is clogged and we wish to dequeue it. Here is the way to do it:


DECLARE
po_t dbms_aqadm.aq$_purge_options_t;
BEGIN
dbms_aqadm.purge_queue_table('AQ_SYNC', NULL, po_t);
END;

Execute the above from SQL client or command line.

Tuesday, February 9, 2016

Useful logging information for cm and dm_oracle

Logging settings for cm and dm_oracle

1) For logging the time taken by opcode in the cm.pinlog
    Add the following lines in $PIN_HOME/sys/cm/pin.conf

     - cm enable_pcm_op_call_stack 1
     - cm max_pcm_op_call_stack_entries 256


This will start displaying the opcode time as below:
cm_pcm_op_call_stack
                Seconds Type  Opcode (flags, notes)
            0.000000000 Enter PCM_OP_READ_OBJ (0x0)
            0.000348000 .Enter PCM_OP_READ_OBJ (0x0)
            0.478129000 .Exit  PCM_OP_READ_OBJ (0x0) - from DM 0.0.0.1
            0.502946000 Exit  PCM_OP_READ_OBJ (0x0)


2) For setting the cm to debug level

    - cm cm_loglevel 3

3) For logging the PCM_OP_SEARCH input and output flist
    Add the following lines in $PIN_HOME/sys/cm/pin.conf

    - cm CMAP_DEBUG 0xFFFFFFFF
    - cm CM_DEBUG 0xFFFFFFFF

This should be used with cm in debug level.

4) Setting the cm log level to debug when cm is running

cat cm_debug3
r << XXX  1
0 PIN_FLD_POID POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_COMPONENT STR [0] "CM"
0 PIN_FLD_LOGLEVEL INT [0] 3
XXX
#
xop PCM_OP_INFMGR_SET_LOGLEVEL 0 1
#


run the below command from $PIN_HOME/test
testnap cm_debug3

5) Setting the cm log level to error when cm is running

cat cm_debug1
r << XXX  1
0 PIN_FLD_POID POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_COMPONENT STR [0] "CM"
0 PIN_FLD_LOGLEVEL INT [0] 1
XXX
#
xop PCM_OP_INFMGR_SET_LOGLEVEL 0 1
#

run the below command from $PIN_HOME/test
testnap cm_debug1

5) Setting the dm_oracle log level to debug when cm and dm are running

cat dm_debug3
r << XXX  1
0 PIN_FLD_POID POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_COMPONENT STR [0] "DM"
0 PIN_FLD_DEBUG_FLAG ARRAY [1] allocated 20, used 2
1     PIN_FLD_NAME STR [0] "DM_DEBUG"
1     PIN_FLD_FLAGS INT [0] 255
0 PIN_FLD_DEBUG_FLAG ARRAY [2] allocated 20, used 2
1     PIN_FLD_NAME STR [0] "DM_DEBUG2"
1     PIN_FLD_FLAGS INT [0] 4090
0 PIN_FLD_DEBUG_FLAG ARRAY [3] allocated 20, used 2
1    PIN_FLD_NAME STR [0] "DM_DEBUG3"
1    PIN_FLD_FLAGS INT [0] 65535
XXX
#

run the below command from $PIN_HOME/test
testnap dm_debug3

6) Setting the dm_oracle log level to normal when cm and dm are running

cat dm_debug1
r << XXX  1
0 PIN_FLD_POID POID [0] 0.0.0.1 /account 1 1
0 PIN_FLD_COMPONENT STR [0] "DM"
0 PIN_FLD_DEBUG_FLAG ARRAY [1] allocated 20, used 2
1     PIN_FLD_NAME STR [0] "DM_DEBUG"
1     PIN_FLD_FLAGS INT [0] 255
0 PIN_FLD_DEBUG_FLAG ARRAY [2] allocated 20, used 2
1     PIN_FLD_NAME STR [0] "DM_DEBUG2"
1     PIN_FLD_FLAGS INT [0] 0
0 PIN_FLD_DEBUG_FLAG ARRAY [3] allocated 20, used 2
1    PIN_FLD_NAME STR [0] "DM_DEBUG3"
1    PIN_FLD_FLAGS INT [0] 0
XXX
#
xop PCM_OP_INFMGR_SET_LOGLEVEL 0 1
#

 run the below command from $PIN_HOME/test
testnap dm_debug1

7) Setting the dm_oracle to debug level

Add the following lines in $PIN_HOME/sys/dm_oracle/pin.conf
- dm dm_debug 0xff
- dm dm_debug2 0xffa
- dm dm_debug3 0xffff


You can find the SQL statements as below in dm_oracle.pinlog file:
SQL_STMT do_sql_update: cmd="update account_t set poid_rev = poid_rev + 1, mod_t = :mod_t, cust_seg_list=:cust_seg_list, currency=:currency, currency_secondary=:currency_secondary where poid_id0 = :poid_id0"
There will be lot more useful information in dm_oracle.log file

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 ...