search cancel

How to update a models V1 or V2 Community String to a V3 Community String in Spectrum using the API

book

Article ID: 255026

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

Customer is configuring devices with v3 community strings. These devices are already modeled in the Spectrum database using v2 community string.

How to update the community string from v2 to v3 using the API.

Environment

Release : Any

Resolution

The following knowledge article and doc reference gives some good information on how v3 community strings are used in Spectrum:

https://knowledge.broadcom.com/external/article?articleId=39077

https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/managing-network/modeling-and-managing-your-it-infrastructure/snmpv3-support.html

Using this information, if you want to update the community string on a device and the community string configuration in Spectrum is "#v3/P:authpassword:privpassword/level3", then the following curl command would be used:

curl -X 'PUT' \
  'https://spectrum1:8443/spectrum/restful/model/0x10035fb?attr=0x10024&val=%23v3%2FP%3Aauthpassword%3Aprivpassword%2Flevel3' \
  -H 'accept: application/xml; charset=UTF-8'

In the above curl command, 0x10035fb is the model handle of the model and 0x10024 is the attribute id of  the Community_Name attribute of the model.

There are some special characters in the community name format for Spectrum. For example, #, /, and :. These have to be converted to the HTML URL-encoding. Reference https://www.eso.org/~ndelmott/url_encode.html