Moves negative tests from api/compute/servers/test_virtual_interfaces

This change set moves the negative tests in test_virtual_interfaces to
a new file test_virtual_interfaces_negative

Also changes line # 43, rand_name(#$%*&^%) to uuid4() to get the invalid
server ID in negative file and removes usage of modules directly.

Note: HACKING.rst
The second requirement is that all negative tests must be added to a negative
test file. If such a file doesn't exist for the particular resource being
tested a new test file should be added

Change-Id: Ia6b4c927112318b5b6b4583511537d1cbe020f56
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index 77ada0b..92fecec 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -18,11 +18,8 @@
 import netaddr
 
 from tempest.api.compute import base
-from tempest.common.utils import data_utils
 from tempest import config
-from tempest import exceptions
-from tempest.test import attr
-from tempest.test import skip_because
+from tempest import test
 
 
 class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
@@ -37,9 +34,9 @@
         resp, server = cls.create_test_server(wait_until='ACTIVE')
         cls.server_id = server['id']
 
-    @skip_because(bug="1183436",
-                  condition=CONF.service_available.neutron)
-    @attr(type='gate')
+    @test.skip_because(bug="1183436",
+                       condition=CONF.service_available.neutron)
+    @test.attr(type='gate')
     def test_list_virtual_interfaces(self):
         # Positive test:Should be able to GET the virtual interfaces list
         # for a given server_id
@@ -54,15 +51,6 @@
             self.assertTrue(netaddr.valid_mac(mac_address),
                             "Invalid mac address detected.")
 
-    @attr(type=['negative', 'gate'])
-    def test_list_virtual_interfaces_invalid_server_id(self):
-        # Negative test: Should not be able to GET virtual interfaces
-        # for an invalid server_id
-        invalid_server_id = data_utils.rand_name('!@#$%^&*()')
-        self.assertRaises(exceptions.NotFound,
-                          self.client.list_virtual_interfaces,
-                          invalid_server_id)
-
 
 class VirtualInterfacesTestXML(VirtualInterfacesTestJSON):
     _interface = 'xml'
diff --git a/tempest/api/compute/servers/test_virtual_interfaces_negative.py b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
new file mode 100644
index 0000000..a2a6c11
--- /dev/null
+++ b/tempest/api/compute/servers/test_virtual_interfaces_negative.py
@@ -0,0 +1,44 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+import uuid
+
+from tempest.api.compute import base
+from tempest import exceptions
+from tempest import test
+
+
+class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
+    _interface = 'json'
+
+    @classmethod
+    def setUpClass(cls):
+        super(VirtualInterfacesNegativeTestJSON, cls).setUpClass()
+        cls.client = cls.servers_client
+
+    @test.attr(type=['negative', 'gate'])
+    def test_list_virtual_interfaces_invalid_server_id(self):
+        # Negative test: Should not be able to GET virtual interfaces
+        # for an invalid server_id
+        invalid_server_id = str(uuid.uuid4())
+        self.assertRaises(exceptions.NotFound,
+                          self.client.list_virtual_interfaces,
+                          invalid_server_id)
+
+
+class VirtualInterfacesNegativeTestXML(VirtualInterfacesNegativeTestJSON):
+    _interface = 'xml'