Skip to content

Commit

Permalink
Merge pull request sonic-net#340 from gechiang/202205
Browse files Browse the repository at this point in the history
[yang-models] Add YANG model for SYSTEM_PORT (sonic-net#12689)
  • Loading branch information
gechiang authored Apr 20, 2024
2 parents c49f39b + 88301b3 commit 9a0ca72
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/sonic-config-engine/tests/sample-voq-graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/1</Name>
<Name>Ethernet0</Name>
<Hostname>linecard-1</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -630,7 +630,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/2</Name>
<Name>Ethernet4</Name>
<Hostname>linecard-1</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -641,7 +641,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/3</Name>
<Name>Ethernet8</Name>
<Hostname>linecard-1</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -652,7 +652,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/4</Name>
<Name>Ethernet12</Name>
<Hostname>linecard-1</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -675,7 +675,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/5</Name>
<Name>Ethernet0</Name>
<Hostname>linecard-2</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -686,7 +686,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/6</Name>
<Name>Ethernet4</Name>
<Hostname>linecard-2</Hostname>
<AsicName>Asic0</AsicName>
<Speed>40000</Speed>
Expand All @@ -709,7 +709,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/7</Name>
<Name>Ethernet8</Name>
<Hostname>linecard-2</Hostname>
<AsicName>Asic1</AsicName>
<Speed>40000</Speed>
Expand All @@ -720,7 +720,7 @@
<NumVoq>8</NumVoq>
</SystemPort>
<SystemPort>
<Name>Ethernet1/8</Name>
<Name>Ethernet12</Name>
<Hostname>linecard-2</Hostname>
<AsicName>Asic1</AsicName>
<Speed>40000</Speed>
Expand Down
16 changes: 8 additions & 8 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,16 +914,16 @@ def test_minigraph_voq_system_ports(self):
json.loads(self.run_script(argument)),
{
"linecard-1|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "0", "speed": "1000", "core_index": "0", "system_port_id": "1" },
"linecard-1|Asic0|Ethernet1/1": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" },
"linecard-1|Asic0|Ethernet1/2": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" },
"linecard-1|Asic0|Ethernet1/3": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" },
"linecard-1|Asic0|Ethernet1/4": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" },
"linecard-1|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" },
"linecard-1|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" },
"linecard-1|Asic0|Ethernet8": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" },
"linecard-1|Asic0|Ethernet12": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" },
"linecard-2|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "2", "speed": "1000", "core_index": "0", "system_port_id": "256" },
"linecard-2|Asic0|Ethernet1/5": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" },
"linecard-2|Asic0|Ethernet1/6": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" },
"linecard-2|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" },
"linecard-2|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" },
"linecard-2|Asic1|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "4", "speed": "1000", "core_index": "0", "system_port_id": "259" },
"linecard-2|Asic1|Ethernet1/7": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" },
"linecard-2|Asic1|Ethernet1/8": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" }
"linecard-2|Asic1|Ethernet8": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" },
"linecard-2|Asic1|Ethernet12": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" }
}
)

Expand Down
44 changes: 44 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Table of Contents
* [Queue](#queue)
* [Sflow](#sflow)
* [Restapi](#restapi)
* [System Port](#system-port)
* [Tacplus Server](#tacplus-server)
* [TC to Priority group map](#tc-to-priority-group-map)
* [TC to Queue map](#tc-to-queue-map)
Expand Down Expand Up @@ -1616,6 +1617,49 @@ Container side configuration:
}
```

### System Port
Every port on the system requires a global representation, known as a System Port,
and is listed in this table.

```
{
"SYSTEM_PORT": {
"host227-4|asic0|Ethernet0": {
"core_index": "1",
"core_port_index": "1",
"num_voq": "8",
"speed": "100000",
"switch_id": "0",
"system_port_id": "1"
},
"host227-4|asic0|Ethernet4": {
"core_index": "1",
"core_port_index": "2",
"num_voq": "8",
"speed": "100000",
"switch_id": "0",
"system_port_id": "2"
},
"host227-5|asic0|Ethernet0": {
"core_index": "1",
"core_port_index": "1",
"num_voq": "8",
"speed": "100000",
"switch_id": "4",
"system_port_id": "80"
},
"host227-5|asic0|Ethernet4": {
"core_index": "1",
"core_port_index": "2",
"num_voq": "8",
"speed": "100000",
"switch_id": "4",
"system_port_id": "81"
}
}
}
```

### Tacplus Server

```
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def run(self):
'./yang-models/sonic-pfc-priority-queue-map.yang',
'./yang-models/sonic-pfc-priority-priority-group-map.yang',
'./yang-models/sonic-port-qos-map.yang',
'./yang-models/sonic-system-port.yang',
'./yang-models/sonic-macsec.yang']),
('cvlyang-models', ['./cvlyang-models/sonic-acl.yang',
'./cvlyang-models/sonic-bgp-common.yang',
Expand Down Expand Up @@ -224,6 +225,7 @@ def run(self):
'./cvlyang-models/sonic-pfc-priority-queue-map.yang',
'./cvlyang-models/sonic-pfc-priority-priority-group-map.yang',
'./cvlyang-models/sonic-port-qos-map.yang',
'./cvlyang-models/sonic-system-port.yang',
'./cvlyang-models/sonic-macsec.yang']),
],
zip_safe=False,
Expand Down
74 changes: 74 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,80 @@
"login": "local"
}
},
"SYSTEM_PORT": {
"host227-4|asic0|Cpu0": {
"core_index": "0",
"core_port_index": "0",
"num_voq": "8",
"speed": "10000",
"switch_id": "0",
"system_port_id": "1"
},
"host227-4|asic0|Ethernet0": {
"core_index": "1",
"core_port_index": "1",
"num_voq": "8",
"speed": "100000",
"switch_id": "0",
"system_port_id": "2"
},
"host227-4|asic0|Ethernet4": {
"core_index": "1",
"core_port_index": "2",
"num_voq": "8",
"speed": "100000",
"switch_id": "0",
"system_port_id": "3"
},
"host227-4|asic1|Cpu0": {
"core_index": "0",
"core_port_index": "0",
"num_voq": "8",
"speed": "10000",
"switch_id": "0",
"system_port_id": "41"
},
"host227-4|asic1|Ethernet8": {
"core_index": "0",
"core_port_index": "1",
"num_voq": "8",
"speed": "100000",
"switch_id": "2",
"system_port_id": "42"
},
"host227-4|asic1|Ethernet12": {
"core_index": "0",
"core_port_index": "2",
"num_voq": "8",
"speed": "100000",
"switch_id": "2",
"system_port_id": "43"
},
"host227-5|asic0|Cpu0": {
"core_index": "0",
"core_port_index": "0",
"num_voq": "8",
"speed": "10000",
"switch_id": "0",
"system_port_id": "81"
},
"host227-5|asic0|Ethernet0": {
"core_index": "1",
"core_port_index": "1",
"num_voq": "8",
"speed": "100000",
"switch_id": "4",
"system_port_id": "82"
},
"host227-5|asic0|Ethernet4": {
"core_index": "1",
"core_port_index": "2",
"num_voq": "8",
"speed": "100000",
"switch_id": "4",
"system_port_id": "83"
}
},
"TACPLUS": {
"global": {
"auth_type": "pap",
Expand Down
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"]
}
}
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"
}
]
}
}
}

}
Loading

0 comments on commit 9a0ca72

Please sign in to comment.