Commit 259813d9 authored by Juraj Sloboda's avatar Juraj Sloboda

Add destination to 'schedule contact' REST call (#59)

parent c874eebb
...@@ -35,13 +35,15 @@ async def handle_config(request): ...@@ -35,13 +35,15 @@ async def handle_config(request):
json = await request.json() json = await request.json()
destination = request.rel_url.query["destination"]
if "messages" not in json: if "messages" not in json:
raise web.HTTPBadRequest raise web.HTTPBadRequest
try: try:
for msg in json["messages"]: for msg in json["messages"]:
await bp_agent.create_and_send_config_msg( await bp_agent.create_and_send_config_msg(
"dtn://ops-sat.dtn/config", destination,
msg["eid"], msg["eid"],
msg["cla_address"], msg["cla_address"],
int(msg["start_offset"]), int(msg["start_offset"]),
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"raw": "{\n \"messages\": [\n {\n \"eid\": \"dtn://pyDTN-2.dtn\",\n \"cla_address\": \"172.25.2.11:2002\",\n \"start_offset\": 5,\n \"end_offset\": 20\n }\n ]\n}" "raw": "{\n \"messages\": [\n {\n \"eid\": \"dtn://pyDTN-2.dtn\",\n \"cla_address\": \"172.25.2.11:2002\",\n \"start_offset\": 5,\n \"end_offset\": 20\n }\n ]\n}"
}, },
"url": { "url": {
"raw": "http://localhost:8082/config", "raw": "http://localhost:8082/config?destination=dtn://ops-sat.dtn/config",
"protocol": "http", "protocol": "http",
"host": [ "host": [
"localhost" "localhost"
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
"port": "8082", "port": "8082",
"path": [ "path": [
"config" "config"
],
"query": [
{
"key": "destination",
"value": "dtn://ops-sat.dtn/config"
}
] ]
} }
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Tell uPCN-1 that pyDTN-2 is going to be available in 5s for next 15s, use REST API # Tell uPCN-1 that pyDTN-2 is going to be available in 5s for next 15s, use REST API
echo "Scheduling contact" echo "Scheduling contact"
curl -H "Content-Type: application/json" --data @schedule_contact.json "http://localhost:8082/config" || exit 1 curl -H "Content-Type: application/json" --data @schedule_contact.json "http://localhost:8082/config?destination=dtn://ops-sat.dtn/config" || exit 1
# Wait, but not longer than contact is going to be visible, otherwise we are hitting uPCN bug # Wait, but not longer than contact is going to be visible, otherwise we are hitting uPCN bug
echo "Waiting" echo "Waiting"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment