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
b153756f
Commit
b153756f
authored
2 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
more processing reviews
parent
7fafe584
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
-7
4 additions, 7 deletions
...stationcontrol/tangostationcontrol/clients/snmp_client.py
tangostationcontrol/tangostationcontrol/devices/snmp_device.py
+3
-3
3 additions, 3 deletions
...stationcontrol/tangostationcontrol/devices/snmp_device.py
with
7 additions
and
10 deletions
tangostationcontrol/tangostationcontrol/clients/snmp_client.py
+
4
−
7
View file @
b153756f
...
...
@@ -51,7 +51,6 @@ class SNMP_client(CommClient):
# only sets up the engine, doesn't connect
self
.
connected
=
True
def
_process_annotation
(
self
,
annotation
):
try
:
...
...
@@ -129,12 +128,10 @@ class snmp_attribute:
def
create_objID
(
self
):
# only scalars can be used at the present time.
if
not
self
.
is_scalar
:
objID
=
tuple
(
hlapi
.
ObjectIdentity
(
self
.
mib
,
self
.
name
,
self
.
idx
+
i
)
for
i
in
range
(
self
.
len
))
else
:
if
self
.
is_scalar
:
objID
=
hlapi
.
ObjectIdentity
(
self
.
mib
,
self
.
name
,
self
.
idx
)
else
:
objID
=
tuple
(
hlapi
.
ObjectIdentity
(
self
.
mib
,
self
.
name
,
self
.
idx
+
i
)
for
i
in
range
(
self
.
len
))
return
objID
...
...
@@ -183,6 +180,7 @@ class snmp_attribute:
"""
vals
=
[]
if
not
self
.
is_scalar
:
#just the first element of this single element list
varBinds
=
varBinds
[
0
]
...
...
@@ -241,7 +239,6 @@ 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
−
3
View file @
b153756f
...
...
@@ -79,11 +79,11 @@ class SNMP(lofar_device):
# example attributes. mib and name mandatory and index optional.
# Reads from a table and returns an array of table entries 1 to 10 (note, tables require an index key and start at 1)
test_attr1_R
=
attribute_wrapper
(
comms_annotation
=
{
"
mib
"
:
"
TEST-MIB
"
,
"
name
"
:
"
test_attr1
"
,
"
index
"
:
1
},
dims
=
(
10
,),
datatype
=
numpy
.
str
)
#
test_attr1_R = attribute_wrapper(comms_annotation={"mib": "TEST-MIB", "name": "test_attr1", "index": 1}, dims=(10,), datatype=numpy.str)
# indices can also be IP addresses sometimes. Gets a single scalar value
test_attr2_R
=
attribute_wrapper
(
comms_annotation
=
{
"
mib
"
:
"
TEST-MIB
"
,
"
name
"
:
"
test_attr2
"
,
"
index
"
:
(
127
,
0
,
0
,
1
)},
datatype
=
numpy
.
int64
)
#
test_attr2_R = attribute_wrapper(comms_annotation={"mib": "TEST-MIB", "name": "test_attr2", "index": (127,0,0,1)}, datatype=numpy.int64)
# if the attribute doesn't get the value from a table, then no index is needed, or the default of 0 can be supplied.
test_attr3_R
=
attribute_wrapper
(
comms_annotation
=
{
"
mib
"
:
"
TEST-MIB
"
,
"
name
"
:
"
test_attr3
"
},
datatype
=
numpy
.
int64
)
#
test_attr3_R = attribute_wrapper(comms_annotation={"mib": "TEST-MIB", "name": "test_attr3"}, datatype=numpy.int64)
# --------
...
...
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