cc/td/doc/product/rtrmgmt/bacbba/bacbba25
hometocprevnextglossaryfeedbacksearchhelp
PDF

Table of Contents

Creating a Client Application

Creating a Client Application


To interact with Broadband Access Center, a client must first connect to the CNS Server and get a token. The token is then passed to the SPM NBAPI (first example that follows) or to Inv NBAPI . Thus, in the first example, the basic steps are: get authenticated then, once authenticated, call the CNS Manager to get a security token; then, pass the security token into SPM NBAPI for service request processing. A README file at the end of examples provides additional information on how to pass a value to SPM NBAPI process_provision_request parameters. The usage is:

ServiceProvisionClient + inputFile + server_name + serverHost_Name

The text files (with .txt extension) are examples of inputFile needed for creating device provisioning and subscriber provisioning. The code examples that follows illustrate how this is done. Other code examples are included to illustrate how to create, delete, and modify objects.

ServiceProvisionClient.java

This example shows how to write authentication procedure in order to obtain a security token. Once the security token is obtained by an authenticated user, it must be a part of every subsequent call to the NBAPI (north bound API is the CORBA interface accessible to client programmers).

package spm.client.srm;
import com.cisco.cnscs.util.*;
import java.util.*;
import CommonDefinition.*;
import SecurityService.*;
import ServiceProvisioning.*;
import org.omg.CORBA.IntHolder;
import java.io.*;
import java.net.InetAddress;
import IE.Iona.OrbixWeb.*;
import IE.Iona.OrbixWeb.Features.*;
import IE.Iona.OrbixWeb._CORBA;
import com.cisco.dslnms.util.*;
import org.omg.CORBA.*;
import org.omg.CORBA.IntHolder;
import org.omg.CORBA.StringHolder;
import org.omg.CORBA.SystemException;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.* ;
// CNS Library:
import com.cisco.cns.security.corba.authorization.* ;
import com.cisco.cns.security.corba.authentication.* ;
import com.cisco.cns.security.corba.cda.* ;
import com.cisco.cns.security.corba.common.* ;
import com.cisco.cns.security.corba.dess.* ;
import com.cisco.cns.security.corba.cns.* ;
class ServiceProvisionClient {
static final String defaultServerName = "SPM_Plus";
static org.omg.CORBA.Object sOR = null;
static NamingContext rootContext;
static CNSServiceManager cnsMgr = null;
static SecurityService.SecurityToken sec_tok;
static void printUsage() {
System.out.println("\n\n Usage : <program_name> <hostName> <service request data file> <userName> <usrPassword> ");
}
public static ServiceProvisioning.ServiceRequest populateServiceRequest(String fileName) {
ConfigReader cfg = new ConfigReader();
String refId=null, desc=null, operId=null, custId=null, profileId=null,techType=null,defOpType=null;
String deviceId=null, deviceType=null, deviceModel=null,deviceSubType=null,deviceTag=null;
String sfName=null,sfOp=null;
Vector blocks = null;
String blockName = null;
NVPair[] serviceParams=new NVPair[0];
serviceParams=new NVPair();
NVPair[] configs;
NVPair[] sfParams;
FeatureData [] sfList=null;
try {
// read the service request params from the input file
cfg.initTextConfig(fileName);
blocks = cfg.getBlockNames("");
refId = cfg.getConfigItem("REQUEST_REFERENCE_ID");
desc = cfg.getConfigItem("DESCRIPTION");
operId = cfg.getConfigItem("OPERATOR_ID");
techType = cfg.getConfigItem("TECHNOLOGY_TYPE");
custId = cfg.getConfigItem("CUSTOMER_ID");
profileId = cfg.getConfigItem("SERVICE_CATEGORY_ID");
defOpType= cfg.getConfigItem("DEFAULT_OPERATION_TYPE");
// System.out.println("\n Total Blocks : " + blocks.size());
int sfCnt=0;
for (int r=0; r<blocks.size(); r++) {
blockName = (String) blocks.elementAt(r);
if ( blockName.startsWith("SERVICE_FEATURE")) ++sfCnt;
else if (!blockName.equals("SERVICE_PARAMETER"))
System.out.println("\n Unexpected Block :: " + blockName + " in the input file. Block Data Ignored.");
}
sfList = new FeatureData[sfCnt];
sfCnt=0;
for (int r=0; r<blocks.size(); r++) {
blockName = (String) blocks.elementAt(r);
// System.out.println("Checking block element: " + blockName);
if (blockName.startsWith("SERVICE_FEATURE")) {
String sfBlockName = blockName;
NEInfo [] neList=null;
int neCnt = 0 ;
Vector neBlocks = cfg.getBlockNames(sfBlockName);
sfName = cfg.getConfigItem(sfBlockName + "::NAME");
sfOp = cfg.getConfigItem(sfBlockName + "::OPERATION");
System.out.println("\n===== Service Request Input params: ==========");
System.out.println("Servie Feature " + sfName + " " + sfOp);
Vector featureParams = cfg.getConfigItemNames( sfBlockName+"::FEATURE_PARAMS");
if (featureParams != null ) {
sfParams = new NVPair[featureParams.size()];
for(int i=0;i<featureParams.size();++i) {
String _name = (String) featureParams.elementAt(i);
String _value = cfg.getConfigItem(sfBlockName+"::FEATURE_PARAMS::" + _name);
System.out.println("ServiceFeature Param :: " + _name + " = " + _value);
if (_value == null) _value ="";
sfParams[i] = new NVPair(_name,_value);
}
}
else
sfParams = new NVPair[0];
for (int p=0;p<neBlocks.size();++p)
if (((String) neBlocks.elementAt(p)).startsWith("NETWORK_ELEMENT")) ++neCnt;
// System.out.println("\n There Are " + neCnt + " Network Elements");
neList = new NEInfo[neCnt];
neCnt = 0;
for (int p=0;p<neBlocks.size();++p) {
String neBlockName = (String) neBlocks.elementAt(p);
if (neBlockName.startsWith("NETWORK_ELEMENT")) {
String fullBlockName = sfBlockName +"::" + neBlockName;
deviceId = cfg.getConfigItem(fullBlockName + "::ID");
deviceType = cfg.getConfigItem(fullBlockName + "::TYPE");
// Check provision Profile if you have a SUBTYPE TAG (it's an XML // file); if yes, then the next line of code is OK; else, assign null pointer to //deviceSubType. Follow the same procedure for deviceModel.
deviceSubType = cfg.getConfigItem(fullBlockName + "::SUBTYPE");
deviceModel = cfg.getConfigItem(fullBlockName + "::MODEL");
deviceTag = cfg.getConfigItem(fullBlockName + "::TAG");
// System.out.println("\n Network Element : " + deviceId + " "+ deviceType + " " + deviceSubType + " " + deviceModel + " " + deviceTag);
Vector configParams = cfg.getConfigItemNames( fullBlockName+"::CONFIG_PARAMS");
if (configParams != null ) {
configs = new NVPair[configParams.size()];
for (int i=0;i<configParams.size();++i) {
String _name = (String) configParams.elementAt(i);
String _value = cfg.getConfigItem(fullBlockName+"::CONFIG_PARAMS::" + _name);
// System.out.println("\n Config Param:: " + _name + " = " + _value);
if (_value == null) _value ="";
configs[i] = new NVPair(_name,_value);
}
}
else
configs = new NVPair[0];
neList[neCnt++] = new NEInfo(deviceId,deviceTag,deviceModel,deviceType,deviceSubType,configs);
}
} //end of reading the ne info
sfList[sfCnt++] = new FeatureData(sfName,sfOp,sfParams,neList);
} // end of reading the service feature
else if (blockName.startsWith("SERVICE_PARAMETER")) {
Vector globalParams = cfg.getConfigItemNames(blockName);
if (globalParams != null ) {
serviceParams = new NVPair[ globalParams.size()];
for (int i=0;i< globalParams.size();++i) {
String _name = (String) globalParams.elementAt(i);
String _value = cfg.getConfigItem(blockName+"::" + _name);
// System.out.println("\n Global Service Param :: " + _name + " = " + _value);
if (_value == null) _value ="";
serviceParams[i] = new NVPair(_name,_value);
}
}
}
} // for loop
}
catch (Exception ex) {
System.out.println("\n There was an error in populating the service request.\n" + ex);
ex.printStackTrace();
System.exit(-1);
}
return new ServiceProvisioning.ServiceRequest(profileId,refId,desc,operId,
techType,defOpType,custId, serviceParams,sfList);
} //end of method
static public void main(String [] args) {
String serverName = ":" + defaultServerName;
if (args.length < 2 ) {
printUsage();
System.exit(-1);
}
String hostName = new String (args[0]);
try {
ORB anOrb = ORB.init(args,null);
int clientId = (new Random()).nextInt(1000);
InetAddress theLocalAddress = InetAddress.getLocalHost();
String theLocalHost = theLocalAddress.getHostName();
String appName = theLocalHost + "_" + clientId;
_OrbixWeb.ORB (anOrb).enableServiceContextList(true);
ClientContextHandler mySrvContext = new ClientContextHandler(5,appName);
_OrbixWeb.ORB (anOrb).registerPerRequestServiceContextHandler(mySrvContext);
ORB.init(args,null);
sOR = CNSServiceManagerHelper.bind (":CNSManager",hostName);
if (sOR == null) {
System.out.println("Bind to LogServer fails.");
}
// The next block is used to call CNS Manager to get a security token
// for a authenticated user.
cnsMgr = CNSServiceManagerHelper.narrow(sOR);
AuthenticationManager authMgr = cnsMgr.getAuthenticationManager();
// You need to create the user accounet (with userName and passwd)
// from BAC2.5 GUI window first
String usrName = args[2];
String passwd = args[3];
AttributeListHolder attrListHolder = new AttributeListHolder(new sAttribute[0]);
EnvironmentContextHolder envContHolder = new EnvironmentContextHolder(new sBOMEntry[0]);
//========================================
// == authenticateUser ==
//========================================
sAttribute[] attrs = new sAttribute[0] ;
AuthenticateWithPassword authPW = null ;
Authenticate atn = null ;
authPW = authMgr.getPasswordAuthenticate();
System.out.println(" getPasswordAuthenticate call is Successfull " ) ;
sResponse response = null ;
response= authPW.authenticate(userName,paswd, attrListHolder, envContHolder) ;
// pass the sec_tok to SPM NBAPI
sec_tok = new SecurityService.SecurityToken(args[2],response.token);
// System.out.println(" Authenticate call is Successfull ");
} // try
catch (CNSException cnsException) {
System.out.println("Authenticate message Exception is: " + cnsException.e.message);
System.out.println("Authenticate details Exception is: " + cnsException.e.details);
System.out.println("Authenticate trace Exception is: " + cnsException.e.trace);
System.exit(0);
}
catch(InvalidMechanismOrProviderException e) {
System.out.println("Authenticate Exception is " + e);
System.exit(0);
}
catch ( OptionsNotSupportedException e) {
System.out.println("RealAuthenticate Exception is " + e);
System.exit(0);
}
catch (Exception ex) {}
// following block is for Client bind to SPM Server
// create a service request
ServiceProvisioning.ServiceRequest serviceRequest = populateServiceRequest(args[1]);
IntHolder serviceId = new IntHolder();
try {
// get a handle to the remote CORBA object
ProvisionMgr spmHandle;
spmHandle = ServiceProvisioning.ProvisionMgrHelper.bind(":SPM_Plus",hostName);
// System.out.println("\n Bind Completed...");
for(int x=0;x<1;++x) { /* this loop is just to check the thread scheduling in server side */
try {
ResultInfo _result = spmHandle.process_provision_request(sec_tok,serviceRequest,serviceId);
System.out.println("\nAPI Result (minorCode): " + _result.minor_code);
System.out.println("\nAPI Result (msg_text): " + _result.msg_text);
}
catch (Exception excp) {
System.out.println("\n Caught EXception : " + excp);
}
} //for
} // try
catch (Exception ex) {
System.out.println("\n Exception in bind :: " + ex);
}
} // main()
}

Use Scenario

The following section presents short descriptions of several examples of device provision/unprovision and subscriber provision/unprovision for the PTAPPoEoA Role.

Selected Service Feature:

Basic Service Feature (mandatory requirement for all other service features) AAA service feature and SinglePVC service feature.

Test scenario:

SPM NBAPI client source code: ServiceProvisionClient.java

SPM NBAPI client class : ServiceProvisionClient.class

Command:

ServiceProvisionClient + serverHostName + inputFile + speUserName + spePassword

Procedures:

ADD services:

1. add Basic Service

input fileName: addBasic.txt

2. add Radius Service

input fileName: addRadius.txt

3. add SinglePVC Service

input fileName: addSinglePVC.txt

4. enable subscriber with (AAA) Radius service

input fileName: addSubscriberService.txt

5. associate subscriber with singlePVC service

input fileName: addSubscriber_singlePVC.txt

DELETE services:

1. de-associate subscriber with singlePVC service

input fileName: delSubscriber_singlePVC.txt

2. disable subscriber with (AAA) Radius service

input fileName: delSubscriberService.txt

3. delete SinglePVC Service

input fileName: delSinglePVC.txt

4. delete Radius Service

input fileName: delRadius.txt

5. delete Basic Service

input fileName: delBasic.txt

addBasic.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Basic Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=Basic
OPERATION= ADD
[begin FEATURE_PARAMS]
FEATURE_ID = addBasic
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_hostname = SP25_ESR_1
System_COND_RADIUS = RADIUS
System_COND_CNOTE = false
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

addRadius.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Radius Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=Radius
OPERATION= ADD
[begin FEATURE_PARAMS]
FEATURE_ID = addradius
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_radius_ip_address = x.x.x.x
System_radius_auth_port = 1645
System_radius_acct_port = 1646
System_radius_key = CISCO
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE3]

addSinglePVC.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=XXX
REQUEST_REFERENCE_ID= addSingePVC
DESCRIPTION=Adding a Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=SinglePVC
OPERATION= ADD
[begin FEATURE_PARAMS]
## the fetaure ID should be unique per Service Request
FEATURE_ID = ATM$Card_${Module}_$Port_$VPI_$VCI
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/San_Jose/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
PP_DOWNLOAD_METHOD = Deployed_Only
System_qos_type = ubr
System_ATM_interface = ATM1/0.6
System_ATM_sub_interface_no = 10
System_qos_rate = 1500
System_pvc_vpi = 10
System_pvc_vci = 320
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

addSubscriber_SinglePVC.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber singlePVC provision
DESCRIPTION= subscirber singlePVC provision
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=Interface
OPERATION= ADD
[begin FEATURE_PARAMS]
## featureID: RDN of value of System_interface_endpoint
## in CONFIG_PARAMs section
FEATURE_ID =1(1-32)
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/ISP-0/subscriber-4
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/Net-0/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_interface_endpoint =/systemTitle=ACT/NIMRoot/Net-0/ESR_99/ATM 7/Module 0/Port 0/1(1-32)
System_COND_pvc_in_range = false
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE3]

addSubscriberService.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber service provision
DESCRIPTION= subscirber service
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE1]
NAME=Service
OPERATION= ADD
[begin FEATURE_PARAMS]
## subscriber provision's FEATURE_ID: RDN of system_service_id in CONFIG_PARAMS block
## below the value "service-jc-1" is the Resource service object name
FEATURE_ID = service-jc-1
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/sp_jc1/jc1_sub1
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_service_id= /systemTitle=ACT/ResourceRoot/Service/service-jc-1
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

delBasic.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Basic Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=Basic
OPERATION= DELETE
[begin FEATURE_PARAMS]
FEATURE_ID = addBasic
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

delRadius.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Radius Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE1]
NAME=Radius
OPERATION= DELETE
[begin FEATURE_PARAMS]
FEATURE_ID = addradius
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_radius_ip_address = x.x.x.x
System_radius_auth_port = 1645
System_radius_acct_port = 1646
System_radius_key = CISCO
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

delSinglePVC.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=XXX
REQUEST_REFERENCE_ID= addSingePVC
DESCRIPTION=Adding a Service.
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
#service profile id
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=SinglePVC
OPERATION= DELETE
[begin FEATURE_PARAMS]
## the fetaure ID should be unique per Service Request
FEATURE_ID = ATM$Card_${Module}_$Port_$VPI_$VCI
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/San_Jose/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

delSubscriber_SinglePVC.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber singlePVC provision
DESCRIPTION= subscirber singlePVC provision
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE3]
NAME=Interface
OPERATION= DELETE
[begin FEATURE_PARAMS]
## featureID: RDN of value of System_interface_endpoint
## in CONFIG_PARAMs section
FEATURE_ID =1(1-32)
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/ISP-0/subscriber-4
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/Net-0/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_interface_endpoint =/systemTitle=ACT/NIMRoot/Net-0/ESR_99/ATM 7/Module 0/Port 0/1(1-32)
System_COND_pvc_in_range = false
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE3]

delSubscriberService.txt

Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber service provision
DESCRIPTION= subscirber service
OPERATOR_ID=tester
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
[end SERVICE_PARAMETER]
[begin SERVICE_FEATURE1]
NAME=Service
OPERATION= DELETE
[begin FEATURE_PARAMS]
## subscriber provision's FEATURE_ID: RDN of system_service_id in CONFIG_PARAMS block
## below the value "service-jc-1" is the Resource service object name
FEATURE_ID = service-jc-1
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/sp_jc1/jc1_sub1
[end FEATURE_PARAMS]
# defining network elements
[begin NETWORK_ELEMENT1]
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
TYPE= Aggregator
SUBTYPE=
MODEL= C10K
TAG=
[begin CONFIG_PARAMS]
System_service_id= /systemTitle=ACT/ResourceRoot/Service/service-jc-1
[end CONFIG_PARAMS]
[end NETWORK_ELEMENT1]
[end SERVICE_FEATURE1]

Creating a Service Request

Procedure how to create a service request by the NBAPI, as defined in ServiceProvision.idl, is described in Appendix A.

Example of template file of addBasic Service (device provision)

<Template>
<?BAC_VERSION version="2.5"?>
<VarDeclaration>
<String VarName="System_COND_RADIUS"/>
<String VarName="System_COND_CNOTE"/>
<String VarName="System_CNOTE_ip_address"/>
</VarDeclaration>
<SubTemplateDeclaration>
</SubTemplateDeclaration>
<MainTemplateDef><![CDATA[
#set ($radius = "RADIUS")
#set ($tt = "true")
no logging console
ip cef
aaa new-model
#if ($System_COND_RADIUS == $radius)
aaa authentication ppp default radius local
#else
aaa authentication ppp default local
#end
aaa authorization network default group radius
virtual-profile aaa
#if ($System_COND_CNOTE == $tt)
logging on
logging $System_CNOTE_ip_address
#end
]]></MainTemplateDef>
<NegationTemplateDef><![CDATA[
]]></NegationTemplateDef>
<UserSection><![CDATA[
<GuiDescription>
<style CType="Style">
<type>SingleDataSet</type>
<action CType="TmogAction">
<classPath>com.cisco.dslnms.tmog.ActionHandle</classPath>
</action>
</style>
<componentList CType="ComponentList">
<DropdownList>
<name>System_COND_RADIUS</name>
<displayName>Authentication Type</displayName>
<required>false</required>
<disabled>false</disabled>
<invisible>false</invisible>
<defaultValueList CType="TextList">
<String >RADIUS</String>
<String >LOCAL</String>
</defaultValueList>
</DropdownList>
<CheckBox>
<name>System_COND_CNOTE</name>
<displayName>CNOTE</displayName>
<required>false</required>
<disabled>false</disabled>
<invisible>false</invisible>
<value>true</value>
<enableVarList CType="TextList">
<String >System_CNOTE_ip_address</String>
</enableVarList>
</CheckBox>
<IPV4Field>
<name>System_CNOTE_ip_address</name>
<displayName>CNOTE IP Address</displayName>
<required>false</required>
<action CType="TmogAction">
<classPath>com.cisco.dslnms.tmog.actions.TmogBasicCnoteHandle</classPath>
</action>
<disabled>false</disabled>
<invisible>false</invisible>
<readOnly>false</readOnly>
</IPV4Field>
</componentList>
</GuiDescription>
]]></UserSection>
</Template>

Example of NVPair list passed to config_param of add basic service on device provision

System_COND_RADIUS = RADIUS
System_COND_CNOTE = true
System_CNOTE_ip_address = a.b.c.d

Create, Delete, Modify Objects

The following code provides an example of how to get a token in order to create, delete, and modify, and associate objects. The XML files at the end of the code are examples of XML files needed to modify the objects. The logical flow is: call the CNS Manager to get a token for an authenticated user; then, pass the security token into Inv NBAPI to work on objects. The basic usage is:

invObjClient + serverHost_Name + xmlFile + userName + password

invObjClient.java

package com.cisco.nsm.inv_mgr.devTest;
import java.util.*;
import java.io.*;
import java.net.InetAddress;
import IE.Iona.OrbixWeb.*;
import IE.Iona.OrbixWeb.Features.*;
import IE.Iona.OrbixWeb._CORBA;
import com.cisco.dslnms.util.*;
import org.omg.CORBA.*;
import org.omg.CORBA.IntHolder;
import org.omg.CORBA.StringHolder;
import org.omg.CORBA.SystemException;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.* ;
// CNS Library:
import com.cisco.cns.security.corba.authorization.* ;
import com.cisco.cns.security.corba.authentication.* ;
import com.cisco.cns.security.corba.cda.* ;
import com.cisco.cns.security.corba.common.* ;
import com.cisco.cns.security.corba.dess.* ;
import com.cisco.cns.security.corba.cns.* ;
//Inventory
import Inventory.*;
import CommonDefinition.*;
import SecurityService.*;
class invObjClient {
static org.omg.CORBA.Object sOR = null;
static NamingContext rootContext;
static CNSServiceManager cnsMgr = null;
static SecurityService.SecurityToken sec_tok;
static void printUsage() {
System.out.println("\n\n Usage : <program_name> <hostName> <inventory XML file> <userName> <usrPassword> ");
}
public static String file_to_xml(String fileName) {
String xmlStr = new String("");
if (fileName == null || fileName == "") {
System.out.println("The fileName: " + fileName + " is not valid. ");
System.exit(1);
}
try {
BufferedReader buff = new BufferedReader(new FileReader(fileName));
String tmpStr = "";
while (( tmpStr = buff.readLine()) != null) {
String t = tmpStr.trim();
if (t.length() != 0) {
xmlStr += t + "\n";
}
}
}
catch (FileNotFoundException e) {
System.out.println("FileNotFoundException " + e.toString());
System.exit(1);
}
catch (IOException e){
System.out.println("FileNotFoundException " + e.toString());
System.exit(1);
}
// System.out.println("DEBUG: xmlStr is: " + xmlStr);
return xmlStr;
}
static public void main(String [] args) {
if (args.length < 2 ) {
printUsage();
System.exit(-1);
}
String hostName = new String (args[0]);
String fileName = new String (args[1]);
try {
ORB anOrb = ORB.init(args,null);
int clientId = (new Random()).nextInt(1000);
InetAddress theLocalAddress = InetAddress.getLocalHost();
String theLocalHost = theLocalAddress.getHostName();
String appName = theLocalHost + "_" + clientId;
_OrbixWeb.ORB (anOrb).enableServiceContextList(true);
ClientContextHandler mySrvContext = new ClientContextHandler(5,appName);
_OrbixWeb.ORB (anOrb).registerPerRequestServiceContextHandler(mySrvContext);
ORB.init(args,null);
sOR = CNSServiceManagerHelper.bind (":CNSManager",hostName);
if (sOR == null) {
System.out.println("Bind to LogServer fails.");
}
// Below the block is used to call CNS Manager to get a security token
// for a authenticated user.
cnsMgr = CNSServiceManagerHelper.narrow(sOR);
AuthenticationManager authMgr = cnsMgr.getAuthenticationManager();
// You need to create the user accounet (with userName and passwd)
// from BAC2.5 GUI window first
String usrName = args[2];
String passwd = args[3];
LoginWithPassword logpw = null;
Login login = null;
logpw = authMgr.getPasswordLogin();
// System.out.println(" getPasswordLogin call is Successfull");
sResponse userResponse = null ;
AttributeListHolder attrListHolder = new AttributeListHolder(new sAttribute[0]);
EnvironmentContextHolder envContHolder = new EnvironmentContextHolder(new sBOMEntry[0]);
userResponse = logpw.login(usrName, passwd, attrListHolder,envContHolder);
// System.out.println(" Login With Password call is Successfully");
//========================================
// == authenticateUser ==
//========================================
sAttribute[] attrs = new sAttribute[0] ;
AuthenticateWithPassword authPW = null ;
Authenticate atn = null ;
authPW = authMgr.getPasswordAuthenticate();
// System.out.println(" getPasswordAuthenticate call is Successfull " ) ;
sResponse response = null ;
response= authPW.authenticate(usrName,passwd, attrListHolder, envContHolder) ;
// pass the sec_tok to SPM NBAPI
sec_tok = new SecurityService.SecurityToken(args[2],response.token);
System.out.println("CNS: Authenticate call is Successfull ");
} // try
catch (CNSException cnsException) {
System.out.println("Authenticate message Exception is: " + cnsException.e.message);
System.out.println("Authenticate details Exception is: " + cnsException.e.details);
System.out.println("Authenticate trace Exception is: " + cnsException.e.trace);
System.exit(0);
}
catch(InvalidMechanismOrProviderException e) {
System.out.println("Authenticate Exception is " + e);
System.exit(0);
}
catch ( OptionsNotSupportedException e) {
System.out.println("RealAuthenticate Exception is " + e);
System.exit(0);
}
catch (Exception ex) {}
// following block is for Client bind to Inventory Manager
try {
// get a handle to the remote CORBA object
InventoryMgr invHandle;
sOR = InventoryMgrHelper.bind(":InventoryManager",args[0]);
if( sOR == null) {
System.out.println("Bind to InventoryManager failed.");
System.exit(1);
}
invHandle = InventoryMgrHelper.narrow(sOR);
System.out.println("Bind to InventoryManager successfully.");
String req_xml = file_to_xml(fileName);
try {
ResultInfo _result = invHandle.action(sec_tok,req_xml);
System.out.println("\nAPI Result (minorCode): " + _result.minor_code);
System.out.println("\nAPI Result (msg_text): " + _result.msg_text);
}
catch (Exception excp) {
System.out.println("\n Caught EXception : " + excp);
}
} // try
catch (Exception ex) {
System.out.println("\n Exception " + ex);
}
} // main()
}

createAdminNetwrk — Sample XML File

<VcCreateAction>
<description>create adminnetwork</description>
<actionId>ID#1</actionId>
<actionObject CType="VcAdminNetwork">
<parentFDN>/systemTitle=ACT/NIMRoot</parentFDN>
<objectRDN>joanne_network</objectRDN>
<technology>VoIPoATM</technology>
<domainName>pluto.cisco.com</domainName>
<description>create network: joanne_network</description>
</actionObject>
</VcCreateAction>

createResourceAAA.xml — Sample XML File

<VcCreateAction>
<description>AAA </description>
<actionId>ID#1</actionId>
<actionObject CType="VcGenericResource">
<parentFDN>/systemTitle=ACT/ResourceRoot/AAA</parentFDN>
<objectRDN>e.g:172.29.145.254</objectRDN>
<resourceType>Resource_AAA</resourceType>
<resourceName></resourceName>
<attributeList CType="ActIdValueListStruct">
<ActIdValueAttrStruct>
<id>aaaType</id>
<value>CAR</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaHostName</id>
<value>cem-sf280-8</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaIpAddress</id>
<value>172.29.145.254</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaInstallationPath</id>
<value>/opt/CSCOar</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaHostRootPasswd</id>
<value>cem-sf280-8</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaServerLoginId</id>
<value>admin</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaServerLoginPasswd</id>
<value>aicuser</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaAuthPort</id>
<value>1645</value>
</ActIdValueAttrStruct>
<ActIdValueAttrStruct>
<id>aaaAccountPort</id>
<value>1646</value>
</ActIdValueAttrStruct>
</attributeList>
<ownerList CType="VcStringList">
<String>sp_jc1</String>
</ownerList>
</actionObject>
</VcCreateAction>

setAssociationAAAwithNetwork1.xml — Sample XML File

<SetAssociationAction>
<description>set association </description>
<actionId> ID#1 </actionId>
<actionObject CType ="VcResourceAssociation">
<!-- associate AAA with network -->
<associationPoint>/systemTitle=ACT/NIMRoot/joanne_network</associationPoint>
<!-- Or, you can associate AAA with aggregator associationPoint>/systemTitle=ACT/NIMRoot/joanne_network/aggregator</associationPoint> -->
<associationInfoList CType="VcAssociationInfoList">
<VcAssociationInfo>
<opFlag>replace</opFlag>
<resourceList CType="VcObjectList">
<VcGenericResource>
<parentFDN> /systemTitle=ACT/ResourceRoot/AAA </parentFDN>
<objectRDN> 172.29.145.254 </objectRDN>
</VcGenericResource>
</resourceList>
</VcAssociationInfo>
</associationInfoList>
</actionObject>
</SetAssociationAction>


hometocprevnextglossaryfeedbacksearchhelp
Posted: Thu May 22 06:43:57 PDT 2003
All contents are Copyright © 1992--2003 Cisco Systems, Inc. All rights reserved.
Important Notices and Privacy Statement.