**- What I did** #### wheel package Makefiles - wheel package Makefiles for sonic-yang-mgmt package. #### libyang Python APIs: - python APIs based on libyang - functions to load/merge yang models and Yang data files - function to validate data trees based on Yang models - functions to merge yang data files/trees - add/set/delete node in schema and data trees - find data/schema nodes from xpath from the Yang data/schema tree in memory - find dependencies - dump the data tree in json/xml #### Extension of libyang Python APIs: -- Cropping input config based on Yang Model. -- Translate input config based on Yang Model. -- rev Translate input config based on Yang Model. -- Find xpath of port, portleaf and a yang list. -- Find if node is key of a list while deletion if yes, then delete the parent. Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com Signed-off-by: Ping Mao pmao@linkedin.com
73 lines
1.2 KiB
YANG
73 lines
1.2 KiB
YANG
module test-interface {
|
|
|
|
namespace "http://github.com/Azure/interface";
|
|
prefix intf;
|
|
|
|
import ietf-yang-types {
|
|
prefix yang;
|
|
}
|
|
|
|
import ietf-inet-types {
|
|
prefix inet;
|
|
}
|
|
|
|
import test-head {
|
|
prefix head;
|
|
revision-date 2019-07-01;
|
|
}
|
|
|
|
import test-port {
|
|
prefix port;
|
|
revision-date 2019-07-01;
|
|
}
|
|
|
|
revision 2019-07-01 {
|
|
description "First Revision";
|
|
}
|
|
|
|
container interface {
|
|
container INTERFACE {
|
|
|
|
description "INTERFACE part of config_db.json";
|
|
|
|
list INTERFACE_LIST {
|
|
|
|
key "interface ip-prefix";
|
|
|
|
leaf interface {
|
|
type leafref {
|
|
path /port:port/port:PORT/port:PORT_LIST/port:port_name;
|
|
}
|
|
}
|
|
|
|
leaf ip-prefix {
|
|
type inet:ip-prefix;
|
|
}
|
|
|
|
leaf scope {
|
|
type enumeration {
|
|
enum global;
|
|
enum local;
|
|
}
|
|
}
|
|
|
|
leaf family {
|
|
|
|
/* family leaf needed for backward compatibility
|
|
Both ip4 and ip6 address are string in IETF RFC 6021,
|
|
so must statement can check based on : or ., family
|
|
should be IPv4 or IPv6 according.
|
|
*/
|
|
|
|
must "(contains(../ip-prefix, ':') and current()='IPv6') or
|
|
(contains(../ip-prefix, '.') and current()='IPv4')";
|
|
type head:ip-family;
|
|
}
|
|
}
|
|
/* end of INTERFACE_LIST */
|
|
|
|
}
|
|
/* end of INTERFACE container */
|
|
}
|
|
}
|