admin@vlab-01:~$ sudo config apply-patch -i /FEATURE -i /QUEUE -i /SCHEDULER bgpl/add.json
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"op": "add", "path": "/BGP_MONITORS", "value": {"11.0.0.1": {"admin_status": "up", "asn": "65100", "holdtime": "10", "keepalive": "3", "local_addr": "10.1.0.32", "name": "BGPMonitor", "nhopself": "0", "rrclient": "0"}}}]
...
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: Token not found
model OrderedDict([('@name', 'BGP_MONITORS_LIST'),
('key', OrderedDict([('@value', 'addr')])),
('description', OrderedDict([('text', 'This list is to support BGP monitor configuration handled by bgpcfgd')])),
('leaf', OrderedDict([('@name', 'addr'), ('type', OrderedDict([('@name', 'inet:ip-address')])),
('description', OrderedDict([('text', 'BGP monitor address')])), ('__isleafList', False)])),
('uses', OrderedDict([('@name', 'bgpcmn:sonic-bgp-cmn-neigh'), <===================================================
('refine', OrderedDict([('@target-node', 'name'),
('must', OrderedDict([('@condition', "current() = 'BGPMonitor'"),
('error-message', OrderedDict([('value', 'Invalid BGP monitor name')]))]))]))]))])
token_index 2 path_tokens ['BGP_MONITORS', '11.0.0.1', 'asn']
See above.
Description
When
apply-patcha json file which yang has grouping member, the method cannot grab token.Steps to reproduce the issue
https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang#L43
raise ValueError("Token not found model {} token_index {} path_tokens {}".format(model, token_index, path_tokens))The token is only got from
leafnot fromusingDescribe the results you received
See above.
Describe the results you expected
Fix in two ways:
usingkeyword in yang model.Additional information you deem important (e.g. issue happens only occasionally)
Output of
show version