Skip to content

Commit

Permalink
DellEMC SFP Refactor (#9142)
Browse files Browse the repository at this point in the history
* DellEMC SFP Refactoring

* Update SFP

* Fix LGTM errors

* update sfp

* Add get_name()

* Add get_name()

* Update sfp.py
  • Loading branch information
aravindmani-1 authored Nov 17, 2021
1 parent 0fa687a commit 5a56659
Show file tree
Hide file tree
Showing 15 changed files with 803 additions and 7,154 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def get_change_event(self, timeout=0):
if(presence and self._global_port_pres_dict[port_num] == '0'):
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num-1)._initialize_media(delay=True)
elif(not presence and
self._global_port_pres_dict[port_num] == '1'):
self._global_port_pres_dict[port_num] = '0'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def get_change_event(self, timeout=0):
if(presence and self._global_port_pres_dict[port_num] == '0'):
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num-1)._initialize_media(delay=True)
elif(not presence and
self._global_port_pres_dict[port_num] == '1'):
self._global_port_pres_dict[port_num] = '0'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def get_change_event(self, timeout=0):
if(presence and self._global_port_pres_dict[port_num] == '0'):
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num)._initialize_media(delay=True)
elif(not presence and
self._global_port_pres_dict[port_num] == '1'):
self._global_port_pres_dict[port_num] = '0'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def get_change_event(self, timeout=0):
if(presence and self._global_port_pres_dict[port_num] == '0'):
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num-1)._initialize_media(delay=True)
elif(not presence and
self._global_port_pres_dict[port_num] == '1'):
self._global_port_pres_dict[port_num] = '0'
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _check_interrupts(self, port_dict):
is_port_dict_updated = True
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num)._initialize_media(delay=True)
elif(not presence and (self._global_port_pres_dict[port_num] == '1')):
is_port_dict_updated = True
self._global_port_pres_dict[port_num] = '0'
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -74,41 +74,41 @@ class Chassis(ChassisBase):

_global_port_pres_dict = {}
_port_to_i2c_mapping = {
1: 4,
2: 5,
3: 6,
4: 7,
5: 8,
6: 9,
7: 10,
8: 11,
9: 12,
10: 13,
11: 14,
12: 15,
13: 16,
14: 17,
15: 18,
16: 19,
17: 20,
18: 21,
19: 22,
20: 23,
21: 24,
22: 25,
23: 26,
24: 27,
25: 28,
26: 29,
27: 30,
28: 31,
29: 32,
30: 33,
31: 34,
32: 35,
33: 1,
34: 2,
}
1: 10,
2: 11,
3: 12,
4: 13,
5: 14,
6: 15,
7: 16,
8: 17,
9: 18,
10: 19,
11: 20,
12: 21,
13: 22,
14: 23,
15: 24,
16: 25,
17: 26,
18: 27,
19: 28,
20: 29,
21: 30,
22: 31,
23: 32,
24: 33,
25: 34,
26: 35,
27: 36,
28: 37,
29: 38,
30: 39,
31: 40,
32: 41,
33: 1,
34: 2
}

reboot_reason_dict = { 0x11: (ChassisBase.REBOOT_CAUSE_POWER_LOSS, "Power on reset"),
0x22: (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Soft-set CPU warm reset"),
Expand Down Expand Up @@ -175,6 +175,7 @@ def get_change_event(self, timeout=0):
if(presence and self._global_port_pres_dict[port_num] == '0'):
self._global_port_pres_dict[port_num] = '1'
port_dict[port_num] = '1'
self.get_sfp(port_num)._initialize_media(delay=True)
elif(not presence and
self._global_port_pres_dict[port_num] == '1'):
self._global_port_pres_dict[port_num] = '0'
Expand Down
Loading

0 comments on commit 5a56659

Please sign in to comment.