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.
Merge pull request sonic-net#340 from gechiang/202205
[yang-models] Add YANG model for SYSTEM_PORT (sonic-net#12689)
Showing
8 changed files
with
331 additions
and
16 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
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
9 changes: 9 additions & 0 deletions
9
src/sonic-yang-models/tests/yang_model_tests/tests/system_port.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,9 @@ | ||
{ | ||
"SYSTEM_PORT_POSITIVE_CONFIG": { | ||
"desc": "Configure SYSTEM_PORT positive config." | ||
}, | ||
"SYSTEM_PORT_WRONG_SPEED_PATTERN": { | ||
"desc": "Configure SYSTEM_PORT wrong speed.", | ||
"eStr": ["pattern", "does not satisfy"] | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
src/sonic-yang-models/tests/yang_model_tests/tests_config/system_port.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,91 @@ | ||
{ | ||
"SYSTEM_PORT_POSITIVE_CONFIG": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 100000 | ||
}, | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth4", | ||
"description": "Ethernet4", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet4", | ||
"speed": 100000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-system-port:sonic-system-port": { | ||
"sonic-system-port:SYSTEM_PORT": { | ||
"SYSTEM_PORT_LIST": [ | ||
{ | ||
"hostname": "host123", | ||
"asic_name": "asic0", | ||
"ifname": "Ethernet0", | ||
"core_index": "0", | ||
"core_port_index": "10", | ||
"num_voq": "8", | ||
"speed": "100000", | ||
"switch_id": "0", | ||
"system_port_id": "100" | ||
}, | ||
{ | ||
"hostname": "host123", | ||
"asic_name": "asic1", | ||
"ifname": "Ethernet4", | ||
"core_index": "1", | ||
"core_port_index": "20", | ||
"num_voq": "8", | ||
"speed": "100000", | ||
"switch_id": "1", | ||
"system_port_id": "200" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"SYSTEM_PORT_WRONG_SPEED_PATTERN": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 100000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-system-port:sonic-system-port": { | ||
"sonic-system-port:SYSTEM_PORT": { | ||
"SYSTEM_PORT_LIST": [ | ||
{ | ||
"hostname": "host456", | ||
"asic_name": "asic0", | ||
"ifname": "Ethernet0", | ||
"core_index": "1", | ||
"core_port_index": "20", | ||
"num_voq": "8", | ||
"speed": "900000", | ||
"switch_id": "1", | ||
"system_port_id": "200" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
} |
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,95 @@ | ||
module sonic-system-port { | ||
|
||
yang-version 1.1; | ||
|
||
namespace "https://github.com/sonic-net/sonic-system-port"; | ||
prefix system-port; | ||
|
||
import sonic-port { | ||
prefix port; | ||
} | ||
|
||
import sonic-types { | ||
prefix stypes; | ||
} | ||
|
||
description "SYSTEM_PORT YANG Module for SONiC OS"; | ||
|
||
revision 2022-11-10 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-system-port { | ||
|
||
container SYSTEM_PORT { | ||
|
||
description "SYSTEM_PORT table of config_db.json"; | ||
|
||
list SYSTEM_PORT_LIST { | ||
|
||
key "hostname asic_name ifname"; | ||
|
||
leaf hostname { | ||
type stypes:hostname; | ||
} | ||
|
||
leaf asic_name { | ||
type string { | ||
pattern "[Aa]sic[0-4]"; | ||
} | ||
} | ||
|
||
leaf ifname { | ||
type union { | ||
type leafref { | ||
path /port:sonic-port/port:PORT/port:PORT_LIST/port:name; | ||
} | ||
type string { | ||
pattern "Cpu0"; | ||
} | ||
} | ||
} | ||
|
||
leaf core_index { | ||
type uint8 { | ||
range 0..7; | ||
} | ||
description "Hardware core index a port is affiliated with."; | ||
} | ||
|
||
leaf core_port_index { | ||
type uint16; | ||
description "Local port index index to an ASIC core."; | ||
} | ||
|
||
leaf num_voq { | ||
type uint8 { | ||
range 1..8; | ||
} | ||
description "Number of VoQs associated with a port."; | ||
} | ||
|
||
leaf speed { | ||
type uint32 { | ||
range 1..800000; | ||
} | ||
description "Port speed in Mbps."; | ||
} | ||
|
||
leaf switch_id { | ||
type uint16; | ||
description "On a VoQ switch, the global ASIC identifier."; | ||
} | ||
|
||
leaf system_port_id { | ||
type uint32; | ||
description "On a VoQ switch, the global port identifier."; | ||
} | ||
} | ||
/* end of list SYSTEM_PORT_LIST */ | ||
} | ||
/* end of container SYSTEM_PORT */ | ||
} | ||
/* end of container sonic-system-port */ | ||
} | ||
/* end of module sonic-system-port */ |