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).
import com.cisco.cnscs.util.*;
import CommonDefinition.*;
import SecurityService.*;
import ServiceProvisioning.*;
import org.omg.CORBA.IntHolder;
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.IntHolder;
import org.omg.CORBA.StringHolder;
import org.omg.CORBA.SystemException;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.* ;
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;
NVPair[] serviceParams=new NVPair[0];
serviceParams=new NVPair();
FeatureData [] sfList=null;
// 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());
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];
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;
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);
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];
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);
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);
System.out.println("\n There was an error in populating the service request.\n" + ex);
return new ServiceProvisioning.ServiceRequest(profileId,refId,desc,operId,
techType,defOpType,custId, serviceParams,sfList);
static public void main(String [] args) {
String serverName = ":" + defaultServerName;
String hostName = new String (args[0]);
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);
sOR = CNSServiceManagerHelper.bind (":CNSManager",hostName);
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];
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 ");
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);
catch(InvalidMechanismOrProviderException e) {
System.out.println("Authenticate Exception is " + e);
catch ( OptionsNotSupportedException e) {
System.out.println("RealAuthenticate Exception is " + e);
// following block is for Client bind to SPM Server
// create a service request
ServiceProvisioning.ServiceRequest serviceRequest = populateServiceRequest(args[1]);
IntHolder serviceId = new IntHolder();
// get a handle to the remote CORBA object
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 */
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);
System.out.println("\n Caught EXception : " + excp);
System.out.println("\n Exception in bind :: " + ex);
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.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
System_hostname = SP25_ESR_1
System_COND_RADIUS = RADIUS
System_COND_CNOTE = false
addRadius.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Radius Service.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
System_radius_ip_address = x.x.x.x
System_radius_auth_port = 1645
System_radius_acct_port = 1646
System_radius_key = CISCO
addSinglePVC.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=XXX
REQUEST_REFERENCE_ID= addSingePVC
DESCRIPTION=Adding a Service.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
## the fetaure ID should be unique per Service Request
FEATURE_ID = ATM$Card_${Module}_$Port_$VPI_$VCI
# defining network elements
ID= /systemTitle=ACT/NIMRoot/San_Jose/ESR_99
PP_DOWNLOAD_METHOD = Deployed_Only
System_ATM_interface = ATM1/0.6
System_ATM_sub_interface_no = 10
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
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
## featureID: RDN of value of System_interface_endpoint
## in CONFIG_PARAMs section
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/ISP-0/subscriber-4
# defining network elements
ID= /systemTitle=ACT/NIMRoot/Net-0/ESR_99
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
addSubscriberService.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber service provision
DESCRIPTION= subscirber service
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=ADD
[begin SERVICE_PARAMETER]
## 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
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
System_service_id= /systemTitle=ACT/ResourceRoot/Service/service-jc-1
delBasic.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Basic Service.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
delRadius.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=xxx
REQUEST_REFERENCE_ID=test
DESCRIPTION=Adding a Radius Service.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
System_radius_ip_address = x.x.x.x
System_radius_auth_port = 1645
System_radius_acct_port = 1646
System_radius_key = CISCO
delSinglePVC.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID=xxx
SECURITY_TOKEN_STRING=XXX
REQUEST_REFERENCE_ID= addSingePVC
DESCRIPTION=Adding a Service.
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Devices/BroadBand/Prov/PTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
## the fetaure ID should be unique per Service Request
FEATURE_ID = ATM$Card_${Module}_$Port_$VPI_$VCI
# defining network elements
ID= /systemTitle=ACT/NIMRoot/San_Jose/ESR_99
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
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
## featureID: RDN of value of System_interface_endpoint
## in CONFIG_PARAMs section
SUBSCRIBER_ID = /systemTitle=ACT/SubscriberRoot/ISP-0/subscriber-4
# defining network elements
ID= /systemTitle=ACT/NIMRoot/Net-0/ESR_99
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
delSubscriberService.txt
Sample Service Request Data File.
SECURITY_TOKEN_USERID= xxx
SECURITY_TOKEN_STRING= xxx
REQUEST_REFERENCE_ID= subscriber service provision
DESCRIPTION= subscirber service
TECHNOLOGY_TYPE= BroadBand
CUSTOMER_ID=SubscriberCisco
SERVICE_CATEGORY_ID= /Default/ServiceProfiles/Subscribers/BroadBand/SubscriberPTAPPPoEoA
DEFAULT_OPERATION_TYPE=DELETE
[begin SERVICE_PARAMETER]
## 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
# defining network elements
ID= /systemTitle=ACT/NIMRoot/jc_network/ESR_99
System_service_id= /systemTitle=ACT/ResourceRoot/Service/service-jc-1
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)
<?BAC_VERSION version="2.5"?>
<String VarName="System_COND_RADIUS"/>
<String VarName="System_COND_CNOTE"/>
<String VarName="System_CNOTE_ip_address"/>
</SubTemplateDeclaration>
<MainTemplateDef><![CDATA[
#set ($radius = "RADIUS")
#if ($System_COND_RADIUS == $radius)
aaa authentication ppp default radius local
aaa authentication ppp default local
aaa authorization network default group radius
#if ($System_COND_CNOTE == $tt)
logging $System_CNOTE_ip_address
<NegationTemplateDef><![CDATA[
]]></NegationTemplateDef>
<type>SingleDataSet</type>
<action CType="TmogAction">
<classPath>com.cisco.dslnms.tmog.ActionHandle</classPath>
<componentList CType="ComponentList">
<name>System_COND_RADIUS</name>
<displayName>Authentication Type</displayName>
<required>false</required>
<disabled>false</disabled>
<invisible>false</invisible>
<defaultValueList CType="TextList">
<name>System_COND_CNOTE</name>
<displayName>CNOTE</displayName>
<required>false</required>
<disabled>false</disabled>
<invisible>false</invisible>
<enableVarList CType="TextList">
<String >System_CNOTE_ip_address</String>
<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>
<disabled>false</disabled>
<invisible>false</invisible>
<readOnly>false</readOnly>
Example of NVPair list passed to config_param of add basic service on device provision
System_COND_RADIUS = RADIUS
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.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.IntHolder;
import org.omg.CORBA.StringHolder;
import org.omg.CORBA.SystemException;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.* ;
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.* ;
import CommonDefinition.*;
import SecurityService.*;
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. ");
BufferedReader buff = new BufferedReader(new FileReader(fileName));
while (( tmpStr = buff.readLine()) != null) {
String t = tmpStr.trim();
catch (FileNotFoundException e) {
System.out.println("FileNotFoundException " + e.toString());
System.out.println("FileNotFoundException " + e.toString());
// System.out.println("DEBUG: xmlStr is: " + xmlStr);
static public void main(String [] args) {
String hostName = new String (args[0]);
String fileName = new String (args[1]);
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);
sOR = CNSServiceManagerHelper.bind (":CNSManager",hostName);
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];
LoginWithPassword logpw = 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 ");
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);
catch(InvalidMechanismOrProviderException e) {
System.out.println("Authenticate Exception is " + e);
catch ( OptionsNotSupportedException e) {
System.out.println("RealAuthenticate Exception is " + e);
// following block is for Client bind to Inventory Manager
// get a handle to the remote CORBA object
sOR = InventoryMgrHelper.bind(":InventoryManager",args[0]);
System.out.println("Bind to InventoryManager failed.");
invHandle = InventoryMgrHelper.narrow(sOR);
System.out.println("Bind to InventoryManager successfully.");
String req_xml = file_to_xml(fileName);
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);
System.out.println("\n Caught EXception : " + excp);
System.out.println("\n Exception " + ex);
createAdminNetwrk Sample XML File
<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>
createResourceAAA.xml Sample XML File
<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">
<value>cem-sf280-8</value>
<value>172.29.145.254</value>
<id>aaaInstallationPath</id>
<value>/opt/CSCOar</value>
<id>aaaHostRootPasswd</id>
<value>cem-sf280-8</value>
<id>aaaServerLoginId</id>
<id>aaaServerLoginPasswd</id>
<ownerList CType="VcStringList">
setAssociationAAAwithNetwork1.xml Sample XML File
<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">
<resourceList CType="VcObjectList">
<parentFDN> /systemTitle=ACT/ResourceRoot/AAA </parentFDN>
<objectRDN> 172.29.145.254 </objectRDN>
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 .