Skip to content

Commit

Permalink
Merge branch 'feature/snmpv3-management-profile' into snmpv3
Browse files Browse the repository at this point in the history
  • Loading branch information
lunkwill42 committed Nov 2, 2023
2 parents f28c4fc + 7f9b82f commit f936740
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/nav/models/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,18 @@ def __str__(self):

@property
def is_snmp(self):
return self.protocol == self.PROTOCOL_SNMP
return self.protocol in (self.PROTOCOL_SNMP, self.PROTOCOL_SNMPV3)

@property
def snmp_version(self):
"""Returns the configured SNMP version as an integer"""
if self.is_snmp:
if self.protocol == self.PROTOCOL_SNMP:
value = self.configuration['version']
if value == "2c":
return 2
return int(value)
elif self.protocol == self.PROTOCOL_SNMPV3:
return 3

raise ValueError(
"Getting snmp protocol version for non-snmp management profile"
Expand Down

0 comments on commit f936740

Please sign in to comment.