- OpenDaylight Cookbook
- Mathieu Lemay Alexis de Talhou?t Jamie Goodyear Rashmi Pujar Mohamed El Serngawy Yrineu Rodrigues
- 630字
- 2021-07-02 21:38:41
How to do it...
Perform the following steps:
- Start the OpenDaylight Karaf distribution using the karaf script. Using this script will give you access to the Karaf CLI:
$ ./bin/karaf
- Install the user facing feature responsible for pulling in all dependencies needed to connect an NETCONF device:
opendaylight-user@root>feature:install odl-usc-channel-ui
It might take a minute or so to complete the installation.
- Start the USC agent and the echo server using a TCP session.
Open two terminal windows accessing this VM, then start the USC agent:
$ java -jar UscAgent.jar -t true
Start the echo server:
$ java -jar EchoServer.jar -t true -p 2007
- Create the channel using the following request. You will need the IP address of your VM, ${VM_IP_ADDRESS}:
- Type: POST
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/operations/usc-channel:add-channel
- Payload:
{
"input":{
"channel":{
"hostname":"${VM_IP_ADDRESS}",
"port":2007,
"remote":false,
"tcp":true
}
}
}
If the request went fine, you will receive the following output:
{
"output": {
"result": "Succeed to connect device(${VM_IP_ADDRESS}:2007)!"
}
}
- View the created channel using either a REST call, or using the OpenDaylight DLUX component:
1. REST CALL: All the information written by the USC plugin is located under the usc topology, so we're reading the content contained in this topology:
- Type: POST
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/operations/usc-channel:view-channel
- Payload:
{
"input":{
"topology-id":"usc"
}
}
This will return, among other information, a payload containing channel information such as its ID, composed of the hostname running OpenDaylight (inocybe.local), the VM IP address (192.168.2.26), and the type of protocol used to established the session (TLS). It also contains data regarding the session; this is the first created session, and we have zero written or read bytes:
"channel": [
{
"channel-id": "Controller:inocybe.local
-Device:192.168.2.26-type:TLS",
"channel-type": "TLS",
--[cut]--
"session": [
{
"session-id": "1",
"bytes-in": 0,
"bytes-out": 0,
"termination-point": {
"termination-point-id": "2007"
},
}
],
"destination": {
"dest-node": "192.168.2.26"
}
--[cut]--
}
]
2. Navigate to http://localhost:8181/index.html:
Log in using admin/admin. On the right, click the USC tab:

- Send a message through the channel. For this you will require the IP address of the VM running the USC agent, the port behind which the echo server is running, whether or not you're using TCP, and the message content:
- Type: POST
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/operations/usc-channel:send-message
- Payload:
{
"input":{
"channel":{
"hostname":"192.168.2.26",
"port":"2007",
"tcp":"true",
"content":"This is a test message."
}
}
}
This request should return a message saying it worked. The return message here is going to be similar to the one sent, as we're using an echo server. Using your own device, you could define the return statement, and you could react as desired when receiving the message:
{
"output": {
"result": "Succeed to send request to device(192.168.2.26:2007),content is This is a test message."
}
}
- Look at the channel information again; we will now see the number of input and output bytes had increased. Use the same process as defined in step 5.
Here is the output for current session 1 for the channel. You can see the number of bytes has increased. It shows the bytes per session and for the whole channel:
"channel": [
{
"channel-id": "Controller:inocybe.local
-Device:192.168.2.26-type:TLS",
"source": {
"source-node": "inocybe.local"
},
"sessions": 1,
"channel-type": "TLS",
"call-home": "",
"channel-alarms": 0,
"session": [
{
"session-id": "1",
"bytes-in": 23,
"termination-point": {
"termination-point-id": "2007"
},
"session-alarms": 0,
"bytes-out": 23
}
],
"destination": {
"dest-node": "192.168.2.26"
},
"bytes-in": 23,
"bytes-out": 23
}
]
- Remove the session, cleaning up all the statistics:
- Type: POST
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/operations/usc-channel:remove-channel
- Payload:
{
"input":{
"channel":{
"hostname":"192.168.2.26",
"port":"2007",
"tcp":"true"
}
}
}
This request will respond with a positive message saying the channel was successfully removed:
{
"output": {
"result": "Succeed to remove device(192.168.2.26:2007)!"
}
}
You can send the request seen at point 5; you will see the channel is still present, but the session was removed.
- 算法零基礎(chǔ)一本通(Python版)
- Java面向?qū)ο笏枷肱c程序設(shè)計(jì)
- Practical DevOps
- Python Data Analysis(Second Edition)
- Apache Spark 2.x for Java Developers
- Creating Stunning Dashboards with QlikView
- Solr Cookbook(Third Edition)
- Java EE企業(yè)級(jí)應(yīng)用開發(fā)教程(Spring+Spring MVC+MyBatis)
- Java程序設(shè)計(jì)基礎(chǔ)(第6版)
- 深度學(xué)習(xí)程序設(shè)計(jì)實(shí)戰(zhàn)
- 計(jì)算機(jī)系統(tǒng)解密:從理解計(jì)算機(jī)到編寫高效代碼
- micro:bit軟件指南
- Mastering High Performance with Kotlin
- 區(qū)塊鏈社會(huì):區(qū)塊鏈助力國家治理能力現(xiàn)代化
- 軟件工程基礎(chǔ)