cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5980
Views
15
Helpful
5
Replies

Getting "inconsistent value: Device refused one or more commands" when trying to configure interface using RESTCONF

mohanconnects
Level 1
Level 1

Hello,

 

When trying to configure CAT9K switch interface via RESTCONF, getting device refused one or more commands error, provided below the tried steps.

 

Used POSTMAN tool.

 

Get the individual interface details.

GET https://192.168.43.2/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F14

 

GET response.

 
{
  "Cisco-IOS-XE-native:GigabitEthernet": {
    "name": "1/0/14"
  }
}
 
 
Tried to Configure the same interface using PUT method.
Body - raw - JSON
{
  "Cisco-IOS-XE-native:GigabitEthernet": {
    "name": "1/0/14",
    "ip": {
      "address": {
        "primary": {
          "address": "87.1.1.10",
          "mask": "255.255.255.0"
        }
      }
    }
  }
}
PUT Response
{
  "errors": {
    "error": [
      {
        "error-message": "inconsistent value: Device refused one or more commands",
        "error-path": "/Cisco-IOS-XE-native:native/interface/GigabitEthernet=\"1/0/14\"",
        "error-tag": "invalid-value",
        "error-type": "application"
      }
    ]
  }
Tried to Configure the same interface using Patch method.
PATCH https://192.168.43.2/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet
Body - raw - JSON
{
  "Cisco-IOS-XE-native:GigabitEthernet": {
    "name": "1/0/14",
    "ip": {
      "address": {
        "primary": {
          "address": "87.1.1.10",
          "mask": "255.255.255.0"
        }
      }
    }
  }
}
PATCH Response
{
  "errors": {
    "error": [
      {
        "error-message": "inconsistent value: Device refused one or more commands",
        "error-path": "/Cisco-IOS-XE-native:native/interface/GigabitEthernet",
        "error-tag": "invalid-value",
        "error-type": "application"
      }
    ]
  }
}
Are the PUT, PATCH URI are correct?
How to configure the interface?
 
Thanks,
Mohan
5 Replies 5

yangorelik
Spotlight
Spotlight

Hi Mohan

For PUT or PATCH commands, when some raw JSON attributed, try this command:

Body - raw - JSON
{
  "Cisco-IOS-XE-native:GigabitEthernet": {
    "name": "1/0/14",
    "ip": {
      "address": {
        "primary": {
          "address": "87.1.1.10",
          "mask": "255.255.255.0"
        }
      }
    }
  }
}
Yan Gorelik
YDK Solutions

Greeting Yan,

I had to say sorry,

It is working by run PUT use the upper tier of the API, amazing!

THANKS FOR YOUR SHARE!!!

MANY THANKS!

All the best

Yao, Eric

yaojinjie022
Level 1
Level 1
Dear Mohan,
I encontered the similar problem,I want to dive into it.
I run GET, phenomenal below, when I modify telnet to ssh or append ,"ssh" after "telent" ,run PATCH , okay no problem, respone 204,check the configration on device,show ssh appended, but if I modify telnet to none or all, got respone 400,Bad request.
 
{
  "Cisco-IOS-XE-native:vty": [
    {
      "first"0,
      "last"4,
      "transport": {
        "input": {
          "input": ["telnet"]
        }
      }
    },
    {
      "first"5,
      "last"6,
      "transport": {
        "input": {
          "input": ["none"]
        }
      }
    }
  ]
}
At last try Mr. Gorelik's method, failed, if you found solution, please leave a message, thank you.
kindly regards,
yours sincerely 
Yao,Eric

I believe you are missing top level containers in your payload. There should be something like this:

{
  "Cisco-IOS-XE-native:native": {
    "line": {
      "vty": [
        {
          "first": 0,
          "last": 4,
          "transport": {
            "input": {
              "input": [
                "telnet"
              ]
            }
          }
        },
        {
          "first": 5,
          "last": 6,
          "transport": {
            "input": {
              "input": [
                "none"
               ]
             }
           }
         }
       ]
     }
   }
}


Yan

Thanks very much! All done.

Yao