File tree 4 files changed +103
-4
lines changed
platform/broadcom/sonic-platform-modules-accton
as7326-56x/sonic_platform
as7726-32x/sonic_platform
as7816-64x/sonic_platform
as9716-32d/sonic_platform
4 files changed +103
-4
lines changed Original file line number Diff line number Diff line change 7
7
#############################################################################
8
8
9
9
try :
10
+ import sys
10
11
import time
11
12
from sonic_platform_pddf_base .pddf_chassis import PddfChassis
12
13
except ImportError as e :
@@ -38,7 +39,7 @@ def get_change_event(self, timeout=2000):
38
39
39
40
bitmap = 0
40
41
for i in range (58 ):
41
- modpres = self .get_sfp (i ).get_presence ()
42
+ modpres = self .get_sfp (i + 1 ).get_presence ()
42
43
if modpres :
43
44
bitmap = bitmap | (1 << i )
44
45
@@ -59,3 +60,26 @@ def get_change_event(self, timeout=2000):
59
60
return True , change_dict
60
61
else :
61
62
return True , change_dict
63
+
64
+ def get_sfp (self , index ):
65
+ """
66
+ Retrieves sfp represented by (1-based) index <index>
67
+
68
+ Args:
69
+ index: An integer, the index (1-based) of the sfp to retrieve.
70
+ The index should be the sequence of a physical port in a chassis,
71
+ starting from 1.
72
+ For example, 1 for Ethernet0, 2 for Ethernet4 and so on.
73
+
74
+ Returns:
75
+ An object derived from SfpBase representing the specified sfp
76
+ """
77
+ sfp = None
78
+
79
+ try :
80
+ # The index will start from 1
81
+ sfp = self ._sfp_list [index - 1 ]
82
+ except IndexError :
83
+ sys .stderr .write ("SFP index {} out of range (1-{})\n " .format (
84
+ index , len (self ._sfp_list )))
85
+ return sfp
Original file line number Diff line number Diff line change 7
7
#############################################################################
8
8
9
9
try :
10
+ import sys
10
11
import time
11
12
from sonic_platform_pddf_base .pddf_chassis import PddfChassis
12
13
except ImportError as e :
@@ -38,7 +39,7 @@ def get_change_event(self, timeout=2000):
38
39
39
40
bitmap = 0
40
41
for i in range (34 ):
41
- modpres = self .get_sfp (i ).get_presence ()
42
+ modpres = self .get_sfp (i + 1 ).get_presence ()
42
43
if modpres :
43
44
bitmap = bitmap | (1 << i )
44
45
@@ -59,3 +60,27 @@ def get_change_event(self, timeout=2000):
59
60
return True , change_dict
60
61
else :
61
62
return True , change_dict
63
+
64
+
65
+ def get_sfp (self , index ):
66
+ """
67
+ Retrieves sfp represented by (1-based) index <index>
68
+
69
+ Args:
70
+ index: An integer, the index (1-based) of the sfp to retrieve.
71
+ The index should be the sequence of a physical port in a chassis,
72
+ starting from 1.
73
+ For example, 1 for Ethernet0, 2 for Ethernet4 and so on.
74
+
75
+ Returns:
76
+ An object derived from SfpBase representing the specified sfp
77
+ """
78
+ sfp = None
79
+
80
+ try :
81
+ # The index will start from 1
82
+ sfp = self ._sfp_list [index - 1 ]
83
+ except IndexError :
84
+ sys .stderr .write ("SFP index {} out of range (1-{})\n " .format (
85
+ index , len (self ._sfp_list )))
86
+ return sfp
Original file line number Diff line number Diff line change 7
7
#############################################################################
8
8
9
9
try :
10
+ import sys
10
11
import time
11
12
from sonic_platform_pddf_base .pddf_chassis import PddfChassis
12
13
except ImportError as e :
@@ -38,7 +39,7 @@ def get_change_event(self, timeout=2000):
38
39
39
40
bitmap = 0
40
41
for i in range (64 ):
41
- modpres = self .get_sfp (i ).get_presence ()
42
+ modpres = self .get_sfp (i + 1 ).get_presence ()
42
43
if modpres :
43
44
bitmap = bitmap | (1 << i )
44
45
@@ -59,3 +60,27 @@ def get_change_event(self, timeout=2000):
59
60
return True , change_dict
60
61
else :
61
62
return True , change_dict
63
+
64
+
65
+ def get_sfp (self , index ):
66
+ """
67
+ Retrieves sfp represented by (1-based) index <index>
68
+
69
+ Args:
70
+ index: An integer, the index (1-based) of the sfp to retrieve.
71
+ The index should be the sequence of a physical port in a chassis,
72
+ starting from 1.
73
+ For example, 1 for Ethernet0, 2 for Ethernet4 and so on.
74
+
75
+ Returns:
76
+ An object derived from SfpBase representing the specified sfp
77
+ """
78
+ sfp = None
79
+
80
+ try :
81
+ # The index will start from 1
82
+ sfp = self ._sfp_list [index - 1 ]
83
+ except IndexError :
84
+ sys .stderr .write ("SFP index {} out of range (1-{})\n " .format (
85
+ index , len (self ._sfp_list )))
86
+ return sfp
Original file line number Diff line number Diff line change 7
7
#############################################################################
8
8
9
9
try :
10
+ import sys
10
11
import time
11
12
from sonic_platform_pddf_base .pddf_chassis import PddfChassis
12
13
except ImportError as e :
@@ -38,7 +39,7 @@ def get_change_event(self, timeout=2000):
38
39
39
40
bitmap = 0
40
41
for i in range (34 ):
41
- modpres = self .get_sfp (i ).get_presence ()
42
+ modpres = self .get_sfp (i + 1 ).get_presence ()
42
43
if modpres :
43
44
bitmap = bitmap | (1 << i )
44
45
@@ -59,3 +60,27 @@ def get_change_event(self, timeout=2000):
59
60
return True , change_dict
60
61
else :
61
62
return True , change_dict
63
+
64
+
65
+ def get_sfp (self , index ):
66
+ """
67
+ Retrieves sfp represented by (1-based) index <index>
68
+
69
+ Args:
70
+ index: An integer, the index (1-based) of the sfp to retrieve.
71
+ The index should be the sequence of a physical port in a chassis,
72
+ starting from 1.
73
+ For example, 1 for Ethernet0, 2 for Ethernet4 and so on.
74
+
75
+ Returns:
76
+ An object derived from SfpBase representing the specified sfp
77
+ """
78
+ sfp = None
79
+
80
+ try :
81
+ # The index will start from 1
82
+ sfp = self ._sfp_list [index - 1 ]
83
+ except IndexError :
84
+ sys .stderr .write ("SFP index {} out of range (1-{})\n " .format (
85
+ index , len (self ._sfp_list )))
86
+ return sfp
You can’t perform that action at this time.
0 commit comments