From 0380abb4ed4920fbb04952be6c92ffcf9c0da5fc Mon Sep 17 00:00:00 2001 From: sabarivel sakthivel Date: Mon, 16 Nov 2020 15:42:48 -0800 Subject: [PATCH] Added openconfig changes for mclag --- .../annotations/openconfig-mclag-annot.yang | 158 ++++++ .../yang/annotations/sonic-mclag-annot.yang | 38 ++ models/yang/extensions/openconfig-mclag.yang | 530 ++++++++++++++++++ 3 files changed, 726 insertions(+) create mode 100644 models/yang/annotations/openconfig-mclag-annot.yang create mode 100644 models/yang/annotations/sonic-mclag-annot.yang create mode 100644 models/yang/extensions/openconfig-mclag.yang diff --git a/models/yang/annotations/openconfig-mclag-annot.yang b/models/yang/annotations/openconfig-mclag-annot.yang new file mode 100644 index 000000000..ed957ed11 --- /dev/null +++ b/models/yang/annotations/openconfig-mclag-annot.yang @@ -0,0 +1,158 @@ +module openconfig-mclag-annot { + yang-version "1"; + + namespace "http://openconfig.net/yang/mclag-annot"; + prefix "oc-mclag-annot"; + + import sonic-extensions { prefix sonic-ext; } + import openconfig-mclag { prefix oc-mclag; } + + // meta + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC VLAN"; + + revision 2020-01-20 { + description + "Initial revision."; + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain { + deviate add { + sonic-ext:table-name "MCLAG_DOMAIN"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:interfaces/oc-mclag:interface { + deviate add { + sonic-ext:table-name "MCLAG_INTERFACE"; + sonic-ext:subtree-transformer "mclag_interface_subtree_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:vlan-interfaces/oc-mclag:vlan-interface { + deviate add { + sonic-ext:table-name "MCLAG_UNIQUE_IP"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:domain-id { + deviate add { + sonic-ext:field-name "domain_id"; + sonic-ext:field-transformer "mclag_domainid_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:source-address { + deviate add { + sonic-ext:field-name "source_ip"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:peer-address { + deviate add { + sonic-ext:field-name "peer_ip"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:peer-link { + deviate add { + sonic-ext:field-name "peer_link"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:keepalive-interval { + deviate add { + sonic-ext:field-name "keepalive_interval"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:session-timeout { + deviate add { + sonic-ext:field-name "session_timeout"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:domain-id { + deviate add { + sonic-ext:field-name "domain_id"; + sonic-ext:field-transformer "mclag_domainid_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:source-address { + deviate add { + sonic-ext:field-name "source_ip"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:peer-address { + deviate add { + sonic-ext:field-name "peer_ip"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:peer-link { + deviate add { + sonic-ext:field-name "peer_link"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:keepalive-interval { + deviate add { + sonic-ext:field-name "keepalive_interval"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:session-timeout { + deviate add { + sonic-ext:field-name "session_timeout"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:delay-restore-start-time { + deviate add { + sonic-ext:field-transformer "mclag_domain_delay_restore_start_time_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:oper-status { + deviate add { + sonic-ext:field-transformer "mclag_domain_oper_status_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:state/oc-mclag:role { + deviate add { + sonic-ext:field-transformer "mclag_domain_role_fld_xfmr"; + } + } + + + + deviation /oc-mclag:mclag/oc-mclag:vlan-interfaces/oc-mclag:vlan-interface/oc-mclag:config/oc-mclag:unique-ip-enable { + deviate add { + sonic-ext:field-name "unique_ip"; + sonic-ext:field-transformer "mclag_unique_ip_enable_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:vlan-interfaces/oc-mclag:vlan-interface/oc-mclag:state/oc-mclag:name { + deviate add { + sonic-ext:field-name "if_name"; + sonic-ext:field-transformer "mclag_vlan_name_fld_xfmr"; + } + } + + deviation /oc-mclag:mclag/oc-mclag:vlan-interfaces/oc-mclag:vlan-interface/oc-mclag:state/oc-mclag:unique-ip-enable { + deviate add { + sonic-ext:field-name "unique_ip"; + sonic-ext:field-transformer "mclag_unique_ip_enable_fld_xfmr"; + } + } +} diff --git a/models/yang/annotations/sonic-mclag-annot.yang b/models/yang/annotations/sonic-mclag-annot.yang new file mode 100644 index 000000000..64a17cf9e --- /dev/null +++ b/models/yang/annotations/sonic-mclag-annot.yang @@ -0,0 +1,38 @@ +module sonic-mclag-annot { + + yang-version "1.1"; + + namespace "http://github.com/Azure/sonic-mclag-annot"; + prefix "smclag-annot"; + + import sonic-extensions { prefix sonic-ext; } + import sonic-mclag { prefix smclag; } + + // meta + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC MCLAG"; + + revision 2019-11-22 { + description + "Initial revision."; + } + + deviation /smclag:sonic-mclag/smclag:MCLAG_TABLE/smclag:MCLAG_TABLE_LIST { + deviate add { + sonic-ext:db-name "STATE_DB"; + } + } + + deviation /smclag:sonic-mclag/smclag:MCLAG_REMOTE_INTF_TABLE/smclag:MCLAG_REMOTE_INTF_TABLE_LIST { + deviate add { + sonic-ext:db-name "STATE_DB"; + } + } +} + diff --git a/models/yang/extensions/openconfig-mclag.yang b/models/yang/extensions/openconfig-mclag.yang new file mode 100644 index 000000000..8f1d5ffed --- /dev/null +++ b/models/yang/extensions/openconfig-mclag.yang @@ -0,0 +1,530 @@ +module openconfig-mclag { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/mclag/extension"; + + prefix "oc-mclag"; + + import openconfig-yang-types { prefix oc-yang; } + import openconfig-inet-types { prefix oc-inet; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-types { prefix oc-types; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines configuration and operational state data for Multi Chassis LAGs. + MCLAG information are organized as MCLAG Domains.Each MCLAG Domain would contain + config and state inforamtion of domain, it would contain mclag interfaces for that given domain"; + + oc-ext:openconfig-version "1.0.2"; + + revision "2019-12-02" { + description + "Initial revision"; + reference "TBD"; + } + + // OpenConfig specific extensions for module metadata. + oc-ext:regexp-posix; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + typedef mclag-peer-ip-option { + type enumeration { + enum USE_LINK_LOCAL { + description + "Indicates the usage of link-local address to communicate + to MCLAG peer"; + } + } + description + "MCLAG Peer IP options other than configuring peer ip address"; + } + + typedef mclag-peer { + type union { + type oc-inet:ip-address; + type mclag-peer-ip-option; + } + description + "MCLAG peer address can be a configurable IP address or + a link-local address"; + } + + // grouping statements + + grouping mclag-domain-config { + description + "MCLAG Domain config"; + + leaf domain-id { + type uint32 { + range 1..4095; + } + description + "Domain id for MCLAG Domain"; + } + + leaf source-address { + type oc-inet:ip-address; + + description + "source ip address of MCLAG Domain"; + } + + leaf peer-address { + type mclag-peer; + description + "peer address of MCLAG Domain"; + } + + leaf peer-link { + type string; + description + "peer link of MCLAG Domain"; + } + + leaf mclag-system-mac { + type oc-yang:mac-address; + description + "MCLAG System MAC"; + } + + leaf keepalive-interval { + type uint32 { + range 1..60; + } + default 1; + + description + "Keepalive interval for ICCP MCLAG session"; + } + + leaf session-timeout { + type uint32 { + range 1..3600; + } + default 30; + + description + "Session Timeout for ICCP MCLAG session"; + } + + leaf delay-restore { + type uint16 { + range 1..3600; + } + units "seconds"; + default 300; + description + "Time to wait for protocol to converge before bringing up + all MCLAG and orphan interfaces"; + } + } + + grouping mclag-gateway-mac-config { + description + "MCLAG Domain config"; + leaf gateway-mac { + type oc-yang:mac-address; + description + "Gateway Mac for MCLAG"; + } +} + + + grouping mclag-domain-state { + description + "MCLAG Domain state"; + + leaf oper-status { + type enumeration { + enum OPER_UP { + description + "MCLAG Session is operationally up"; + } + enum OPER_DOWN { + description + "MCLAG Session is operationally down"; + } + } + description + "MCLAG Domain Session oper status"; + } + + leaf role { + type enumeration { + enum ROLE_ACTIVE { + description + "MCLAG Node Role is Active"; + } + enum ROLE_STANDBY { + description + "MCLAG Node Role is Standby"; + } + } + description + "MCLAG Node's Role"; + } + + leaf system-mac { + type oc-yang:mac-address; + description + "System MAC Address used for MCLAG Interface"; + } + + leaf delay-restore-start-time { + type oc-types:timeticks64; + units "seconds"; + description + "Delay restore start time in seconds since the Epoch"; + } + } + + grouping mclag-domain-top { + description + "MCLAG Domain variables top level container"; + + container mclag-domains { + description + "MCLAG Domain entries variables enclosing container"; + + list mclag-domain { + key "domain-id"; + description + "List of MCLAG Domain entries"; + + leaf domain-id { + type leafref { + path "../config/domain-id"; + } + description + "Reference to the domain-id list key"; + } + + container config { + description + "MCLAG Domain config"; + uses mclag-domain-config; + + } + + container state { + config false; + description + "MCLAG Domain state information"; + uses mclag-domain-config; + uses mclag-domain-state; + } + } + } + } + + + grouping mclag-gateway-mac-top { + description + "MCLAG Gateway mac top level container"; + + container mclag-gateway-macs { + description + "MCLAG Gateway MAC entries varaibles enclosing container"; + list mclag-gateway-mac { + key "gateway-mac"; + max-elements 1; + description + "Gateway Mac for MCLAG"; + leaf gateway-mac { + type leafref { + path "../config/gateway-mac"; + } + description + "Reference to the gateway-mac list key"; + } + container config { + description + "MCLAG gw-mac config"; + uses mclag-gateway-mac-config; + } + container state { + config false; + description + "MCLAG gw-mac config"; + uses mclag-gateway-mac-config; + } + } + } + } + + + grouping mclag-interface-config { + description + "Configuration data for mclag interfaces"; + + leaf name { + type oc-if:base-interface-ref; + description + "Reference to the MCLAG LAG Interface"; + } + + leaf mclag-domain-id { + type leafref { + path "../../../../mclag-domains/mclag-domain/config/domain-id"; + } + description + "Reference to MCLAG domain list key"; + } + + leaf mclag-id { + type uint16 { + range 1..256; + } + description + "Groups the mclag interfaces among the mclag peers, which + are bundled together to connect to the same attached device. + mclag-id has to be same on all these interfaces."; + } + } + + grouping mclag-interface-state { + description + "Operational state data for local interface references"; + + container local { + description + "Operational state for local interfaces"; + leaf traffic-disable { + type boolean; + default false; + description + "MCLAG local interface traffic disable value to indicate whether Tx/Rx traffic + is disabled or enabled on this MCLAG interface"; + } + + leaf port-isolate { + type boolean; + default false; + description + "MCLAG local interface port isolation state to indicate whether BUM + traffic incoming on ISL is blocked on MCLAG Interface"; + } + + leaf oper-status { + type enumeration { + enum OPER_UP { + description + "Local Interface operational status up"; + } + enum OPER_DOWN { + description + "Local Interface operational status down"; + } + } + default OPER_DOWN; + description + "MCLAG Local Interface Operational status"; + } + } + } + + grouping mclag-remote-interface-state { + description + "Operational state data for remote interface references"; + + container remote { + description + "Operational state data for remote interface references"; + leaf oper-status { + type enumeration { + enum OPER_UP { + description + "Remote Interface operational status up"; + } + enum OPER_DOWN { + description + "Remote Interface operational status down"; + } + } + default OPER_DOWN; + description + "MCLAG Remote Interface Operational status"; + } + } + } + + + grouping mclag-interfaces-top { + description + "Top-level grouping for MCLAG interface-specific data"; + + container interfaces { + description + "Enclosing container for the list of interfaces on which + MCLAG domains are enabled"; + + list interface { + key "name"; + description + "List of interfaces on which MCLAG is configured"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the interface id list key"; + } + + container config { + description + "Configuration for MCLAG per-interface data"; + + uses mclag-interface-config; + } + + container state { + + config false; + + description + "Operational state for MCLAG interface data"; + + uses mclag-interface-config; + uses mclag-interface-state; + uses mclag-remote-interface-state; + } + + } + } + } + + grouping mclag-unique-ip-config { + description + "Configuration data for mclag unique ip"; + + leaf name { + type oc-if:base-interface-ref; + description + "Reference to the vlan routed Interface (SVI)"; + } + + leaf unique-ip-enable { + type enumeration { + enum ENABLE { + description + "Enable MCLAG Unique-ip"; + } + } + description + "unique ip enable, default : not enabled"; + } + } + + grouping mclag-unique-ip-top { + description + "Top-level grouping for MCLAG unique-ip specific data"; + + container vlan-interfaces { + description + "Enclosing container for the list of routed vlan + interfaces on which MCLAG unique-ip are enabled"; + + list vlan-interface { + key "name"; + description + "List of interfaces on which MCLAG unique-ip is configured"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the interface id list key"; + } + + container config { + description + "Configuration for MCLAG unique-ip per vlan interface data"; + + uses mclag-unique-ip-config; + } + + container state { + + config false; + + description + "Operational state for MCLAG unique-ip per + vlan interface data"; + + uses mclag-unique-ip-config; + } + } + } + } + + grouping mclag-config { + description + "Global configuration data for MCLAG"; + } + + grouping mclag-state { + description + "Global operational state data for MCLAG"; + } + + grouping mclag-top { + description + "Top level grouping for MCLAG data and structure"; + + container mclag { + description + "Top level enclosing container for MCLAG model config + and operational state data"; + + container config { + description + "Global config data for MCLAG"; + uses mclag-config; + } + + container state { + + config false; + + description + "Global operational state data for MCLAG"; + + uses mclag-config; + uses mclag-state; + } + + //mclag domain config and state + uses mclag-domain-top; + uses mclag-interfaces-top; + uses mclag-unique-ip-top; + uses mclag-gateway-mac-top; + } + } + + // data definition statements + uses mclag-top; + + // augment statements + + deviation + /oc-mclag:mclag/oc-mclag:mclag-domains/oc-mclag:mclag-domain/oc-mclag:config/oc-mclag:peer-address + { + deviate replace { + type oc-inet:ip-address; + } + } +}