Cisco Cisco Configuration Engine 3.5 开发者指南
![Cisco](https://files.manualsbrain.com/attachments/7380d0050044647c30f5c24bbbf5d0c0b6d9bb84/common/fit/150/50/faa183d287233c52228cfea3dbc2a127fe780f60564fcb0955d9c3d1cd23/brand_logo.png)
5-11
Cisco Configuration Engine Software Development Kit API Reference and Programmer Guide 3.5
OL-17661-02
Chapter 5 Web Services: Admin, Config, Image, Exec, NSM
Web Services Model
UpdateConfig _et = new UpdateConfig();
/*
* Get command line args...
*/
String _sNumDevices = null;
String _sDevType = null;
String _sHostNm = null;
String _sUsername = null;
String _sPassword = null;
if (args.length < 4)
{
p(m_usage);
System.exit(1);
}
_sNumDevices = args[0];
_sDevType = args[1];
_sUsername = args[2];
_sPassword = args[3];
if (args.length == 5)
{
_sHostNm = args[4];
}
/*
* Initialize service stub...
*/
_et.init(_sHostNm);
/*
* Set username & password...
*/
_et.setCredentials(_sUsername, _sPassword);
/*
* Invoke service...
*/
_et.execute(Integer.parseInt(_sNumDevices), _sDevType);
}
public void execute(int numberOfDevices, String type)
{
try
{
Device[] _devices = new Device[numberOfDevices];
for (int i = 0; i < numberOfDevices; i++)
{
Device _device = new Device();
_device.setName(“router1”);
_device.setType(“NON_AGENT_ENABLED_DEVICE”);
// Non-Agent-enabled device
// hostname of the CE hosting the event gateway
_device.setGatewayId("my-ce-host");
_device.setDeviceType("IOS");
// tells the agent proxy to proxy the config agent
_device.setAgentType("Config Agent");
HopInfo[] _hopInfos = new HopInfo[2];
_hopInfos[0] = new HopInfo();
_hopInfos[0].setHopType("IOS_EN");