cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2222
Views
5
Helpful
1
Comments
Nael Mohammad
Level 5
Level 5

Using the cwcli netconfig to make changes to devices from the command line without the need of webui has many advantages such as simplicity, practicality and speed of deployment for mass pushing of config.

This document will explain how to deploy changes to a single device by creating a subinterface with name description and community strings using the command files, device list and cwcli utilities. The example below applies to both LMS 3.2 and LMS 4.0.

Prerequisites:

  • Device must be managed by LMS.
  • Device must have correct credentials with correct privileges to make changes.
  • User must have correct privileges to make changes from LMS.

1. Create the content of the files using the following examples for creating community strings and sub-interface with a name description.  Note that command1, command2, command3, and command4 are command list examples and not actual syntaxes. You will need to create two files, one for the commands only and the second for the device using the display name as it appears in LMS.

GigabitEthernet0_1.cmd command file:

Command List File

command1

command2

command3

command4

interface GigabitEthernet0/1.5

description subinterface_Test

snmp-server community private rw

snmp-server community public ro

Note: Commands are not validated so you must define the complete cli syntax.

GigabitEthernet0_1.dev device file:

Examples

Device List File

-device device_display_name1

-device  ISR-3845-A

2. Go to NMSROOT/bin

Running cwcli netconfig

The cwcli config command is located in the following directories, where install_dir is the directory in which LMS is installed:

  • This example uses NMSROOT/bin/cwcli commands. NMSROOT is the installation directory of CiscoWorks Lan Management Solution.

  • On UNIX systems, /opt/CSCOpx/bin
  • On Windows systems, install_dir\CSCOpx\bin where the default install directory is C:\Program Files.

3. Use the following syntax as an example for creating “netconfig” jobs from the cli.

cwcli netconfig Sub_command Common_arguments Command_arguments

The above example is documented in the users guide:

http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_lan_management_solution/4.0/user/guide/configuration_management/cwcli.html#wp1200332

cwcli netconfig createjob -u lmsadminuser -p lmspassword -devicefile GigabitEthernet0_1.dev -commandfile GigabitEthernet0_1.cmd -description "cwcli netconfig job" -mode config

Replace the lmasadminuser with the lms administrator account and lmspassword with the password of the admin user.

4.  Now confirm the job is successful using the following job ID below with the step 5.

The results should be the following is when completed:

<cwcli> INFO - NetConfig Job created Successfully. JobId= 2001

SUMMARY

========

        Successful: createjob

5.  Check the job results using the cwcli.

“ ./cwcli netconfig jobresults -id 2001 -u lmsadmin -p lmspassword “    

* Warning * The -p option is highly insecure and *not* recommended.

* Warning * See -u option for more details.

<cwcli> INFO -

<<<<< Job Results for jobId= 2001 >>>>>

Results for Job 2001

Job Message: Job completed successfully:

Job Start time: Sat Dec 25 00:17:32 PST 2010

Job End time: Sat Dec 25 00:18:09 PST 2010

*************************** Job Summary *****************************

Deploy pending: 0

Not attempted during deploy: 0

Successfully deployed: 1

Failed during deploy: 0

Successfully rollbacked: 0

Failed during rollback: 0

Not attempted during Rollback: 0

Pre Job Execution Message:

Post Job Execution Message:

****************************************

6. Confirm the changes have been made on the device and verify job completion.

show ip int gigabitEthernet 0/1.5

GigabitEthernet0/1.5 is up, line protocol is down

show run | inc descr

description subinterface_Test1


show run | inc snmp-server

snmp-server community private RW

snmp-server community public RO

Comments
Gaganjeet Chug
Level 4
Level 4

Nael,

Thank you so much for sharing this information.

Regards

Gaganjeet

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: