{"action":"created","comment":{"url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/comments/47894473","id":47894473,"diff_hunk":"@@ -0,0 +1,135 @@\n+#    Copyright 2015 Mirantis, Inc.\n+#\n+#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+#    not use this file except in compliance with the License. You may obtain\n+#    a copy of the License at\n+#\n+#         http://www.apache.org/licenses/LICENSE-2.0\n+#\n+#    Unless required by applicable law or agreed to in writing, software\n+#    distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+#    License for the specific language governing permissions and limitations\n+#    under the License.\n+\n+import pytest\n+\n+from paramiko.ssh_exception import SSHException, NoValidConnectionsError\n+\n+from mos_tests.neutron.python_tests.base import TestBase\n+\n+\n+@pytest.mark.usefixtures(\"setup\")\n+class TestFloatingIP(TestBase):\n+    \"\"\"Check association and disassociation floating ip\"\"\"\n+\n+    @pytest.fixture(autouse=True)\n+    def _prepare_openstack(self, init):\n+        \"\"\"Prepare OpenStack for scenarios run\n+\n+        Steps:\n+            1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24\n+            2. Create new security group sec_group1\n+            3. Add Ingress rule for TCP protocol to sec_group1\n+            4. Boot vm1 net01 with sec_group1\n+        \"\"\"\n+        # init variables\n+        exist_networks = self.os_conn.list_networks()['networks']\n+        ext_net = [x for x in exist_networks\n+                   if x.get('router:external')][0]\n+        zone = self.os_conn.nova.availability_zones.find(zoneName=\"nova\")\n+        security_group = self.os_conn.create_sec_group_for_ssh()\n+        hostname = zone.hosts.keys()[0]\n+        cidr = \"10.1.1.0/24\"\n+        self.instance_keypair = self.os_conn.create_key(key_name='instancekey')\n+\n+        self.os_conn.nova.security_group_rules.create(\n+            security_group.id,\n+            ip_protocol='tcp',\n+            from_port=1,\n+            to_port=65535,\n+            cidr='0.0.0.0/0')\n+\n+        net, subnet = self.create_internal_network_with_subnet(cidr=cidr)\n+        # create router\n+        self.create_router_between_nets(ext_net, subnet)\n+\n+        self.os_conn.create_server(\n+            name='server01',\n+            availability_zone='{}:{}'.format(zone.zoneName,\n+                                             hostname),\n+            key_name=self.instance_keypair.name,\n+            nics=[{'net-id': net['network']['id']}],\n+            security_groups=[security_group.id])\n+\n+        # add floating ip to first server\n+        server = self.os_conn.nova.servers.find(name=\"server01\")\n+        self.floating_ip = self.os_conn.assign_floating_ip(server,\n+                                                           use_neutron=True)\n+\n+        pkeys = self.convert_private_key_for_vm(\n+            [self.instance_keypair.private_key])\n+\n+        self.check_vm_is_accessible_with_ssh(\n+            vm_ip=self.floating_ip['floating_ip_address'],\n+            pkeys=pkeys)\n+\n+    def check_vm_inaccessible_by_ssh(self, vm_ip, pkeys):\n+        \"\"\"Check that instance is inaccessible with ssh via floating_ip.\n+\n+        :param vm_ip: floating_ip of instance\n+        :param pkeys: ip of instance to ping\n+        \"\"\"\n+        with pytest.raises(NoValidConnectionsError):\n+            with self.env.get_ssh_to_cirros(vm_ip, pkeys) as vm_remote:\n+                vm_remote.execute(\"date\")\n+\n+    def test_ssh_after_deleting_floating(self):\n+        \"\"\"Check ssh-connection by floating ip for vm after\n+        deleting floating ip\n+\n+        Steps:\n+            1. Create network net01, subnet net01__subnet with CIDR 10.1.1.0/24\n+            2. Create new security group sec_group1\n+            3. Add Ingress rule for TCP protocol to sec_group1\n+            4. Boot vm1 net01 with sec_group1\n+            5. Associate floating IP for vm1\n+            6. Go to vm1 with ssh and floating IP\n+            7. Without stopping ssh-connection dissociate floating ip from vm\n+            8. Check that connection is stopped\n+            9.Try to go to vm1 with ssh and floating IP","path":"mos_tests/neutron/python_tests/test_floating_ip.py","position":null,"original_position":100,"commit_id":"c29c88419cffa06de679639dc43d577b96f1b8bd","original_commit_id":"c3e39341b7a95a27eabbdc3f38568900eba24ba4","user":{"login":"AlexGromov","id":16225824,"avatar_url":"https://avatars.githubusercontent.com/u/16225824?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexGromov","html_url":"https://github.com/AlexGromov","followers_url":"https://api.github.com/users/AlexGromov/followers","following_url":"https://api.github.com/users/AlexGromov/following{/other_user}","gists_url":"https://api.github.com/users/AlexGromov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexGromov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexGromov/subscriptions","organizations_url":"https://api.github.com/users/AlexGromov/orgs","repos_url":"https://api.github.com/users/AlexGromov/repos","events_url":"https://api.github.com/users/AlexGromov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexGromov/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-12-17T11:15:58Z","updated_at":"2015-12-17T11:15:58Z","html_url":"https://github.com/Mirantis/mos-integration-tests/pull/46#discussion_r47894473","pull_request_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/comments/47894473"},"html":{"href":"https://github.com/Mirantis/mos-integration-tests/pull/46#discussion_r47894473"},"pull_request":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46","id":53788732,"html_url":"https://github.com/Mirantis/mos-integration-tests/pull/46","diff_url":"https://github.com/Mirantis/mos-integration-tests/pull/46.diff","patch_url":"https://github.com/Mirantis/mos-integration-tests/pull/46.patch","issue_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/46","number":46,"state":"open","locked":false,"title":"Added test_ssh_after_deleting_floating for neutron.","user":{"login":"AlexGromov","id":16225824,"avatar_url":"https://avatars.githubusercontent.com/u/16225824?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexGromov","html_url":"https://github.com/AlexGromov","followers_url":"https://api.github.com/users/AlexGromov/followers","following_url":"https://api.github.com/users/AlexGromov/following{/other_user}","gists_url":"https://api.github.com/users/AlexGromov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexGromov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexGromov/subscriptions","organizations_url":"https://api.github.com/users/AlexGromov/orgs","repos_url":"https://api.github.com/users/AlexGromov/repos","events_url":"https://api.github.com/users/AlexGromov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexGromov/received_events","type":"User","site_admin":false},"body":"Added test_ssh_after_deleting_floating for neutron.\r\nAdded SSHClient with conditional support of sftp.","created_at":"2015-12-16T01:42:32Z","updated_at":"2015-12-17T11:15:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08cc4d7e7279aa7120246a2aa86fc53ffc1be9f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46/commits","review_comments_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46/comments","review_comment_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/46/comments","statuses_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/statuses/c29c88419cffa06de679639dc43d577b96f1b8bd","head":{"label":"AlexGromov:neutron","ref":"neutron","sha":"c29c88419cffa06de679639dc43d577b96f1b8bd","user":{"login":"AlexGromov","id":16225824,"avatar_url":"https://avatars.githubusercontent.com/u/16225824?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexGromov","html_url":"https://github.com/AlexGromov","followers_url":"https://api.github.com/users/AlexGromov/followers","following_url":"https://api.github.com/users/AlexGromov/following{/other_user}","gists_url":"https://api.github.com/users/AlexGromov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexGromov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexGromov/subscriptions","organizations_url":"https://api.github.com/users/AlexGromov/orgs","repos_url":"https://api.github.com/users/AlexGromov/repos","events_url":"https://api.github.com/users/AlexGromov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexGromov/received_events","type":"User","site_admin":false},"repo":{"id":47819109,"name":"mos-integration-tests","full_name":"AlexGromov/mos-integration-tests","owner":{"login":"AlexGromov","id":16225824,"avatar_url":"https://avatars.githubusercontent.com/u/16225824?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexGromov","html_url":"https://github.com/AlexGromov","followers_url":"https://api.github.com/users/AlexGromov/followers","following_url":"https://api.github.com/users/AlexGromov/following{/other_user}","gists_url":"https://api.github.com/users/AlexGromov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexGromov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexGromov/subscriptions","organizations_url":"https://api.github.com/users/AlexGromov/orgs","repos_url":"https://api.github.com/users/AlexGromov/repos","events_url":"https://api.github.com/users/AlexGromov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexGromov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexGromov/mos-integration-tests","description":"","fork":true,"url":"https://api.github.com/repos/AlexGromov/mos-integration-tests","forks_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/forks","keys_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/teams","hooks_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/hooks","issue_events_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/issues/events{/number}","events_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/events","assignees_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/assignees{/user}","branches_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/branches{/branch}","tags_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/tags","blobs_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/languages","stargazers_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/stargazers","contributors_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/contributors","subscribers_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/subscribers","subscription_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/subscription","commits_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/contents/{+path}","compare_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/merges","archive_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/downloads","issues_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/issues{/number}","pulls_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/labels{/name}","releases_url":"https://api.github.com/repos/AlexGromov/mos-integration-tests/releases{/id}","created_at":"2015-12-11T10:02:51Z","updated_at":"2015-12-11T10:02:52Z","pushed_at":"2015-12-17T11:12:22Z","git_url":"git://github.com/AlexGromov/mos-integration-tests.git","ssh_url":"git@github.com:AlexGromov/mos-integration-tests.git","clone_url":"https://github.com/AlexGromov/mos-integration-tests.git","svn_url":"https://github.com/AlexGromov/mos-integration-tests","homepage":null,"size":307,"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":"Mirantis:master","ref":"master","sha":"5f72dc538ccf0edc66c2bda5d31a78dd58a5e187","user":{"login":"Mirantis","id":609319,"avatar_url":"https://avatars.githubusercontent.com/u/609319?v=3","gravatar_id":"","url":"https://api.github.com/users/Mirantis","html_url":"https://github.com/Mirantis","followers_url":"https://api.github.com/users/Mirantis/followers","following_url":"https://api.github.com/users/Mirantis/following{/other_user}","gists_url":"https://api.github.com/users/Mirantis/gists{/gist_id}","starred_url":"https://api.github.com/users/Mirantis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mirantis/subscriptions","organizations_url":"https://api.github.com/users/Mirantis/orgs","repos_url":"https://api.github.com/users/Mirantis/repos","events_url":"https://api.github.com/users/Mirantis/events{/privacy}","received_events_url":"https://api.github.com/users/Mirantis/received_events","type":"Organization","site_admin":false},"repo":{"id":47408971,"name":"mos-integration-tests","full_name":"Mirantis/mos-integration-tests","owner":{"login":"Mirantis","id":609319,"avatar_url":"https://avatars.githubusercontent.com/u/609319?v=3","gravatar_id":"","url":"https://api.github.com/users/Mirantis","html_url":"https://github.com/Mirantis","followers_url":"https://api.github.com/users/Mirantis/followers","following_url":"https://api.github.com/users/Mirantis/following{/other_user}","gists_url":"https://api.github.com/users/Mirantis/gists{/gist_id}","starred_url":"https://api.github.com/users/Mirantis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mirantis/subscriptions","organizations_url":"https://api.github.com/users/Mirantis/orgs","repos_url":"https://api.github.com/users/Mirantis/repos","events_url":"https://api.github.com/users/Mirantis/events{/privacy}","received_events_url":"https://api.github.com/users/Mirantis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Mirantis/mos-integration-tests","description":"","fork":false,"url":"https://api.github.com/repos/Mirantis/mos-integration-tests","forks_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/forks","keys_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/teams","hooks_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/hooks","issue_events_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/events{/number}","events_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/events","assignees_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/assignees{/user}","branches_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/branches{/branch}","tags_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/tags","blobs_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/languages","stargazers_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/stargazers","contributors_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/contributors","subscribers_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/subscribers","subscription_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/subscription","commits_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/contents/{+path}","compare_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/merges","archive_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/downloads","issues_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues{/number}","pulls_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/labels{/name}","releases_url":"https://api.github.com/repos/Mirantis/mos-integration-tests/releases{/id}","created_at":"2015-12-04T14:33:39Z","updated_at":"2015-12-16T13:46:02Z","pushed_at":"2015-12-17T11:12:23Z","git_url":"git://github.com/Mirantis/mos-integration-tests.git","ssh_url":"git@github.com:Mirantis/mos-integration-tests.git","clone_url":"https://github.com/Mirantis/mos-integration-tests.git","svn_url":"https://github.com/Mirantis/mos-integration-tests","homepage":null,"size":313,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":8,"forks":10,"open_issues":8,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46"},"html":{"href":"https://github.com/Mirantis/mos-integration-tests/pull/46"},"issue":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/46"},"comments":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/Mirantis/mos-integration-tests/statuses/c29c88419cffa06de679639dc43d577b96f1b8bd"}}}}