Skip to content

Commit

Permalink
Merge pull request #5 from nagarwal03/Nikita_subintf_oc_yang
Browse files Browse the repository at this point in the history
Adding support for OC yang interfaces.
  • Loading branch information
nagarwal03 authored Feb 7, 2024
2 parents e1f8d71 + 26ca597 commit c399ed1
Show file tree
Hide file tree
Showing 6 changed files with 2,079 additions and 101 deletions.
2 changes: 2 additions & 0 deletions config/transformer/models_list
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
openconfig-acl.yang
openconfig-acl-annot.yang
openconfig-sampling-sflow.yang
openconfig-sampling-sflow-annot.yang
openconfig-if-ethernet.yang
openconfig-interfaces.yang
openconfig-interfaces-annot.yang
openconfig-if-ip.yang
108 changes: 96 additions & 12 deletions models/yang/annotations/openconfig-interfaces-annot.yang
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module openconfig-interfaces-annot {

import sonic-extensions { prefix sonic-ext; }
import openconfig-interfaces { prefix oc-intf; }
import openconfig-if-ip {prefix oc-ip; }

deviation /oc-intf:interfaces/oc-intf:interface {
deviate add {
Expand All @@ -22,12 +23,6 @@ module openconfig-interfaces-annot {
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state {
deviate add {
sonic-ext:db-name "APPL_DB";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-eth:ethernet/oc-eth:state {
deviate add {
sonic-ext:db-name "APPL_DB";
Expand All @@ -40,17 +35,23 @@ module openconfig-interfaces-annot {
sonic-ext:field-name "autoneg";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-eth:ethernet/oc-eth:state/oc-eth:port-speed {
deviate add {
sonic-ext:field-transformer "intf_eth_port_speed_xfmr";
sonic-ext:field-name "speed";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:config/oc-intf:mtu {
deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:state {
deviate add {
sonic-ext:field-transformer "intf_mtu_xfmr";
sonic-ext:db-name "APPL_DB";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-eth:ethernet/oc-eth:state/oc-eth:port-speed {
deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:config/oc-intf:mtu {
deviate add {
sonic-ext:field-transformer "intf_eth_port_speed_xfmr";
sonic-ext:field-name "speed";
sonic-ext:field-transformer "intf_mtu_xfmr";
}
}

Expand All @@ -75,5 +76,88 @@ module openconfig-interfaces-annot {
sonic-ext:field-name "admin_status";
}
}

deviation /oc-intf:interfaces {
deviate add {
sonic-ext:pre-transformer "intf_pre_xfmr";
sonic-ext:post-transformer "intf_post_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces {
deviate add {
sonic-ext:table-name "NONE";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface {
deviate add {
sonic-ext:table-transformer "intf_subintfs_table_xfmr";
sonic-ext:virtual-table "true";
sonic-ext:key-transformer "intf_subintfs_xfmr";
sonic-ext:path-transformer "intf_ip_path_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:config/oc-intf:index {
deviate add {
sonic-ext:field-transformer "subif_index_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:index {
deviate add {
sonic-ext:field-transformer "subif_index_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:addresses {
deviate add {
sonic-ext:table-name "NONE";
sonic-ext:subtree-transformer "intf_ip_addr_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:addresses {
deviate add {
sonic-ext:table-name "NONE";
sonic-ext:subtree-transformer "intf_ip_addr_xfmr";
}
}

}
deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:addresses/oc-ip:address {
deviate add {
sonic-ext:key-transformer "subintf_ip_addr_key_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address {
deviate add {
sonic-ext:key-transformer "subintf_ip_addr_key_xfmr";
}
}
deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4 {
deviate add {
sonic-ext:table-transformer "intf_table_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6 {
deviate add {
sonic-ext:key-transformer "subintf_ipv6_tbl_key_xfmr";
sonic-ext:table-transformer "intf_table_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:config/oc-ip:enabled {
deviate add {
sonic-ext:field-transformer "ipv6_enabled_xfmr";
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:state/oc-ip:enabled {
deviate add {
sonic-ext:field-transformer "ipv6_enabled_xfmr";
}
}
}
135 changes: 135 additions & 0 deletions models/yang/extensions/openconfig-interfaces-deviation.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
module openconfig-interfaces-deviation {

yang-version "1";

// namespace
namespace "http://openconfig.net/yang/interfaces/deviation/extension";

prefix "oc-intf-dev";

// import some basic types
import openconfig-interfaces { prefix oc-intf; }
import openconfig-extensions { prefix oc-ext; }
import openconfig-if-ip {prefix oc-ip; }
import openconfig-vlan { prefix oc-vlan; }

organization
"SONiC";

contact
"SONiC";

description
"This module describes a YANG model for openconfig-interfaces deviations.";

oc-ext:openconfig-version "0.2.7";

revision "2024-01-19" {
description
"Add Yang deviations for unsupported subinterfaces.";
reference "0.2.7";
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:ifindex {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:admin-status {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:oper-status {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:last-change {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:logical {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-intf:state/oc-intf:counters {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-vlan:vlan {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:addresses/oc-ip:address/oc-ip:state/oc-ip:origin {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:addresses/oc-ip:address/oc-ip:vrrp {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:proxy-arp {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:neighbors {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:unnumbered {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:config {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv4/oc-ip:state {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/oc-ip:state/oc-ip:origin {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/oc-ip:state/oc-ip:status {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/oc-ip:vrrp {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:router-advertisement {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:neighbors {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:unnumbered {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:config/oc-ip:enabled {
deviate replace {
default false;
}
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:config/oc-ip:mtu {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:config/oc-ip:dup-addr-detect-transmits {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:config/oc-ip:dhcp-client {
deviate not-supported;
}

deviation /oc-intf:interfaces/oc-intf:interface/oc-intf:subinterfaces/oc-intf:subinterface/oc-ip:ipv6/oc-ip:state {
deviate not-supported;
}

}
9 changes: 9 additions & 0 deletions models/yang/openconfig-if-ip.yang
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ module openconfig-if-ip {
description
"The length of the subnet prefix.";
}

leaf family {
type string;
description "Indicates whether the IP address is IPv4 or IPv6";
}
}

grouping ipv4-neighbor-config {
Expand Down Expand Up @@ -502,6 +507,10 @@ module openconfig-if-ip {
description
"The length of the subnet prefix.";
}
leaf family {
type string;
description "Indicates whether the IP address is IPv4 or IPv6";
}
}

grouping ipv6-address-state {
Expand Down
Loading

0 comments on commit c399ed1

Please sign in to comment.