#!/bin/sh

export SNMP_TRANSPORT_SPEC
export SNMP_SNMPTRAPD_PORT
export SNMP_SNMPD_PORT
export SNMP_TEST_DEST

export NET_SNMP_CRT_CFGTOOL="${builddir}/net-snmp-config"
NSCERT="perl $SNMP_BASEDIR/../../../local/net-snmp-cert -I"
NSCERTARGS="-C $SNMP_TMPDIR"

DOSETTEST() {
  value=$1
  args=$2

  # SNMPv2-MIB::sysLocation.0
  CAPTURE "snmpset $args .1.3.6.1.2.1.1.6.0 s '$value'"

  CAPTURE "snmpget $args .1.3.6.1.2.1.1.6.0"

  CHECK "STRING: '$value'"
}


DOFAILSETTEST() {
  value=$1
  args=$2

  # SNMPv2-MIB::sysLocation.0
  CAPTURE "snmpset $args .1.3.6.1.2.1.1.6.0 s '$value'"

  CAPTURE "snmpget $args .1.3.6.1.2.1.1.6.0"

  CHECKCOUNT 0 "$value"
}

DOTRAPTEST() {
  value=$1
  args=$2

  # IF-MIB::linkUp
  CAPTURE "snmptrap $args 0 .1.3.6.1.6.3.1.1.5.4 system.sysContact.0 s $value"

  CHECKTRAPD "STRING: $value"
}

DOFAILTRAPTEST() {
  value=$1
  args=$2

  # IF-MIB::linkUp
  CAPTURE "snmptrap $args 0 .1.3.6.1.6.3.1.1.5.4 system.sysContact.0 s $value"

  CHECKTRAPDCOUNT 0 "$value"
}

