Callmanager Update Users
From NippAero
Contents |
Background
I ran into a problem where I uploaded a bunch of users and phone with the Cisco BAT tool. After the update the users were not associated to their phones in Callmanager. Using the Update Users feature in the Cisco BAT tool, I was able to correct this problem. The problem was I needed a quick way to insert "SEP" and change the MAC addresses from the 00078545CAD6 format to the SEP00078545CAD6 format. This is easily accomplished with Sed. This is just a small example but could be used for any changes to CSV data.
Example User CSV File
This is an example file from Callmanager.
Sample string from CSV file:
johns,Daviss,123,johnProfile,English United States,SEP8612113425AC,9725557154
Sample string defined:
johns,Daviss,123,johnProfile,English United States,SEP8612113425AC,9725557154
|___| |____| |_| |_________| |___________________| |_____________| |________|
| | | | | | |
| | | | | | |
| | | | | | Telephone Number (up to 24 numerals, optional)
| | | | | |
| | | | | Controlled Device Name(50 characters, optional)
| | | | |
| | | | User Locale (up to 50 characters, optional)
| | | |
| | | User Device Profile (up to 50 characters, optional)
| | |
| | Department (up to 30 characters, optional)
| |
| Manager(up to 30 characters, optional)
|
User ID (up to 30 characters, mandatory)
Note: When updating users you have the option of having certain fields ignored by BAT during an update operation.
Any field containing a character you specify will retain the previously set value when you specify the same character
in the "Value for fields to be ignored" text box on the Update Users screen in BAT. Such fields will not be updated
irrespective of value you specify in the User Default Values area of the Update User window. The character can be a single
character such as '#' or a combination of characters of your choosing or can be a blank. For example, in the following
instructions, we use '#' as the 'Value for fields to be ignored'.
Instructions: 1.Manager is the User ID of an existing user in the Global Directory.
2.Except Controlled Device Name, and user device profile, all other fields if left blank, will be
set to empty. For example, if you want to erase the 'department' and 'manager' information for a user,
a sample record would be:
johns,,,johnProfile,English United States,SEP8612113425AC,9725557154
Controlled Device Name and user device profile, if left blank, means that control device list, and device profile list
for that user will remain unaltered.
3.You can use a character(s) to indicate fields to be ignored. You must specify the "Value for fields to be
ignored" text box on the Update Users screen in BAT. In the following examples we use the character '#'.
a. If you want to update only the department and User Device profile of a user and keep the values of manager, user
locale, Controlled Device Name and telephone number unaltered, a sample record in the CSV could be,
johns,#,12,johnprofile,#,#,#
b. If you want to update only the Controlled Device Name for a user, a sample record could be,
johns,#,#,#,#,SEPAB1234539087,#
c. If you want to set the department to blank for a user and keep the values of other attributes unaltered, a sample
record could be,
johns,#,,#,#,#,#
4.User locale, if updated, will be added as the default user locale for that user.
5.If the value of the field includes a comma or double quotes, then that field must be enclosed in double quotes.
Enclosing the field in double quotes is not required for characters other than comma and double quotes in the field
value.
For example if the department field inludes a comma in its value, the sample record would be:
johns,Daviss,"QA,123",johnProfile,English United States,SEP8612113425AC,9725557154
Looking at the CSV file
This is the file that was exported from the Cisco BAT. The resulting file is Test_Update_Users#09102007150742.txt.
punky:/usr/local # cat Test_Update_Users#09102007150742.txt publicjq1,#,#,#,#,00078545CAD6,# publicjq2,#,#,#,#,000785532D71,# publicjq3,#,#,#,#,00078545DAC3,# publicjq4,#,#,#,#,0007855545D0,# publicjq5,#,#,#,#,0007855333EC,# publicjq6,#,#,#,#,000785469B1B,# publicjq7,#,#,#,#,0007855552E2,# publicjq8,#,#,#,#,000785554531,# publicjq9,#,#,#,#,00078546A30F,# publicjq10,#,#,#,#,000785469F24,# publicjq11,#,#,#,#,00078553321E,# publicjq12,#,#,#,#,00078545CB0B,# publicjq13,#,#,#,#,0014A8C14F19,# publicjq14,#,#,#,#,00078545DAC1,# publicjq15,#,#,#,#,000785554BB6,# publicjq16,#,#,#,#,00078545CA8B,# publicjq17,#,#,#,#,000785469B26,# publicjq18,#,#,#,#,00078545CB10,# publicjq19,#,#,#,#,000750DD06F8,# publicjq20,#,#,#,#,00078545CAAE,# publicjq21,#,#,#,#,000750DCFF57,# publicjq22,#,#,#,#,00078545DADC,# publicjq23,#,#,#,#,000785554533,# publicjq24,#,#,#,#,000750DCFCDA,#
Use Sed to insert SEP into the MAC Address
Using Sed, you can inset "SEP" into the mac address on each line in the CSV file.
punky:/usr/local # cat Test_Update_Users#09102007150742.txt |sed "s/,#,#,#,#,/,#,#,#,#,SEP/" publicjq1,#,#,#,#,SEP00078545CAD6,# publicjq2,#,#,#,#,SEP000785532D71,# publicjq3,#,#,#,#,SEP00078545DAC3,# publicjq4,#,#,#,#,SEP0007855545D0,# publicjq5,#,#,#,#,SEP0007855333EC,# publicjq6,#,#,#,#,SEP000785469B1B,# publicjq7,#,#,#,#,SEP0007855552E2,# publicjq8,#,#,#,#,SEP000785554531,# publicjq9,#,#,#,#,SEP00078546A30F,# publicjq10,#,#,#,#,SEP000785469F24,# publicjq11,#,#,#,#,SEP00078553321E,# publicjq12,#,#,#,#,SEP00078545CB0B,# publicjq13,#,#,#,#,SEP0014A8C14F19,# publicjq14,#,#,#,#,SEP00078545DAC1,# publicjq15,#,#,#,#,SEP000785554BB6,# publicjq16,#,#,#,#,SEP00078545CA8B,# publicjq17,#,#,#,#,SEP000785469B26,# publicjq18,#,#,#,#,SEP00078545CB10,# publicjq19,#,#,#,#,SEP000750DD06F8,# publicjq20,#,#,#,#,SEP00078545CAAE,# publicjq21,#,#,#,#,SEP000750DCFF57,# publicjq22,#,#,#,#,SEP00078545DADC,# publicjq23,#,#,#,#,SEP000785554533,# publicjq24,#,#,#,#,SEP000750DCFCDA,#
You could then pipe this out to a new file.
Upload to Callmanager
Copy the resulting file up to CCM and use the BAT Update users feature to update the users. The # sign is ignored and any data already in these fields is ignored.
