Switched creation of SGs, FIPs to Neutron instead of Nova

* Since there were "novaclient.v2.security_group_rules module is deprecated"
  warnings, switched creation of SG to the Neutron instead of Nova.
* Since there were "novaclient.v2.floating_ips module is deprecated"
  warning, switched creating of FIP to the Neutron instead of Nova.
* Added special methods for creating/deleting FIPs. Added the exception
  in case FIP is already absent.
* Added check whether the iperf tool is installed at the VMs and raising
  and exception in case iperf tool is not installed in the VM (due to
  Internet access issue or transfering & installing offline packages).

Related-PROD: PROD-36943
Change-Id: I165e1358754f3c98adbf8e4cdbfb0b10d2ac117f
diff --git a/tests/test_vm2vm.py b/tests/test_vm2vm.py
index 1b81268..d387ce1 100644
--- a/tests/test_vm2vm.py
+++ b/tests/test_vm2vm.py
@@ -52,25 +52,25 @@
         vm1 = os_actions.create_basic_server(
             os_resources['image_id'], os_resources['flavor_id'],
             os_resources['net1'], '{0}:{1}'.format(zone1[0], pair[0]),
-            [os_resources['sec_group'].name], os_resources['keypair'].name)
+            [os_resources['sec_group']['name']], os_resources['keypair'].name)
         logger.info("Created VM {}.".format(vm1.id))
 
         vm2 = os_actions.create_basic_server(
             os_resources['image_id'], os_resources['flavor_id'],
             os_resources['net1'], '{0}:{1}'.format(zone1[0], pair[0]),
-            [os_resources['sec_group'].name], os_resources['keypair'].name)
+            [os_resources['sec_group']['name']], os_resources['keypair'].name)
         logger.info("Created VM {}.".format(vm2.id))
 
         vm3 = os_actions.create_basic_server(
             os_resources['image_id'], os_resources['flavor_id'],
             os_resources['net1'], '{0}:{1}'.format(zone2[0], pair[1]),
-            [os_resources['sec_group'].name], os_resources['keypair'].name)
+            [os_resources['sec_group']['name']], os_resources['keypair'].name)
         logger.info("Created VM {}.".format(vm3.id))
 
         vm4 = os_actions.create_basic_server(
             os_resources['image_id'], os_resources['flavor_id'],
             os_resources['net2'], '{0}:{1}'.format(zone2[0], pair[1]),
-            [os_resources['sec_group'].name], os_resources['keypair'].name)
+            [os_resources['sec_group']['name']], os_resources['keypair'].name)
         logger.info("Created VM {}.".format(vm4.id))
 
         vm_info = []
@@ -82,14 +82,13 @@
         # Associate FIPs and check VMs are Active
         logger.info("Creating Floating IPs and associating them...")
         for i in range(4):
-            fip = openstack_clients.compute.floating_ips.create(
-                os_resources['ext_net']['name'])
-            fips.append(fip.id)
+            fip = os_actions.create_floating_ip(os_resources['ext_net']['id'])
+            fips.append(fip['id'])
             os_actions.check_vm_is_active(vms[i].id, timeout=timeout)
-            vms[i].add_floating_ip(fip)
+            vms[i].add_floating_ip(fip['floating_ip_address'])
             private_address = vms[i].addresses[
                 list(vms[i].addresses.keys())[0]][0]['addr']
-            vm_info.append({'vm': vms[i], 'fip': fip.ip,
+            vm_info.append({'vm': vms[i], 'fip': fip['floating_ip_address'],
                             'private_address': private_address})
         # Check VMs are reachable and prepare iperf3
         transport1 = ssh.SSHTransport(vm_info[0]['fip'], 'ubuntu',
@@ -208,7 +207,7 @@
             openstack_clients.compute.servers.delete(vm)
         logger.info("Removing FIPs...")
         for fip in fips:
-            openstack_clients.compute.floating_ips.delete(fip)
+            os_actions.delete_floating_ip(fip)
     except Exception as e:
         sys.stdout.write("\n{}".format(e))
         sys.stdout.write("\nSomething went wrong\n")
@@ -219,7 +218,7 @@
             if 'fips' in locals():
                 logger.info("Removing FIPs...")
                 for fip in fips:
-                    openstack_clients.compute.floating_ips.delete(fip)
+                    os_actions.delete_floating_ip(fip)
         else:
             sys.stdout.write("\nSkipping cleaning, VMs were not created")
         pytest.fail("Something went wrong")