aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/helpserver/provider/src/main/resources/help/mediatorserver/0.4.0/README.md
blob: c03217d14e5d0892bc099f6533d1617ffd3e2e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# MediatorServer

## Description
The mediator server is the physical device on which multiple instances of the [mediators](mediator/) 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://<host>:<port>/api/?task=<task>
```

| Task | additional Parameters | Description | Response (Success) |
| ---- | --------------------- | ----------- | ------------------ |
| create       | config=&lt;config-object&gt;  | create new mediator instance | {"code":1,"data":"&lt;string&gt;"}|
| delete       | name=&lt;name&gt; | delete mediator instance | \{"code":1,"data":&lt;string&gt;"} |
| start        | name=&lt;name&gt; | start mediator instance | \{"code":1,"data":"&lt;string&gt;"} |
| stop         | name=&lt;name&gt; | stop mediator instance | \{"code":1,"data":"&lt;string&gt;"} |
| getconfig    | name=&lt;name&gt;(optional) | Get current Config for all instances / named mediator instance | \{"code":1,"data":[&lt;config-objects&gt;]}|
| getlog       | name=&lt;name&gt;(optional) | Get LogEntries for all instances / named mediator instance | \{"code":1,"data":[]} |
| clearlock    | name=&lt;name&gt; | Clear Mediator Lock File | \{"code":1,"data":"&lt;string&gt;"} |
| getnemodels  | - | get all Network Element Template Filenames | \{"code":1,"data":[&lt;string-array&gt;]} |
| getncports   | limit=&lt;limit&gt;(optional) | get next free ports for Netconf Connections | \{"code":1,"data":[&lt;int-array&gt;]} |
| getsnmpports | limit=&lt;limit&gt;(optional) | get next free ports for SNMP Traps | \{"code":1,"data":[&lt;int-array&gt;]} |
| 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":[&lt;config-status-objects&gt;]}|

HTTP-Response is always a json-formatted String with 2 Elements:

* code ... 1:success 0:failure
* data ... if code==0: &lt;string&gt; else &lt;string | object&gt;


### JSON-Objects

Config-Object
```
{
  Name:<String>,
  DeviceType:<enum>,
  DeviceIp:<String>,
  DevicePort: <int>,
  TrapsPort:<Int>,
  NeModel:<XML Filename>,
  NcPort:<int>,
  ODLConfig:[
    {
      Server:<String>,
      Port:<int>,
      User:<String>,
      Password:<String>
    }
  ],
  PID:<int>,
  IsLocked:<boolean>,
  AutoRun:<boolean>,
  FwActive:<boolean>,
  IsNetconfConnected:<boolean>,
  IsNeConnected:<boolean>
}
```

Log-Object
```
{
  ts:"<Timestamp>",
  lvl:"<LogLevel>",
  src:"<Source>",
  msg:"<Message"
}
```


## Usage

All functionality which is not automated can be executed by the control script
```
bin/control.sh
```

| parameter     | description                                      |
| ------------- | ------------------------------------------------ |
|checkout       | get latest code from git repo                    |
|cpsrc          | copy binary files from source                    |
|cpxml          | copy xml files from source                       |
|build          | build sources                                    |
|make           | build sources and install bins and ressources    |
|start          | start server                                     |
|stop           | stop server                                      |
|stopall        | stop all mediators, then the server              |
|startmed [med] | start mediator with name [med]                   |
|stopmed [med]  | stop mediator with name [med]                    |
|status         | print status                                     |
|repair         | repair config files if corrupted                 |