Skip to content

Commit 9a0ca72

Browse files
authored
Merge pull request #340 from gechiang/202205
[yang-models] Add YANG model for SYSTEM_PORT (#12689)
2 parents c49f39b + 88301b3 commit 9a0ca72

File tree

8 files changed

+331
-16
lines changed

8 files changed

+331
-16
lines changed

src/sonic-config-engine/tests/sample-voq-graph.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@
619619
<NumVoq>8</NumVoq>
620620
</SystemPort>
621621
<SystemPort>
622-
<Name>Ethernet1/1</Name>
622+
<Name>Ethernet0</Name>
623623
<Hostname>linecard-1</Hostname>
624624
<AsicName>Asic0</AsicName>
625625
<Speed>40000</Speed>
@@ -630,7 +630,7 @@
630630
<NumVoq>8</NumVoq>
631631
</SystemPort>
632632
<SystemPort>
633-
<Name>Ethernet1/2</Name>
633+
<Name>Ethernet4</Name>
634634
<Hostname>linecard-1</Hostname>
635635
<AsicName>Asic0</AsicName>
636636
<Speed>40000</Speed>
@@ -641,7 +641,7 @@
641641
<NumVoq>8</NumVoq>
642642
</SystemPort>
643643
<SystemPort>
644-
<Name>Ethernet1/3</Name>
644+
<Name>Ethernet8</Name>
645645
<Hostname>linecard-1</Hostname>
646646
<AsicName>Asic0</AsicName>
647647
<Speed>40000</Speed>
@@ -652,7 +652,7 @@
652652
<NumVoq>8</NumVoq>
653653
</SystemPort>
654654
<SystemPort>
655-
<Name>Ethernet1/4</Name>
655+
<Name>Ethernet12</Name>
656656
<Hostname>linecard-1</Hostname>
657657
<AsicName>Asic0</AsicName>
658658
<Speed>40000</Speed>
@@ -675,7 +675,7 @@
675675
<NumVoq>8</NumVoq>
676676
</SystemPort>
677677
<SystemPort>
678-
<Name>Ethernet1/5</Name>
678+
<Name>Ethernet0</Name>
679679
<Hostname>linecard-2</Hostname>
680680
<AsicName>Asic0</AsicName>
681681
<Speed>40000</Speed>
@@ -686,7 +686,7 @@
686686
<NumVoq>8</NumVoq>
687687
</SystemPort>
688688
<SystemPort>
689-
<Name>Ethernet1/6</Name>
689+
<Name>Ethernet4</Name>
690690
<Hostname>linecard-2</Hostname>
691691
<AsicName>Asic0</AsicName>
692692
<Speed>40000</Speed>
@@ -709,7 +709,7 @@
709709
<NumVoq>8</NumVoq>
710710
</SystemPort>
711711
<SystemPort>
712-
<Name>Ethernet1/7</Name>
712+
<Name>Ethernet8</Name>
713713
<Hostname>linecard-2</Hostname>
714714
<AsicName>Asic1</AsicName>
715715
<Speed>40000</Speed>
@@ -720,7 +720,7 @@
720720
<NumVoq>8</NumVoq>
721721
</SystemPort>
722722
<SystemPort>
723-
<Name>Ethernet1/8</Name>
723+
<Name>Ethernet12</Name>
724724
<Hostname>linecard-2</Hostname>
725725
<AsicName>Asic1</AsicName>
726726
<Speed>40000</Speed>

src/sonic-config-engine/tests/test_cfggen.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -914,16 +914,16 @@ def test_minigraph_voq_system_ports(self):
914914
json.loads(self.run_script(argument)),
915915
{
916916
"linecard-1|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "0", "speed": "1000", "core_index": "0", "system_port_id": "1" },
917-
"linecard-1|Asic0|Ethernet1/1": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" },
918-
"linecard-1|Asic0|Ethernet1/2": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" },
919-
"linecard-1|Asic0|Ethernet1/3": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" },
920-
"linecard-1|Asic0|Ethernet1/4": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" },
917+
"linecard-1|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "2" },
918+
"linecard-1|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "0", "system_port_id": "3" },
919+
"linecard-1|Asic0|Ethernet8": { "core_port_index": "3", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "4" },
920+
"linecard-1|Asic0|Ethernet12": { "core_port_index": "4", "num_voq": "8", "switch_id": "0", "speed": "40000", "core_index": "1", "system_port_id": "5" },
921921
"linecard-2|Asic0|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "2", "speed": "1000", "core_index": "0", "system_port_id": "256" },
922-
"linecard-2|Asic0|Ethernet1/5": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" },
923-
"linecard-2|Asic0|Ethernet1/6": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" },
922+
"linecard-2|Asic0|Ethernet0": { "core_port_index": "1", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "0", "system_port_id": "257" },
923+
"linecard-2|Asic0|Ethernet4": { "core_port_index": "2", "num_voq": "8", "switch_id": "2", "speed": "40000", "core_index": "1", "system_port_id": "258" },
924924
"linecard-2|Asic1|Cpu0": { "core_port_index": "0", "num_voq": "8", "switch_id": "4", "speed": "1000", "core_index": "0", "system_port_id": "259" },
925-
"linecard-2|Asic1|Ethernet1/7": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" },
926-
"linecard-2|Asic1|Ethernet1/8": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" }
925+
"linecard-2|Asic1|Ethernet8": { "core_port_index": "1", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "0", "system_port_id": "260" },
926+
"linecard-2|Asic1|Ethernet12": { "core_port_index": "2", "num_voq": "8", "switch_id": "4", "speed": "40000", "core_index": "1", "system_port_id": "261" }
927927
}
928928
)
929929

src/sonic-yang-models/doc/Configuration.md

+44
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Table of Contents
5454
* [Queue](#queue)
5555
* [Sflow](#sflow)
5656
* [Restapi](#restapi)
57+
* [System Port](#system-port)
5758
* [Tacplus Server](#tacplus-server)
5859
* [TC to Priority group map](#tc-to-priority-group-map)
5960
* [TC to Queue map](#tc-to-queue-map)
@@ -1616,6 +1617,49 @@ Container side configuration:
16161617
}
16171618
```
16181619

1620+
### System Port
1621+
Every port on the system requires a global representation, known as a System Port,
1622+
and is listed in this table.
1623+
1624+
```
1625+
{
1626+
"SYSTEM_PORT": {
1627+
"host227-4|asic0|Ethernet0": {
1628+
"core_index": "1",
1629+
"core_port_index": "1",
1630+
"num_voq": "8",
1631+
"speed": "100000",
1632+
"switch_id": "0",
1633+
"system_port_id": "1"
1634+
},
1635+
"host227-4|asic0|Ethernet4": {
1636+
"core_index": "1",
1637+
"core_port_index": "2",
1638+
"num_voq": "8",
1639+
"speed": "100000",
1640+
"switch_id": "0",
1641+
"system_port_id": "2"
1642+
},
1643+
"host227-5|asic0|Ethernet0": {
1644+
"core_index": "1",
1645+
"core_port_index": "1",
1646+
"num_voq": "8",
1647+
"speed": "100000",
1648+
"switch_id": "4",
1649+
"system_port_id": "80"
1650+
},
1651+
"host227-5|asic0|Ethernet4": {
1652+
"core_index": "1",
1653+
"core_port_index": "2",
1654+
"num_voq": "8",
1655+
"speed": "100000",
1656+
"switch_id": "4",
1657+
"system_port_id": "81"
1658+
}
1659+
}
1660+
}
1661+
```
1662+
16191663
### Tacplus Server
16201664

16211665
```

src/sonic-yang-models/setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def run(self):
165165
'./yang-models/sonic-pfc-priority-queue-map.yang',
166166
'./yang-models/sonic-pfc-priority-priority-group-map.yang',
167167
'./yang-models/sonic-port-qos-map.yang',
168+
'./yang-models/sonic-system-port.yang',
168169
'./yang-models/sonic-macsec.yang']),
169170
('cvlyang-models', ['./cvlyang-models/sonic-acl.yang',
170171
'./cvlyang-models/sonic-bgp-common.yang',
@@ -224,6 +225,7 @@ def run(self):
224225
'./cvlyang-models/sonic-pfc-priority-queue-map.yang',
225226
'./cvlyang-models/sonic-pfc-priority-priority-group-map.yang',
226227
'./cvlyang-models/sonic-port-qos-map.yang',
228+
'./cvlyang-models/sonic-system-port.yang',
227229
'./cvlyang-models/sonic-macsec.yang']),
228230
],
229231
zip_safe=False,

src/sonic-yang-models/tests/files/sample_config_db.json

+74
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,80 @@
12801280
"login": "local"
12811281
}
12821282
},
1283+
"SYSTEM_PORT": {
1284+
"host227-4|asic0|Cpu0": {
1285+
"core_index": "0",
1286+
"core_port_index": "0",
1287+
"num_voq": "8",
1288+
"speed": "10000",
1289+
"switch_id": "0",
1290+
"system_port_id": "1"
1291+
},
1292+
"host227-4|asic0|Ethernet0": {
1293+
"core_index": "1",
1294+
"core_port_index": "1",
1295+
"num_voq": "8",
1296+
"speed": "100000",
1297+
"switch_id": "0",
1298+
"system_port_id": "2"
1299+
},
1300+
"host227-4|asic0|Ethernet4": {
1301+
"core_index": "1",
1302+
"core_port_index": "2",
1303+
"num_voq": "8",
1304+
"speed": "100000",
1305+
"switch_id": "0",
1306+
"system_port_id": "3"
1307+
},
1308+
"host227-4|asic1|Cpu0": {
1309+
"core_index": "0",
1310+
"core_port_index": "0",
1311+
"num_voq": "8",
1312+
"speed": "10000",
1313+
"switch_id": "0",
1314+
"system_port_id": "41"
1315+
},
1316+
"host227-4|asic1|Ethernet8": {
1317+
"core_index": "0",
1318+
"core_port_index": "1",
1319+
"num_voq": "8",
1320+
"speed": "100000",
1321+
"switch_id": "2",
1322+
"system_port_id": "42"
1323+
},
1324+
"host227-4|asic1|Ethernet12": {
1325+
"core_index": "0",
1326+
"core_port_index": "2",
1327+
"num_voq": "8",
1328+
"speed": "100000",
1329+
"switch_id": "2",
1330+
"system_port_id": "43"
1331+
},
1332+
"host227-5|asic0|Cpu0": {
1333+
"core_index": "0",
1334+
"core_port_index": "0",
1335+
"num_voq": "8",
1336+
"speed": "10000",
1337+
"switch_id": "0",
1338+
"system_port_id": "81"
1339+
},
1340+
"host227-5|asic0|Ethernet0": {
1341+
"core_index": "1",
1342+
"core_port_index": "1",
1343+
"num_voq": "8",
1344+
"speed": "100000",
1345+
"switch_id": "4",
1346+
"system_port_id": "82"
1347+
},
1348+
"host227-5|asic0|Ethernet4": {
1349+
"core_index": "1",
1350+
"core_port_index": "2",
1351+
"num_voq": "8",
1352+
"speed": "100000",
1353+
"switch_id": "4",
1354+
"system_port_id": "83"
1355+
}
1356+
},
12831357
"TACPLUS": {
12841358
"global": {
12851359
"auth_type": "pap",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"SYSTEM_PORT_POSITIVE_CONFIG": {
3+
"desc": "Configure SYSTEM_PORT positive config."
4+
},
5+
"SYSTEM_PORT_WRONG_SPEED_PATTERN": {
6+
"desc": "Configure SYSTEM_PORT wrong speed.",
7+
"eStr": ["pattern", "does not satisfy"]
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"SYSTEM_PORT_POSITIVE_CONFIG": {
3+
"sonic-port:sonic-port": {
4+
"sonic-port:PORT": {
5+
"PORT_LIST": [
6+
{
7+
"admin_status": "up",
8+
"alias": "eth0",
9+
"description": "Ethernet0",
10+
"lanes": "65",
11+
"mtu": 9000,
12+
"name": "Ethernet0",
13+
"speed": 100000
14+
},
15+
{
16+
"admin_status": "up",
17+
"alias": "eth4",
18+
"description": "Ethernet4",
19+
"lanes": "65",
20+
"mtu": 9000,
21+
"name": "Ethernet4",
22+
"speed": 100000
23+
}
24+
]
25+
}
26+
},
27+
"sonic-system-port:sonic-system-port": {
28+
"sonic-system-port:SYSTEM_PORT": {
29+
"SYSTEM_PORT_LIST": [
30+
{
31+
"hostname": "host123",
32+
"asic_name": "asic0",
33+
"ifname": "Ethernet0",
34+
"core_index": "0",
35+
"core_port_index": "10",
36+
"num_voq": "8",
37+
"speed": "100000",
38+
"switch_id": "0",
39+
"system_port_id": "100"
40+
},
41+
{
42+
"hostname": "host123",
43+
"asic_name": "asic1",
44+
"ifname": "Ethernet4",
45+
"core_index": "1",
46+
"core_port_index": "20",
47+
"num_voq": "8",
48+
"speed": "100000",
49+
"switch_id": "1",
50+
"system_port_id": "200"
51+
}
52+
]
53+
}
54+
}
55+
},
56+
"SYSTEM_PORT_WRONG_SPEED_PATTERN": {
57+
"sonic-port:sonic-port": {
58+
"sonic-port:PORT": {
59+
"PORT_LIST": [
60+
{
61+
"admin_status": "up",
62+
"alias": "eth0",
63+
"description": "Ethernet0",
64+
"lanes": "65",
65+
"mtu": 9000,
66+
"name": "Ethernet0",
67+
"speed": 100000
68+
}
69+
]
70+
}
71+
},
72+
"sonic-system-port:sonic-system-port": {
73+
"sonic-system-port:SYSTEM_PORT": {
74+
"SYSTEM_PORT_LIST": [
75+
{
76+
"hostname": "host456",
77+
"asic_name": "asic0",
78+
"ifname": "Ethernet0",
79+
"core_index": "1",
80+
"core_port_index": "20",
81+
"num_voq": "8",
82+
"speed": "900000",
83+
"switch_id": "1",
84+
"system_port_id": "200"
85+
}
86+
]
87+
}
88+
}
89+
}
90+
91+
}

0 commit comments

Comments
 (0)