{"action":"created","comment":{"url":"https://api.github.com/repos/telstra/open-kilda/pulls/comments/225432750","pull_request_review_id":165026882,"id":225432750,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTQzMjc1MA==","diff_hunk":"@@ -24,4 +33,118 @@ class SwitchSpec extends BaseSpecification {\n         def exc = thrown(HttpClientErrorException)\n         exc.rawStatusCode == 400\n     }\n+\n+    def \"Delete nonexistent switch\"() {\n+        given: \"Nonexistent switch ID\"\n+        def switchId = new SwitchId(\"de:ad:be:ef:99:99:99:99\")\n+\n+        when: \"Try to delete nonexistent switch\"\n+        northboundService.deleteSwitch(switchId, false)\n+\n+        then: \"Got 404 NotFound\"\n+        def exc = thrown(HttpClientErrorException)\n+        exc.rawStatusCode == 404\n+    }\n+\n+    def \"Delete active switch\"() {\n+        given: \"An active switch\"\n+        def sw = topology.getActiveSwitches()[0]\n+\n+        when: \"Try to delete active switch\"\n+        northboundService.deleteSwitch(sw.getDpId(), false)\n+\n+        then: \"Got 400 BadRequest because switch must be deactivated\"\n+        def exc = thrown(HttpClientErrorException)\n+        exc.rawStatusCode == 400\n+    }\n+\n+    def \"Delete inactive switch with ISLs\"() {\n+        requireProfiles(\"virtual\")\n+\n+        given: \"An active switch\"\n+        def sw = topology.getActiveSwitches()[0]\n+\n+        and: \"Deactivate this switch\"\n+        lockKeeperService.knockoutSwitch(sw.getDpId())\n+\n+        when: \"Try to delete inactive switch with ISLs\"\n+        northboundService.deleteSwitch(sw.getDpId(), false)\n+\n+        then: \"Got 400 BadRequest because switch has ISLs\"\n+        def exc = thrown(HttpClientErrorException)\n+        exc.rawStatusCode == 400\n+\n+        and: \"Cleanup: Activate the switch back\"\n+        lockKeeperService.reviveSwitch(sw.getDpId())\n+    }\n+\n+    def \"Delete inactive switch with single flow\"() {\n+        requireProfiles(\"virtual\")\n+\n+        given: \"An active switch with flow\"\n+        def sw = topology.getActiveSwitches()[0]\n+        def flow = flowHelper.singleSwitchFlow(sw)\n+        northboundService.addFlow(flow)\n+        assert Wrappers.wait(WAIT_OFFSET) { northboundService.getFlowStatus(flow.id).status == FlowState.UP }\n+\n+        and: \"Deactivate this switch\"\n+        lockKeeperService.knockoutSwitch(sw.getDpId())\n+\n+        when: \"Try to delete inactive switch with flow\"\n+        northboundService.deleteSwitch(sw.getDpId(), false)\n+\n+        then: \"Got 400 BadRequest because switch has flow\"\n+        def exc = thrown(HttpClientErrorException)\n+        exc.rawStatusCode == 400","path":"services/src/functional-tests/src/test/groovy/org/openkilda/functionaltests/spec/northbound/switches/SwitchSpec.groovy","position":90,"original_position":90,"commit_id":"a634b5341d3d9be232a20c3803c86304aa21b880","original_commit_id":"6267ccbe6c1c5eddb7bb9a213f8d46abddc911b1","user":{"login":"niksv","id":8777565,"node_id":"MDQ6VXNlcjg3Nzc1NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/8777565?v=4","gravatar_id":"","url":"https://api.github.com/users/niksv","html_url":"https://github.com/niksv","followers_url":"https://api.github.com/users/niksv/followers","following_url":"https://api.github.com/users/niksv/following{/other_user}","gists_url":"https://api.github.com/users/niksv/gists{/gist_id}","starred_url":"https://api.github.com/users/niksv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksv/subscriptions","organizations_url":"https://api.github.com/users/niksv/orgs","repos_url":"https://api.github.com/users/niksv/repos","events_url":"https://api.github.com/users/niksv/events{/privacy}","received_events_url":"https://api.github.com/users/niksv/received_events","type":"User","site_admin":false},"body":"I'll try to do it, but \r\n1. For some reasons `exc` has only \"400 \" error message. (Real http request returns correct error messages)\r\n2. ISL in down state is not enough. I need to remove ISL from DB. At this moment I'm trying to find a way to remove and restore ISL in DB.","created_at":"2018-10-16T07:56:30Z","updated_at":"2018-10-16T07:56:30Z","html_url":"https://github.com/telstra/open-kilda/pull/1444#discussion_r225432750","pull_request_url":"https://api.github.com/repos/telstra/open-kilda/pulls/1444","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/comments/225432750"},"html":{"href":"https://github.com/telstra/open-kilda/pull/1444#discussion_r225432750"},"pull_request":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/1444"}},"in_reply_to_id":224758252},"pull_request":{"url":"https://api.github.com/repos/telstra/open-kilda/pulls/1444","id":222430664,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNDMwNjY0","html_url":"https://github.com/telstra/open-kilda/pull/1444","diff_url":"https://github.com/telstra/open-kilda/pull/1444.diff","patch_url":"https://github.com/telstra/open-kilda/pull/1444.patch","issue_url":"https://api.github.com/repos/telstra/open-kilda/issues/1444","number":1444,"state":"open","locked":false,"title":"New API: delete switch","user":{"login":"niksv","id":8777565,"node_id":"MDQ6VXNlcjg3Nzc1NjU=","avatar_url":"https://avatars1.githubusercontent.com/u/8777565?v=4","gravatar_id":"","url":"https://api.github.com/users/niksv","html_url":"https://github.com/niksv","followers_url":"https://api.github.com/users/niksv/followers","following_url":"https://api.github.com/users/niksv/following{/other_user}","gists_url":"https://api.github.com/users/niksv/gists{/gist_id}","starred_url":"https://api.github.com/users/niksv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksv/subscriptions","organizations_url":"https://api.github.com/users/niksv/orgs","repos_url":"https://api.github.com/users/niksv/repos","events_url":"https://api.github.com/users/niksv/events{/privacy}","received_events_url":"https://api.github.com/users/niksv/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-12T11:06:06Z","updated_at":"2018-10-16T07:56:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44e078ee415dc397756365d9e2813ce624a21037","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/telstra/open-kilda/pulls/1444/commits","review_comments_url":"https://api.github.com/repos/telstra/open-kilda/pulls/1444/comments","review_comment_url":"https://api.github.com/repos/telstra/open-kilda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telstra/open-kilda/issues/1444/comments","statuses_url":"https://api.github.com/repos/telstra/open-kilda/statuses/a634b5341d3d9be232a20c3803c86304aa21b880","head":{"label":"telstra:feature/328-switch-delete","ref":"feature/328-switch-delete","sha":"a634b5341d3d9be232a20c3803c86304aa21b880","user":{"login":"telstra","id":3914896,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MTQ4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3914896?v=4","gravatar_id":"","url":"https://api.github.com/users/telstra","html_url":"https://github.com/telstra","followers_url":"https://api.github.com/users/telstra/followers","following_url":"https://api.github.com/users/telstra/following{/other_user}","gists_url":"https://api.github.com/users/telstra/gists{/gist_id}","starred_url":"https://api.github.com/users/telstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telstra/subscriptions","organizations_url":"https://api.github.com/users/telstra/orgs","repos_url":"https://api.github.com/users/telstra/repos","events_url":"https://api.github.com/users/telstra/events{/privacy}","received_events_url":"https://api.github.com/users/telstra/received_events","type":"Organization","site_admin":false},"repo":{"id":104974693,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ5NzQ2OTM=","name":"open-kilda","full_name":"telstra/open-kilda","private":false,"owner":{"login":"telstra","id":3914896,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MTQ4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3914896?v=4","gravatar_id":"","url":"https://api.github.com/users/telstra","html_url":"https://github.com/telstra","followers_url":"https://api.github.com/users/telstra/followers","following_url":"https://api.github.com/users/telstra/following{/other_user}","gists_url":"https://api.github.com/users/telstra/gists{/gist_id}","starred_url":"https://api.github.com/users/telstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telstra/subscriptions","organizations_url":"https://api.github.com/users/telstra/orgs","repos_url":"https://api.github.com/users/telstra/repos","events_url":"https://api.github.com/users/telstra/events{/privacy}","received_events_url":"https://api.github.com/users/telstra/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/telstra/open-kilda","description":"OpenKilda is an open-source OpenFlow controller initially designed for use in a global network with high control-plane latency and a heavy emphasis on latency-centric data path optimisation.","fork":false,"url":"https://api.github.com/repos/telstra/open-kilda","forks_url":"https://api.github.com/repos/telstra/open-kilda/forks","keys_url":"https://api.github.com/repos/telstra/open-kilda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telstra/open-kilda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telstra/open-kilda/teams","hooks_url":"https://api.github.com/repos/telstra/open-kilda/hooks","issue_events_url":"https://api.github.com/repos/telstra/open-kilda/issues/events{/number}","events_url":"https://api.github.com/repos/telstra/open-kilda/events","assignees_url":"https://api.github.com/repos/telstra/open-kilda/assignees{/user}","branches_url":"https://api.github.com/repos/telstra/open-kilda/branches{/branch}","tags_url":"https://api.github.com/repos/telstra/open-kilda/tags","blobs_url":"https://api.github.com/repos/telstra/open-kilda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telstra/open-kilda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telstra/open-kilda/git/refs{/sha}","trees_url":"https://api.github.com/repos/telstra/open-kilda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telstra/open-kilda/statuses/{sha}","languages_url":"https://api.github.com/repos/telstra/open-kilda/languages","stargazers_url":"https://api.github.com/repos/telstra/open-kilda/stargazers","contributors_url":"https://api.github.com/repos/telstra/open-kilda/contributors","subscribers_url":"https://api.github.com/repos/telstra/open-kilda/subscribers","subscription_url":"https://api.github.com/repos/telstra/open-kilda/subscription","commits_url":"https://api.github.com/repos/telstra/open-kilda/commits{/sha}","git_commits_url":"https://api.github.com/repos/telstra/open-kilda/git/commits{/sha}","comments_url":"https://api.github.com/repos/telstra/open-kilda/comments{/number}","issue_comment_url":"https://api.github.com/repos/telstra/open-kilda/issues/comments{/number}","contents_url":"https://api.github.com/repos/telstra/open-kilda/contents/{+path}","compare_url":"https://api.github.com/repos/telstra/open-kilda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telstra/open-kilda/merges","archive_url":"https://api.github.com/repos/telstra/open-kilda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telstra/open-kilda/downloads","issues_url":"https://api.github.com/repos/telstra/open-kilda/issues{/number}","pulls_url":"https://api.github.com/repos/telstra/open-kilda/pulls{/number}","milestones_url":"https://api.github.com/repos/telstra/open-kilda/milestones{/number}","notifications_url":"https://api.github.com/repos/telstra/open-kilda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telstra/open-kilda/labels{/name}","releases_url":"https://api.github.com/repos/telstra/open-kilda/releases{/id}","deployments_url":"https://api.github.com/repos/telstra/open-kilda/deployments","created_at":"2017-09-27T05:13:18Z","updated_at":"2018-10-12T13:02:48Z","pushed_at":"2018-10-15T21:24:28Z","git_url":"git://github.com/telstra/open-kilda.git","ssh_url":"git@github.com:telstra/open-kilda.git","clone_url":"https://github.com/telstra/open-kilda.git","svn_url":"https://github.com/telstra/open-kilda","homepage":"","size":209197,"stargazers_count":32,"watchers_count":32,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"archived":false,"open_issues_count":249,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":32,"open_issues":249,"watchers":32,"default_branch":"develop"}},"base":{"label":"telstra:develop","ref":"develop","sha":"278b6e8abba3abdfe2c6f9ff1a862d0d1e03ae09","user":{"login":"telstra","id":3914896,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MTQ4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3914896?v=4","gravatar_id":"","url":"https://api.github.com/users/telstra","html_url":"https://github.com/telstra","followers_url":"https://api.github.com/users/telstra/followers","following_url":"https://api.github.com/users/telstra/following{/other_user}","gists_url":"https://api.github.com/users/telstra/gists{/gist_id}","starred_url":"https://api.github.com/users/telstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telstra/subscriptions","organizations_url":"https://api.github.com/users/telstra/orgs","repos_url":"https://api.github.com/users/telstra/repos","events_url":"https://api.github.com/users/telstra/events{/privacy}","received_events_url":"https://api.github.com/users/telstra/received_events","type":"Organization","site_admin":false},"repo":{"id":104974693,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQ5NzQ2OTM=","name":"open-kilda","full_name":"telstra/open-kilda","private":false,"owner":{"login":"telstra","id":3914896,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MTQ4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3914896?v=4","gravatar_id":"","url":"https://api.github.com/users/telstra","html_url":"https://github.com/telstra","followers_url":"https://api.github.com/users/telstra/followers","following_url":"https://api.github.com/users/telstra/following{/other_user}","gists_url":"https://api.github.com/users/telstra/gists{/gist_id}","starred_url":"https://api.github.com/users/telstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telstra/subscriptions","organizations_url":"https://api.github.com/users/telstra/orgs","repos_url":"https://api.github.com/users/telstra/repos","events_url":"https://api.github.com/users/telstra/events{/privacy}","received_events_url":"https://api.github.com/users/telstra/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/telstra/open-kilda","description":"OpenKilda is an open-source OpenFlow controller initially designed for use in a global network with high control-plane latency and a heavy emphasis on latency-centric data path optimisation.","fork":false,"url":"https://api.github.com/repos/telstra/open-kilda","forks_url":"https://api.github.com/repos/telstra/open-kilda/forks","keys_url":"https://api.github.com/repos/telstra/open-kilda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telstra/open-kilda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telstra/open-kilda/teams","hooks_url":"https://api.github.com/repos/telstra/open-kilda/hooks","issue_events_url":"https://api.github.com/repos/telstra/open-kilda/issues/events{/number}","events_url":"https://api.github.com/repos/telstra/open-kilda/events","assignees_url":"https://api.github.com/repos/telstra/open-kilda/assignees{/user}","branches_url":"https://api.github.com/repos/telstra/open-kilda/branches{/branch}","tags_url":"https://api.github.com/repos/telstra/open-kilda/tags","blobs_url":"https://api.github.com/repos/telstra/open-kilda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telstra/open-kilda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telstra/open-kilda/git/refs{/sha}","trees_url":"https://api.github.com/repos/telstra/open-kilda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telstra/open-kilda/statuses/{sha}","languages_url":"https://api.github.com/repos/telstra/open-kilda/languages","stargazers_url":"https://api.github.com/repos/telstra/open-kilda/stargazers","contributors_url":"https://api.github.com/repos/telstra/open-kilda/contributors","subscribers_url":"https://api.github.com/repos/telstra/open-kilda/subscribers","subscription_url":"https://api.github.com/repos/telstra/open-kilda/subscription","commits_url":"https://api.github.com/repos/telstra/open-kilda/commits{/sha}","git_commits_url":"https://api.github.com/repos/telstra/open-kilda/git/commits{/sha}","comments_url":"https://api.github.com/repos/telstra/open-kilda/comments{/number}","issue_comment_url":"https://api.github.com/repos/telstra/open-kilda/issues/comments{/number}","contents_url":"https://api.github.com/repos/telstra/open-kilda/contents/{+path}","compare_url":"https://api.github.com/repos/telstra/open-kilda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telstra/open-kilda/merges","archive_url":"https://api.github.com/repos/telstra/open-kilda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telstra/open-kilda/downloads","issues_url":"https://api.github.com/repos/telstra/open-kilda/issues{/number}","pulls_url":"https://api.github.com/repos/telstra/open-kilda/pulls{/number}","milestones_url":"https://api.github.com/repos/telstra/open-kilda/milestones{/number}","notifications_url":"https://api.github.com/repos/telstra/open-kilda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telstra/open-kilda/labels{/name}","releases_url":"https://api.github.com/repos/telstra/open-kilda/releases{/id}","deployments_url":"https://api.github.com/repos/telstra/open-kilda/deployments","created_at":"2017-09-27T05:13:18Z","updated_at":"2018-10-12T13:02:48Z","pushed_at":"2018-10-15T21:24:28Z","git_url":"git://github.com/telstra/open-kilda.git","ssh_url":"git@github.com:telstra/open-kilda.git","clone_url":"https://github.com/telstra/open-kilda.git","svn_url":"https://github.com/telstra/open-kilda","homepage":"","size":209197,"stargazers_count":32,"watchers_count":32,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"archived":false,"open_issues_count":249,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":32,"open_issues":249,"watchers":32,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/1444"},"html":{"href":"https://github.com/telstra/open-kilda/pull/1444"},"issue":{"href":"https://api.github.com/repos/telstra/open-kilda/issues/1444"},"comments":{"href":"https://api.github.com/repos/telstra/open-kilda/issues/1444/comments"},"review_comments":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/1444/comments"},"review_comment":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telstra/open-kilda/pulls/1444/commits"},"statuses":{"href":"https://api.github.com/repos/telstra/open-kilda/statuses/a634b5341d3d9be232a20c3803c86304aa21b880"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"niksv"}}