Consumer Producer repo ng example with two containers - skoulouzis/ndn-with-docker GitHub Wiki
This is a simple test of the repo-ng
Start docker containers
On the hosting node start repo-ng-A:
sudo docker run --name repo-ng-A repo-ng
or:
sudo docker start repo-ng-A
On the hosting node start repo-ng-B:
sudo docker run --name repo-ng-B repo-ng
or:
sudo docker start repo-ng-B
Get containers' IP addresses
For repo-ng-B on the hosting node type:
sudo docker inspect repo-ng-B | grep IPAddress
The output should look like this:
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.3",
"IPAddress": "172.17.0.3",
Connect containers
Log in repo-ng-A. From the hosting node type:
sudo docker exec -it repo-ng-A bash
Add to repo-ng-A a route to repo-ng-B. On repo-ng-A type:
nfdc face create udp://$repo-ng-B_IP
The output should look like this:
face-created id=260 local=udp4://172.17.0.2:6363 remote=udp4://172.17.0.3:6363 persistency=persistent reliability=off
Next, on repo-ng-A type:
nfdc route add /example udp://$repo-ng-B_IP
The output should look like this:
route-add-accepted prefix=/example nexthop=260 origin=static cost=0 flags=child-inherit expires=never
This means that repo-ng-B can send data to repo-ng-A. However, repo-ng-A cannot send data to repo-ng-B.
Create repository
Log in repo-ng-B. On the hosting node type:
sudo docker exec -it repo-ng-B bash
On repo-ng-B add some data
ndnputfile /example/repo/1 /example/data/1 test.txt
Log in repo-ng-A. On the hosting node type:
sudo docker exec -it repo-ng-A bash
On repo-ng-A get the data:
ndngetfile -v /example/data/1
The output should look like this:
TIMEOUT: retransmit interest for /example/data/1
<File contents>
LOG: received data = /example/data/1/%FD%00%00%01a%F0%FDC%92/%00%00
INFO: End of file is reached.
INFO: Total # of segments received: 1
INFO: Total # bytes of content received: 91