- 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.
- TypeScript Essentials
- 解構(gòu)產(chǎn)品經(jīng)理:互聯(lián)網(wǎng)產(chǎn)品策劃入門寶典
- Java EE 6 企業(yè)級應(yīng)用開發(fā)教程
- Web Development with Django Cookbook
- 深入淺出RxJS
- Python機(jī)器學(xué)習(xí)編程與實(shí)戰(zhàn)
- C#程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- Microsoft Dynamics AX 2012 R3 Financial Management
- uni-app跨平臺開發(fā)與應(yīng)用從入門到實(shí)踐
- C編程技巧:117個(gè)問題解決方案示例
- HTML+CSS+JavaScript網(wǎng)頁制作:從入門到精通(第4版)
- INSTANT Apache ServiceMix How-to
- Elasticsearch搜索引擎構(gòu)建入門與實(shí)戰(zhàn)
- Node.js Web Development
- Office VBA開發(fā)經(jīng)典:中級進(jìn)階卷