# MediatorServer ## Description The mediator server is the physical device on which multiple instances of the [mediators](mediator/README.md) are running. Additionally a small webserver provides an API to control and create the mediators via HTTP-API. These mediators are translating the requests and responses between the SDN-Controller(netconf) and the device(snmp). Because of the restricted snmp protocol (port 162 only) we have to implement a prerouting automatism that forwards the alarms sent by the devices to another local port so that each mediator only gets the alarms of its device. ## Config-File ``` /etc/mediatorserver.conf ``` ``` #global config file for mediatorserver #Home Directory home=/opt/snmp #HOST IP host=192.168.178.89 port=7071 #Port range for Netconf ncrangemin=4000 ncrangemax=6000 #Port Range for SNMP snmprangemin=10000 snmprangemax=12000 #PortRange for JMX jmxrangemin=6001 jmxrangemax=7000 #Log (ERROR | WARN | DEBUG | INFO | TRACE ) loglevel=DEBUG logfile=/var/log/mediatorserver.log #===================================== #global MediatorConfig #set LogLevel (ERROR | WARN | DEBUG | INFO | TRACE ) MediatorLogLevel=DEBUG #set ping timeout in milliseconds MediatorDevicePingTimeout=2000 #set latency for snmp requests MediatorSnmpLatency=2000 #set java memory for mediator instance MediatorMemory="-Xmx256m -Xms128m" ``` ## HTTP-API ``` http://:/api/?task= ``` | Task | additional Parameters | Description | Response (Success) | | ---- | --------------------- | ----------- | ------------------ | | create | config=<config-object> | create new mediator instance | {"code":1,"data":"<string>"}| | delete | name=<name> | delete mediator instance | \{"code":1,"data":<string>"} | | start | name=<name> | start mediator instance | \{"code":1,"data":"<string>"} | | stop | name=<name> | stop mediator instance | \{"code":1,"data":"<string>"} | | getconfig | name=<name>(optional) | Get current Config for all instances / named mediator instance | \{"code":1,"data":[<config-objects>]}| | getlog | name=<name>(optional) | Get LogEntries for all instances / named mediator instance | \{"code":1,"data":[]} | | clearlock | name=<name> | Clear Mediator Lock File | \{"code":1,"data":"<string>"} | | getnemodels | - | get all Network Element Template Filenames | \{"code":1,"data":[<string-array>]} | | getncports | limit=<limit>(optional) | get next free ports for Netconf Connections | \{"code":1,"data":[<int-array>]} | | getsnmpports | limit=<limit>(optional) | get next free ports for SNMP Traps | \{"code":1,"data":[<int-array>]} | | version | - | get version info of server and mediator | \{"code":1,"data":\{"server":"0.1.0","mediator":"0.1.1"\}\}| | repair | - | try to fix corrupted configs | \{"code":1,"data":[<config-status-objects>]}| HTTP-Response is always a json-formatted String with 2 Elements: * code ... 1:success 0:failure * data ... if code==0: <string> else <string | object> ### JSON-Objects Config-Object ``` { Name:, DeviceType:, DeviceIp:, DevicePort: , TrapsPort:, NeModel:, NcPort:, ODLConfig:[ { Server:, Port:, User:, Password: } ], PID:, IsLocked:, AutoRun:, FwActive:, IsNetconfConnected:, IsNeConnected: } ``` Log-Object ``` { ts:"", lvl:"", src:"", msg:"