-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YANG] add peer switch model (#11828)
Why I did it Address issue #10966 sign-off: Jing Zhang zhangjing@microsoft.com How I did it Add sonic-peer-switch.yang and unit tests. How to verify it Compile Compile target/python-wheels/sonic_yang_mgmt-1.0-py3-none-any.whl and target/python-wheels/sonic_yang_models-1.0-py3-none-any.whl. Which release branch to backport (provide reason below if selected) 201811 201911 202006 202012 202106 202111 202205 Description for the changelog Link to config_db schema for YANG module changes https://github.com/sonic-net/sonic-buildimage/blob/b721ff87b976a6a38bdd65443ea3bc686014e783/src/sonic-yang-models/doc/Configuration.md#peer-switch
- Loading branch information
Showing
6 changed files
with
185 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/sonic-yang-models/tests/yang_model_tests/tests/peer-switch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"PEER_SWITCH_LOAD_NORMAL": { | ||
"desc": "Load PEER_SWITCH for dualtor device." | ||
}, | ||
"PEER_SWITCH_MISSING_DEVICE__NAME": { | ||
"desc": "Load PEER_SWITCH missing PEER Device name.", | ||
"eStrKey": "Mandatory" | ||
}, | ||
"PEER_SWITCH_INVALID_IP_ADDRESS": { | ||
"desc": "Load PEER_SWITCH with invalid IPv4 Address.", | ||
"eStrKey": "Pattern" | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/sonic-yang-models/tests/yang_model_tests/tests_config/peer-switch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"PEER_SWITCH_LOAD_NORMAL": { | ||
"sonic-peer-switch:sonic-peer-switch": { | ||
"sonic-peer-switch:PEER_SWITCH": { | ||
"PEER_SWITCH_LIST": [ | ||
{ | ||
"peer_switch": "vlab-05", | ||
"address_ipv4": "10.1.0.33" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
|
||
"PEER_SWITCH_MISSING_DEVICE__NAME": { | ||
"sonic-peer-switch:sonic-peer-switch": { | ||
"sonic-peer-switch:PEER_SWITCH": { | ||
"PEER_SWITCH_LIST": [ | ||
{ | ||
"address_ipv4": "10.1.0.33" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
|
||
"PEER_SWITCH_INVALID_IP_ADDRESS": { | ||
"sonic-peer-switch:sonic-peer-switch": { | ||
"sonic-peer-switch:PEER_SWITCH": { | ||
"PEER_SWITCH_LIST": [ | ||
{ | ||
"peer_switch": "vlab-05", | ||
"address_ipv4": "10.1.0.33/32" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
module sonic-peer-switch { | ||
yang-version 1.1; | ||
namespace "http://github.com/Azure/sonic-peer-switch"; | ||
prefix peer_switch; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-types { | ||
prefix stypes; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONiC DualToR peer switch data"; | ||
|
||
revision 2022-08-23 { | ||
description | ||
"Initial revision"; | ||
} | ||
|
||
container sonic-peer-switch { | ||
container PEER_SWITCH { | ||
list PEER_SWITCH_LIST { | ||
max-elements 1; | ||
|
||
key "peer_switch"; | ||
|
||
leaf peer_switch { | ||
type stypes:hostname; | ||
|
||
description "SONiC DualToR peer host name."; | ||
} | ||
|
||
leaf address_ipv4 { | ||
type inet:ipv4-address; | ||
|
||
description "SONiC DualToR peer's IPv4 address."; | ||
} | ||
} | ||
} | ||
} | ||
} |