From 0e8d82771c1b1a01c6fd75daeb043737c844f369 Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Tue, 27 Jun 2023 22:00:50 -0700 Subject: [PATCH] [yang] add Yang model for `MUX_LINKMGR|LINK_PROBER` (#15384) (#15608) Add yang model for MUX_LINKMGR|LINK_PROBER table. sign-off: zhangjing@microsoft.com --- src/sonic-yang-models/doc/Configuration.md | 20 +++++ src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 14 +++ .../yang_model_tests/tests/mux-linkmgr.json | 8 ++ .../tests_config/mux-linkmgr.json | 26 ++++++ .../yang-models/sonic-mux-linkmgr.yang | 88 +++++++++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/mux-linkmgr.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/mux-linkmgr.json create mode 100644 src/sonic-yang-models/yang-models/sonic-mux-linkmgr.yang diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index e646fb1a18..3e321315b1 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -40,6 +40,7 @@ Table of Contents * [Management VRF](#management-vrf) * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) * [MUX_CABLE](#muxcable) + * [MUX_LINKMGR](#mux_linkmgr) * [NTP Global Configuration](#ntp-global-configuration) * [NTP and SYSLOG servers](#ntp-and-syslog-servers) * [Peer Switch](#peer-switch) @@ -1205,6 +1206,25 @@ The **MUX_CABLE** table is used for dualtor interface configuration. The `cable_ } ``` +### MUX_LINKMGR +The **MUX_LINKMGR** table is used for dualtor device configuration. +``` +{ + "MUX_LINKMGR": { + "LINK_PROBER": { + "interval_v4": "100", + "interval_v6": "1000", + "positive_signal_count": "1", + "negative_signal_count": "3", + "suspend_timer": "500", + "use_well_known_mac": "enabled", + "src_mac": "ToRMac", + "interval_pck_loss_count_update": "3" + } + } +} +``` + ### NTP Global Configuration These configuration options are used to modify the way that diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index c0383d4447..0567637f53 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -128,6 +128,7 @@ setup( './yang-models/sonic-mirror-session.yang', './yang-models/sonic-mpls-tc-map.yang', './yang-models/sonic-mux-cable.yang', + './yang-models/sonic-mux-linkmgr.yang', './yang-models/sonic-ntp.yang', './yang-models/sonic-nat.yang', './yang-models/sonic-nvgre-tunnel.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index db80f4e6b9..723d0846ff 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1934,6 +1934,20 @@ }, + "MUX_LINKMGR": { + "LINK_PROBER": { + "interval_v4": "100", + "interval_v6": "1000", + "positive_signal_count": "1", + "negative_signal_count": "3", + "suspend_timer": "500", + "use_well_known_mac": "enabled", + "src_mac": "ToRMac", + "interval_pck_loss_count_update": "3" + } + }, + + "POLICER": { "everflow_static_policer": { "meter_type": "bytes", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mux-linkmgr.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mux-linkmgr.json new file mode 100644 index 0000000000..3f399eec76 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mux-linkmgr.json @@ -0,0 +1,8 @@ +{ + "MUX_LINKMGR_LINK_PROBER_INTERVAL_CHANGE": { + "desc": "Consume ICMP heartbeat interval and timeout config changes. " + }, + "MUX_LINKMGR_LINK_PROBER_CHANGE_MAC_ADDR": { + "desc": "Use well-known mac and vlan mac as dst/src in linkmgrd link prober. " + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mux-linkmgr.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mux-linkmgr.json new file mode 100644 index 0000000000..2210c16936 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mux-linkmgr.json @@ -0,0 +1,26 @@ +{ + "MUX_LINKMGR_LINK_PROBER_INTERVAL_CHANGE": { + "sonic-mux-linkmgr:sonic-mux-linkmgr": { + "sonic-mux-linkmgr:MUX_LINKMGR": { + "sonic-mux-linkmgr:LINK_PROBER": + { + "interval_v4": "1000", + "interval_v6": "10000", + "positive_signal_count": 3, + "negative_signal_count": 9 + } + } + } + }, + "MUX_LINKMGR_LINK_PROBER_CHANGE_MAC_ADDR": { + "sonic-mux-linkmgr:sonic-mux-linkmgr": { + "sonic-mux-linkmgr:MUX_LINKMGR": { + "sonic-mux-linkmgr:LINK_PROBER": + { + "use_well_known_mac": "enabled", + "src_mac": "VlanMac" + } + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/yang-models/sonic-mux-linkmgr.yang b/src/sonic-yang-models/yang-models/sonic-mux-linkmgr.yang new file mode 100644 index 0000000000..93e605ea8e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-mux-linkmgr.yang @@ -0,0 +1,88 @@ +module sonic-mux-linkmgr { + namespace "http://github.com/sonic-net/sonic-mux-linkmgr"; + prefix mux_linkmgr; + yang-version 1.1; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONiC DualToR Linkmgrd configuration data"; + + revision 2023-06-07 { + description + "Initial revision"; + } + + container sonic-mux-linkmgr { + + container MUX_LINKMGR { + + container LINK_PROBER { + + leaf interval_v4 { + type uint32; + default 100; + units milliseconds; + + description "IPv4 ICMP heartbeat interval. "; + } + + leaf interval_v6 { + type uint32; + default 1000; + units milliseconds; + + description "IPv6 ICMP heartbeat interval. "; + } + + leaf positive_signal_count { + type uint32; + default 1; + + description "Linkmgrd positive signal count. "; + } + + leaf negative_signal_count { + type uint32; + default 3; + + description "Linkmgrd negative signal count. "; + } + + leaf suspend_timer { + type uint32; + + description "ICMP heartbeat suspending timer, currently not in use. "; + } + + leaf use_well_known_mac { + type enumeration { + enum enabled; + enum disabled; + } + + description "ICMP heartbeat use well known mac as dst mac or not. "; + } + + leaf src_mac { + type enumeration { + enum ToRMac; + enum VlanMac; + } + + description "ICMP heartbeat use what mac as src mac. "; + } + + leaf interval_pck_loss_count_update { + type uint32; + + description "The frequency of streaming ICMP heartbeat loss data to telemetry. "; + } + } + } + } +} \ No newline at end of file