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
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
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
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
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
Add querying for lists in ceilometer client

Resources, meters, alarms has query param in ceilometer API.
But current ceilometer client hasn't such ability.

Change-Id: I2d77b0a8d9d79aab7b9198ffb06b054b2fb87983
VPNaaS API Tests Enhancements

Added the following tests:
 - test_admin_create_vpn_service_for_tenant:
   Admin user creates VPN Service for tenant.

 - test_admin_create_ike_policy_for_tenant:
   Admin user creates IKE Policy for tenant.

 - test_admin_create_ipsec_policy_for_tenant:
   Admin user created Ipsec Policy for tenant.

Extended the following tests:
 - test_show_vpn_service:
   Now tests to check whether the returned status has a
   valid value.

 - test_create_update_delete_ike_policy:
   Now also updates encryption_algorithm, ike_version,
   and lifetime in update tests. Verifies whether test was
   successful by comparing with vpn_service object returned by
   show API call.
   Also now checks whether delete was succesful by asserting
   that is the ikepolicy is no longer returned by list_ikepolicies.

Minor edits to network_client_base.py to support ipsecpolicy resources.

Change-Id: I0e4e56c4fdcb591c456b4c32c6b6dd208f0c4045
Sahara: minor changes for API tests

In file "test_cluster_templates.py" setUpClass method needs
to be wrapped in decorator "safe_setup" because resource
(node group template) is created in setUpClass method.

In addition small code refactoring in tests for data sources was made.

Partially implements: blueprint savanna-api-tests

Change-Id: If783df527fc23ea197c5344a67e1aa3e82774b2c
update iptables rules for more useful debugging

As discussed with dansmith in #openstack-nova,
iptables --line-numbers -L -nv is a more useful representation of
the iptables dump for determining network issues.

Related-Bug: #1298472

Change-Id: Ibae97f7a0cf29105e3601eca8ce24b8271a3a13d
Merge "Remove the skip for test_get_instance_action()"