Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yang-models] Add YANG model for SYSTEM_PORT #12689

Merged
merged 6 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -889,16 +889,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 @@ -50,6 +50,7 @@ Table of Contents
* [Syslog Rate Limit](#syslog-rate-limit)
* [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 @@ -1521,6 +1522,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 @@ -175,6 +175,7 @@ def run(self):
'./yang-models/sonic-logger.yang',
'./yang-models/sonic-port-qos-map.yang',
'./yang-models/sonic-static-route.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 @@ -241,6 +242,7 @@ def run(self):
'./cvlyang-models/sonic-logger.yang',
'./cvlyang-models/sonic-port-qos-map.yang',
'./cvlyang-models/sonic-static-route.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 @@ -1338,6 +1338,80 @@
"login": "local"
}
},
"SYSTEM_PORT": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kindly point to the source of truth for config, e.g. HLD, Orchagent processing functions etc. Thx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see PortsOrch::addSystemPorts() in sonic-swss/orchagent/portsorch.cpp

"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