Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
536d37ab
Commit
536d37ab
authored
Aug 04, 2016
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'aux-diag' into proposed_master
parents
b5e318d8
4348ecd9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
770 additions
and
5 deletions
+770
-5
Kconfig
Kconfig
+15
-0
syscon.c
dev/syscon.c
+61
-0
wrc_syscon_regs.h
include/hw/wrc_syscon_regs.h
+50
-1
syscon.h
include/syscon.h
+10
-0
WR-WRPC-AUX-DIAG-MIB.txt
lib/WR-WRPC-AUX-DIAG-MIB.txt
+153
-0
WR-WRPC-MIB.txt
lib/WR-WRPC-MIB.txt
+1
-1
snmp.c
lib/snmp.c
+260
-1
cmd_diag.c
shell/cmd_diag.c
+62
-0
shell.mk
shell/shell.mk
+2
-0
Makefile
test/snmp/Makefile
+4
-0
snmp_test_aux_diag_1.bats
test/snmp/snmp_test_aux_diag_1.bats
+139
-0
snmp_test_helpers.bash
test/snmp/snmp_test_helpers.bash
+13
-2
No files found.
Kconfig
View file @
536d37ab
...
...
@@ -148,6 +148,14 @@ config SNMP_SET
help
This option enables support for SET requests for Mini SNMP responder
config SNMP_AUX_DIAG
depends on SNMP && AUX_DIAG
default y if AUX_DIAG
default n
boolean "Adds support of auxiliary diagnostics registers to SNMP"
help
This option adds branch wrpcAuxDiag to the SNMP
config SNMP_HW_TYPE
depends on SNMP
default "spec"
...
...
@@ -183,6 +191,13 @@ config FLASH_INIT
default y if EMBEDDED_NODE
default n
config AUX_DIAG
default n
boolean "Add support for auxiliary diagnostics registers"
help
This option adds support for read/write of aux diag registers and
the diag command.
#
# This is a set of configuration options that should not be changed by
# normal users. If the "developer" menu is used, the binary is tainted.
...
...
dev/syscon.c
View file @
536d37ab
...
...
@@ -7,6 +7,7 @@
* Released according to the GNU GPL, version 2 or any later version.
*/
#include "syscon.h"
#include <errno.h>
struct
s_i2c_if
i2c_if
[
2
]
=
{
{
SYSC_GPSR_FMC_SCL
,
SYSC_GPSR_FMC_SDA
},
...
...
@@ -43,3 +44,63 @@ void timer_delay(uint32_t tics)
while
(
time_before
(
timer_get_tics
(),
t_end
))
;
}
static
int
diag_rw_words
,
diag_ro_words
;
/****************************
* AUX Diagnostics
***************************/
void
diag_read_info
(
uint32_t
*
id
,
uint32_t
*
ver
,
uint32_t
*
nrw
,
uint32_t
*
nro
)
{
diag_rw_words
=
SYSC_DIAG_NW_RW_R
(
syscon
->
DIAG_NW
);
diag_ro_words
=
SYSC_DIAG_NW_RO_R
(
syscon
->
DIAG_NW
);
if
(
id
)
*
id
=
SYSC_DIAG_INFO_ID_R
(
syscon
->
DIAG_INFO
);
if
(
ver
)
*
ver
=
SYSC_DIAG_INFO_VER_R
(
syscon
->
DIAG_INFO
);
if
(
nrw
)
*
nrw
=
diag_rw_words
;
if
(
nro
)
*
nro
=
diag_ro_words
;
}
int
diag_read_word
(
uint32_t
adr
,
int
bank
,
uint32_t
*
val
)
{
if
(
!
val
)
return
-
EINVAL
;
if
(
diag_rw_words
==
0
)
{
pp_printf
(
"fetching diag_rw_words
\n
"
);
diag_rw_words
=
SYSC_DIAG_NW_RW_R
(
syscon
->
DIAG_NW
);
}
if
(
diag_ro_words
==
0
)
{
pp_printf
(
"fetching diag_ro_words
\n
"
);
diag_ro_words
=
SYSC_DIAG_NW_RO_R
(
syscon
->
DIAG_NW
);
}
if
((
bank
==
DIAG_RW_BANK
&&
adr
>=
diag_rw_words
)
||
(
bank
==
DIAG_RO_BANK
&&
adr
>=
diag_ro_words
))
{
*
val
=
0
;
return
-
EINVAL
;
}
if
(
bank
==
DIAG_RO_BANK
)
adr
+=
diag_rw_words
;
syscon
->
DIAG_CR
=
SYSC_DIAG_CR_ADR_W
(
adr
);
*
val
=
syscon
->
DIAG_DAT
;
return
0
;
}
int
diag_write_word
(
uint32_t
adr
,
uint32_t
val
)
{
if
(
adr
>=
diag_rw_words
)
return
-
EINVAL
;
syscon
->
DIAG_DAT
=
val
;
syscon
->
DIAG_CR
=
SYSC_DIAG_CR_RW
|
SYSC_DIAG_CR_ADR_W
(
adr
);
return
0
;
}
include/hw/wrc_syscon_regs.h
View file @
536d37ab
...
...
@@ -3,7 +3,7 @@
* File : wrc_syscon_regs.h
* Author : auto-generated by wbgen2 from wrc_syscon_wb.wb
* Created :
Wed Sep 25 14:35:39 2013
* Created :
Mon Jul 11 14:59:51 2016
* Standard : ANSI C
THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE wrc_syscon_wb.wb
...
...
@@ -135,6 +135,47 @@
#define SYSC_TCR_ENABLE WBGEN2_GEN_MASK(31, 1)
/* definitions for register: Timer Counter Value Register */
/* definitions for register: User Diag: version register */
/* definitions for field: Ver in reg: User Diag: version register */
#define SYSC_DIAG_INFO_VER_MASK WBGEN2_GEN_MASK(0, 16)
#define SYSC_DIAG_INFO_VER_SHIFT 0
#define SYSC_DIAG_INFO_VER_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define SYSC_DIAG_INFO_VER_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
/* definitions for field: Id in reg: User Diag: version register */
#define SYSC_DIAG_INFO_ID_MASK WBGEN2_GEN_MASK(16, 16)
#define SYSC_DIAG_INFO_ID_SHIFT 16
#define SYSC_DIAG_INFO_ID_W(value) WBGEN2_GEN_WRITE(value, 16, 16)
#define SYSC_DIAG_INFO_ID_R(reg) WBGEN2_GEN_READ(reg, 16, 16)
/* definitions for register: User Diag: number of words */
/* definitions for field: Read/write words in reg: User Diag: number of words */
#define SYSC_DIAG_NW_RW_MASK WBGEN2_GEN_MASK(0, 16)
#define SYSC_DIAG_NW_RW_SHIFT 0
#define SYSC_DIAG_NW_RW_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define SYSC_DIAG_NW_RW_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
/* definitions for field: Read-only words in reg: User Diag: number of words */
#define SYSC_DIAG_NW_RO_MASK WBGEN2_GEN_MASK(16, 16)
#define SYSC_DIAG_NW_RO_SHIFT 16
#define SYSC_DIAG_NW_RO_W(value) WBGEN2_GEN_WRITE(value, 16, 16)
#define SYSC_DIAG_NW_RO_R(reg) WBGEN2_GEN_READ(reg, 16, 16)
/* definitions for register: User Diag: Control Register */
/* definitions for field: Address in reg: User Diag: Control Register */
#define SYSC_DIAG_CR_ADR_MASK WBGEN2_GEN_MASK(0, 16)
#define SYSC_DIAG_CR_ADR_SHIFT 0
#define SYSC_DIAG_CR_ADR_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define SYSC_DIAG_CR_ADR_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
/* definitions for field: R/W in reg: User Diag: Control Register */
#define SYSC_DIAG_CR_RW WBGEN2_GEN_MASK(31, 1)
/* definitions for register: User Diag: data to read/write */
/* [0x0]: REG Syscon reset register */
#define SYSC_REG_RSTR 0x00000000
/* [0x4]: REG GPIO Set/Readback Register */
...
...
@@ -147,4 +188,12 @@
#define SYSC_REG_TCR 0x00000010
/* [0x14]: REG Timer Counter Value Register */
#define SYSC_REG_TVR 0x00000014
/* [0x18]: REG User Diag: version register */
#define SYSC_REG_DIAG_INFO 0x00000018
/* [0x1c]: REG User Diag: number of words */
#define SYSC_REG_DIAG_NW 0x0000001c
/* [0x20]: REG User Diag: Control Register */
#define SYSC_REG_DIAG_CR 0x00000020
/* [0x24]: REG User Diag: data to read/write */
#define SYSC_REG_DIAG_DAT 0x00000024
#endif
include/syscon.h
View file @
536d37ab
...
...
@@ -51,6 +51,10 @@ struct SYSCON_WB {
uint32_t
HWFR
;
/*Hardware Feature Register */
uint32_t
TCR
;
/*Timer Control Register */
uint32_t
TVR
;
/*Timer Counter Value Register */
uint32_t
DIAG_INFO
;
uint32_t
DIAG_NW
;
uint32_t
DIAG_CR
;
uint32_t
DIAG_DAT
;
};
/*GPIO pins*/
...
...
@@ -101,5 +105,11 @@ static inline int sysc_get_memsize(void)
return
(
SYSC_HWFR_MEMSIZE_R
(
syscon
->
HWFR
)
+
1
)
*
16
;
}
#define DIAG_RW_BANK 0
#define DIAG_RO_BANK 1
void
diag_read_info
(
uint32_t
*
id
,
uint32_t
*
ver
,
uint32_t
*
nrw
,
uint32_t
*
nro
);
int
diag_read_word
(
uint32_t
adr
,
int
bank
,
uint32_t
*
val
);
int
diag_write_word
(
uint32_t
adr
,
uint32_t
val
);
#endif
/* CONFIG_WR_NODE */
#endif
lib/WR-WRPC-AUX-DIAG-MIB.txt
0 → 100644
View file @
536d37ab
WR-WRPC-AUX-DIAG-MIB DEFINITIONS ::= BEGIN
-- Template for Aux Registers used by WRPC
-- Based on the WR-WRPC-MIB
-- Adam Wujek, BE-CO-HT, CERN
-- IMPORTS: Include definitions from other mibs here
IMPORTS
OBJECT-TYPE, Unsigned32, MODULE-IDENTITY FROM SNMPv2-SMI
wrWrpcMIB FROM WR-WRPC-MIB;
wrpcAuxDiag MODULE-IDENTITY
LAST-UPDATED "201607151000Z"
ORGANIZATION "CERN"
CONTACT-INFO "postal: BE-CO-HT, CERN, Geneva
email: ht-drivers@cern.ch
"
DESCRIPTION "Template of MIB for White Rabbit WRPC aux registers
"
REVISION "201607151000Z"
DESCRIPTION
"First revision."
::= { wrWrpcMIB 2 }
-- put your assigned ID number in the line below
wrpcAuxDiagId1 OBJECT IDENTIFIER ::= { wrpcAuxDiag 1 }
-- put the version number in the line below
wrpcAuxDiagVersion101 OBJECT IDENTIFIER ::= { wrpcAuxDiagId1 1 }
-- ****************************************************************************
wrpcAuxDiag101RoTable OBJECT-TYPE
SYNTAX SEQUENCE OF WrpcAuxDiag101RoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Table with read only registers"
::= { wrpcAuxDiagVersion101 1 }
wrpcAuxDiag101RoEntry OBJECT-TYPE
SYNTAX WrpcAuxDiag101RoEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry for read only registers"
INDEX { wrpcAuxDiag101RoIndex }
::= { wrpcAuxDiag101RoTable 1 }
WrpcAuxDiag101RoEntry ::=
SEQUENCE {
wrpcAuxDiag101RoIndex Unsigned32,
wrpcAuxDiag101RoRegCount Unsigned32,
wrpcAuxDiag101RoReg1 Unsigned32,
wrpcAuxDiag101RoReg2 Unsigned32
}
wrpcAuxDiag101RoIndex OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Index for wrpcAuxDiag101RoTable"
::= { wrpcAuxDiag101RoEntry 1 }
wrpcAuxDiag101RoRegCount OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of registers available in the wrpcAuxDiag101RoTable"
::= { wrpcAuxDiag101RoEntry 2 }
wrpcAuxDiag101RoReg1 OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"First read-only register"
::= { wrpcAuxDiag101RoEntry 3 }
wrpcAuxDiag101RoReg2 OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Second read-only register"
::= { wrpcAuxDiag101RoEntry 4 }
-- ****************************************************************************
wrpcAuxDiag101RwTable OBJECT-TYPE
SYNTAX SEQUENCE OF WrpcAuxDiag101RwEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Table with read-write registers"
::= { wrpcAuxDiagVersion101 2 }
wrpcAuxDiag101RwEntry OBJECT-TYPE
SYNTAX WrpcAuxDiag101RwEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry for read-write registers"
INDEX { wrpcAuxDiag101RwIndex }
::= { wrpcAuxDiag101RwTable 1 }
WrpcAuxDiag101RwEntry ::=
SEQUENCE {
wrpcAuxDiag101RwIndex Unsigned32,
wrpcAuxDiag101RwRegCount Unsigned32,
wrpcAuxDiag101RwReg1 Unsigned32,
wrpcAuxDiag101RwReg2 Unsigned32
}
wrpcAuxDiag101RwIndex OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Index for wrpcAuxDiag101RwTable"
::= { wrpcAuxDiag101RwEntry 1 }
wrpcAuxDiag101RwRegCount OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of registers available in the wrpcAuxDiag101RwTable"
::= { wrpcAuxDiag101RwEntry 2 }
wrpcAuxDiag101RwReg1 OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"First read-write register"
::= { wrpcAuxDiag101RwEntry 3 }
wrpcAuxDiag101RwReg2 OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Second read-write register"
::= { wrpcAuxDiag101RwEntry 4 }
-- ****************************************************************************
END
lib/WR-WRPC-MIB.txt
View file @
536d37ab
...
...
@@ -37,7 +37,7 @@ cern OBJECT IDENTIFIER ::= { enterprises 96 }
-- Define typical mib nodes
-- we'll prefix everything in this mib with wrpc
wrpcCore OBJECT IDENTIFIER ::= { wrWrpcMIB 1 }
--
x wrpcCustom
OBJECT IDENTIFIER ::= { wrWrpcMIB 2 }
--
wrpcAuxDiag
OBJECT IDENTIFIER ::= { wrWrpcMIB 2 }
-- ****************************************************************************
wrpcVersionGroup OBJECT IDENTIFIER ::= { wrpcCore 1 }
...
...
lib/snmp.c
View file @
536d37ab
This diff is collapsed.
Click to expand it.
shell/cmd_diag.c
0 → 100644
View file @
536d37ab
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2016 CERN (www.cern.ch)
* Author: Grzegorz Daniluk <grzegorz.daniluk@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include "shell.h"
#include <wrc.h>
#include <syscon.h>
#include <string.h>
#include <errno.h>
static
int
cmd_diag
(
const
char
*
args
[])
{
uint32_t
id
,
ver
,
nrw
,
nro
;
uint32_t
addr
,
val
;
int
ret
=
0
;
if
(
!
args
[
0
])
{
diag_read_info
(
&
id
,
&
ver
,
&
nrw
,
&
nro
);
pp_printf
(
"Aux diagnostics info:
\n
"
);
pp_printf
(
"id: %d.%d, r/w words: %d, r/o words: %d
\n
"
,
id
,
ver
,
nrw
,
nro
);
return
0
;
}
if
(
!
strcasecmp
(
args
[
0
],
"ro"
)
&&
args
[
1
])
{
addr
=
atoi
(
args
[
1
]);
ret
=
diag_read_word
(
addr
,
DIAG_RO_BANK
,
&
val
);
if
(
!
ret
)
pp_printf
(
"Word %d is 0x%08x
\n
"
,
addr
,
val
);
return
ret
;
}
if
(
!
strcasecmp
(
args
[
0
],
"rw"
)
&&
args
[
1
])
{
addr
=
atoi
(
args
[
1
]);
ret
=
diag_read_word
(
addr
,
DIAG_RW_BANK
,
&
val
);
if
(
!
ret
)
pp_printf
(
"Word %d is 0x%08x
\n
"
,
addr
,
val
);
return
ret
;
}
if
(
!
strcasecmp
(
args
[
0
],
"w"
)
&&
args
[
1
]
&&
args
[
2
])
{
addr
=
atoi
(
args
[
1
]);
val
=
atoi
(
args
[
2
]);
ret
=
diag_write_word
(
addr
,
val
);
if
(
!
ret
)
pp_printf
(
"Value 0x%08x written to the word %d
\n
"
,
val
,
addr
);
return
ret
;
}
return
-
EINVAL
;
}
DEFINE_WRC_COMMAND
(
diag
)
=
{
.
name
=
"diag"
,
.
exec
=
cmd_diag
,
};
shell/shell.mk
View file @
536d37ab
...
...
@@ -18,6 +18,7 @@ obj-$(CONFIG_EMBEDDED_NODE) += \
shell/cmd_sdb.o \
shell/cmd_ptrack.o \
obj-$(CONFIG_IP) += shell/cmd_ip.o
obj-$(CONFIG_PPSI) += shell/cmd_verbose.o
obj-$(CONFIG_CMD_CONFIG) += shell/cmd_config.o
...
...
@@ -25,3 +26,4 @@ obj-$(CONFIG_CMD_SLEEP) += shell/cmd_sleep.o
obj-$(CONFIG_CMD_LL) += shell/cmd_ll.o
obj-$(CONFIG_FLASH_INIT) += shell/cmd_init.o
obj-$(CONFIG_VLAN) += shell/cmd_vlan.o
obj-$(CONFIG_AUX_DIAG) += shell/cmd_diag.o
test/snmp/Makefile
View file @
536d37ab
...
...
@@ -14,3 +14,7 @@ bats/libexec/bats:
test
:
prepare
bats/libexec/bats snmp_tests_
*
.bats
aux_diag
:
prepare
bats/libexec/bats snmp_test_aux_diag_
*
.bats
test/snmp/snmp_test_aux_diag_1.bats
0 → 100644
View file @
536d37ab
load snmp_test_config
load snmp_test_helpers
@test "Get index of a table 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1, check if correct returned" {
helper_snmpget_oidfound 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get number of aux RO registers of a table 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1, check if correct returned" {
helper_snmpget_oidfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1.1, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1.1
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1.1.3, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1.1.3.0, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3.0
}
@test "Get number of aux RO registers of a table 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1, check if correct returned" {
helper_snmpget_oidfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1.1.3.2, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3.2
}
@test "Get invalid OID 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1.1, check if correct returned" {
helper_snmpget_oidnotfound 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1.1
}
# get next
@test "Get next object after 1.3.6.1.4.1.96.101.2, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1, check if other returned" {
result="$(snmpgetnext $SNMP_OPTIONS $TARGET_IP 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1 | grep 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1 | wc -l)"
[ "$result" -eq 0 ]
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1 1.3.6.1.4.1.96.101.2.1.2.1.1.4.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.0, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2.0 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.0.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2.0.1 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1.0, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1.0 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1
}
@test "Get next object after 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1.1, check if correct returned" {
helper_snmpgetnext 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1.1 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1
}
# sets
@test "Set read-only object 1.3.6.1.4.1.96.101.2.1.2.1.1.1.1" {
helper_snmpset_failed_u 1.3.6.1.4.1.96.101.2.1.2.1.1.1.1 99
}
@test "Set read-only object 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1" {
helper_snmpset_failed_u 1.3.6.1.4.1.96.101.2.1.2.1.1.2.1 99
}
@test "Set read-only object 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1" {
helper_snmpset_failed_u 1.3.6.1.4.1.96.101.2.1.2.1.1.3.1 99
}
@test "Set read-only object 1.3.6.1.4.1.96.101.2.1.2.2.1.1.1" {
helper_snmpset_failed_u 1.3.6.1.4.1.96.101.2.1.2.2.1.1.1 99
}
@test "Set read-only object 1.3.6.1.4.1.96.101.2.1.2.2.1.2.1" {
helper_snmpset_failed_u 1.3.6.1.4.1.96.101.2.1.2.2.1.2.1 99
}
@test "Set read-write object 1.3.6.1.4.1.96.101.2.1.2.2.1.3.1, check if correct set" {
helper_snmpset_u 1.3.6.1.4.1.96.101.2.1.2.2.1.3.1 99
}
@test "Get read-write object 1.3.6.1.4.1.96.101.2.1.2.2.1.3.1" {
helper_snmpget 1.3.6.1.4.1.96.101.2.1.2.2.1.3.1 99
}
test/snmp/snmp_test_helpers.bash
View file @
536d37ab
...
...
@@ -4,12 +4,12 @@ helper_snmpget() {
}
helper_snmpget_oidnotfound
()
{
run snmpget
$SNMP_OPTIONS
$TARGET_IP
$1
run snmpget
$SNMP_OPTIONS
_NO_M
$TARGET_IP
$1
[
"
$status
"
-eq
2
]
}
helper_snmpget_oidfound
()
{
result
=
"
$(
snmpget
$SNMP_OPTIONS
$TARGET_IP
$1
|
grep
"
$1
"
|
wc
-l
)
"
result
=
"
$(
snmpget
$SNMP_OPTIONS
_NO_M
$TARGET_IP
$1
|
grep
"
$1
"
|
wc
-l
)
"
[
"
$result
"
-eq
1
]
}
...
...
@@ -24,6 +24,17 @@ helper_snmpset() {
[
"
$result
"
-eq
1
]
}
helper_snmpset_u
()
{
result
=
"
$(
snmpset
$SNMP_OPTIONS
$TARGET_IP
$1
u
"
$2
"
|
grep
"
$2
"
|
wc
-l
)
"
[
"
$result
"
-eq
1
]
}
helper_snmpset_failed_u
()
{
run snmpset
$SNMP_OPTIONS
$TARGET_IP
$1
u
"
$2
"
[
"
$status
"
-eq
2
]
}
helper_erase_sfp_database
()
{
result
=
"
$(
snmpset
$SNMP_OPTIONS
$TARGET_IP
wrpcPtpConfigApply.0
=
eraseFlash |
grep
applySuccessful |
wc
-l
)
"
[
"
$result
"
-eq
1
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment