Closed aslam4g closed 1 year ago
@aslam4g can you please join the next YANG subgroup meeting and have a discussion on this issue? Thanks.
g the redis table being created ,
@aslam4g would you please join the YANG subgroup meeting if you still need help? Thanks.
@aslam4g can you please join the next YANG group meeting next week? If no response within 1 month, this issue will be closed. Thanks.
Triaged by YANG workgroup, this is not YANG issue. Please check if mgmt. can help your case.
Hi @aslam4g , @robertlperry ,
Was this issue resolved, Kindly share the solution for this issue.
Thanks
Description
When a yang file with annotation (table-name field-name) is included , The user should be able to do put , set and get from swagger and corresponding redis table should be created.
We are not seeing the redis table being created ,
Want to understand if I am missing anything as xDbSpecMap: xpath seems to not filled properly as expected by the program.
My understanding is no overloaded function is required to be written when only table-name and field-name is used for 1 to 1 mapping from yang fields to redis db table field.
Steps to reproduce the issue:
With following simple yang file do put from swagger
Yang file
module ultraconfig-interfaces {
yang-version 1.1;
namespace "http://ultraconfig.com.au/ns/yang/ultraconfig-interfaces";
prefix if;
organization "Ultra Config Pty Ltd";
contact "Support: https://ultraconfig.com.au/contact/";
description "This YANG module has been created for the purpose of a tutorial. It defines the model for a basic ethernet interface";
revision "2020-01-03" { description "Initial Revision"; reference "Learn YANG - Full Tutorial for Beginners"; } typedef dotted-quad { type string { pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}'
container interfaces-ultra { list interface { key "name"; leaf name { type string; mandatory "true"; description "Interface name. Example value: GigabitEthernet 0/0/0"; } leaf address { type dotted-quad; mandatory "true"; description "Interface IP address. Example value: 10.10.10.1"; } leaf subnet-mask { type dotted-quad; mandatory "true"; description "Interface subnet mask. Example value: 255.255.255.0"; } leaf enabled { type boolean; default "false"; description "Enable or disable the interface. Example value: true"; } } list interface-state { config false; key "name"; leaf name { type string; description "Interface name. Example value: GigabitEthernet 0/0/0"; } leaf oper-status { type enumeration { enum up; enum down; } mandatory "true"; description "Describes whether the interface is physically up or down"; } } } }
Yang Annotation file
module ultraconfig-interfaces-annot {
yang-version "1.1";
//namespace "http://openconfig.net/yang/annotation/if-annot"; namespace "http://ultraconfig.com.au/ns/yang/ultraconfig-interfaces/if-annot"; prefix "if-annot";
import ultraconfig-interfaces { prefix if; } import sonic-extensions { prefix sonic-ext; }
deviation /if:interfaces-ultra { deviate add { sonic-ext:table-name "ULTRA_TABLE1"; }
}
/ deviation /if:interfaces-ultra/if:interface { deviate add { sonic-ext:table-name "ULTRA_TABLE2"; } } / deviation /if:interfaces-ultra/if:interface/if:name { deviate add { sonic-ext:field-name "name"; } }
deviation /if:interfaces-ultra/if:interface/if:address { deviate add { sonic-ext:field-name "address"; } }
deviation /if:interfaces-ultra/if:interface/if:subnet-mask { deviate add { sonic-ext:field-name "subnet-mask"; } }
deviation /if:interfaces-ultra/if:interface/if:enabled { deviate add { sonic-ext:field-name "enabled"; }
}
deviation /if:interfaces-ultra/if:interface-state { deviate add { sonic-ext:field-name "interface-state"; } }
deviation /if:interfaces-ultra/if:interface-state/if:name { deviate add { sonic-ext:field-name "name"; } }
deviation /if:interfaces-ultra/if:interface-state/if:oper-status { deviate add { sonic-ext:field-name "oper-status"; } }
}
Describe the results you received:
Received http response 204 with no content and syslog shows following
Error log
Apr 25 02:41:41.712188 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711842 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/enabled"). Apr 25 02:41:41.712202 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711865 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/subnet-mask"). Apr 25 02:41:41.712206 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711876 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/address").
Yang files are loaded
Apr 25 02:34:58.693067 ip-172-26-8-32 INFO #/supervisord: rest-server Yang model List: [sonic-bgp-common.yang son ic-bgp-global.yang sonic-bgp-monitor.yang sonic-bgp-neighbor.yang sonic-bgp-peergroup.yang sonic-bgp-peerrange.ya ng sonic-common.yang sonic-extension.yang sonic-extensions.yang sonic-interface.yang sonic-loopback-interface.yan g sonic-port.yang sonic-portchannel.yang sonic-types.yang sonic-vrf.yang ultraconfig-interfaces.yang ultraconfig- interfaces-annot.yang
Describe the results you expected:
Expectation is when put is issued from Rest API (swagger) , config db redis table (ULTRA_TABLE1)should be created,
Output of
show version
:Using the code from that master branch latest
Additional information you deem important (e.g. issue happens only occasionally):
Relevant Logs from /var/log/syslog
45] Replace request received with payload ={ Apr 25 02:41:41.711466 ip-172-26-8-32 INFO #/supervisord: rest-server "ultraconfig-interfaces:interfaces-ultra" : { Apr 25 02:41:41.711470 ip-172-26-8-32 INFO #/supervisord: rest-server "interface": [ Apr 25 02:41:41.711474 ip-172-26-8-32 INFO #/supervisord: rest-server{ Apr 25 02:41:41.711478 ip-172-26-8-32 INFO #/supervisord: rest-server"name": "0/0/0", Apr 25 02:41:41.711482 ip-172-26-8-32 INFO #/supervisord: rest-server"address": "10.10.10.1", Apr 25 02:41:41.711486 ip-172-26-8-32 INFO #/supervisord: rest-server"subnet-mask": "255.255.255.0", Apr 25 02:41:41.711490 ip-172-26-8-32 INFO #/supervisord: rest-server"enabled": true Apr 25 02:41:41.711493 ip-172-26-8-32 INFO #/supervisord: rest-server} Apr 25 02:41:41.711497 ip-172-26-8-32 INFO #/supervisord: rest-server ] Apr 25 02:41:41.711501 ip-172-26-8-32 INFO #/supervisord: rest-server } Apr 25 02:41:41.711505 ip-172-26-8-32 INFO #/supervisord: rest-server } Apr 25 02:41:41.711509 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.710844 165 app_interface .go:129] getAppModule called for path =/ultraconfig-interfaces:interfaces-ultra Apr 25 02:41:41.711514 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.710853 165 app_interface .go:142] No app module registered for path /ultraconfig-interfaces:interfaces-ultra hence fallback to default/com mon app Apr 25 02:41:41.711518 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.710864 165 app_interface .go:164] cast to appInterface worked&{ [] false map[] map[] map[] {0 false}}
Apr 25 02:41:41.711522 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.710978 165 request_binde
r.go:338] requestBinder: modified path is:
Apr 25 02:41:41.711526 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711385 165 common_app.go
:80] initialize:path =/ultraconfig-interfaces:interfaces-ultra
Apr 25 02:41:41.711868 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711453 165 db.go:394] Ne
wDB: Init indication not requested
Apr 25 02:41:41.711884 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711462 165 common_app.go
:110] translateReplace:path =/ultraconfig-interfaces:interfaces-ultra
Apr 25 02:41:41.711888 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711468 165 common_app.go
:362] translateCRUDCommon:path =/ultraconfig-interfaces:interfaces-ultra
Apr 25 02:41:41.711892 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711642 165 xlate_utils.g
o:976] [xlate.go:360]REPLACE case
Apr 25 02:41:41.711896 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711668 165 xlate_utils.g
o:976] [xlate_to_db.go:369]Update/replace req: path("/ultraconfig-interfaces:interfaces-ultra").
Apr 25 02:41:41.711906 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711694 165 xlate_utils.g
o:976] [xlate_to_db.go:564]Module name for uri /ultraconfig-interfaces:interfaces-ultra is /ultraconfig-interface
s:interfaces-ultra
Apr 25 02:41:41.712188 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711842 165 xlate_to_db.g
o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/enabled").
Apr 25 02:41:41.712202 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711865 165 xlate_to_db.g
o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/subnet-mask").
Apr 25 02:41:41.712206 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711876 165 xlate_to_db.g
o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/address").
@
Apr 25 02:41:41.711522 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.710978 165 request_binde r.go:338] requestBinder: modified path is: Apr 25 02:41:41.711526 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711385 165 common_app.go :80] initialize:path =/ultraconfig-interfaces:interfaces-ultra Apr 25 02:41:41.711868 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711453 165 db.go:394] Ne wDB: Init indication not requested Apr 25 02:41:41.711884 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711462 165 common_app.go :110] translateReplace:path =/ultraconfig-interfaces:interfaces-ultra Apr 25 02:41:41.711888 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711468 165 common_app.go :362] translateCRUDCommon:path =/ultraconfig-interfaces:interfaces-ultra Apr 25 02:41:41.711892 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711642 165 xlate_utils.g o:976] [xlate.go:360]REPLACE case Apr 25 02:41:41.711896 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711668 165 xlate_utils.g o:976] [xlate_to_db.go:369]Update/replace req: path("/ultraconfig-interfaces:interfaces-ultra"). Apr 25 02:41:41.711906 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711694 165 xlate_utils.g o:976] [xlate_to_db.go:564]Module name for uri /ultraconfig-interfaces:interfaces-ultra is /ultraconfig-interface s:interfaces-ultra Apr 25 02:41:41.712188 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711842 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/enabled"). Apr 25 02:41:41.712202 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711865 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/subnet-mask"). Apr 25 02:41:41.712206 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.711876 165 xlate_to_db.g o:197] Failed to find the xDbSpecMap: xpath("ULTRA_TABLE1/address"). Apr 25 02:41:41.712210 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711889 165 xlate_utils.g o:976] [xlate_to_db.go:622]Fill default value for /ultraconfig-interfaces:interfaces-ultra, oper(3)#015 @
Apr 25 02:41:41.712210 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711889 165 xlate_utils.g o:976] [xlate_to_db.go:622]Fill default value for /ultraconfig-interfaces:interfaces-ultra, oper(3)#015 Apr 25 02:41:41.712215 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.711899 165 xlate_utils.g o:976] [xlate_to_db.go:648]Module name for uri /ultraconfig-interfaces:interfaces-ultra is /ultraconfig-interface s:interfaces-ultra Apr 25 02:41:41.712219 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.712054 165 xlate_utils.g o:976] [xlate_to_db.go:371]Update/replace req: path("/ultraconfig-interfaces:interfaces-ultra") result("map[]"). Apr 25 02:41:41.712223 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.712134 165 common_app.go :366] transformer.XlateToDb() returned result DB map - map[] Apr 25 02:41:41.712227 ip-172-26-8-32 INFO #/supervisord: rest-server Default value Db Map - map[] Apr 25 02:41:41.712231 ip-172-26-8-32 INFO #/supervisord: rest-server Aux Db Map - map[] Apr 25 02:41:41.712235 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.712145 165 common_app.go :377] XlatetoDB() returned empty map Apr 25 02:41:41.712508 ip-172-26-8-32 INFO #/supervisord: rest-server W0425 02:41:41.712156 165 db.go:1299] p erformWatch: Empty WatchKeys. Skipping WATCH Apr 25 02:41:41.712522 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.712163 165 common_app.go :223] processReplace:path =/ultraconfig-interfaces:interfaces-ultra Apr 25 02:41:41.713164 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.712993 165 handler.go:72 ] [REST-3] Sending response 204, type=, data= Apr 25 02:41:41.713190 ip-172-26-8-32 INFO #/supervisord: rest-server I0425 02:41:41.713018 165 router.go:128 ] [REST-3] PutUltraconfigInterfacesInterfacesUltra took 2.296184ms ~