Add error condition when building image
[anna.git] / INSTALL_ADML_HTTP.md
1 # ADML with REST Interface (ADML-HTTP)
2
3 ## Deployment
4
5 Execute this [script](./example/diameter/launcher/deploy-adml-http.sh) and follow instructions.
6
7 ## Enabling HTTP2 Service
8
9 This is done through nginx proxy configured as reverse proxy to translate `HTTP2` traffic coming to port *8074* towards *localhost* port *8000* where `ADML HTTP` is going to serve the *HTTP1.1* Rest Service.
10
11 To build the docker image, execute this script:
12
13 > tools/build-adml-http [variant: [Release]|Debug]
14
15 ## Running docker image
16
17 > docker run --rm -d -p 8074:8074 --name adml-http anna-adml-http:<version>
18
19 Service port is **8074**.
20
21 ## Basic operations
22
23 ### Monitoring ADML traces
24
25 > docker exec -it adml-http tail -F /opt/adml/launcher.trace
26
27 ### Checking available diameter dictionaries
28
29 > docker exec -it adml-http ls -1 /opt/adml/stacks
30 >
31 > DictionaryGx.16777238.xml
32 > DictionaryRx.16777236.xml
33 > DictionarySy.16777302.xml
34 > diameter_base.0.xml
35
36 ### Configure diameter nodes
37
38 You may use the *REST API* to load diameter services into *ADML*. This is the way to load stacks and nodes (origin hosts) in order to be up and running.
39
40 For example, consider an Origin-Host acting as diameter client with the name: **afHost.afRealm.com** and also a node named **ownHostId.operatorRealm.com** acting as diameter server, both using the *Rx interface* ( **/stacks/DictionaryRx.16777236.xml)**. You could configure any number of stacks/nodes to setup different diameter interfaces even having proxy/relay/translation capabilities.
41
42 You could load any number of services given by this [file specification](./example/diameter/launcher/resources/services_examples/services.dtd). Also, you could configure a single file and load together all the needed elements, for example:
43
44 `<services>`
45   `<stack id="16777236" dictionary="stacks/DictionaryRx.16777236.xml" fixMode="Always" ignoreFlagsOnValidation="yes"/>`
46   `<node originHost="afHost.afRealm.com" applicationId="16777236" entity="localhost:3868"/>`
47   `<node originHost="ownHostId.operatorRealm.com" applicationId="16777236" diameterServer="localhost:3868" diameterServerSessions="1"/>`
48 `</services>`
49
50 The REST API works with json format, then we shall use the [xml2json.py](./example/diameter/launcher/resources/rest_api/helpers/diameterJsonHelper/xml2json.py) tool to convert the previous one and insert on a node called "**servicesJson**":
51
52 > {
53 >    **"servicesJson": {**
54 >       "services": {
55 >          "node": [
56 >             {
57 >                "@applicationId": "16777236",
58 >                "@entity": "localhost:3868",
59 >                "@originHost": "afHost.afRealm.com"
60 >             },
61 >             {
62 >                "@applicationId": "16777236",
63 >                "@diameterServer": "localhost:3868",
64 >                "@diameterServerSessions": "1",
65 >                "@originHost": "ownHostId.operatorRealm.com"
66 >             }
67 >          ],
68 >          "stack": {
69 >             "@dictionary": "stacks/DictionaryRx.16777236.xml",
70 >             "@fixMode": "Always",
71 >             "@id": "16777236",
72 >             "@ignoreFlagsOnValidation": "yes"
73 >          }
74 >       }
75 >    **}**
76 > }
77
78 Then, you could load the former *services.json* file:
79
80 > nghttp -v -H ":method: POST" -d services.json http://localhost:8074/services
81
82
83
84 ## Component Test
85
86 Read [this](./example/diameter/launcher/resources/rest_api/README.md).
87