SNMP frontend, RPC of single variable through clixon

This commit is contained in:
Olof hagsand 2022-05-06 14:48:52 +02:00
parent 4e0d9dd987
commit 182b72a4cc
4 changed files with 258 additions and 58 deletions

View file

@ -16,6 +16,7 @@ snmpset="$(type -p snmpset) -On -c public -v2c localhost "
cfg=$dir/conf_startup.xml
fyang=$dir/clixon-example.yang
fstate=$dir/state.xml
# AgentX unix socket
SOCK=/var/run/snmp.sock
@ -46,8 +47,15 @@ module clixon-example{
}
EOF
# This is state data written to file that backend reads from (on request)
cat <<EOF > $fstate
<sender-state xmlns="urn:example:example">
<ref>x</ref>
</sender-state>
EOF
function testinit(){
new "test params: -f $cfg"
new "test params: -f $cfg -- -sS $fstate"
if [ $BE -ne 0 ]; then
# Kill old backend and start a new one
@ -60,7 +68,7 @@ function testinit(){
sudo pkill -f clixon_backend
new "Starting backend"
start_backend -s init -f $cfg
start_backend -s init -f $cfg -- -sS $fstate
fi
new "wait backend"

View file

@ -41,7 +41,7 @@ cat <<EOF > $cfg
<CLICON_BACKEND_PIDFILE>/var/tmp/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
<CLICON_SNMP_AGENT_SOCK>unix:$SOCK</CLICON_SNMP_AGENT_SOCK>
<CLICON_SNMP_MIB>NET-SNMP-EXAMPLES-MIB</CLICON_SNMP_MIB>
<!--CLICON_SNMP_MIB>NET-SNMP-EXAMPLES-MIB</CLICON_SNMP_MIB-->
</clixon-config>
EOF