Skip to content

Commit

Permalink
Merge pull request #44 from QualiSystems/bugfix_duplicate_ids_for_pow…
Browse files Browse the repository at this point in the history
…er_ports

Solving duplicates for power port indexes
  • Loading branch information
yaroslavNqualisystems committed Apr 11, 2018
2 parents 1f6f68b + 9ccf0b6 commit e3da1e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ target/
#Ipython Notebook
.ipynb_checkpoints
.pypirc

.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def __init__(self, snmp_handler, shell_name, shell_type, resource_name, logger):
self._if_duplex_table = None
self._autoneg = None
self._lldp_keys = None
self._power_port_indexes = []

@property
def logger(self):
Expand Down Expand Up @@ -371,7 +372,12 @@ def _build_power_modules(self):
content_data = self.snmp_handler.get_properties("JUNIPER-MIB", index,
power_modules_snmp_attributes).get(index)
index1, index2, index3, index4 = index.split(".")[:4]
power_port_id = index2

power_port_id = int(index2)
if power_port_id in self._power_port_indexes:
power_port_id = max(self._power_port_indexes)+1
self._power_port_indexes.append(power_port_id)
power_port_id = str(power_port_id)

power_port = GenericPowerPort(shell_name=self.shell_name,
name="PP{}".format(power_port_id),
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.5
4.0.6

0 comments on commit e3da1e4

Please sign in to comment.