cc/td/doc/product/rtrmgmt/csrc/101/ur
hometocprevnextglossaryfeedbacksearchhelp

Table of Contents

CSRC Callouts

CSRC Callouts

The Cisco Subscriber Registration Service (CSRC) Callout system allows you to interface external systems to the CSRC Object architecture for the purpose of retrieving supplemental data for CSRC objects and monitoring CSRC change sets. You can create programs using most programming languages (C++, Perl, ksh or others).

These programs are called Customer Callout Modules (CCM). There are three types of CCMs registered with the CSRC architecture and invoked when the following actions occur:

Each type of CCM has a specific command line interface, input specification, output specification, and interpretation of CCM return code values. See Figure 7-1 for a description of the relationship between the three CCM types and the data flow in the CSRC architecture.


Figure 7-1: CSRC Architecture Data Flow


If you have extended the schema, you might want to handle all three operations (read, update, and commit). But, since reads to LDAP are expensive, you should perform only necessary operations. The type of callout you need depends on what you are doing. The following are some cases in which you would choose one type of callout over another.

When you handle a particular data set, you can choose to combine the callouts to the read, update, and commit operations on a single line. The definition file syntax is:

[Class_Name] -[ruc] ANAV [command]
 

Note You can specify Read, Update and Commit CCMs independently. None are required. You may have Read CCMS and not Update and/or Commit or any combination of the -ruc flags.

Creating Read CCMs

You create Read CCMs to verify and, optionally, update objects that have been read from the CSRC database, before they are passed to the user interface. CSRC associates Read CCMs with one or more object classes, and invokes them when it responds to retrieval requests for the associated object type.


Note When you read values from CSRC, it may return only a subset of the attributes in the schema. In such cases, the callout should supply the remaining
attributes. If you do not know all the object attributes, check the schema for the list. For more information about the schema, see "CSRC Schema."

Read CCMs perform the following tasks:

Using the Read CCM Command Line

The Read CCM command line has the following format:

ccm_name -r obj_count ClassName
 

Table 7-1 describes the arguments to the command line:


Table 7-1: Read CCM Command Line
Element Description

ccm_name

The name of the CCM.

-r

The mode. The -r flag indicates that the CCM is being invoked in read (objects have just been read from the database) mode.

obj_count

The number of objects read from the database. The CSRC object layer passes these object attributes to the CCM's standard input.

ClassName

The class name of the objects read from the database.

For example, the following command line indicates that the CSRC object layer is passing ten Account objects to the standard input of the CCM named account_ccm for inspection and possible update.

account_ccm -r 10 Account

Understanding Read CCM Standard Input

The CSRC object layer reads the objects from the database, and passes them to the Read CCM's standard input in the AttributeName=AttributeValue (ANAV) format.

Table 7-2 describes what the CSRC object layer writes and what the Read CCM reads.


Table 7-2: Read CCM Input
CSRC Object Layer (out) Read CCM (in)

Writes names and values one per line.

Reads attribute names and values one per line.

Writes attribute name, equal sign, and the value.

Reads up to the first equal sign for the attribute name and to the end of the line for the value. Note that the end of line character is not part of the value. It is simply a terminator.

Writes multivalued attributes on consecutive lines.

Reads all occurrences of an attribute on consecutive lines.

Writes, in one invocation, all the objects it finds for a query.

Reads the objects.

Writes the ObjectID as the object's first attribute.

Reads the ObjectID, finishes processing the old object, and starts processing the new object.

Writes the ClassName as the object's second attribute

Reads the ClassName as the object's second attribute.

Writes the number of objects specified to the command line.

Reads the number of objects specified from the command line.


Note Because the CSRC object layer is multithreaded, it can call several Read CCMs concurrently. The Read CCM or an external datastore must handle the synchronization.

Sample Read CCM Input

Example 7-1 shows a sample of standard input that the CSRC object layer passes to a Read CCM when invoked with the command line: "ccm_name -r 3 Account." Notice the consecutive lines for the multivalued ObjectClass attribute.


Example 7-1:
Read CCM Sample Input Code




Understanding Read CMM Exit Code

The Read CCM exit code indicates whether the CSRC object layer passes the objects it reads to the requestor (normally a user interface).


Note Because callouts run in a separate process from the CSRC object layer, if they core, they will not bring down CSRC. A core will look like a failed callout with no error message output.

Understanding Read CCM Standard Output

If the exit code of the CCM is zero, the CSRC object layer reads the CCM's standard output. Although the standard output is not required, it might contain attribute replacement and/or append or delete specifications for one or more of the objects from standard input.

The CSRC object layer passes the attributes to be replaced and/or appended or deleted to the CSRC architecture using Modified AttributeName=AttributeValue (MANAV) format. MANAV format is essentially the same as ANAV format with an indicator for attribute append (+) and delete (-). For more information about changing attributes, see the "Using Attributes" section and Table 7-4.

Table 7-3 describes what the CSRC object layer reads and what the Read CCM writes.


Table 7-3: Read CCM Output
CSRC Object Layer (in) Read CCM (out)

Can read nothing

Not required to write output.

Reads attributes for each object it is requested to modify.

Writes the attributes for each object it wants the CSRC object layer to modify.

Reads the attribute names and values one per line

Writes the attribute names and values one per line.

Reads up to the first equal sign for the attribute name, and to the end of the line for the value. Note that the end of line character is not part of the value. It is simply a terminator.

Writes attribute name, equal sign, and the value.

Reads all occurrences of an attribute on consecutive lines.

Writes multivalued attributes on consecutive lines.

Reads the objects.

Starts writing each object with the ObjectID.

Ignores any requests to change ObjectID, ClassName, SequenceNo, ObjectClass, or Version.

  • Does not change ObjectID, ClassName, SequenceNo, ObjectClass, or Version.

  • Passes the same ObjectID(s) to standard output as were received from standard input.

  • Writes the ObjectID to delineate the start of attribute replace/append specifications for an object.

Appends attribute values on lines preceded with a plus sign.

Precedes append attributes with a plus sign.

Clears all attribute occurrences preceded with a minus sign.

Precedes clear attributes with a minus sign.

Replaces attributes received (default).

Writes attributes the CSRC object layer must replace.


Note Because the CSRC object layer is multithreaded, it can call Read CCMs concurrently. The
Read CCM or an external datastore must handle the synchronization.

Using Attributes

Read callouts allow you to alter objects that have been read from the CSRC database. If they are subsequently saved, they will alter the CSRC database.

The following rules apply:

Table 7-4 describes all the ways that a Read CCM can affect the CSRC database.


Table 7-4: Changing Attributes
In Out Data Store

A=10

A=5

A=5

A=10

+A=5

A=10

A=5

A=10

-A

no A attribute

A=10

A=3

A=5

A=2

A=1

A=2

A=1

A=10

A=3

A=5

+A=2

+A=1

A=10

A=3

A=5

A=2

A=1

A=10

A=3

A=1

-A

no A attribute


Note You can not mix operations, that is, you can not append and delete in a single operation. The following syntax is illegal: A=2, +A=1.

Sample Read CCM Output

Example 7-2 shows the standard output that the Read CCM passes to the CSRC architecture when it is invoked with the command line:

ccm_name -r 3 Account
 

Example 7-2 changes the AccountNumber attribute, adds another FirstName attribute, and specifies the City, State and ZipCode attributes for each object, and specifies removal of the PIN attribute for each Account object. Notice that the ObjectID attribute values are exactly the same as the standard input (they, however, do not have to be in the same order).


Example 7-2:
Sample Read CCM Output




Creating Update CCMs

You create Update CCMs to validate object change sets before the CSRC object layer writes them to the CSRC database. You can associate Update CCMs with one or more object classes, and have them invoked when the CSRC object layer saves a change set containing one or more of the associated object types.

Update CCMs perform the following tasks:

The invocation command line takes the following format:

ccm_name -u obj_count ClassName [ClassName]
 

Table 7-5 describes the arguments to the command line:


Table 7-5: Update CCM Command Line
Element Description

ccm_name

The name of the CCM.

-u

The mode. The -u flag indicates that the CCM is being invoked in update (objects are about to be written to the database) mode.

obj_count

The number of objects read from the database. The CSRC object layer passes these object attributes to the CCM standard input.

ClassName

The class name of the associated objects in the change set. Change sets are heterogeneous. They can contain objects of many different types. Therefore, a change set can have more than one associated object, but must have at least one associate object. CSRC displays all associated objects in the change set on the command line.

The following invocation command line indicates that 15 objects are in the change set, and the change set contains one or more Account or Subscriber objects. The CSRC object layer passes all the change set objects to the standard input of a CCM named account_ccm.

account_ccm -u 15 Account Subscriber

Understanding Update CCM Standard Input

The CSRC object layer reads the objects from the application code and passes them to the Update CCM's standard input in AttributeName=AttributeValue (ANAV) format. The attributes for each object are preceded by a change set operation (insert, update or delete), which indicates the operation that the CSO is requesting. Change sets occur when a user makes a change to one of the User Registrar or Modem Registrar pages.

Change set operations (CSOs) employ the following rules:

The following are example CSOs:

@insert Account
 
@delete Computer
 
@update Subscriber 3 ModemList Username AccountNumber

Using Attributes

The attributes the CSRC object layer displays follow the same rules as those described in Table 7-2 and Table 7-3 in this chapter.

Sample Update CCM Standard Input

Example 7-3 shows the standard input lines a CCM would receive for a change set containing a Subscriber and an Account objects (all Account and Subscriber attributes are not shown for brevity).

Example 7-3 shows the standard input that the CSRCD object layer passes to a CCM when your CCM receives the command line: "ccm_name -u 2 Account" (or possibly "ccm_name -u 2 Subscriber" or "ccm_name -u 2 Account Subscriber"). Notice the consecutive lines for the multivalued ModemList attribute.


Example 7-3:
Update CCM Sample Input




Understanding Update CCM Exit Code

The Update CCM exit code indicates whether the objects the CSRC object layer reads from the change set should be passed to the CSRC database for execution.

In addition, the CSRC object layer appends any data received from standard output to the rejected-by-callout error as explanation for the rejection.

Note 
Update CCMs cannot alter the change set data. They can only accept or reject the change set. The CSRC object layer ignores Update CCMs standard output.

Creating Commit CCMs

You can use Commit CCMs to take action after the CSRC object layer has successfully written change sets to the CSRC database. Commit CCMs are not called if the change set is not executed successfully against the CSRC database. Commit CCM(s) are associated with one or more object classes and are invoked after the CSRC architecture executes a change set containing one or more of the associated object type. Commit CCM(s) perform the following tasks:

The invocation command line takes the following format:

ccm_name -c obj_count ClassName [ClassName]
 

Table 7-6 describes the arguments to the command line:


Table 7-6: Commit CCM Command Line
Element Description

ccm_name

The name of the CCM.

-c

The mode. The -c flag indicates that the CCM is being invoked in commit (objects have been written to the database) mode.

obj_count

The number of objects read from the database. The CSRC object layer passes these object attributes to the CCM standard input.

ClassName

The class names of the associated objects in the change set. Change sets are heterogeneous. Therefore, a change set can have more than one associated object, but must have at least one associated object. CSRC displays all associated objects in the change set on the command line.

The following example invocation command line indicates that 15 objects are in the change set and the change set contains Account and Subscriber objects. The CSRC object layer passes all the change set objects to standard input of a CCM named account_ccm. The command line for the Commit CCM is the same as the Update CCM command line for the same change set.

account_ccm -c 15 Account Subscriber

Understanding Commit CCM Standard Input

The objects read from the database are passed to the CCM standard input in AttributeName=AttributeValue (ANAV) format. A change set operation (insert, update, or delete precedes the attribute for each object. The change set operation indicates the operation that the CSRC database performed.

The CSRC object layer passes CSOs and attribute names/values one per line.

Change set operations employ the following rules:

The following are example CSOs:

@insert Account
 
@delete Computer
 
@update Subscriber 3 ModemList Username AccountNumber

Using Attributes

Attributes employ the following rules:

Sample Commit CCM Standard Input

Example 7-4 shows the standard input lines a CCM would receive for a change set containing a Subscriber and an Account objects (all Account and Subscriber attributes are not shown for brevity).

This is the standard input passed to a CCM invoked with a command line: "ccm_name -c 2 Account" (or possibly "ccm_name -c 2 Subscriber" or "ccm_name -c 2 Account Subscriber"). Notice the consecutive lines for the multivalued ModemList attribute.


Example 7-4: Commit CCM Sample Input




Understanding Commit CCM Exit Code

You can use Commit CCMs to perform some external operations after CSRC has successfully saved the change set to the CSRC database.

Creating a Callout Definition File

To enable callouts you must create a callout definition file and place an entry in the CSRC configuration file indicating the pathname of the callout definition file.

Each uncommented line in the callout definition file associates a CCM pathname with one or more class names, and defines the acceptable types of CCM invocations.

The format of the callout definition lines:

ClassName[,ClassName]   [-ruc]+   CCMPathname
 

Table 7-7 describes the arguments to the command line:


Table 7-7: Callout Definition Lines
Element Description

ClassName[,ClassName]

A comma-separated list of one or more ClassNames that can be associated with this CCM. Do not place any whitespace in the comma separated list. The ClassName(s) must be object classes recognized by the CSRC schema.

[ruc]

A list of the types the CCM supports. You can use any combination of r (for Read) u (for Update) and c (for Commit). The preceding dash '-' is optional.

CCMPathname

The command line needed to invoke the CCM.

The CSRC object layer considers any line in the callout definition file that begins with a pound sign (#) or contains only whitespace a comment or formatting, and thus ignores it.

Example 7-5 is a sample callout definition file.


Example 7-5: Callout Definition File
# CSRC Callout Definition File
 
# Register acctsub_ccm to be called for all operations on Account and/or
# Subscriber objects.
Account,Subscriber						 -ruc 		/home/customer/ccm/acctsub_ccm
# Register modem_ccm to be called for read of modem objects
Modem 						-r		 /home/customer/ccm/modem_ccm
 

Edit the CSRC configuration file to indicate the path of your callout definition file. The addition of the CalloutMgr.CDF-Pathname entry enables callouts in the CSRC.

The format of the entry is:

CalloutMgr.CDF-Pathname = <the pathname of the callout definition file>

Callout Summary

The following contains the callouts for Read CCM, Update CCM, Commit CCM, and the checklist for installing CCMs.

Read CCM

Update CCM

Commit CCM

CCM Installation Check List

Callout Error Messages

The CSRC object layer log contains the following messages when the listed conditions occur.


Table 7-8: Callout Error Messages
Error Description

Cannot read the callout definition file at <callout definition file pathname from configuration file>.

Cannot find or open for reading the callout definition file specified in the configuration file.

Invalid callout definition file line <invalid line number>.

  • The comment line does not begin with pound sign in the first column.

  • There are embedded spaces in the comma-separated list of class names.

  • The CCM type flags are missing.

  • The CCM pathname is missing.

Invalid object class name <invalid name> specified in callout definition file.

The object classname specified does not exist in the CSRC application schema.

Invalid CCM type flag <invalid flag> specified in callout definition file.

The CCM type flag is not c, u, or r.

Cannot find CCM at pathname <pathname from callout definition file line>.

Cannot find or open for execution the CCM at the pathname specified.

Cannot invoke CCM at pathname <CCM pathname>.

  • CCM at pathname has been removed.

  • CCM at pathname does not execution permission.

CCM <ccm name> output invalid ObjectID <errant object id>.

The CCM has output an object id that was not passed to CCM input.

CCM <ccm name> specified invalid attribute name <errant attribute name> for object <object id>.

The CCM has output an attribute name that is invalid for the object class specified.

CCM <ccm name> specified <errant attribute name> for replacement and append for the same object <object id>.

The CCM has requested that CSRC replace and append an attribute for the same object.

CCM <ccm_name> attempted to write a read-only attribute <errant attribute name> for object <object id>.

CCM has attempted to replace or append ObjectID, Classname, SequenceNo, ObjectClass or Version attribute.

CCM <ccm_name> has rejected a CSRC database read. Reason: <standard output of CCM> (will be followed by all attributes of rejected objects).

A Read CMM returned a nonzero error code.

CCM <ccm_name> has rejected a CSRC change list. Reason: <standard output of CCM> (will be followed by all attributes of rejected objects and object operations).

An Update CCM returned a nonzero error code.

CCM <ccm_name> returned an error code after commit of a CSRC change list. Reason: <standard output of CCM> (followed by all attributes of rejected objects and object operations).

A Commit CCM returned a nonzero error code.

Example Callout Program (Perl)

Example 7-6 is a sample CCM callout program.


Example 7-6: README File Callout
# README File for Sample Callout ccm_log
#
#The purpose of this sample custom callout module (ccm) is to
#demonstrate the kind of data callouts receive.  This sample, if
#installed, accumulates a complete record of all data transactions
#(read, commit, write) to the datastore into a file called ccm.rpt.
#
#NOTE - You must add the following line to the csrc.cfg ( default
#installed to /opt/csrc/conf/)
#file in order to activate this callout:
CalloutMgr.cdf-pathname=<CCM_LOG_INSTALL_PATH>ccm_log.cfg
#where <CCM_LOG_INSTALL_PATH> should be replaced with the
#full path to the directory containing the file ccm_log.cfg
#
#
# In the file ccm_log.cfg you must replace the following
# strings with the correct paths:
#
# <PERL_PATH> - The complete path to the perl executable
# <SCRIPTS_PATH> - The complete path to the ccm_log.pl file, including
#   the final slash or backslash
#
# A sample line on Windows NT would look like:
Account -ruc ANAV c:\perl\bin\perl \Program Files\csrc\scripts\ccm_log.pl
# A sample line on Solaris would look like:
Account -ruc ANAV /usr/local/bin/perl /opt/csrc/scripts/ccm_log.pl
 

Example 7-7: ccm_log.pl
%op_type = (
	'-u', 'Update',
	'-c', 'Commit',
	'-r', 'Read'
);
 
$RPTFILE= join('', ">>", "ccm.rpt");
 
open RPTFILE;
 
 
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
print RPTFILE "************************************************************\n";
print RPTFILE "ccm_log.pl run on $mon/$mday/$year, $hour:$min:$sec\n";
 
$op = $op_type{lc($ARGV[0])};
$rcount = $ARGV[1];
$rtype = $ARGV[2];
print RPTFILE "\nOperation: $op\n";
print RPTFILE "Record Count: $rcount\n";
print RPTFILE "Record Class: $rtype\n\n";
 
while (1)
{
    $line = <STDIN>;
 
	if ( $line =~ /^ObjectID\=/ ) {
		print RPTFILE "____________________________________________________________\n";
    	print  RPTFILE "\nRecord Class: $rtype\n";
	}
    print RPTFILE "$line";
    last unless $line;
}
 
close RPTFILE;
 
exit 0;


hometocprevnextglossaryfeedbacksearchhelp
Posted: Fri Oct 22 07:44:42 PDT 1999
Copyright 1989-1999©Cisco Systems Inc.