Skip to content

Commit 1ee8ed9

Browse files
BalaselviShuotian Cheng
authored andcommitted
[Inventec]: Add Inventec D7054 platform support and update D7032 platform support (#1052)
1 parent 2a56479 commit 1ee8ed9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+9242
-263
lines changed

device/inventec/x86_64-inventec_d7032q28b-r0/plugins/eeprom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
class board(eeprom_tlvinfo.TlvInfoDecoder):
1919

2020
def __init__(self, name, path, cpld_root, ro):
21-
self.eeprom_path = "/tmp/eeprom"
21+
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
2222
super(board, self).__init__(self.eeprom_path, 0, '', True)

device/inventec/x86_64-inventec_d7032q28b-r0/plugins/sfputil.py

Lines changed: 125 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
#!/usr/bin/env python
1+
# sfputil.py
2+
#
3+
# Platform-specific SFP transceiver interface for SONiC
4+
#
25

36
try:
4-
from sonic_sfp.sfputilbase import sfputilbase
5-
except ImportError, e:
6-
raise ImportError (str(e) + "- required module not found")
7+
import time
8+
from sonic_sfp.sfputilbase import SfpUtilBase
9+
except ImportError as e:
10+
raise ImportError("%s - required module not found" % str(e))
711

812

9-
class sfputil(sfputilbase):
10-
"""Platform specific sfputil class"""
13+
class SfpUtil(SfpUtilBase):
14+
"""Platform-specific SfpUtil class"""
1115

12-
port_start = 0
13-
port_end = 31
14-
ports_in_block = 32
16+
PORT_START = 0
17+
PORT_END = 31
18+
PORTS_IN_BLOCK = 32
1519

16-
port_to_eeprom_mapping = {}
20+
_port_to_eeprom_mapping = {}
1721
port_to_i2c_mapping = {
1822
0: 22,
1923
1: 23,
@@ -49,12 +53,117 @@ class sfputil(sfputilbase):
4953
31: 21
5054
}
5155

52-
_qsfp_ports = range(0, ports_in_block + 1)
56+
@property
57+
def port_start(self):
58+
return self.PORT_START
5359

54-
def __init__(self, port_num):
55-
# Override port_to_eeprom_mapping for class initialization
56-
eeprom_path = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom'
57-
for x in range(self.port_start, self.port_end + 1):
60+
@property
61+
def port_end(self):
62+
return self.PORT_END
63+
64+
@property
65+
def qsfp_ports(self):
66+
return range(0, self.PORTS_IN_BLOCK + 1)
67+
68+
@property
69+
def port_to_eeprom_mapping(self):
70+
return self._port_to_eeprom_mapping
71+
72+
def __init__(self):
73+
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
74+
75+
for x in range(0, self.port_end + 1):
5876
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x])
5977
self.port_to_eeprom_mapping[x] = port_eeprom_path
60-
sfputilbase.__init__(self, port_num)
78+
SfpUtilBase.__init__(self)
79+
80+
def get_presence(self, port_num):
81+
# Check for invalid port_num
82+
if port_num < self.port_start or port_num > self.port_end:
83+
return False
84+
85+
try:
86+
reg_file = open("/sys/class/swps/port"+str(port_num)+"/present")
87+
except IOError as e:
88+
print "Error: unable to open file: %s" % str(e)
89+
return False
90+
91+
reg_value = int(reg_file.readline().rstrip())
92+
93+
if reg_value == 0:
94+
return True
95+
96+
return False
97+
98+
def get_low_power_mode(self, port_num):
99+
# Check for invalid port_num
100+
if port_num < self.port_start or port_num > self.port_end:
101+
return False
102+
103+
try:
104+
reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod")
105+
except IOError as e:
106+
print "Error: unable to open file: %s" % str(e)
107+
108+
reg_value = int(reg_file.readline().rstrip())
109+
110+
if reg_value == 0:
111+
return False
112+
113+
return True
114+
115+
def set_low_power_mode(self, port_num, lpmode):
116+
# Check for invalid port_num
117+
if port_num < self.port_start or port_num > self.port_end:
118+
return False
119+
120+
try:
121+
reg_file = open("/sys/class/swps/port"+str(port_num)+"/lpmod", "r+")
122+
except IOError as e:
123+
print "Error: unable to open file: %s" % str(e)
124+
return False
125+
126+
reg_value = int(reg_file.readline().rstrip())
127+
128+
# LPMode is active high; set or clear the bit accordingly
129+
if lpmode is True:
130+
reg_value = 1
131+
else:
132+
reg_value = 0
133+
134+
reg_file.write(hex(reg_value))
135+
reg_file.close()
136+
137+
return True
138+
139+
def reset(self, port_num):
140+
QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/class/swps/port"+str(port_num)+"/reset"
141+
# Check for invalid port_num
142+
if port_num < self.port_start or port_num > self.port_end:
143+
return False
144+
145+
try:
146+
reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+")
147+
except IOError as e:
148+
print "Error: unable to open file: %s" % str(e)
149+
return False
150+
151+
reg_value = 0
152+
reg_file.write(hex(reg_value))
153+
reg_file.close()
154+
155+
# Sleep 2 second to allow it to settle
156+
time.sleep(2)
157+
158+
# Flip the value back write back to the register to take port out of reset
159+
try:
160+
reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+")
161+
except IOError as e:
162+
print "Error: unable to open file: %s" % str(e)
163+
return False
164+
165+
reg_value = 1
166+
reg_file.write(hex(reg_value))
167+
reg_file.close()
168+
169+
return True
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 48x25G + 6x100G
2+
# name lanes alias
3+
Ethernet0 2 Ethernet0
4+
Ethernet4 1 Ethernet4
5+
Ethernet8 4 Ethernet8
6+
Ethernet12 3 Ethernet12
7+
Ethernet16 6 Ethernet16
8+
Ethernet20 5 Ethernet20
9+
Ethernet24 8 Ethernet24
10+
Ethernet28 7 Ethernet28
11+
Ethernet32 10 Ethernet32
12+
Ethernet36 9 Ethernet36
13+
Ethernet40 12 Ethernet40
14+
Ethernet44 11 Ethernet44
15+
Ethernet48 22 Ethernet48
16+
Ethernet52 21 Ethernet52
17+
Ethernet56 24 Ethernet56
18+
Ethernet60 23 Ethernet60
19+
Ethernet64 34 Ethernet64
20+
Ethernet68 33 Ethernet68
21+
Ethernet72 36 Ethernet72
22+
Ethernet76 35 Ethernet76
23+
Ethernet80 38 Ethernet80
24+
Ethernet84 37 Ethernet84
25+
Ethernet88 40 Ethernet88
26+
Ethernet92 39 Ethernet92
27+
Ethernet96 42 Ethernet96
28+
Ethernet100 41 Ethernet100
29+
Ethernet104 44 Ethernet104
30+
Ethernet108 43 Ethernet108
31+
Ethernet112 50 Ethernet112
32+
Ethernet116 49 Ethernet116
33+
Ethernet120 52 Ethernet120
34+
Ethernet124 51 Ethernet124
35+
Ethernet128 54 Ethernet128
36+
Ethernet132 53 Ethernet132
37+
Ethernet136 56 Ethernet136
38+
Ethernet140 55 Ethernet140
39+
Ethernet144 66 Ethernet144
40+
Ethernet148 65 Ethernet148
41+
Ethernet152 68 Ethernet152
42+
Ethernet156 67 Ethernet156
43+
Ethernet160 70 Ethernet160
44+
Ethernet164 69 Ethernet164
45+
Ethernet168 72 Ethernet168
46+
Ethernet172 71 Ethernet172
47+
Ethernet176 82 Ethernet176
48+
Ethernet180 81 Ethernet180
49+
Ethernet184 84 Ethernet184
50+
Ethernet188 83 Ethernet188
51+
Ethernet192 85,86,87,88 Ethernet192
52+
Ethernet196 97,98,99,100 Ethernet196
53+
Ethernet200 105,106,107,108 Ethernet200
54+
Ethernet204 101,102,103,104 Ethernet204
55+
Ethernet208 117,118,119,120 Ethernet208
56+
Ethernet212 109,110,111,112 Ethernet212
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SAI_INIT_CONFIG_FILE=/etc/bcm/th-d7054q28b-48x10g-6x100g.config.bcm
2+
SAI_NUM_ECMP_MEMBERS=32
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONSOLE_PORT=0x3f8
2+
CONSOLE_DEV=0
3+
CONSOLE_SPEED=115200
4+
VAR_LOG_SIZE=1024
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<DeviceMiniGraph xmlns="Microsoft.Search.Autopilot.Evolution" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
2+
<CpgDec>
3+
<IsisRouters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
4+
<PeeringSessions>
5+
<BGPSession>
6+
<StartRouter>OCPSCH0104001MS</StartRouter>
7+
<StartPeer>10.10.1.26</StartPeer>
8+
<EndRouter>SONiC-Inventec-d7054</EndRouter>
9+
<EndPeer>10.10.1.25</EndPeer>
10+
<Multihop>1</Multihop>
11+
<HoldTime>10</HoldTime>
12+
<KeepAliveTime>3</KeepAliveTime>
13+
</BGPSession>
14+
<BGPSession>
15+
<StartRouter>OCPSCH0104002MS</StartRouter>
16+
<StartPeer>10.10.2.26</StartPeer>
17+
<EndRouter>SONiC-Inventec-d7054</EndRouter>
18+
<EndPeer>10.10.2.25</EndPeer>
19+
<Multihop>1</Multihop>
20+
<HoldTime>10</HoldTime>
21+
<KeepAliveTime>3</KeepAliveTime>
22+
</BGPSession>
23+
</PeeringSessions>
24+
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
25+
<a:BGPRouterDeclaration>
26+
<a:ASN>64536</a:ASN>
27+
<a:Hostname>SONiC-Inventec-d7054</a:Hostname>
28+
<a:Peers>
29+
<BGPPeer>
30+
<Address>10.10.1.26</Address>
31+
<RouteMapIn i:nil="true"/>
32+
<RouteMapOut i:nil="true"/>
33+
</BGPPeer>
34+
<BGPPeer>
35+
<Address>10.10.2.26</Address>
36+
<RouteMapIn i:nil="true"/>
37+
<RouteMapOut i:nil="true"/>
38+
</BGPPeer>
39+
</a:Peers>
40+
<a:RouteMaps/>
41+
</a:BGPRouterDeclaration>
42+
<a:BGPRouterDeclaration>
43+
<a:ASN>64542</a:ASN>
44+
<a:Hostname>OCPSCH0104001MS</a:Hostname>
45+
<a:RouteMaps/>
46+
</a:BGPRouterDeclaration>
47+
<a:BGPRouterDeclaration>
48+
<a:ASN>64543</a:ASN>
49+
<a:Hostname>OCPSCH0104002MS</a:Hostname>
50+
<a:RouteMaps/>
51+
</a:BGPRouterDeclaration>
52+
</Routers>
53+
</CpgDec>
54+
<DpgDec>
55+
<DeviceDataPlaneInfo>
56+
<IPSecTunnels/>
57+
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
58+
<a:LoopbackIPInterface>
59+
<Name>HostIP</Name>
60+
<AttachTo>Loopback0</AttachTo>
61+
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
62+
<b:IPPrefix>100.0.0.9/32</b:IPPrefix>
63+
</a:Prefix>
64+
<a:PrefixStr>100.0.0.9/32</a:PrefixStr>
65+
</a:LoopbackIPInterface>
66+
</LoopbackIPInterfaces>
67+
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
68+
</ManagementIPInterfaces>
69+
<MplsInterfaces/>
70+
<MplsTeInterfaces/>
71+
<RsvpInterfaces/>
72+
<Hostname>SONiC-Inventec-d7054</Hostname>
73+
<PortChannelInterfaces/>
74+
<VlanInterfaces/>
75+
<IPInterfaces>
76+
<IPInterface>
77+
<Name i:nil="true"/>
78+
<AttachTo>Ethernet0</AttachTo>
79+
<Prefix>10.10.1.25/30</Prefix>
80+
</IPInterface>
81+
<IPInterface>
82+
<Name i:nil="true"/>
83+
<AttachTo>Ethernet4</AttachTo>
84+
<Prefix>10.10.2.25/30</Prefix>
85+
</IPInterface>
86+
</IPInterfaces>
87+
<DataAcls/>
88+
<AclInterfaces/>
89+
<DownstreamSummaries/>
90+
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
91+
</DeviceDataPlaneInfo>
92+
</DpgDec>
93+
<PngDec>
94+
<DeviceInterfaceLinks>
95+
<DeviceLinkBase i:type="DeviceInterfaceLink">
96+
<Bandwidth>40000</Bandwidth>
97+
<ElementType>DeviceInterfaceLink</ElementType>
98+
<EndDevice>OCPSCH0104001MS</EndDevice>
99+
<EndPort>Ethernet24</EndPort>
100+
<StartDevice>SONiC-Inventec-d7054</StartDevice>
101+
<StartPort>Ethernet0</StartPort>
102+
</DeviceLinkBase>
103+
<DeviceLinkBase i:type="DeviceInterfaceLink">
104+
<Bandwidth>40000</Bandwidth>
105+
<ElementType>DeviceInterfaceLink</ElementType>
106+
<EndDevice>OCPSCH0104002MS</EndDevice>
107+
<EndPort>Ethernet24</EndPort>
108+
<StartDevice>SONiC-Inventec-d7054</StartDevice>
109+
<StartPort>Ethernet4</StartPort>
110+
</DeviceLinkBase>
111+
</DeviceInterfaceLinks>
112+
<Devices>
113+
<Device i:type="LeafRouter">
114+
<Hostname>SONiC-Inventec-d7054</Hostname>
115+
<HwSku>INVENTEC-D7054Q28B-S48-Q6</HwSku>
116+
</Device>
117+
</Devices>
118+
</PngDec>
119+
<MetadataDeclaration>
120+
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
121+
<a:DeviceMetadata>
122+
<a:Name>SONiC-Inventec-d7054</a:Name>
123+
<a:Properties>
124+
<a:DeviceProperty>
125+
<a:Name>DhcpResources</a:Name>
126+
<a:Reference i:nil="true"/>
127+
<a:Value></a:Value>
128+
</a:DeviceProperty>
129+
<a:DeviceProperty>
130+
<a:Name>NtpResources</a:Name>
131+
<a:Reference i:nil="true"/>
132+
<a:Value>0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org</a:Value>
133+
</a:DeviceProperty>
134+
<a:DeviceProperty>
135+
<a:Name>SyslogResources</a:Name>
136+
<a:Reference i:nil="true"/>
137+
<a:Value></a:Value>
138+
</a:DeviceProperty>
139+
</a:Properties>
140+
</a:DeviceMetadata>
141+
</Devices>
142+
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
143+
</MetadataDeclaration>
144+
<Hostname>SONiC-Inventec-d7054</Hostname>
145+
<HwSku>INVENTEC-D7054Q28B-S48-Q6</HwSku>
146+
</DeviceMiniGraph>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
3+
#############################################################################
4+
# Inventec d7032q28b
5+
#
6+
# Platform and model specific eeprom subclass, inherits from the base class,
7+
# and provides the followings:
8+
# - the eeprom format definition
9+
# - specific encoder/decoder if there is special need
10+
#############################################################################
11+
12+
try:
13+
from sonic_eeprom import eeprom_tlvinfo
14+
except ImportError, e:
15+
raise ImportError (str(e) + "- required module not found")
16+
17+
18+
class board(eeprom_tlvinfo.TlvInfoDecoder):
19+
20+
def __init__(self, name, path, cpld_root, ro):
21+
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0053/eeprom"
22+
super(board, self).__init__(self.eeprom_path, 0, '', True)

0 commit comments

Comments
 (0)