cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
76
Views
0
Helpful
8
Replies
Highlighted
Cisco Employee

Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

HI,

 

 

Are there any json-rpc experts ? I work with CCA MCP team. In our product we use JSON RPC as the northbound NCS API to configure devices. I have a CSR1000v and I am trying to add a rule for and “ip access-list”. The config tree looks as follows

 

 

{

 

  "access-list": {

 

    "extended": {

 

      "ext-named-acl": [       

 

        {

 

          "name": "default-service-acl",

 

          "ext-access-list-rule": [

 

            {

 

              "rule": "permit object-group default-service any any"

 

            }

 

          ]

 

        }

 

      ]

 

    }

 

  }

 

}

 

 

I checked the yang file for cisco-ios NED and the Element “rule” is a key for the List “ext-acces-list-rule”. It is of the type string and defined as a multi-word key. I am using create method to add a rule and I am getting an Invalid Path error.

 

 

 

 

Any idea on what could be wrong ?

 

 

Thanks

 

Georgy

 

Everyone's tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi Gregory,

I also tried giving the rule as ==> ext-access-list-rule{"permit object-group default-service any any”} but json-rpc report bad character.

 

Do you think something is wrong with the NED model ?

 

When your list has multiple keys, you can separate the keys by comma instead of space. This seems to work for the JSON-RPC API.

 

 

  1. I.e. try giving the rule as ext-access-list-rule{permit,object-group,default-service,any,any}
    Best regards,

   

View solution in original post

8 REPLIES 8
Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi

 

I'm afraid it has nothing to do with JSON RPC, but the path itself. I would guess your path was supposed to be

/ncs:devices/device{"SunAfter-s14-cA"}/config/ios:ip/access-list/extended/ext-named-acl{"default-service-acl"}/ext-access-list-rule{"permit object-group default-service any any"}

 

i.e. default-service-acl is a key in the ext-named-acl list

 

Regards,

Andrei

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi Andrei,

 

 

I had tried those combinations but none works. I have similar configuration for another element which is adding a host to a network object group which works fine

 

 

{"jsonrpc":"2.0","result":{},"id":11}

 

Sending:

 

{

 

                "jsonrpc": "2.0",

 

                "method": "create",

 

                "id": 12,

 

                "params":

 

                    {"th": 1, "path": "/ncs:devices/device/{gmk-csr01}/config/ios:object-group/network/{tier1-subnet}/host/{10.5.1.1}" }

 

            }

 

 

But for adding rules it doesn’t work.

 

Sending:

{

               "jsonrpc": "2.0",

               "method": "create",

               "id": 16,

               "params":

                   {"th": 1, "path": "/ncs:devices/device/{gmk-csr01}/config/ios:ip/access-list/extended/ext-named-acl/{default-service-acl}/ext-access-list-rule/{permit object-group default-service any any}" }

           }

"jsonrpc":"2.0","error":{"type":"rpc.method.invalid_params","code":-32602,"message":"Invalid parameters","data":{"param":"path"}},"id":16}

 

I also tried giving the rule as ==> ext-access-list-rule{"permit object-group default-service any any”} but json-rpc report bad character.

Do you think something is wrong with the NED model ?

Thanks

Georgy

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi Gregory,

I also tried giving the rule as ==> ext-access-list-rule{"permit object-group default-service any any”} but json-rpc report bad character.

 

Do you think something is wrong with the NED model ?

 

When your list has multiple keys, you can separate the keys by comma instead of space. This seems to work for the JSON-RPC API.

 

 

  1. I.e. try giving the rule as ext-access-list-rule{permit,object-group,default-service,any,any}
    Best regards,

   

View solution in original post

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Also, for the REST API, I found that when a LIST has a composite key, you will need to provide the entire key-material separated by commas.

I’m presuming it would be the same for JSON RPC API.

   

Thanks,

 

Bilal.

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi All,

 

Thanks for your suggestions. I was able to get it working based on the format Andrei suggested {\"permit object-group default-service any any\"}

 

-Georgy

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

HI All,

 

 

I have two devices D1 (ned type cli) and D2 (ned type generic). I set some configuration for both the devices from NCS CLI and commit. Due to some error in configuration for D2 commit fails. I am trying to understand the behavior of NCS in this case.

 

    1. From my tests I see that NCS pushes config to D1 but fails to push on D2

    1. NCS triggers an abort. Is it supposed to rollback configurations from both D1 and D2 ?

 

Thanks

 

Georgy

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi Georgy,

  yes. if both devices are configured in a single transaction and configuring one device fails, the config will not be commited to any device, respectively will be rolled back for non-transactional devices, eg IOS.

 

;Mike

 

Cisco Employee

Re: Invalid Param Path error (JSON RPC) while creating list key (multi word)

 

Hi Mike,

 

 

In my lab I have an ASR9000 (iosxr) and ACI APIC (generic). The error occurs in the configuration for asr9000. I see that nothing gets pushed to asr9000 but the APIC config gets pushed and NCS believes it cancelled which leads into the APIC going into out of sync. Do you think there is any issue with APIC NED ?

 

 

From the trace files i see the following:

 

 

TestASR

 

 

<< 5-Aug-2015::16:10:17.446 TRANS_ID c864a9e9f462c9e109f731eb46cfbe3

 

>> 5-Aug-2015::16:10:23.706 PREPARE 1:

 

router bgp 200

 

vrf test02

 

  rd x

 

exit

 

exit

 

 

<< 5-Aug-2015::16:10:44.047 ERROR: Network Element Driver error ned_prepare_cli for device TestAsr: read timeout

 

>> 5-Aug-2015::16:10:44.048 ABORT 1:

 

 

<< 5-Aug-2015::16:10:44.067 ERROR: Network Element Driver error ned_abort_cli for device TestAsr: read eof

 

>> 5-Aug-2015::16:10:44.098 CLOSE 1: (Pool: force)

 

<< 5-Aug-2015::16:10:44.099 CLOSED

 

 

TEstApic

 

 

>> 5-Aug-2015::16:10:17.031 GET_TRANS_ID

 

<< 5-Aug-2015::16:10:23.705 TRANS_ID 138536293021635592234344726629954433064

 

>> 5-Aug-2015::16:10:23.705 PREPARE 0:

 

modified   /cisco-apicdc:apic/fvTenant[name='Zinc']

 

created    /cisco-apicdc:apic/fvTenant[name='Zinc']/fvAp[name='test02']

 

<< 5-Aug-2015::16:10:23.715 PREPARE OK

 

>> 5-Aug-2015::16:10:44.091 SHOW 0:

 

<< 5-Aug-2015::16:10:44.094 ERROR: Network Element Driver error ned_show_generic for device TestApic: /ncs:devices/device{TestApic}/ned-settings/cisco-apicdc-meta:cisco-apicdc/host: /ncs:devices/device{TestApic}/ned-settings/cisco-apicdc does not exist

 

>> 5-Aug-2015::16:10:44.099 CLOSE 0: (Pool: true)

 

<< 5-Aug-2015::16:10:44.099 CLOSED

 

 

Thanks

 

Georgy

 

Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.