Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
5743e076
Commit
5743e076
authored
3 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
began processing review
parent
6eeda113
No related branches found
No related tags found
1 merge request
!288
Resolve L2SS-446 "Extend snmp client to support mib files"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/tangostationcontrol/clients/snmp_client.py
+4
-10
4 additions, 10 deletions
...stationcontrol/tangostationcontrol/clients/snmp_client.py
tangostationcontrol/tangostationcontrol/devices/snmp_device.py
+3
-4
3 additions, 4 deletions
...stationcontrol/tangostationcontrol/devices/snmp_device.py
with
7 additions
and
14 deletions
tangostationcontrol/tangostationcontrol/clients/snmp_client.py
+
4
−
10
View file @
5743e076
...
...
@@ -52,13 +52,7 @@ class SNMP_client(CommClient):
self
.
connected
=
True
def
_setup_annotation
(
self
,
annotation
):
"""
The SNMP client uses a dict and takes the following keys:
mib: the mib name
name: name of the value to read
index (optional) the index if the value thats being read from is a table.
"""
def
_process_annotation
(
self
,
annotation
):
# check if the 'mib' and 'name' keys are present
if
'
mib
'
in
annotation
and
'
name
'
in
annotation
:
...
...
@@ -94,7 +88,7 @@ class SNMP_client(CommClient):
"""
# process the annotation
mib
,
name
,
idx
=
self
.
_
setup
_annotation
(
annotation
)
mib
,
name
,
idx
=
self
.
_
process
_annotation
(
annotation
)
# get all the necessary data to set up the read/write functions from the attribute_wrapper
dim_x
,
dim_y
,
dtype
=
self
.
setup_value_conversion
(
attribute
)
...
...
@@ -236,10 +230,9 @@ class snmp_attribute:
class
mib_loader
:
def
__init__
(
self
):
def
__init__
(
self
,
mib_dir
:
str
):
self
.
mibBuilder
=
builder
.
MibBuilder
()
def
set_pymib_dir
(
self
,
mib_dir
:
str
):
abs_path
=
str
(
Path
().
absolute
()).
replace
(
"
\\
"
,
"
/
"
)
if
mib_dir
[
0
]
!=
"
/
"
:
...
...
@@ -250,6 +243,7 @@ class mib_loader:
mib_source
=
builder
.
DirMibSource
(
dir_path
)
self
.
mibBuilder
.
addMibSources
(
mib_source
)
def
load_pymib
(
self
,
mib_name
):
self
.
mibBuilder
.
loadModule
(
mib_name
)
...
...
This diff is collapsed.
Click to expand it.
tangostationcontrol/tangostationcontrol/devices/snmp_device.py
+
3
−
4
View file @
5743e076
...
...
@@ -109,8 +109,7 @@ class SNMP(lofar_device):
def
init_device
(
self
):
super
().
init_device
()
# create the mib_loader
loader
=
mib_loader
()
# if the string doesn't start with '/' it is a relative directory and we need to prepend the full path + '/'
if
self
.
SNMP_rel_mib_dir
[
0
]
!=
"
/
"
:
...
...
@@ -119,8 +118,8 @@ class SNMP(lofar_device):
# if the string does start with
mib_path
=
self
.
SNMP_rel_mib_dir
#
set the directory with the compiled mib files.
loader
.
set_pymib_di
r
(
mib_path
)
#
create the mib_loader and set the mib path
loader
=
mib_loade
r
(
mib_path
)
for
i
in
self
.
attr_list
():
try
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment