bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_net-snmp/snmpv3_test.sh

Christoph Galuschka caaecd
#!/bin/sh
Christoph Galuschka caaecd
# Author: Athmane Madjoudj <athmanem@gmail.com>
Christoph Galuschka caaecd
# Author: Christoph Galuschka <christoph.galuschka@tiwag.at>
Christoph Galuschka caaecd
Christoph Galuschka caaecd
t_Log "Running $0 - snmpv3 test"
Christoph Galuschka caaecd
Christoph Galuschka caaecd
t_InstallPackage net-snmp-utils 
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Make Backup of snmpd.conf and add V3-settings
Christoph Galuschka caaecd
/bin/cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
Christoph Galuschka caaecd
echo 'rouser centosro' >> /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
echo 'createUser centosro MD5 centosro DES centosro' >> /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Restart Service
Christoph Galuschka caaecd
service snmpd restart
Christoph Galuschka caaecd
Christoph Galuschka caaecd
#Run test
Christoph Galuschka caaecd
snmpget -v 3 -u centosro  -n "" -l authPriv -a MD5 -A centosro -x DES -X centosro 127.0.0.1 sysUpTime.0 > /dev/null 2>&1
Athmane Madjoudj 55ca06
ret_val=$?
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Restore settings
Christoph Galuschka caaecd
/bin/cp /etc/snmp/snmpd.conf.orig /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
service snmpd restart
Christoph Galuschka caaecd
Athmane Madjoudj 55ca06
t_CheckExitStatus $ret_val