10-06-2017 02:50 PM - edited 03-01-2019 04:00 AM
Below is a yang snippet for a small service that works right now -
list loopback {
description "This is an RFS skeleton service";
key serv-id;
leaf serv-id {
tailf:info "Unique service id";
type uint16;
}
leaf device-name {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}
uses ncs:service-data;
ncs:servicepoint loopback-servicepoint;
leaf lp-inf-num {
tailf:info "Enter loopback interface num";
mandatory true;
type uint16;
}
leaf loopback-ip {
tailf:info "Assign loopback Interface-IP";
mandatory true;
type inet:ipv4-address;
}
}
Then in a python script, after I have created a login session, obtained the cookie and transaction handle, etc, I try to execute - the following -
# Set service id
set_lpserv_id = {'jsonrpc': '2.0', 'id': 1, 'method': 'set_value', 'params': {'th': th, 'path': '/loopback:loopback/loopback:serv-id', 'value': '77'}}
set_lpserv_id_response = requests.post(url, json=set_lpserv_id, headers=headers);
print 'set serv id:::' + str(set_lpserv_id_response.json())
This generates the error msg - below - What causes this error ? Should I be able to set the leaf that serves as the key of a list, in this manner ?
set serv id:::{u'jsonrpc': u'2.0', u'id': 1, u'error': {u'data': {u'reason': u'wrong number of identifiers', u'param': u'path'}, u'message': u'Invalid parameters', u'code': -32602, u'type': u'rpc.method.invalid_params', u'internal': u'webui_util585'}}
Solved! Go to Solution.
10-06-2017 03:02 PM
Answer- Need to use create method, not the way, I was doing it .......
10-06-2017 03:02 PM
Answer- Need to use create method, not the way, I was doing it .......
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide