forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YANG] Add MUX_CABLE yang model (sonic-net#11797)
Why I did it Address issue sonic-net#10970 sign-off: Jing Zhang zhangjing@microsoft.com How I did it Add sonic-mux-cable.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. Pass sonic-config-engine unit test. 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/f8fe41a0238b8a7b9e32ae42262f41b63050c55f/src/sonic-yang-models/doc/Configuration.md#mux_cable
- Loading branch information
Showing
6 changed files
with
237 additions
and
0 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
16 changes: 16 additions & 0 deletions
16
src/sonic-yang-models/tests/yang_model_tests/tests/mux_cable.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,16 @@ | ||
{ | ||
"MUX_CABLE_ACTIVE_STANDBY_INTERFACE": { | ||
"desc": "Load MUX_CABLE for active-standby interface." | ||
}, | ||
"MUX_CABLE_ACTIVE_ACTIVE_INTERFACE": { | ||
"desc":"Load MUX_CABLE for active-active interface." | ||
}, | ||
"MUX_CABLE_INVALID_STATE": { | ||
"desc": "Load MUX_CABLE with invalid state.", | ||
"eStrKey": "InvalidValue" | ||
}, | ||
"MUX_CABLE_INVALID_IP": { | ||
"desc": "Load MUX_CABLE with invalid server ip address.", | ||
"eStrKey": "Pattern" | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
src/sonic-yang-models/tests/yang_model_tests/tests_config/mux_cable.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,93 @@ | ||
{ | ||
"MUX_CABLE_ACTIVE_STANDBY_INTERFACE": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": "9000", | ||
"name": "Ethernet0", | ||
"tpid": "0x8100", | ||
"speed": "25000" | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-mux-cable:sonic-mux-cable": { | ||
"sonic-mux-cable:MUX_CABLE": { | ||
"MUX_CABLE_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"server_ipv4": "192.168.0.2/32", | ||
"server_ipv6": "fc02:1000::30/128", | ||
"state": "auto" | ||
} | ||
] | ||
|
||
} | ||
} | ||
}, | ||
|
||
"MUX_CABLE_ACTIVE_ACTIVE_INTERFACE": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet4", | ||
"lanes": "65", | ||
"mtu": "9000", | ||
"name": "Ethernet4", | ||
"tpid": "0x8100", | ||
"speed": "25000" | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-mux-cable:sonic-mux-cable": { | ||
"sonic-mux-cable:MUX_CABLE": { | ||
"MUX_CABLE_LIST": [ | ||
{ | ||
"ifname": "Ethernet4", | ||
"cable_type": "active-active", | ||
"server_ipv4": "192.168.0.2/32", | ||
"server_ipv6": "fc02:1000::30/128", | ||
"soc_ipv4": "192.168.0.3/32", | ||
"state": "auto" | ||
} | ||
] | ||
|
||
} | ||
} | ||
}, | ||
|
||
"MUX_CABLE_INVALID_STATE": { | ||
"sonic-mux-cable:sonic-mux-cable": { | ||
"sonic-mux-cable:MUX_CABLE": { | ||
"MUX_CABLE_LIST": [ | ||
{ | ||
"state": "Standby" | ||
} | ||
] | ||
|
||
} | ||
} | ||
}, | ||
|
||
"MUX_CABLE_INVALID_IP": { | ||
"sonic-mux-cable:sonic-mux-cable": { | ||
"sonic-mux-cable:MUX_CABLE": { | ||
"MUX_CABLE_LIST": [ | ||
{ | ||
"server_ipv4": "999.999.999.999/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,92 @@ | ||
module sonic-mux-cable { | ||
namespace "http://github.com/Azure/sonic-mux-cable"; | ||
prefix mux_cable; | ||
yang-version 1.1; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-port { | ||
prefix prt; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONiC DualToR MUX CABLE confifuration data"; | ||
|
||
revision 2022-08-19 { | ||
description | ||
"Initial revision"; | ||
} | ||
|
||
container sonic-mux-cable { | ||
|
||
container MUX_CABLE { | ||
|
||
list MUX_CABLE_LIST { | ||
|
||
key "ifname"; | ||
|
||
leaf ifname { | ||
type leafref { | ||
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; | ||
} | ||
description | ||
"Reference of port on which MUX cable to be configured."; | ||
} | ||
|
||
leaf cable_type { | ||
type enumeration { | ||
enum active-active; | ||
enum active-standby; | ||
} | ||
default active-standby; | ||
description "SONiC DualToR interface cable type."; | ||
} | ||
|
||
leaf server_ipv4 { | ||
type inet:ipv4-prefix; | ||
|
||
description "Server IPv4 Address."; | ||
} | ||
|
||
leaf server_ipv6 { | ||
type inet:ipv6-prefix; | ||
|
||
description "Server IPv6 Address."; | ||
} | ||
|
||
leaf soc_ipv4 { | ||
type inet:ipv4-prefix; | ||
|
||
description "SoC IPv4 address. Optional and for active-active ports only. "; | ||
} | ||
|
||
leaf soc_ipv6 { | ||
type inet:ipv6-prefix; | ||
|
||
description "SoC IPv6 address. Optional and for active-active ports only. "; | ||
} | ||
|
||
leaf state { | ||
type enumeration { | ||
enum auto; | ||
enum manual; | ||
enum detach; | ||
enum active; | ||
enum standby; | ||
} | ||
|
||
default auto; | ||
description "MUX mode determining if auto failover is enabled. "; | ||
} | ||
} | ||
} | ||
} | ||
} |