{"action":"created","comment":{"url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/comments/34849824","id":34849824,"diff_hunk":"@@ -216,13 +199,45 @@ def endpoint_oper_info():\n @app.route('/NetworkDriver.Join', methods=['POST'])\n def join():\n     json_data = request.get_json(force=True)\n+    app.logger.debug(\"Join JSON=%s\", json_data)\n     ep_id = json_data[\"EndpointID\"]\n+    net_id = json_data[\"NetworkID\"]\n     app.logger.info(\"Joining endpoint %s\", ep_id)\n \n-    ep = client.get_endpoint(hostname=hostname,\n-                             orchestrator_id=\"docker\",\n-                             workload_id=CONTAINER_NAME,\n-                             endpoint_id=ep_id)\n+    # Get CNM endpoint ID from datastore so we can find the IP addresses\n+    # assigned to it.\n+    cnm_ep = client.read_cnm_endpoint(ep_id)\n+\n+    # Read the next hops from etcd\n+    next_hops = client.get_default_next_hops(hostname)\n+\n+    # Create a Calico endpoint object.\n+    #TODO - set the CONTAINER_NAME to something better (the sandbox key?)\n+    ep = Endpoint(hostname, \"docker\", CONTAINER_NAME, ep_id, \"active\",\n+                      FIXED_MAC)\n+    ep.profile_ids.append(net_id)\n+    ep.ipv4_nets.add(IPNetwork(cnm_ep['Interfaces'][0]['Address']))","path":"calico_containers/libnetwork_plugin/docker_plugin.py","position":257,"original_position":257,"commit_id":"ea4d5130d0de4e60ad1fae9eefb016b7911c2ae3","original_commit_id":"ea4d5130d0de4e60ad1fae9eefb016b7911c2ae3","user":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"body":"If we aren't checking the IPv4 value here then we should be create_endpoint() based on whether an IPv4 address was assigned (not on whether any IP address was assigned)","created_at":"2015-07-16T23:32:20Z","updated_at":"2015-07-16T23:32:20Z","html_url":"https://github.com/Metaswitch/calico-docker/pull/333#discussion_r34849824","pull_request_url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333","_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/comments/34849824"},"html":{"href":"https://github.com/Metaswitch/calico-docker/pull/333#discussion_r34849824"},"pull_request":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333"}}},"pull_request":{"url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333","id":40186332,"html_url":"https://github.com/Metaswitch/calico-docker/pull/333","diff_url":"https://github.com/Metaswitch/calico-docker/pull/333.diff","patch_url":"https://github.com/Metaswitch/calico-docker/pull/333.patch","issue_url":"https://api.github.com/repos/Metaswitch/calico-docker/issues/333","number":333,"state":"open","locked":false,"title":"Rewrite libnetwork plugin","user":{"login":"tomdee","id":6635,"avatar_url":"https://avatars.githubusercontent.com/u/6635?v=3","gravatar_id":"","url":"https://api.github.com/users/tomdee","html_url":"https://github.com/tomdee","followers_url":"https://api.github.com/users/tomdee/followers","following_url":"https://api.github.com/users/tomdee/following{/other_user}","gists_url":"https://api.github.com/users/tomdee/gists{/gist_id}","starred_url":"https://api.github.com/users/tomdee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomdee/subscriptions","organizations_url":"https://api.github.com/users/tomdee/orgs","repos_url":"https://api.github.com/users/tomdee/repos","events_url":"https://api.github.com/users/tomdee/events{/privacy}","received_events_url":"https://api.github.com/users/tomdee/received_events","type":"User","site_admin":false},"body":"I'll squash and sort out a better commit message before I merge.\r\n\r\nThe aim is to get this in today, so please start giving me all feedback but noting if I can defer applying it until after I merge to master.","created_at":"2015-07-16T23:14:30Z","updated_at":"2015-07-16T23:32:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61ee3c8be55c8462380b79b17f16946bfe0eb5f0","assignee":{"login":"robbrockbank","id":3227729,"avatar_url":"https://avatars.githubusercontent.com/u/3227729?v=3","gravatar_id":"","url":"https://api.github.com/users/robbrockbank","html_url":"https://github.com/robbrockbank","followers_url":"https://api.github.com/users/robbrockbank/followers","following_url":"https://api.github.com/users/robbrockbank/following{/other_user}","gists_url":"https://api.github.com/users/robbrockbank/gists{/gist_id}","starred_url":"https://api.github.com/users/robbrockbank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbrockbank/subscriptions","organizations_url":"https://api.github.com/users/robbrockbank/orgs","repos_url":"https://api.github.com/users/robbrockbank/repos","events_url":"https://api.github.com/users/robbrockbank/events{/privacy}","received_events_url":"https://api.github.com/users/robbrockbank/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333/commits","review_comments_url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333/comments","review_comment_url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Metaswitch/calico-docker/issues/333/comments","statuses_url":"https://api.github.com/repos/Metaswitch/calico-docker/statuses/ea4d5130d0de4e60ad1fae9eefb016b7911c2ae3","head":{"label":"tomdee:libnetwork-endpoint-host","ref":"libnetwork-endpoint-host","sha":"ea4d5130d0de4e60ad1fae9eefb016b7911c2ae3","user":{"login":"tomdee","id":6635,"avatar_url":"https://avatars.githubusercontent.com/u/6635?v=3","gravatar_id":"","url":"https://api.github.com/users/tomdee","html_url":"https://github.com/tomdee","followers_url":"https://api.github.com/users/tomdee/followers","following_url":"https://api.github.com/users/tomdee/following{/other_user}","gists_url":"https://api.github.com/users/tomdee/gists{/gist_id}","starred_url":"https://api.github.com/users/tomdee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomdee/subscriptions","organizations_url":"https://api.github.com/users/tomdee/orgs","repos_url":"https://api.github.com/users/tomdee/repos","events_url":"https://api.github.com/users/tomdee/events{/privacy}","received_events_url":"https://api.github.com/users/tomdee/received_events","type":"User","site_admin":false},"repo":{"id":37998562,"name":"calico-docker","full_name":"tomdee/calico-docker","owner":{"login":"tomdee","id":6635,"avatar_url":"https://avatars.githubusercontent.com/u/6635?v=3","gravatar_id":"","url":"https://api.github.com/users/tomdee","html_url":"https://github.com/tomdee","followers_url":"https://api.github.com/users/tomdee/followers","following_url":"https://api.github.com/users/tomdee/following{/other_user}","gists_url":"https://api.github.com/users/tomdee/gists{/gist_id}","starred_url":"https://api.github.com/users/tomdee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomdee/subscriptions","organizations_url":"https://api.github.com/users/tomdee/orgs","repos_url":"https://api.github.com/users/tomdee/repos","events_url":"https://api.github.com/users/tomdee/events{/privacy}","received_events_url":"https://api.github.com/users/tomdee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomdee/calico-docker","description":"Docker version of Project Calico","fork":true,"url":"https://api.github.com/repos/tomdee/calico-docker","forks_url":"https://api.github.com/repos/tomdee/calico-docker/forks","keys_url":"https://api.github.com/repos/tomdee/calico-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomdee/calico-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomdee/calico-docker/teams","hooks_url":"https://api.github.com/repos/tomdee/calico-docker/hooks","issue_events_url":"https://api.github.com/repos/tomdee/calico-docker/issues/events{/number}","events_url":"https://api.github.com/repos/tomdee/calico-docker/events","assignees_url":"https://api.github.com/repos/tomdee/calico-docker/assignees{/user}","branches_url":"https://api.github.com/repos/tomdee/calico-docker/branches{/branch}","tags_url":"https://api.github.com/repos/tomdee/calico-docker/tags","blobs_url":"https://api.github.com/repos/tomdee/calico-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomdee/calico-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomdee/calico-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomdee/calico-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomdee/calico-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/tomdee/calico-docker/languages","stargazers_url":"https://api.github.com/repos/tomdee/calico-docker/stargazers","contributors_url":"https://api.github.com/repos/tomdee/calico-docker/contributors","subscribers_url":"https://api.github.com/repos/tomdee/calico-docker/subscribers","subscription_url":"https://api.github.com/repos/tomdee/calico-docker/subscription","commits_url":"https://api.github.com/repos/tomdee/calico-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomdee/calico-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomdee/calico-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomdee/calico-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomdee/calico-docker/contents/{+path}","compare_url":"https://api.github.com/repos/tomdee/calico-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomdee/calico-docker/merges","archive_url":"https://api.github.com/repos/tomdee/calico-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomdee/calico-docker/downloads","issues_url":"https://api.github.com/repos/tomdee/calico-docker/issues{/number}","pulls_url":"https://api.github.com/repos/tomdee/calico-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/tomdee/calico-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/tomdee/calico-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomdee/calico-docker/labels{/name}","releases_url":"https://api.github.com/repos/tomdee/calico-docker/releases{/id}","created_at":"2015-06-24T17:05:45Z","updated_at":"2015-06-24T17:05:46Z","pushed_at":"2015-07-16T21:59:22Z","git_url":"git://github.com/tomdee/calico-docker.git","ssh_url":"git@github.com:tomdee/calico-docker.git","clone_url":"https://github.com/tomdee/calico-docker.git","svn_url":"https://github.com/tomdee/calico-docker","homepage":"http://www.projectcalico.org","size":13108,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Metaswitch:master","ref":"master","sha":"224774eb8c559e4795539c91b8f522ea7aa40fd6","user":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"repo":{"id":29629333,"name":"calico-docker","full_name":"Metaswitch/calico-docker","owner":{"login":"Metaswitch","id":453759,"avatar_url":"https://avatars.githubusercontent.com/u/453759?v=3","gravatar_id":"","url":"https://api.github.com/users/Metaswitch","html_url":"https://github.com/Metaswitch","followers_url":"https://api.github.com/users/Metaswitch/followers","following_url":"https://api.github.com/users/Metaswitch/following{/other_user}","gists_url":"https://api.github.com/users/Metaswitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Metaswitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metaswitch/subscriptions","organizations_url":"https://api.github.com/users/Metaswitch/orgs","repos_url":"https://api.github.com/users/Metaswitch/repos","events_url":"https://api.github.com/users/Metaswitch/events{/privacy}","received_events_url":"https://api.github.com/users/Metaswitch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Metaswitch/calico-docker","description":"Docker version of Project Calico","fork":false,"url":"https://api.github.com/repos/Metaswitch/calico-docker","forks_url":"https://api.github.com/repos/Metaswitch/calico-docker/forks","keys_url":"https://api.github.com/repos/Metaswitch/calico-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Metaswitch/calico-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Metaswitch/calico-docker/teams","hooks_url":"https://api.github.com/repos/Metaswitch/calico-docker/hooks","issue_events_url":"https://api.github.com/repos/Metaswitch/calico-docker/issues/events{/number}","events_url":"https://api.github.com/repos/Metaswitch/calico-docker/events","assignees_url":"https://api.github.com/repos/Metaswitch/calico-docker/assignees{/user}","branches_url":"https://api.github.com/repos/Metaswitch/calico-docker/branches{/branch}","tags_url":"https://api.github.com/repos/Metaswitch/calico-docker/tags","blobs_url":"https://api.github.com/repos/Metaswitch/calico-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Metaswitch/calico-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Metaswitch/calico-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/Metaswitch/calico-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Metaswitch/calico-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/Metaswitch/calico-docker/languages","stargazers_url":"https://api.github.com/repos/Metaswitch/calico-docker/stargazers","contributors_url":"https://api.github.com/repos/Metaswitch/calico-docker/contributors","subscribers_url":"https://api.github.com/repos/Metaswitch/calico-docker/subscribers","subscription_url":"https://api.github.com/repos/Metaswitch/calico-docker/subscription","commits_url":"https://api.github.com/repos/Metaswitch/calico-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/Metaswitch/calico-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/Metaswitch/calico-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/Metaswitch/calico-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/Metaswitch/calico-docker/contents/{+path}","compare_url":"https://api.github.com/repos/Metaswitch/calico-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Metaswitch/calico-docker/merges","archive_url":"https://api.github.com/repos/Metaswitch/calico-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Metaswitch/calico-docker/downloads","issues_url":"https://api.github.com/repos/Metaswitch/calico-docker/issues{/number}","pulls_url":"https://api.github.com/repos/Metaswitch/calico-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/Metaswitch/calico-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/Metaswitch/calico-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Metaswitch/calico-docker/labels{/name}","releases_url":"https://api.github.com/repos/Metaswitch/calico-docker/releases{/id}","created_at":"2015-01-21T23:46:47Z","updated_at":"2015-07-15T07:38:34Z","pushed_at":"2015-07-16T23:25:00Z","git_url":"git://github.com/Metaswitch/calico-docker.git","ssh_url":"git@github.com:Metaswitch/calico-docker.git","clone_url":"https://github.com/Metaswitch/calico-docker.git","svn_url":"https://github.com/Metaswitch/calico-docker","homepage":"http://www.projectcalico.org","size":16641,"stargazers_count":97,"watchers_count":97,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333"},"html":{"href":"https://github.com/Metaswitch/calico-docker/pull/333"},"issue":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/issues/333"},"comments":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/issues/333/comments"},"review_comments":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333/comments"},"review_comment":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/pulls/333/commits"},"statuses":{"href":"https://api.github.com/repos/Metaswitch/calico-docker/statuses/ea4d5130d0de4e60ad1fae9eefb016b7911c2ae3"}}}}