From b5844947e43502c6976f597a7dee9e39ea7be244 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Fri, 23 Aug 2019 17:07:54 +0100 Subject: [PATCH] Initial Join / Leave implementation --- net-dhcp/network.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/net-dhcp/network.py b/net-dhcp/network.py index f23178b..cc1fa55 100644 --- a/net-dhcp/network.py +++ b/net-dhcp/network.py @@ -177,3 +177,22 @@ def delete_endpoint(): .commit()) return jsonify({}) + +@app.route('/NetworkDriver.Join', methods=['POST']) +def join(): + req = request.get_json(force=True) + logger.info(req) + + bridge = net_bridge(req['NetworkID']) + _if_host, if_container = veth_pair(req['EndpointID']) + + return jsonify({ + 'InterfaceName': { + 'SrcName': if_container, + 'DstPrefix': bridge.ifname + } + }) + +@app.route('/NetworkDriver.Leave', methods=['POST']) +def leave(): + return jsonify({}) \ No newline at end of file