Cisco SCMS Collection Manager User Guide, Release 3.7.x
Code Samples

Table Of Contents

Code Samples

Introduction

Application Configuration

dbtables.xml File

tables.dtd File

RAG Adapter Configuration

ragadapter.conf File

ragadapter.xml File

http_TURs.xml File

video_TURs.xml File

vlink_BW_per_pkg.xml File

vsa_SURs.xml File

cdma_SURs.xml file

Custom Adapter Configuration


Code Samples


Introduction

This appendix contains samples of files used to configure the Cisco Service Control Management Suite (SCMS) Collection M anager (CM) and the adapters that process the data that the Collection Manager receives.

Application Configuration

RAG Adapter Configuration

Custom Adapter Configuration

Application Configuration

The following sections list part of the XML file (dbtables.xml) used to configure the database tables, and the DTD file used to verify the structure of the XML file.

dbtables.xml File

tables.dtd File

dbtables.xml File

The following code is a portion of the Cisco Service Control Application for Broadband dbtables.xml file:

<?xml version="1.0" encoding="ISO8859_1"?>
<!DOCTYPE dbtabconf PUBLIC "-//P-Cube//Engage DB RDR Configuration 2.1.0//EN" 
"dbtables.dtd">
<dbtabconf>
   <fileversion>
      ...
   </fileversion>
   <application name="Engage" version="2.1"/>
   <dbtables>
      <rdr name="SUR" dbtabname="RPT_SUR" tag="4042321922" createtable="true">
         <fields>
            <field id="1" name="TIME_STAMP" type="TIMESTAMP">
               <options>
                  <option property="source" value="timestamp"/>
               </options>
            </field>
            <field id="2" name="RECORD_SOURCE" type="INT32">
               <options>
                  <option property="source" value="recordsource"/>
               </options>
            </field>
            <field id="3" name="SUBSCRIBER_ID" type="STRING" size="64"/>
            <field id="4" name="PACKAGE_ID" type="INT32"/>
            <field id="5" name="SERVICE_ID" type="INT32">
               <options>
                  <option property="notnull" value="true"/>
               </options>
            </field>
            <field id="6" name="MONITORED_OBJECT_ID" type="INT32"/>
            <field id="7" name="BREACH_STATE" type="INT32"/>
            <field id="8" name="REASON" type="INT32"/>
            <field id="9" name="CONFIGURED_DURATION" type="INT32"/>
            <field id="10" name="DURATION" type="INT32"/>
            <field id="11" name="END_TIME" type="INT32"/>
            <field id="12" name="UPSTREAM_VOLUME" type="UINT32"/>
            <field id="13" name="DOWNSTREAM_VOLUME" type="UINT32"/>
            <field id="14" name="SESSIONS" type="UINT32"/>
         </fields>
         <indexes>
            <index name="RPT_SUR_I1" columns="END_TIME">
               <options>
                  <option property="clustered" value="true"/>
               </options>
            </index>
         </indexes>
      </rdr>
      <rdr name="LUR" dbtabname="RPT_LUR" tag="4042321925" createtable="true">
         <fields>
            <field id="1" name="TIME_STAMP" type="TIMESTAMP">
               <options>
                  <option property="source" value="timestamp"/>
               </options>
            </field>
            <field id="2" name="RECORD_SOURCE" type="INT32">
               <options>
                  <option property="source" value="recordsource"/>
               </options>
            </field>
            <field id="3" name="LINK_ID" type="INT32"/>
            <field id="4" name="GENERATOR_ID" type="INT32"/>
            <field id="5" name="SERVICE_ID" type="INT32"/>
            <field id="6" name="CONFIGURED_DURATION" type="INT32"/>
            <field id="7" name="DURATION" type="INT32"/>
            <field id="8" name="END_TIME" type="INT32"/>
            <field id="9" name="UPSTREAM_VOLUME" type="UINT32"/>
            <field id="10" name="DOWNSTREAM_VOLUME" type="UINT32"/>
            <field id="11" name="SESSIONS" type="UINT32"/>
         </fields>
         <indexes>
            <index name="RPT_LUR_I1" columns="END_TIME">
               <options>
                  <option property="clustered" value="true"/>
                  <option property="allowduprow" value="true"/>
               </options>
            </index>
         </indexes>
      </rdr>
      <aggtable name="TOP_HOURLY" dbtabname="RPT_TOPS_PERIOD0" aggperiod="0">
         <fields>
            <field id="1" name="RECORD_SOURCE" type="INT32"/>
            <field id="2" name="METRIC_ID" type="INT8"/>
            <field id="3" name="SERVICE_ID" type="INT8"/>
            <field id="4" name="TIME_STAMP" type="TIMESTAMP"/>
            <field id="5" name="AGG_PERIOD" type="INT8"/>
            <field id="6" name="SUBSCRIBER_ID" type="STRING" size="64"/>
            <field id="7" name="CONSUMPTION" type="UINT32"/>
         </fields>
         <indexes>
            <index name="RPT_TOPS_PERIOD0_I1" columns="TIME_STAMP">
               <options>
                  <option property="clustered" value="true"/>
                  <option property="allowduprow" value="true"/>
               </options>
            </index>
         </indexes>
      </aggtable>
      <table name="TZ" dbtabname="JCONF_SE_TZ_OFFSET">
         <fields>
            <field id="1" name="TIME_STAMP" type="TIMESTAMP"/>
            <field id="2" name="OFFSET_MIN" type="INT16"/>
         </fields>
      </table>
   </dbtables>
</dbtabconf>

For each table (either an RDR table, an aggregation table, or an extra table), the fields, indexes, and so on, are listed.


Note A table, an index, or fields can have arbitrary free text options that can be accessed in the templates.


The XML file is verified at runtime against a simple DTD, which is reproduced in the following section.

tables.dtd File

The following sample code represents the DTD file used to verify the dbtables.xml definition file:

<?xml version="1.0" encoding="ISO8859_1"?>
<!ELEMENT dbtabconf (fileversion, application, db?, dbtables)>
<!ELEMENT fileversion (#PCDATA)>
<!ELEMENT application EMPTY>
<!ATTLIST application
   name CDATA #REQUIRED
   version CDATA #REQUIRED
>
<!ELEMENT db (options)>
<!ELEMENT dbtables (rdr*, aggtable*, table*)>
<!ELEMENT table (options?, fields, indexes?)>
<!ATTLIST table
   name CDATA #REQUIRED
   dbtabname CDATA #REQUIRED
   createtable (true | false) "true"
   inserttodb (true | false) "false"
>
<!ELEMENT aggtable (options?, fields, indexes?)>
<!ATTLIST aggtable
   name CDATA #REQUIRED
   dbtabname CDATA #REQUIRED
   aggperiod CDATA #REQUIRED
   createtable (true | false) "true"
>
<!ELEMENT rdr (options?, fields, indexes?)>
<!ATTLIST rdr
   name CDATA #REQUIRED
   dbtabname CDATA #REQUIRED
   tag CDATA #REQUIRED
   createtable (true | false) "true"
   inserttodb (true | false) "true"
>
<!ELEMENT fields (field+)>
<!ELEMENT field (options?)>
<!-- the id attribute below is presumably a numeric index, but it is for future
     use, we currently don't look at it, as the order is imposed in the XML -->
<!ATTLIST field
   id CDATA #REQUIRED
   name CDATA #REQUIRED
   type CDATA #REQUIRED
   size CDATA #IMPLIED
>
<!ELEMENT indexes (index+)>
<!ELEMENT index (options?)>
<!ATTLIST index
   name CDATA #REQUIRED
   columns CDATA #REQUIRED
   create (true | false) "true"
>
<!ELEMENT options (option+)>
<!ELEMENT option EMPTY>
<!ATTLIST option
   property CDATA #REQUIRED
   value CDATA #REQUIRED
>

You can set the location and name of the DTD and XML files separately for each adapter in the adapter configuration file.

RAG Adapter Configuration

The following sections list the configuration file (ragadapter.conf) and the associated XML files used to configure the real-time aggregating (RAG) adapter.

The configuration files of the other adapters are similar to the RAG adapter configuration file. Only the RAG adapter has associated XML files.

ragadapter.conf File

ragadapter.xml File

http_TURs.xml File

video_TURs.xml File

vlink_BW_per_pkg.xml File

vsa_SURs.xml File

cdma_SURs.xml file

ragadapter.conf File

To perform RAG adapter general maintenance, use the file ~scmscm/cm/config/ragadapter.conf. The following sample represents the RAG adapter configuration file:

# 
# RAGAdapter main configuration file 
# 
[config] 
xml_conf_dir = ~/cm/config/ragadapter
domain_ext_filename = ~/cm/config/tlds-alpha-by-domain.txt
network_type_filename = ~/cm/config/rat-networktype.txt
imei_lookup = false
vsa_type=gsm
meid_length=8
attr_index=17
attr_shift_pos=0
[housekeeper]
interval_sec = 10
[db]
operations_timeout = 60
batch_size = 10
transaction_size = 15
commit_interval = 6
blocking_connects = true
db_template_file = main.vm
db_template_dir = dbpacks/sybase/ase12.5.1
#db_template_dir = dbpacks/sybase/ase12.5.1
#db_template_dir = dbpacks/oracle/9204e
#db_template_dir = dbpacks/mysql/4.0.20
[app]
app_conf_file = dbtables.xml
app_dtd_file = dbtables.dtd
app_conf_dir = apps/scasbb/latest
[bench]
rate_period_msec = 5000

ragadapter.xml File

The following sample ragadapter.xml file listed defines the sinks to persist the aggregated data. The sink section specifies the format of the aggregated data store and location to which the data is written (a CSV file or the database).

The CSV file definition is located in the <sinks> section under the <csvsink id="csv1"> tag. This definition specifies the output file name and directory. This definition also specifies the rate at which new files are opened, either every 5 minutes, or when the current file reaches 1000 lines. Each field in the file is enclosed by quotes (").

The database definition is located in the <sinks> section under the <dbsink id="dbsink1"> tag. If the sink is configured as a database, the aggregated data is written to the database configured in the Collection Manager.

<?xml version="1.0" standalone="no"?>
<!--!DOCTYPE ragadapterconf SYSTEM "cm/config/ragadapter/ragadapterconf.dtd"-->
<ragadapterconf>
    <description>RAG Adapter basic configuration</description>
    <config>
        <aggregations/>
        <sinks>
            <csvsink id="csv1"
                classname="com.cisco.scmscm.adapters.rag.sinks.CSVSink"
                filenameformat="yyyy-MM-dd_HH-mm-ss-SSS'.csv'"
                dirname="~/cm/adapters/RAGAdapter/csvfiles"
                maxagesec="300" maxlines="1000" usequotes="true" active="false"/>
            <dbsink id="dbsink1"
                classname="com.cisco.scmscm.adapters.rag.sinks.JDBCSink" active="true"/>
        </sinks>
    </config>
</ragadapterconf>

http_TURs.xml File

The following sample represents a portion of the http_TURs.xml file, which defines aggregations for the incoming HTTP Transaction Usage RDRs (intag="4042323004").

Aggregates RDRs with the RDR tag 71072 (outtag="71072") and persists them into database (sinkid="dbsink1").

The buckets aggregate the data by three HTTP_TUR fields: 7, 18, and 19. These fields correspond to ACCESS_STRING, SERVICE_COUNTER_ID, and PACKAGE_COUNTER_ID. The bucket identifiers are similar to the fields appearing in the SQL "GROUP BY" clause. The database definition is located in the <sinks> section under the <dbsink id="dbsink1"> tag. The outtag table definition is located in the tables configuration file, dbtables.xml.

<aggregation id="HTTP TURs by domain, per service, per package" intag="4042323004" 
outtag="71072" sinkid="dbsink1" period="60" top="500"  topid="1" topby="4,5,6,8"> <!-- 
topby - out index -->
	<bucketident>
		<field inindex="7" type="string" index="1" 
pretransform="com.cisco.scmscm.adapters.rag.transforms.URLToDomain"/> <!-- ACCESS_string 
to domain-->
		<field inindex="18" type="int" index="2"/> <!-- Service counter id -->
		<field inindex="19" type="int" index="3"/> <!-- Package counter id -->
                                <totals>
                                                <total set="1"/>
                                                <total set="2"/>
                                                <total set="3"/>
                                                <total set="1,2"/>
                                                <total set="1,3"/>
                                                <total set="2,3"/>
                                                <total set="1,2,3"/>
                                 </totals>
		</bucketident>
	<closures/>
<accumulators>
		<field inindex="0" type="int" kind="agg_period" index="0"/>
		<field inindex="0" type="long" kind="count" index="4"/> 
		<field inindex="15" type="long" index="5"/> 
		<field inindex="16" type="long" index="6"/> 
		<field inindex="13" type="long" index="7" unitsFactor="1000"/> 
		<field inindex="0" type="long" kind="uniq_count" index="8"/> 
		<field inindex="6" type="long" kind="rank" index="9"/>
		<field inindex="4" type="long" kind="rank" index="10"/> 
		<field inindex="8" type="long" kind="rank" index="11"/> 
</accumulators>
<monitors/>
</aggregation>

video_TURs.xml File

The following sample represents a portion of the video_TURs.xml file, which defines aggregations for the incoming VIDEO Transaction Usage RDRs (intag="4042323072").

<aggregation id="Video TURs by domain, per service, per package" intag="4042323072" 
outtag="71074" sinkid="dbsink1" period="60" top="500"  topid="1" topby="4,5,6,8"> <!-- 
topby - out index -->
	<bucketident>
		<field inindex="7" type="string" index="1" 
pretransform="com.cisco.scmscm.adapters.rag.transforms.URLToDomain"/> <!-- ACCESS_string 
to domain-->
		<field inindex="18" type="int" index="2"/> <!-- Service counter id -->
		<field inindex="19" type="int" index="3"/> <!-- Package counter id -->
                                        <totals>
                                                <total set="1"/>
                                                <total set="2"/>
                                                <total set="3"/>
                                                <total set="1,2"/>
                                                <total set="1,3"/>
                                                <total set="2,3"/>
                                                <total set="1,2,3"/>
                                </totals>
	</bucketident>
<closures/>
	<accumulators>
		<field inindex="0" type="int" kind="agg_period" index="0"/> 
		<field inindex="0" type="long" kind="count" index="4"/> 
		<field inindex="15" type="long" index="5"/> 
		<field inindex="16" type="long" index="6"/> 
		<field inindex="13" type="long" index="7" unitsFactor="1000"/>
		<field inindex="0" type="long" kind="uniq_count" index="8"/> 
		<field inindex="6" type="long" kind="rank" index="9"/>
		<field inindex="4" type="long" kind="rank" index="10"/> 
		<field inindex="8" type="long" kind="rank" index="11"/>
	</accumulators>
	<monitors/>
</aggregation>

vlink_BW_per_pkg.xml File

The following sample represents a portion of the vlink_BW_per_pkg.xml file, which defines aggregations for the uplink and downlink fields in the Subscriber Usage RDRs (intag="4042321920").

<aggregation id="NUR's by VLINK UPSTREAM and subs usage counter" intag="4042321920" 
outtag="71080" sinkid="dbsink1">
	<bucketident>
		<field index="1" type="string"/>
		<field index="12" type="int"/> <!-- Check the type -->
	</bucketident>
	<closures/>								
	<accumulators>
		<!-- duration=6, up=8, down=9, sessions=10, seconds=11 (not to use) -->
		<field index="6" type="long"/>
		<field index="8" type="long"/>
		<field index="9" type="long"/>
		<field index="10" type="long"/>
		<field index="11" type="long"/>
	</accumulators>
	<monitors>
		<timeoutmonitor action="checkpoint" maxsec="900" active="true"/>
	</monitors>
</aggregation>

vsa_SURs.xml File

The following sample represents a portion of the vsa_SURs.xml file, which defines aggregations for the VSA fields present in the Subscriber Usage RDRs (intag="4042321920").

<aggregation id="VSA SURs by device type, per service"
				intag="4042321920" outtag="71076" sinkid="dbsink1" period="60" top="500"
				topid="1" topby="3,4,5"> <!-- topby - out index -->
	<bucketident>
		<field inindex="19" type="string" index="1" 			
pretransform="com.cisco.scmscm.adapters.rag.transforms.IMEIToDeviceType" />
		<field inindex="2" type="int" index="2" /> <!-- Service usage counter id -->
	<totals>
		<total set="1" />
		<total set="2" />
		<total set="1,2" />
	</totals>
	</bucketident>
	<closures />
	<accumulators>
		<field inindex="0" type="int" kind="agg_period" index="0" /> 
		<field inindex="8" type="long" index="3" />
		<field inindex="9" type="long" index="4" /> 
		<field inindex="0" type="long" kind="uniq_count" index="5" /> 
		<field inindex="4" type="long" kind="rank" index="6" /> 
		<field inindex="5" type="long" kind="rank" index="7" /> 
	</accumulators>
	<monitors />
</aggregation>

cdma_SURs.xml file

The following sample represents a portion of the Cdma_SURs.xml file, which defines aggregations for the VSA fields present in the Subscriber Usage RDRs (intag="4042321920").

<aggregations>
			<aggregation id="CDMA SURs by device type, per service"
				intag="4042321920" outtag="71082" sinkid="dbsink1" period="60" top="-1"
				topid="1" topby="3,4,5"> <!-- topby - out index -->
				<bucketident>
					<field inindex="26" type="string" index="1"
						
pretransform="com.cisco.scmscm.adapters.rag.transforms.MEIDToDeviceType" /> <!-- Need to 
identify device type-->
					<field inindex="2" type="int" index="2" /> <!-- Service usage counter 
id -->
					<totals>
						<total set="1" />
						<total set="2" />
						<total set="1,2" />
					</totals>
				</bucketident>
				<closures />
				<accumulators>
					<field inindex="0" type="int" kind="agg_period" index="0" /> <!-- agg 
period -->
					<field inindex="8" type="long" index="3" /> <!-- 
SESSION_UPSTREAM_VOLUME -->
					<field inindex="9" type="long" index="4" /> <!-- 
SESSION_DOWNSTREAM_VOLUME -->
					<field inindex="0" type="long" kind="uniq_count" index="5" /> <!-- UNIQ 
SUBSCRIBER -->
					<field inindex="4" type="long" kind="rank" index="6" /> <!-- RANK 
VOLUME-->
					<field inindex="5" type="long" kind="rank" index="7" /> <!-- UNIQ_SUBS 
RANK-->
				</accumulators>
				<monitors />
			</aggregation>

Custom Adapter Configuration

The Custom Adapter allows the user to configure specific fields in the CSV file for a particular RDR. The file ~scmscm/cm/config/customadapter/custom.xml contains this configuration

<customadapter>
<description>Customized CSV Adapter</description>
<config>
 <rdrs>
  <rdr tag="4042321925" sinkId="csv1">
   <fields>
    <field outindex="0" name="RDR_TAG" type="STRING" constant="4042321925" />
    <field outindex="1" name="LINK_ID" type="STRING" rdrindex="0" />
    <field outindex="2" name="GEN_ID" type="STRING" rdrindex="1" />
    <field outindex="3" name="SVC_ID" type="STRING" rdrindex="2" />
    <field outindex="4" name="UPSTREAM_VOL" type="LONG" rdrindex="6" />
    <field outindex="5" name="DOWNSTREAM_VOL" type="LONG" rdrindex="7" />
    <field outindex="6" name="TOTAL_VOL" type="LONG" expr="(F6+F7)" />
    <!--<field outindex="7" name="SUB_CONST" type="STRING" expr="F0+FC"
constant="HELLO"/>-->
   </fields>
  </rdr>
</rdrs>
<sinks>
  <csvsink id="csv1"   classname="com.cisco.scmscm.adapters.custom.sinks.CSVSink" 
filenameformat="yyyy-MM-dd_HH-mm-ss-SSS'.csv'" 
dirname="~/cm/adapters/CustomAdapter/csvfiles/4042321925" maxlines="1000" active="true" />
 </sinks>
</config>
</customadapter>  

Note The above configured RDR TAG ID's should be added in the ~scmscm/cm/config/queue.conf file under [bill-custom] section.


The sink information also needs to be configured in the ~scmscm/cm/config/customadapter/custom.xml file for the Custom Adapter to store the customized RDR records. The Sink ids should be unique for each RDR.

Table A-1 defines the fields of the custom.xml file.

Table A-1 custom.xml File Fields

   

outindex

Refers to the column index of the csv file.

name

Column name of the csv file.

type

Refers to the Data Type for the corresponding column

rdrindex

Refers to the rdr fields that need to be processed.

expr

Performs Arithmetic Expressions between RDR Fields and with constant values.

(ex:- expr

"(F6+F7)"à Perform Addition operation for the rdr field 6 and rdr Field 7 and store the result in the corresponding outindex column

expr

" (F0+FC)" à Add rdr Field 0 with a constant value, FC refers to the constant value that needs to be added).

constant

Stores the constant value in the corresponding outindex column.