Extending quota support for neutron LBaaS entities

Part of extending quota mechanism to support neutron
LBaaS entities.
Adding new test for testing the lbaas resources.
The test is skipped if network lbaas extension is not available

This is one of four changes related to the BP.
This one is for tempest project.
Another one is for neutron project
and another one is for python-neutronclient package
and another one for horizon/openstack-dashboard project.

See blueprint neutron-quota-extension for another three changes.

Change-Id: I3b2739c28ff8dfbc4271d6f5d14b0655b6f9e203
Implements: blueprint neutron-quota-extension
lbaas basic - open firewall for http on vip port

This is necessary for test_load_balancer_basic to work
when the linuxbridge agent is used.

Change-Id: I620882c31461d438add0f011cb916e28e2f266a3
Closes-Bug: 1313117
botoclient does not honor disable_ssl_certificate_validation

The keystone Client() class should pass in insecure as the value
of CONF.identity.disable_ssl_certificate_validation, otherwise
many tests will fail if the keystone server is secured with SSL.

Change-Id: Id4759645ca84fd0fd7e41d2ffe72c6ae36d3b604
Closes-Bug: 1307675
Adds keystone roles v2 tests in v3

This submission is to add the tests missing in v3 and present in v2.
Submitting roles test cases.

Change-Id: I0e995848ed0019a4895cdff2b70795b5eaf9795a
Add a hacking check to block scenario manager in api tests

This commit adds a new hacking check to ensure that the manager class
from the scenario tests, OfficialClientManager, isn't used in the API
tests. There is already a hacking rule preventing imports of the
official clients, T102. But, the official clients could still be used
through the scenario tests which wouldn't be caught by T102. This
attempts to close that gap by adding a new hacking check for
OfficialClientManager.

Change-Id: I608a1319c136118947e3df74fa88f7124011caa4
Correcting 'id' type in compute schema

This patch corrects the type of 'id' in compute schema
/tempest/api_schema/compute/.
Many place 'id' is defined as both 'string' and 'integer' but not all
APIs return 'id' in both format.

For example, servers APIs always return 'server id' as UUID so those
should be defined as 'string' only not {'string', 'integer'} both.
Same applies for other 'id' like in flavor, Image API's response.

Below are the correct type of 'id'-
  Server's id – String
  Image id – String
  Flavor id - String
  key-pair API- > user_id – String
  Agent id – Integer
  Service id - Integer

Partially implements blueprint nova-api-attribute-test

Change-Id: Ifdde2ddd56d600f968d02356aaec0c56e5c3767f
Code clean-up of CLI test "cinder list-extensions"

Redundant code is removed:
list-extensions

Change-Id: Ia0ba0c897c36ceea8d909276d019f1736a86d879
Add test for compute API os-quota-class-sets

This tests showing and updating the 'default' quota class, which is
really all this API is used for. It was removed in Icehouse in part to
not knowing it was used even though python-novaclient and Horizon were
using it. The removal was reverted and this change is to enforce what
the API is used for.

The extension only lives in the Nova v2 API, it was removed in the v3
API in Icehouse.

This change adds new quota client and test classes for the new API.

An external lock fixture is used in all compute API quota tests to
avoid introducing race bugs with the existing tenant-specific
os-quota-sets tests.

Closes-Bug: #1325727

Change-Id: Ib0cde08dfaa0f6a5e180d247864fb59d76eca903
Fix calls to mock.assert_not_called()

There is no assert_not_called() method in mock, as described here:
https://code.google.com/p/mock/issues/detail?id=159
Fix these calls to use the assertEqual(0, mock.call_count) instead.
This patch also fixes a typo.

Change-Id: I7cfb968f6d4b775ceb901411ee8f24057d97cf91
Verify V2 list server_group API attributes

This patch adds the JSON schema for Nova V2 list
server_group API response and validate the response with added
JSON schema to block the backward incompatibility change in the future.

The response body of List server_group V2 API is given below:

{
    "server_groups": [
        {
            "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
            "name": "test",
            "policies": ["anti-affinity"],
            "members": [],
            "metadata": {}
        }
    ]
}

Partially implements blueprint nova-api-attribute-test

Change-Id: I554237d9b66b42ea75ef3b47c8a9038c80b3cfb5
Adds scenario tests for volume encryption

Two scenario tests and the supporting methods in the test manager
are added. For each encryption type, the test creates an image, boots an
instance of the image, creates an encryption type, creates a volume of that
type, attaches the volume to the instance, detaches it, and deletes
the encrypted volume and volume type.

Change-Id: Ib2c3f9b04d35a65ce2f0e45e63e940ecd92991d0
Implements: blueprint cinder-volume-encryption-tempest-tests
Verify delete-Floating-IP-Bulk Nova API attributes

This patch adds the JSON schema for Nova V2 delete-Floating-IP-Bulk
API response and validate the response with added JSON schema
to block the backward incompatibility change in the future.

The response body of delete-Floating-IP-Bulk V2 API is below:

{
    "floating_ips_bulk_delete": "192.168.1.0/24"
}

Partially implements blueprint nova-api-attribute-test

Change-Id: Id48ba7129d97c3691f8e61375f4205b1587d385b
Improve test isolation in test_networks:BulkNetworkOpsTest*

Each test should be using its own networks. The sharing of networks
causes weird, unintended interactions.

Change-Id: Ifef6e9604fb40bba771bf41eea2f08246a803faf
Verify list-Floating-IP-Bulk Nova API attributes

This patch adds the JSON schema for Nova V2 list-Floating-IP-Bulk
API response and validate the response with added JSON schema
to block the backward incompatibility change in the future.
The response body of list-Floating-IP-Bulk V2 API is below:
{
    "floating_ip_info": [
        {
            "address": "10.10.10.1",
            "instance_uuid": null,
            "interface": "eth0",
            "pool": "nova",
            "project_id": null
        },
        {
            "address": "10.10.10.3",
            "instance_uuid": null,
            "interface": "eth0",
            "pool": "nova",
            "project_id": null
        }
    ]
}
Partially implements blueprint nova-api-attribute-test

Change-Id: I43b6f0618cb85d78577e7c63d8fbf08acc5e93a3
Allowed Address Pair API Tests Enhancements

Add test to update 'allowed-address-pair' attribute of port

-Create a port without allowed-address-pair
-Set allowed-address-pair attribute of port using port_update
-Validate that allowed-address-pair attribute of port is updated successfully

Change-Id: I0556617f837f62e3ccc06f50c049af0b227357b0
Sharing codes for volumes list tests

1. merge the common tests between v1 and v2, and set its
   default value for v2.
2. make volumes v1 list tests inherits common tests
3. leave volumes v2 specific tests in direcotry 'tempest/api/volume/v2'
4. delete BaseVolumeV2Test

Partially implements: blueprint cinder-v2-api-tests

Change-Id: I7cecbde9543c441a2f3478941f85625755aabf7f
Improve neutron CLI existing tests

Objective of this patch to parse the output of read only neutron CLI's, 
to validate the output and improve more output verification.
It is improving the code of all below read only neutron CLI's sub-commands:
1. net-list
2. net-external-list
3. port-list
4. router-list
5. security-group-rule-list
6. subnet-list

Partially implements: blueprint missing-cli-tests-in-tempest

Task is managed using etherpad :
https://etherpad.openstack.org/p/missing-cli-tests-in-tempest)

Change-Id: I9b8c9cd0ab115a08519c0d2474c41836a984cce2
Verify "get a server" API response attributes

Now most attributes of Nova v2/v3 APIs are not checked in Tempest,
and this patch adds some tests which check these attributes to block
the backward incompatibility change in the future.

This patch adds the checks of "get a server" API responses.

The response body of v2 API is the following:
  {
    "server": {
      "id": "c2f2ebe8-5a25-442b-83d2-9f0926a7a88a",
      "name": "vm01-v3",
      "status": "ACTIVE",
      "image": {
        "id": "b62655db-2ff7-4d7f-8821-d0a468a25bec",
        "links": [{"href": "http://[..]", "rel": "bookmark"}]
      },
      "flavor": {
        "id": "42",
        "links": [{"href": "http://[..]", "rel": "bookmark"}]
      },
      "user_id": "832ebd066fb0427ea77c4aab6bab5ec1",
      "tenant_id": "b8d8f3df596b482e93c4225b1d72d2c2",
      "created": "2014-03-13T00:40:21Z",
      "updated": "2014-03-13T00:40:31Z",
      "metadata": {},
      "links": [
        {"href": "http://[..]", "rel": "self"},
        {"href": "http://[..]", "rel": "bookmark"}
      ],
      "addresses": {
        "private": [{
          "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:5f:c3:0f",
          "version": 4, "addr": "10.0.0.5", "OS-EXT-IPS:type": "fixed"
        }]
      },
      "key_name": null,
      "hostId": "6efdef81d6341b7fac789263e366cdf3ed5136f5894db8a2b79d1bc7",
      "progress": 0,
      "OS-SRV-USG:launched_at": "2014-03-13T00:40:31.000000",
      "OS-SRV-USG:terminated_at": null,
      "OS-EXT-AZ:availability_zone": "nova",

      "OS-EXT-STS:task_state": null,
      "OS-EXT-STS:vm_state": "active",
      "OS-EXT-STS:power_state": 1,

      "OS-EXT-SRV-ATTR:host": "localhost-dev",
      "OS-EXT-SRV-ATTR:instance_name": "instance-0000004a",
      "OS-EXT-SRV-ATTR:hypervisor_hostname": "localhost-dev",

      "os-extended-volumes:volumes_attached": [],
      "accessIPv4": "",
      "accessIPv6": "",
      "config_drive": "",
      "OS-DCF:diskConfig": "MANUAL"
    }
  }

The one of v3 API is the following:
  {
    "server": {
      "id": "c2f2ebe8-5a25-442b-83d2-9f0926a7a88a",
      "name": "vm01-v3",
      "status": "ACTIVE",
      "image": {
        "id": "b62655db-2ff7-4d7f-8821-d0a468a25bec",
        "links": [{"href": "http://[..]", "rel": "bookmark"}]
      },
      "flavor": {
        "id": "42", "links": [{"href": "http://192.168.11.100:8774/flavors/42", "rel": "bookmark"}]
      },
      "user_id": "832ebd066fb0427ea77c4aab6bab5ec1",
      "tenant_id": "b8d8f3df596b482e93c4225b1d72d2c2",
      "created": "2014-03-13T00:40:21Z",
      "updated": "2014-03-13T00:40:31Z",
      "metadata": {},
      "links": [
        {"href": "http://[..]", "rel": "self"},
        {"href": "http://[..]", "rel": "bookmark"}
      ],
      "addresses": {
        "private": [{
          "version": 4, "type": "fixed",
          "addr": "10.0.0.5", "mac_addr": "fa:16:3e:5f:c3:0f"
        }]
      },
      "key_name": null,
      "host_id": "6efdef81d6341b7fac789263e366cdf3ed5136f5894db8a2b79d1bc7",
      "progress": 0,
      "os-server-usage:launched_at": "2014-03-13T00:40:31.000000",
      "os-server-usage:terminated_at": null,
      "os-extended-availability-zone:availability_zone": "nova",

      "os-extended-status:task_state": null,
      "os-extended-status:vm_state": "active",
      "os-extended-status:power_state": 1,
      "os-extended-status:locked_by": null,

      "os-extended-server-attributes:host": "localhost-dev",
      "os-extended-server-attributes:instance_name": "instance-0000004a",
      "os-extended-server-attributes:hypervisor_hostname": "localhost-dev",

      "os-extended-volumes:volumes_attached": [],
      "os-pci:pci_devices": [],
      "os-access-ips:access_ip_v4": "",
      "os-access-ips:access_ip_v6": "",
      "os-config-drive:config_drive": ""
    }
  }

Partially implements blueprint nova-api-attribute-test

Change-Id: I951eae22d694349ae734e1ea16f24f500af6a894
Add network service tag to compute tests

This commit adds the network service tag to all the compute api tests
that are using network services so that they're properly tagged.

Partially implements bp add-service-tags

Change-Id: I0b3436e4b3a2f1c2285a17718ecb8e413bc60269
Remove the skip for test_get_instance_action()

Change Ia1880dd53b7cbf34e66b349f01afb15672dffd12 introduced a skip
for InstanceActionsV3Test.test_get_instance_action(). This was due
to the header x-compute-request-id being changed to
x-openstack-request id. The name has since been updated (as nova
change I5e370fd3de5ee2f8a8d13553015d88910ff5ea87), so the skip
is no longer needed.

Also the skip in change Ia493d4838dee4a8a587d12a55f16afeb143d959d
is no longer needed.

Closes-Bug: 1281915
Change-Id: I4839ba9287f792c8ed352bb63391285a3afc0b84