Cisco Cisco Configuration Engine 3.5 Entwickleranleitung

Seite von 344
5-14
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
Prepare Parameters
Prepare CNSDevice Object
     // Prepare device objects for config object.
              
          CSNDevice _cnsDevice = new CNSDevice();
          _cnsDevice.setDeviceName(“myCNSDevice”);
          _cnsDevice.setId(“myCNSDevice”);
Prepare Attributes
        // Attribute 1
        CNSAttribute _attr1 = new CNSAttribute();
        _attr1.setName("IOShostname");
        String[] _values = new String[1];
        _values[0] = "myhost ";
        _attr1.setValues(_values);
        // Attribute 2
        CNSAttribute _attr2 = new CNSAttribute();
       _attr2.setName("IOSdomain");
        _values = new String[1];
        _values[0] = "mycom.com";
        _attr2.setValues(_values);
        // Attribute 3
        CNSAttribute _attr3 = new CNSAttribute();
        _attr2.setName("IOSpassword");
        _values = new String[1];
        _values[0] = "mypass";
        _attr3.setValues(_values);
        CNSAttributeMsg[] _attrs = new CNSAttributeMsg[3];
        _attrs[0] = _attr1;
        _attrs[1] = _attr2;
        _attrs[2] = _attr2;
Prepare Token Object
Token object is not supported in this version, therefore null will be passed to the API.
Complete Code
/*
 * CreateDeviceWithAttr.java
 *
 * Copyright (c) 2005 by Cisco Systems, Inc.,
 * 170 West Tasman Drive, San Jose, California, 95134, U.S.A.