Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yang models for device_metadata, device_neighbor, flex_counters, crm, versions. Processing code and tests. #87

Merged
merged 9 commits into from
Jul 15, 2020
55 changes: 55 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module sonic-breakout_cfg {

yang-version 1.1;

namespace "http://github.com/Azure/sonic-breakout_cfg";
prefix breakout_cfg;

import sonic-extension {
prefix ext;
revision-date 2019-07-01;
}

description "BREAKOUT_CFG YANG Module for SONiC OS";

revision 2020-04-10 {
description "First Revision";
}

container sonic-breakout_cfg {

container BREAKOUT_CFG {

description "BREAKOUT_CFG part of config_db.json";

list BREAKOUT_CFG_LIST {

key "port";

ext:key-regex-configdb-to-yang "^([a-zA-Z0-9_-]+)$";

ext:key-regex-yang-to-configdb "<port>";

leaf port {
type string {
length 1..255;
}
}

leaf brkout_mode {
type string {
length 1..64;
/* should be not allow any pattern here, since this is
* auto populated by cli.
*/
/* pattern "1x100G[40G]|2x50G|4x25G[10G]"; */
}
}
}
/* end of list BREAKOUT_CFG_LIST */
}
/* end of container BREAKOUT_CFG */
}
/* end of top level container */
}
/* end of module sonic-breakout_cfg */
203 changes: 203 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-crm.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
module sonic-crm {

yang-version 1.1;

namespace "http://github.com/Azure/sonic-crm";
prefix crm;

import sonic-types {
prefix stypes;
revision-date 2019-07-01;
}

description "BREAKOUT_CFG YANG Module for SONiC OS";

revision 2020-04-10 {
description "First Revision";
}

container sonic-crm {

container CRM {

description "CRM part of config_db.json";

container Config {

/* typedef specific to CRM */
typedef threshold {
type uint16;
praveen-li marked this conversation as resolved.
Show resolved Hide resolved
}

leaf acl_counter_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../acl_counter_high_threshold<100 and
../acl_counter_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf acl_counter_high_threshold {
type threshold;
}

leaf acl_counter_low_threshold {
type threshold;
}

leaf acl_group_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../acl_group_high_threshold<100 and
../acl_group_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf acl_group_high_threshold {
type threshold;
}

leaf acl_group_low_threshold {
type threshold;
}

leaf acl_entry_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../acl_entry_high_threshold<100 and
../acl_entry_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf acl_entry_high_threshold {
type threshold;
}

leaf acl_entry_low_threshold {
type threshold;
}

leaf acl_table_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../acl_table_high_threshold<100 and
../acl_table_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf acl_table_high_threshold {
type threshold;
}

leaf acl_table_low_threshold {
type threshold;
}

leaf fdb_entry_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../fdb_entry_high_threshold<100 and
../fdb_entry_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf fdb_entry_high_threshold {
type threshold;
}

leaf fdb_entry_low_threshold {
type threshold;
}

leaf ipv4_neighbor_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../ipv4_neighbor_high_threshold<100 and
../ipv4_neighbor_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf ipv4_neighbor_high_threshold {
type threshold;
}

leaf ipv4_neighbor_low_threshold {
type threshold;
}

leaf ipv4_nexthop_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../ipv4_nexthop_high_threshold<100 and
../ipv4_nexthop_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf ipv4_nexthop_high_threshold {
type threshold;
}

leaf ipv4_nexthop_low_threshold {
type threshold;
}

leaf ipv4_route_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../ipv4_route_high_threshold<100 and
../ipv4_route_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf ipv4_route_high_threshold {
type threshold;
}

leaf ipv4_route_low_threshold {
type threshold;
}

leaf ipv6_nexthop_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../ipv6_nexthop_high_threshold<100 and
../ipv6_nexthop_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf ipv6_nexthop_high_threshold {
type threshold;
}

leaf ipv6_nexthop_low_threshold {
type threshold;
}

leaf ipv6_route_threshold_type {
must "(((current()='PERCENTAGE' or current()='percentage') and
../ipv6_route_high_threshold<100 and
../ipv6_route_low_threshold<100) or
(current()!='PERCENTAGE' and current()!='PERCENTAGE'))";
type stypes:crm_threshold_type;
}

leaf ipv6_route_high_threshold {
type threshold;
}

leaf ipv6_route_low_threshold {
type threshold;
}

leaf polling_interval {
type threshold;
}

}
/* end of Config */
}
/* end of container CRM */
}
/* end of top level container */
}
/* end of module sonic-crm */
96 changes: 96 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-device_metadata.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
module sonic-device_metadata {

yang-version 1.1;

namespace "http://github.com/Azure/sonic-device_metadata";
prefix device_metadata;

import ietf-yang-types {
prefix yang;
}

import ietf-inet-types {
prefix inet;
}

import sonic-types {
prefix stypes;
revision-date 2019-07-01;
}

description "DEVICE_METADATA YANG Module for SONiC OS";

revision 2020-04-10 {
description "First Revision";
}

container sonic-device_metadata {

container DEVICE_METADATA {

description "DEVICE_METADATA part of config_db.json";

container localhost{

leaf hwsku {
type stypes:hwsku;
}

leaf default_bgp_status {
type enumeration {
enum UP;
enum DOWN;
}
}

leaf docker_routing_config_mode {
type enumeration {
enum unified;
enum split;
}
}

leaf hostname {
type string {
length 1..255;
}
}

leaf platform {
type string {
length 1..255;
}
}

leaf mac {
type yang:mac-address;
}

leaf default_pfcwd_status {
type enumeration {
enum disable;
enum enable;
}
}

leaf bgp_asn {
type inet:as-number;
}

leaf deployment_id {
type uint32;
}

leaf type {
type string {
length 1..255;
}
}
}
/* end of container localhost */
}
/* end of container DEVICE_METADATA */
}
/* end of top level container */
}
/* end of module sonic-device_metadata */
Loading