cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
206
Views
0
Helpful
0
Replies

NSO Device-Templates with tags not configuring with RESTCONF

jabouche
Cisco Employee
Cisco Employee

Hi, I am having trouble configuring new Device Templates on NSO 5.4.6 using RESTCONF / JSON payload when tags are configured.
I use "rload merge snmp3.xml" to load the following device template. I pull the JSON format and get @ tags markups. 
curl -u admin:admin -X GET -H "Accept:application/yang-data+json" "http://10.10.10.10:8080/restconf/data/tailf-ncs:devices/template=snmp3"
The problem is that I can't seem to patch the Device Template back with RESTCONF. I keep getting errors unless I delete all the @ tags markup (at which point it works). Do you see what I'm missing or a workaround?
$ curl -u admin:admin -X PATCH -T ./snmp3_json.txt -H "Accept:application/yang-data+json" -H "Content-Type:application/yang-data+json" "http://10.10.10.10:8080/restconf/data/tailf-ncs:devices/template"
{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "malformed-message",
"error-path": "/tailf-ncs:devices/template",
"error-message": "missing element: snmp-community-string in /ncs:devices/ncs:template[ncs:name='snmp3']/ncs:ned-id[ncs:id='cisco-nx-cli-5.21:cisco-nx-cli-5.21']/ncs:config/nx:snmp-server/nx:community"
}
]
}
}

 

{
  "tailf-ncs:template": [
    {
      "name": "snmp3",
      "ned-id": [
        {
          "id": "cisco-nx-cli-5.21:cisco-nx-cli-5.21",
          "config": {
            "tailf-ned-cisco-nx:snmp-server": {
              "community": [
                {
                  "@@community": {"tags": ["delete"]},
                  "snmp-community-string": "{$COMMUNITY}"
                }
              ],
              "location": "{$LOCATION}",
              "@location": {"tags": ["delete"]}
            }
          }
        },
        {
          "id": "cisco-ios-cli-6.74:cisco-ios-cli-6.74",
          "config": {
            "tailf-ned-cisco-ios:snmp-server": {
              "community": [
                {
                  "@@community": {"tags": ["delete"]},
                  "name": "{$COMMUNITY}",
                  "RO": [null]
                }
              ],
              "location": "{$LOCATION}",
              "@location": {"tags": ["delete"]}
            }
          }
        }
      ]
    }
  ]
}
$ cat snmp3.xml
<config xmlns="http://tail-f.com/ns/config/1.0">
  <devices xmlns="http://tail-f.com/ns/ncs">
  <template>
    <name>snmp3</name>

    <ned-id>
      <id xmlns:id="http://tail-f.com/ns/ned-id/cisco-ios-cli-6.74"> id:cisco-ios-cli-6.74</id>
      <config>
        <snmp-server xmlns="urn:ios">
          <community tags="delete">
            <name>{$COMMUNITY}</name>
            <RO/>
          </community>
          <location tags="delete">{$LOCATION}</location>
        </snmp-server>
      </config>
    </ned-id>

    <ned-id>
      <id xmlns:id="http://tail-f.com/ns/ned-id/cisco-nx-cli-5.21"> id:cisco-nx-cli-5.21</id>
      <config>
        <snmp-server xmlns="http://tail-f.com/ned/cisco-nx">
          <community tags="delete">
            <snmp-community-string>{$COMMUNITY}</snmp-community-string>
          </community>
          <location tags="delete">{$LOCATION}</location>
        </snmp-server>
      </config>
    </ned-id>

  </template>
  </devices>
</config>

 

 

0 Replies 0
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 NSO Developer community:

Recognize Your Peers