{"action":"created","comment":{"url":"https://api.github.com/repos/internap/netman/pulls/comments/51188883","id":51188883,"diff_hunk":"@@ -49,11 +52,31 @@ def open_session(self, switch, session_id):\n             raise\n \n         self.logger.info(\"Switch for session {} connected and in transaction mode, storing session\".format(session_id))\n-        self.sessions[session_id] = switch\n+        self.add_session(switch, session_id)\n         self._start_timer(session_id)\n \n         return session_id\n \n+    def add_session(self, switch, session_id):\n+        if session_id in self.sessions:\n+            raise SessionAlreadyExists(session_id)\n+        self.sessions[session_id] = switch\n+        try:\n+            self.session_storage.add(switch.switch_descriptor, session_id)\n+        except NetmanException as e:\n+            self.logger.error('Switch for session {} could not be added in '\n+                              'SessionStorage: {}'.format(session_id, e))\n+\n+    def remove_session(self, session_id):\n+        if session_id not in self.sessions:","path":"netman/core/switch_sessions.py","position":51,"original_position":51,"commit_id":"8aa544912265f2a53bf2487834e25abbdc019199","original_commit_id":"8aa544912265f2a53bf2487834e25abbdc019199","user":{"login":"lindycoder","id":12926519,"avatar_url":"https://avatars.githubusercontent.com/u/12926519?v=3","gravatar_id":"","url":"https://api.github.com/users/lindycoder","html_url":"https://github.com/lindycoder","followers_url":"https://api.github.com/users/lindycoder/followers","following_url":"https://api.github.com/users/lindycoder/following{/other_user}","gists_url":"https://api.github.com/users/lindycoder/gists{/gist_id}","starred_url":"https://api.github.com/users/lindycoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindycoder/subscriptions","organizations_url":"https://api.github.com/users/lindycoder/orgs","repos_url":"https://api.github.com/users/lindycoder/repos","events_url":"https://api.github.com/users/lindycoder/events{/privacy}","received_events_url":"https://api.github.com/users/lindycoder/received_events","type":"User","site_admin":false},"body":"again if you're here, you passed the \"get_switch_for_session\" at line 99 that would have thrown that eexception","created_at":"2016-01-28T21:17:46Z","updated_at":"2016-01-28T21:17:46Z","html_url":"https://github.com/internap/netman/pull/66#discussion_r51188883","pull_request_url":"https://api.github.com/repos/internap/netman/pulls/66","_links":{"self":{"href":"https://api.github.com/repos/internap/netman/pulls/comments/51188883"},"html":{"href":"https://github.com/internap/netman/pull/66#discussion_r51188883"},"pull_request":{"href":"https://api.github.com/repos/internap/netman/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/internap/netman/pulls/66","id":57565785,"html_url":"https://github.com/internap/netman/pull/66","diff_url":"https://github.com/internap/netman/pull/66.diff","patch_url":"https://github.com/internap/netman/pull/66.patch","issue_url":"https://api.github.com/repos/internap/netman/issues/66","number":66,"state":"open","locked":false,"title":"Session Storage Implementation","user":{"login":"idjaw","id":941141,"avatar_url":"https://avatars.githubusercontent.com/u/941141?v=3","gravatar_id":"","url":"https://api.github.com/users/idjaw","html_url":"https://github.com/idjaw","followers_url":"https://api.github.com/users/idjaw/followers","following_url":"https://api.github.com/users/idjaw/following{/other_user}","gists_url":"https://api.github.com/users/idjaw/gists{/gist_id}","starred_url":"https://api.github.com/users/idjaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idjaw/subscriptions","organizations_url":"https://api.github.com/users/idjaw/orgs","repos_url":"https://api.github.com/users/idjaw/repos","events_url":"https://api.github.com/users/idjaw/events{/privacy}","received_events_url":"https://api.github.com/users/idjaw/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-28T21:06:32Z","updated_at":"2016-01-28T21:17:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"239ad6e53b29620d2d75acfdcdca1e876d2e3740","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/internap/netman/pulls/66/commits","review_comments_url":"https://api.github.com/repos/internap/netman/pulls/66/comments","review_comment_url":"https://api.github.com/repos/internap/netman/pulls/comments{/number}","comments_url":"https://api.github.com/repos/internap/netman/issues/66/comments","statuses_url":"https://api.github.com/repos/internap/netman/statuses/8aa544912265f2a53bf2487834e25abbdc019199","head":{"label":"idjaw:session_source","ref":"session_source","sha":"8aa544912265f2a53bf2487834e25abbdc019199","user":{"login":"idjaw","id":941141,"avatar_url":"https://avatars.githubusercontent.com/u/941141?v=3","gravatar_id":"","url":"https://api.github.com/users/idjaw","html_url":"https://github.com/idjaw","followers_url":"https://api.github.com/users/idjaw/followers","following_url":"https://api.github.com/users/idjaw/following{/other_user}","gists_url":"https://api.github.com/users/idjaw/gists{/gist_id}","starred_url":"https://api.github.com/users/idjaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idjaw/subscriptions","organizations_url":"https://api.github.com/users/idjaw/orgs","repos_url":"https://api.github.com/users/idjaw/repos","events_url":"https://api.github.com/users/idjaw/events{/privacy}","received_events_url":"https://api.github.com/users/idjaw/received_events","type":"User","site_admin":false},"repo":{"id":43786227,"name":"netman","full_name":"idjaw/netman","owner":{"login":"idjaw","id":941141,"avatar_url":"https://avatars.githubusercontent.com/u/941141?v=3","gravatar_id":"","url":"https://api.github.com/users/idjaw","html_url":"https://github.com/idjaw","followers_url":"https://api.github.com/users/idjaw/followers","following_url":"https://api.github.com/users/idjaw/following{/other_user}","gists_url":"https://api.github.com/users/idjaw/gists{/gist_id}","starred_url":"https://api.github.com/users/idjaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idjaw/subscriptions","organizations_url":"https://api.github.com/users/idjaw/orgs","repos_url":"https://api.github.com/users/idjaw/repos","events_url":"https://api.github.com/users/idjaw/events{/privacy}","received_events_url":"https://api.github.com/users/idjaw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/idjaw/netman","description":"A unified REST API to provide vendor-agnostic network automation","fork":true,"url":"https://api.github.com/repos/idjaw/netman","forks_url":"https://api.github.com/repos/idjaw/netman/forks","keys_url":"https://api.github.com/repos/idjaw/netman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idjaw/netman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idjaw/netman/teams","hooks_url":"https://api.github.com/repos/idjaw/netman/hooks","issue_events_url":"https://api.github.com/repos/idjaw/netman/issues/events{/number}","events_url":"https://api.github.com/repos/idjaw/netman/events","assignees_url":"https://api.github.com/repos/idjaw/netman/assignees{/user}","branches_url":"https://api.github.com/repos/idjaw/netman/branches{/branch}","tags_url":"https://api.github.com/repos/idjaw/netman/tags","blobs_url":"https://api.github.com/repos/idjaw/netman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idjaw/netman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idjaw/netman/git/refs{/sha}","trees_url":"https://api.github.com/repos/idjaw/netman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idjaw/netman/statuses/{sha}","languages_url":"https://api.github.com/repos/idjaw/netman/languages","stargazers_url":"https://api.github.com/repos/idjaw/netman/stargazers","contributors_url":"https://api.github.com/repos/idjaw/netman/contributors","subscribers_url":"https://api.github.com/repos/idjaw/netman/subscribers","subscription_url":"https://api.github.com/repos/idjaw/netman/subscription","commits_url":"https://api.github.com/repos/idjaw/netman/commits{/sha}","git_commits_url":"https://api.github.com/repos/idjaw/netman/git/commits{/sha}","comments_url":"https://api.github.com/repos/idjaw/netman/comments{/number}","issue_comment_url":"https://api.github.com/repos/idjaw/netman/issues/comments{/number}","contents_url":"https://api.github.com/repos/idjaw/netman/contents/{+path}","compare_url":"https://api.github.com/repos/idjaw/netman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idjaw/netman/merges","archive_url":"https://api.github.com/repos/idjaw/netman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idjaw/netman/downloads","issues_url":"https://api.github.com/repos/idjaw/netman/issues{/number}","pulls_url":"https://api.github.com/repos/idjaw/netman/pulls{/number}","milestones_url":"https://api.github.com/repos/idjaw/netman/milestones{/number}","notifications_url":"https://api.github.com/repos/idjaw/netman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idjaw/netman/labels{/name}","releases_url":"https://api.github.com/repos/idjaw/netman/releases{/id}","deployments_url":"https://api.github.com/repos/idjaw/netman/deployments","created_at":"2015-10-07T00:11:59Z","updated_at":"2016-01-28T17:56:51Z","pushed_at":"2016-01-28T21:05:19Z","git_url":"git://github.com/idjaw/netman.git","ssh_url":"git@github.com:idjaw/netman.git","clone_url":"https://github.com/idjaw/netman.git","svn_url":"https://github.com/idjaw/netman","homepage":null,"size":340,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"internap:master","ref":"master","sha":"b39353d66ce5ecc00b968e53840831c34253217a","user":{"login":"internap","id":13888621,"avatar_url":"https://avatars.githubusercontent.com/u/13888621?v=3","gravatar_id":"","url":"https://api.github.com/users/internap","html_url":"https://github.com/internap","followers_url":"https://api.github.com/users/internap/followers","following_url":"https://api.github.com/users/internap/following{/other_user}","gists_url":"https://api.github.com/users/internap/gists{/gist_id}","starred_url":"https://api.github.com/users/internap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/internap/subscriptions","organizations_url":"https://api.github.com/users/internap/orgs","repos_url":"https://api.github.com/users/internap/repos","events_url":"https://api.github.com/users/internap/events{/privacy}","received_events_url":"https://api.github.com/users/internap/received_events","type":"Organization","site_admin":false},"repo":{"id":42546590,"name":"netman","full_name":"internap/netman","owner":{"login":"internap","id":13888621,"avatar_url":"https://avatars.githubusercontent.com/u/13888621?v=3","gravatar_id":"","url":"https://api.github.com/users/internap","html_url":"https://github.com/internap","followers_url":"https://api.github.com/users/internap/followers","following_url":"https://api.github.com/users/internap/following{/other_user}","gists_url":"https://api.github.com/users/internap/gists{/gist_id}","starred_url":"https://api.github.com/users/internap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/internap/subscriptions","organizations_url":"https://api.github.com/users/internap/orgs","repos_url":"https://api.github.com/users/internap/repos","events_url":"https://api.github.com/users/internap/events{/privacy}","received_events_url":"https://api.github.com/users/internap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/internap/netman","description":"A unified REST API to provide vendor-agnostic network automation","fork":false,"url":"https://api.github.com/repos/internap/netman","forks_url":"https://api.github.com/repos/internap/netman/forks","keys_url":"https://api.github.com/repos/internap/netman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/internap/netman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/internap/netman/teams","hooks_url":"https://api.github.com/repos/internap/netman/hooks","issue_events_url":"https://api.github.com/repos/internap/netman/issues/events{/number}","events_url":"https://api.github.com/repos/internap/netman/events","assignees_url":"https://api.github.com/repos/internap/netman/assignees{/user}","branches_url":"https://api.github.com/repos/internap/netman/branches{/branch}","tags_url":"https://api.github.com/repos/internap/netman/tags","blobs_url":"https://api.github.com/repos/internap/netman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/internap/netman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/internap/netman/git/refs{/sha}","trees_url":"https://api.github.com/repos/internap/netman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/internap/netman/statuses/{sha}","languages_url":"https://api.github.com/repos/internap/netman/languages","stargazers_url":"https://api.github.com/repos/internap/netman/stargazers","contributors_url":"https://api.github.com/repos/internap/netman/contributors","subscribers_url":"https://api.github.com/repos/internap/netman/subscribers","subscription_url":"https://api.github.com/repos/internap/netman/subscription","commits_url":"https://api.github.com/repos/internap/netman/commits{/sha}","git_commits_url":"https://api.github.com/repos/internap/netman/git/commits{/sha}","comments_url":"https://api.github.com/repos/internap/netman/comments{/number}","issue_comment_url":"https://api.github.com/repos/internap/netman/issues/comments{/number}","contents_url":"https://api.github.com/repos/internap/netman/contents/{+path}","compare_url":"https://api.github.com/repos/internap/netman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/internap/netman/merges","archive_url":"https://api.github.com/repos/internap/netman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/internap/netman/downloads","issues_url":"https://api.github.com/repos/internap/netman/issues{/number}","pulls_url":"https://api.github.com/repos/internap/netman/pulls{/number}","milestones_url":"https://api.github.com/repos/internap/netman/milestones{/number}","notifications_url":"https://api.github.com/repos/internap/netman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/internap/netman/labels{/name}","releases_url":"https://api.github.com/repos/internap/netman/releases{/id}","deployments_url":"https://api.github.com/repos/internap/netman/deployments","created_at":"2015-09-15T21:06:05Z","updated_at":"2016-01-28T21:13:23Z","pushed_at":"2016-01-28T21:06:32Z","git_url":"git://github.com/internap/netman.git","ssh_url":"git@github.com:internap/netman.git","clone_url":"https://github.com/internap/netman.git","svn_url":"https://github.com/internap/netman","homepage":null,"size":443,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":15,"forks":9,"open_issues":15,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/internap/netman/pulls/66"},"html":{"href":"https://github.com/internap/netman/pull/66"},"issue":{"href":"https://api.github.com/repos/internap/netman/issues/66"},"comments":{"href":"https://api.github.com/repos/internap/netman/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/internap/netman/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/internap/netman/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/internap/netman/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/internap/netman/statuses/8aa544912265f2a53bf2487834e25abbdc019199"}}}}