c99967d2b75127a7a5224e2e97ee8e52cccede24
[ccsdk/features.git] / sdnr / wt / helpserver / provider / src / main / resources / help / mediatorserver / README.md
1 # MediatorServer
2
3 ## Description
4 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.
5
6
7
8 ## Config-File
9
10 ```
11 /etc/mediatorserver.conf
12 ```
13
14 ```
15 #global config file for mediatorserver
16
17 #Home Directory
18 home=/opt/snmp
19
20 #HOST IP
21 host=192.168.178.89
22 port=7071
23
24 #Port range for Netconf
25 ncrangemin=4000
26 ncrangemax=6000
27
28 #Port Range for SNMP
29 snmprangemin=10000
30 snmprangemax=12000
31
32 #PortRange for JMX
33 jmxrangemin=6001
34 jmxrangemax=7000
35
36 #Log (ERROR | WARN | DEBUG | INFO | TRACE )
37 loglevel=DEBUG
38 logfile=/var/log/mediatorserver.log
39
40 #=====================================
41 #global MediatorConfig
42
43 #set LogLevel (ERROR | WARN | DEBUG | INFO | TRACE )
44 MediatorLogLevel=DEBUG
45
46 #set ping timeout in milliseconds
47 MediatorDevicePingTimeout=2000
48
49 #set latency for snmp requests
50 MediatorSnmpLatency=2000
51
52 #set java memory for mediator instance
53 MediatorMemory="-Xmx256m -Xms128m"
54 ```
55
56 ## HTTP-API
57
58 ```
59 http://<host>:<port>/api/?task=<task>
60 ```
61
62 | Task | additional Parameters | Description | Response (Success) |
63 | ---- | --------------------- | ----------- | ------------------ |
64 | create       | config=&lt;config-object&gt;  | create new mediator instance | {"code":1,"data":"&lt;string&gt;"}|
65 | delete       | name=&lt;name&gt; | delete mediator instance | \{"code":1,"data":&lt;string&gt;"} |
66 | start        | name=&lt;name&gt; | start mediator instance | \{"code":1,"data":"&lt;string&gt;"} |
67 | stop         | name=&lt;name&gt; | stop mediator instance | \{"code":1,"data":"&lt;string&gt;"} |
68 | getconfig    | name=&lt;name&gt;(optional) | Get current Config for all instances / named mediator instance | \{"code":1,"data":[&lt;config-objects&gt;]}|
69 | getlog       | name=&lt;name&gt;(optional) | Get LogEntries for all instances / named mediator instance | \{"code":1,"data":[]} |
70 | clearlock    | name=&lt;name&gt; | Clear Mediator Lock File | \{"code":1,"data":"&lt;string&gt;"} |
71 | getnemodels  | - | get all Network Element Template Filenames | \{"code":1,"data":[&lt;string-array&gt;]} |
72 | getncports   | limit=&lt;limit&gt;(optional) | get next free ports for Netconf Connections | \{"code":1,"data":[&lt;int-array&gt;]} |
73 | getsnmpports | limit=&lt;limit&gt;(optional) | get next free ports for SNMP Traps | \{"code":1,"data":[&lt;int-array&gt;]} |
74 | version      | - | get version info of server and mediator |  \{"code":1,"data":\{"server":"0.1.0","mediator":"0.1.1"\}\}|
75 | repair       | - | try to fix corrupted configs | \{"code":1,"data":[&lt;config-status-objects&gt;]}|
76
77 HTTP-Response is always a json-formatted String with 2 Elements:
78
79 * code ... 1:success 0:failure
80 * data ... if code==0: &lt;string&gt; else &lt;string | object&gt;
81
82
83 ### JSON-Objects
84
85 Config-Object
86 ```
87 {
88   Name:<String>,
89   DeviceType:<enum>,
90   DeviceIp:<String>,
91   DevicePort: <int>,
92   TrapsPort:<Int>,
93   NeModel:<XML Filename>,
94   NcPort:<int>,
95   ODLConfig:[
96     {
97       Server:<String>,
98       Port:<int>,
99       User:<String>,
100       Password:<String>
101     }
102   ],
103   PID:<int>,
104   IsLocked:<boolean>,
105   AutoRun:<boolean>,
106   FwActive:<boolean>,
107   IsNetconfConnected:<boolean>,
108   IsNeConnected:<boolean>
109 }
110 ```
111
112 Log-Object
113 ```
114 {
115   ts:"<Timestamp>",
116   lvl:"<LogLevel>",
117   src:"<Source>",
118   msg:"<Message"
119 }
120 ```
121
122
123 ## Usage
124
125 All functionality which is not automated can be executed by the control script
126 ```
127 bin/control.sh
128 ```
129
130 | parameter     | description                                      |
131 | ------------- | ------------------------------------------------ |
132 |checkout       | get latest code from git repo                    |
133 |cpsrc          | copy binary files from source                    |
134 |cpxml          | copy xml files from source                       |
135 |build          | build sources                                    |
136 |make           | build sources and install bins and ressources    |
137 |start          | start server                                     |
138 |stop           | stop server                                      |
139 |stopall        | stop all mediators, then the server              |
140 |startmed [med] | start mediator with name [med]                   |
141 |stopmed [med]  | stop mediator with name [med]                    |
142 |status         | print status                                     |
143 |repair         | repair config files if corrupted                 |
144