{"action":"created","comment":{"url":"https://api.github.com/repos/CCI-MOC/hil/pulls/comments/171683215","pull_request_review_id":100580410,"id":171683215,"diff_hunk":"@@ -9,3 +12,46 @@ def should_save(switch_obj):\n         if not cfg.getboolean(switch_ext, 'save'):\n             return False\n     return True\n+\n+\n+def check_native_networks(nic, op_type, channel):\n+    \"\"\"Check to ensure that native network is the first one to be added\n+    and last one to be removed\n+    \"\"\"\n+    table = model.NetworkAttachment\n+    query = db.session.query(table).filter(table.nic_id == nic.id)\n+\n+    if channel != 'vlan/native' and op_type == 'connect' and \\\n+       query.filter(table.channel == 'vlan/native').count() == 0:\n+        # checks if it is trying to attach a trunked network, and then in\n+        # in the db see if nic does not have any networks attached natively\n+        raise BlockedError(\"Please attach a native network first\")\n+    elif channel == 'vlan/native' and op_type == 'detach' and \\\n+            query.filter(table.channel != 'vlan/native').count() > 0:\n+        # if it is detaching a network, then check in the database if there\n+        # are any trunked vlans.\n+        raise BlockedError(\"Please remove all trunked Vlans\"\n+                           \" before removing the native vlan\")\n+    else:","path":"hil/ext/switches/common.py","position":34,"original_position":34,"commit_id":"c9e13e7af89075cc37c10259bf0d417a8722dc47","original_commit_id":"c9e13e7af89075cc37c10259bf0d417a8722dc47","user":{"login":"Izhmash","id":14796566,"avatar_url":"https://avatars2.githubusercontent.com/u/14796566?v=4","gravatar_id":"","url":"https://api.github.com/users/Izhmash","html_url":"https://github.com/Izhmash","followers_url":"https://api.github.com/users/Izhmash/followers","following_url":"https://api.github.com/users/Izhmash/following{/other_user}","gists_url":"https://api.github.com/users/Izhmash/gists{/gist_id}","starred_url":"https://api.github.com/users/Izhmash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Izhmash/subscriptions","organizations_url":"https://api.github.com/users/Izhmash/orgs","repos_url":"https://api.github.com/users/Izhmash/repos","events_url":"https://api.github.com/users/Izhmash/events{/privacy}","received_events_url":"https://api.github.com/users/Izhmash/received_events","type":"User","site_admin":false},"body":"We don't really need the `else` or the `return` here.","created_at":"2018-03-01T20:24:31Z","updated_at":"2018-03-01T20:25:15Z","html_url":"https://github.com/CCI-MOC/hil/pull/958#discussion_r171683215","pull_request_url":"https://api.github.com/repos/CCI-MOC/hil/pulls/958","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/comments/171683215"},"html":{"href":"https://github.com/CCI-MOC/hil/pull/958#discussion_r171683215"},"pull_request":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/958"}}},"pull_request":{"url":"https://api.github.com/repos/CCI-MOC/hil/pulls/958","id":169122286,"html_url":"https://github.com/CCI-MOC/hil/pull/958","diff_url":"https://github.com/CCI-MOC/hil/pull/958.diff","patch_url":"https://github.com/CCI-MOC/hil/pull/958.patch","issue_url":"https://api.github.com/repos/CCI-MOC/hil/issues/958","number":958,"state":"open","locked":false,"title":" Require setting a native vlan before adding any trunk vlans on the brocade switch (and correctly parse range of vlans)","user":{"login":"naved001","id":20113064,"avatar_url":"https://avatars0.githubusercontent.com/u/20113064?v=4","gravatar_id":"","url":"https://api.github.com/users/naved001","html_url":"https://github.com/naved001","followers_url":"https://api.github.com/users/naved001/followers","following_url":"https://api.github.com/users/naved001/following{/other_user}","gists_url":"https://api.github.com/users/naved001/gists{/gist_id}","starred_url":"https://api.github.com/users/naved001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naved001/subscriptions","organizations_url":"https://api.github.com/users/naved001/orgs","repos_url":"https://api.github.com/users/naved001/repos","events_url":"https://api.github.com/users/naved001/events{/privacy}","received_events_url":"https://api.github.com/users/naved001/received_events","type":"User","site_admin":false},"body":"\r\n* Moved that fix from the dellnos9 driver to switches.common and then used it\r\nin brocade.\r\n\r\n* Fixes #728 \r\n\r\nIt's a work in progress because `tests/deployment/vlan_networks.py` is failing. Gotta dig into that and push a fix asap.","created_at":"2018-02-14T14:21:36Z","updated_at":"2018-03-01T20:25:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d87ce143173f9d7d30bba6e1dde0a48e790b6ecb","assignee":{"login":"naved001","id":20113064,"avatar_url":"https://avatars0.githubusercontent.com/u/20113064?v=4","gravatar_id":"","url":"https://api.github.com/users/naved001","html_url":"https://github.com/naved001","followers_url":"https://api.github.com/users/naved001/followers","following_url":"https://api.github.com/users/naved001/following{/other_user}","gists_url":"https://api.github.com/users/naved001/gists{/gist_id}","starred_url":"https://api.github.com/users/naved001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naved001/subscriptions","organizations_url":"https://api.github.com/users/naved001/orgs","repos_url":"https://api.github.com/users/naved001/repos","events_url":"https://api.github.com/users/naved001/events{/privacy}","received_events_url":"https://api.github.com/users/naved001/received_events","type":"User","site_admin":false},"assignees":[{"login":"naved001","id":20113064,"avatar_url":"https://avatars0.githubusercontent.com/u/20113064?v=4","gravatar_id":"","url":"https://api.github.com/users/naved001","html_url":"https://github.com/naved001","followers_url":"https://api.github.com/users/naved001/followers","following_url":"https://api.github.com/users/naved001/following{/other_user}","gists_url":"https://api.github.com/users/naved001/gists{/gist_id}","starred_url":"https://api.github.com/users/naved001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naved001/subscriptions","organizations_url":"https://api.github.com/users/naved001/orgs","repos_url":"https://api.github.com/users/naved001/repos","events_url":"https://api.github.com/users/naved001/events{/privacy}","received_events_url":"https://api.github.com/users/naved001/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":108897181,"url":"https://api.github.com/repos/CCI-MOC/hil/labels/waiting%20on%20reviewer","name":"waiting on reviewer","color":"999999","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/CCI-MOC/hil/pulls/958/commits","review_comments_url":"https://api.github.com/repos/CCI-MOC/hil/pulls/958/comments","review_comment_url":"https://api.github.com/repos/CCI-MOC/hil/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CCI-MOC/hil/issues/958/comments","statuses_url":"https://api.github.com/repos/CCI-MOC/hil/statuses/c9e13e7af89075cc37c10259bf0d417a8722dc47","head":{"label":"naved001:brocade-native-vlan","ref":"brocade-native-vlan","sha":"c9e13e7af89075cc37c10259bf0d417a8722dc47","user":{"login":"naved001","id":20113064,"avatar_url":"https://avatars0.githubusercontent.com/u/20113064?v=4","gravatar_id":"","url":"https://api.github.com/users/naved001","html_url":"https://github.com/naved001","followers_url":"https://api.github.com/users/naved001/followers","following_url":"https://api.github.com/users/naved001/following{/other_user}","gists_url":"https://api.github.com/users/naved001/gists{/gist_id}","starred_url":"https://api.github.com/users/naved001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naved001/subscriptions","organizations_url":"https://api.github.com/users/naved001/orgs","repos_url":"https://api.github.com/users/naved001/repos","events_url":"https://api.github.com/users/naved001/events{/privacy}","received_events_url":"https://api.github.com/users/naved001/received_events","type":"User","site_admin":false},"repo":{"id":68385520,"name":"hil","full_name":"naved001/hil","owner":{"login":"naved001","id":20113064,"avatar_url":"https://avatars0.githubusercontent.com/u/20113064?v=4","gravatar_id":"","url":"https://api.github.com/users/naved001","html_url":"https://github.com/naved001","followers_url":"https://api.github.com/users/naved001/followers","following_url":"https://api.github.com/users/naved001/following{/other_user}","gists_url":"https://api.github.com/users/naved001/gists{/gist_id}","starred_url":"https://api.github.com/users/naved001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naved001/subscriptions","organizations_url":"https://api.github.com/users/naved001/orgs","repos_url":"https://api.github.com/users/naved001/repos","events_url":"https://api.github.com/users/naved001/events{/privacy}","received_events_url":"https://api.github.com/users/naved001/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/naved001/hil","description":"Hardware Isolation Layer, formerly Hardware as a Service","fork":true,"url":"https://api.github.com/repos/naved001/hil","forks_url":"https://api.github.com/repos/naved001/hil/forks","keys_url":"https://api.github.com/repos/naved001/hil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/naved001/hil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/naved001/hil/teams","hooks_url":"https://api.github.com/repos/naved001/hil/hooks","issue_events_url":"https://api.github.com/repos/naved001/hil/issues/events{/number}","events_url":"https://api.github.com/repos/naved001/hil/events","assignees_url":"https://api.github.com/repos/naved001/hil/assignees{/user}","branches_url":"https://api.github.com/repos/naved001/hil/branches{/branch}","tags_url":"https://api.github.com/repos/naved001/hil/tags","blobs_url":"https://api.github.com/repos/naved001/hil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/naved001/hil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/naved001/hil/git/refs{/sha}","trees_url":"https://api.github.com/repos/naved001/hil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/naved001/hil/statuses/{sha}","languages_url":"https://api.github.com/repos/naved001/hil/languages","stargazers_url":"https://api.github.com/repos/naved001/hil/stargazers","contributors_url":"https://api.github.com/repos/naved001/hil/contributors","subscribers_url":"https://api.github.com/repos/naved001/hil/subscribers","subscription_url":"https://api.github.com/repos/naved001/hil/subscription","commits_url":"https://api.github.com/repos/naved001/hil/commits{/sha}","git_commits_url":"https://api.github.com/repos/naved001/hil/git/commits{/sha}","comments_url":"https://api.github.com/repos/naved001/hil/comments{/number}","issue_comment_url":"https://api.github.com/repos/naved001/hil/issues/comments{/number}","contents_url":"https://api.github.com/repos/naved001/hil/contents/{+path}","compare_url":"https://api.github.com/repos/naved001/hil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/naved001/hil/merges","archive_url":"https://api.github.com/repos/naved001/hil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/naved001/hil/downloads","issues_url":"https://api.github.com/repos/naved001/hil/issues{/number}","pulls_url":"https://api.github.com/repos/naved001/hil/pulls{/number}","milestones_url":"https://api.github.com/repos/naved001/hil/milestones{/number}","notifications_url":"https://api.github.com/repos/naved001/hil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/naved001/hil/labels{/name}","releases_url":"https://api.github.com/repos/naved001/hil/releases{/id}","deployments_url":"https://api.github.com/repos/naved001/hil/deployments","created_at":"2016-09-16T14:13:37Z","updated_at":"2017-07-06T19:13:57Z","pushed_at":"2018-02-28T18:07:55Z","git_url":"git://github.com/naved001/hil.git","ssh_url":"git@github.com:naved001/hil.git","clone_url":"https://github.com/naved001/hil.git","svn_url":"https://github.com/naved001/hil","homepage":"","size":4012,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CCI-MOC:master","ref":"master","sha":"98afe145b554c171e32e44dd00589294c7a24940","user":{"login":"CCI-MOC","id":3578683,"avatar_url":"https://avatars1.githubusercontent.com/u/3578683?v=4","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"repo":{"id":16487339,"name":"hil","full_name":"CCI-MOC/hil","owner":{"login":"CCI-MOC","id":3578683,"avatar_url":"https://avatars1.githubusercontent.com/u/3578683?v=4","gravatar_id":"","url":"https://api.github.com/users/CCI-MOC","html_url":"https://github.com/CCI-MOC","followers_url":"https://api.github.com/users/CCI-MOC/followers","following_url":"https://api.github.com/users/CCI-MOC/following{/other_user}","gists_url":"https://api.github.com/users/CCI-MOC/gists{/gist_id}","starred_url":"https://api.github.com/users/CCI-MOC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCI-MOC/subscriptions","organizations_url":"https://api.github.com/users/CCI-MOC/orgs","repos_url":"https://api.github.com/users/CCI-MOC/repos","events_url":"https://api.github.com/users/CCI-MOC/events{/privacy}","received_events_url":"https://api.github.com/users/CCI-MOC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CCI-MOC/hil","description":"Hardware Isolation Layer, formerly Hardware as a Service","fork":false,"url":"https://api.github.com/repos/CCI-MOC/hil","forks_url":"https://api.github.com/repos/CCI-MOC/hil/forks","keys_url":"https://api.github.com/repos/CCI-MOC/hil/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CCI-MOC/hil/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CCI-MOC/hil/teams","hooks_url":"https://api.github.com/repos/CCI-MOC/hil/hooks","issue_events_url":"https://api.github.com/repos/CCI-MOC/hil/issues/events{/number}","events_url":"https://api.github.com/repos/CCI-MOC/hil/events","assignees_url":"https://api.github.com/repos/CCI-MOC/hil/assignees{/user}","branches_url":"https://api.github.com/repos/CCI-MOC/hil/branches{/branch}","tags_url":"https://api.github.com/repos/CCI-MOC/hil/tags","blobs_url":"https://api.github.com/repos/CCI-MOC/hil/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CCI-MOC/hil/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CCI-MOC/hil/git/refs{/sha}","trees_url":"https://api.github.com/repos/CCI-MOC/hil/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CCI-MOC/hil/statuses/{sha}","languages_url":"https://api.github.com/repos/CCI-MOC/hil/languages","stargazers_url":"https://api.github.com/repos/CCI-MOC/hil/stargazers","contributors_url":"https://api.github.com/repos/CCI-MOC/hil/contributors","subscribers_url":"https://api.github.com/repos/CCI-MOC/hil/subscribers","subscription_url":"https://api.github.com/repos/CCI-MOC/hil/subscription","commits_url":"https://api.github.com/repos/CCI-MOC/hil/commits{/sha}","git_commits_url":"https://api.github.com/repos/CCI-MOC/hil/git/commits{/sha}","comments_url":"https://api.github.com/repos/CCI-MOC/hil/comments{/number}","issue_comment_url":"https://api.github.com/repos/CCI-MOC/hil/issues/comments{/number}","contents_url":"https://api.github.com/repos/CCI-MOC/hil/contents/{+path}","compare_url":"https://api.github.com/repos/CCI-MOC/hil/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CCI-MOC/hil/merges","archive_url":"https://api.github.com/repos/CCI-MOC/hil/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CCI-MOC/hil/downloads","issues_url":"https://api.github.com/repos/CCI-MOC/hil/issues{/number}","pulls_url":"https://api.github.com/repos/CCI-MOC/hil/pulls{/number}","milestones_url":"https://api.github.com/repos/CCI-MOC/hil/milestones{/number}","notifications_url":"https://api.github.com/repos/CCI-MOC/hil/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CCI-MOC/hil/labels{/name}","releases_url":"https://api.github.com/repos/CCI-MOC/hil/releases{/id}","deployments_url":"https://api.github.com/repos/CCI-MOC/hil/deployments","created_at":"2014-02-03T17:48:01Z","updated_at":"2018-02-16T20:08:51Z","pushed_at":"2018-03-01T20:16:35Z","git_url":"git://github.com/CCI-MOC/hil.git","ssh_url":"git@github.com:CCI-MOC/hil.git","clone_url":"https://github.com/CCI-MOC/hil.git","svn_url":"https://github.com/CCI-MOC/hil","homepage":"","size":3964,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":125,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":49,"open_issues":125,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/958"},"html":{"href":"https://github.com/CCI-MOC/hil/pull/958"},"issue":{"href":"https://api.github.com/repos/CCI-MOC/hil/issues/958"},"comments":{"href":"https://api.github.com/repos/CCI-MOC/hil/issues/958/comments"},"review_comments":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/958/comments"},"review_comment":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CCI-MOC/hil/pulls/958/commits"},"statuses":{"href":"https://api.github.com/repos/CCI-MOC/hil/statuses/c9e13e7af89075cc37c10259bf0d417a8722dc47"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Izhmash"}}