diff options
| author | Manjeet Singh Bhatia <manjeet.s.bhatia@intel.com> | 2016-04-14 20:45:27 +0000 |
|---|---|---|
| committer | Manjeet Singh Bhatia <manjeet.s.bhatia@intel.com> | 2016-06-03 16:47:56 +0000 |
| commit | eab6cdebdc28c7eaaf330bbf6c9261c4eedf4dce (patch) | |
| tree | 0072bd62bbd08e7b0fa0c78863040afd0c92f3e2 /openstackclient/tests/network/v2/fakes.py | |
| parent | 17bc850440045128871c381244540eeedaa569a7 (diff) | |
| download | python-openstackclient-eab6cdebdc28c7eaaf330bbf6c9261c4eedf4dce.tar.gz | |
Add network availability for osc
This patch implements openstack client for network ip availability.
Implements: blueprint neutron-ip-capacity
Depends-On: I3b40d8edea87c068c4e8133e436511765064d5f8
Change-Id: Iffaa2e20ff495fbd205d3397e027e8141d04385e
Diffstat (limited to 'openstackclient/tests/network/v2/fakes.py')
| -rw-r--r-- | openstackclient/tests/network/v2/fakes.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 84ede381..ee63a0e0 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -174,6 +174,50 @@ class FakeAvailabilityZone(object): return availability_zones +class FakeIPAvailability(object): + """Fake one or more network ip availabilities.""" + + @staticmethod + def create_one_ip_availability(): + """Create a fake list with ip availability stats of a network. + + :return: + A FakeResource object with network_name, network_id, etc. + """ + + # Set default attributes. + network_ip_availability = { + 'network_id': 'network-id-' + uuid.uuid4().hex, + 'network_name': 'network-name-' + uuid.uuid4().hex, + 'tenant_id': '', + 'subnet_ip_availability': [], + 'total_ips': 254, + 'used_ips': 6, + } + + network_ip_availability = fakes.FakeResource( + info=copy.deepcopy(network_ip_availability), + loaded=True) + return network_ip_availability + + @staticmethod + def create_ip_availability(count=2): + """Create fake list of ip availability stats of multiple networks. + + :param int count: + The number of networks to fake + :return: + A list of FakeResource objects faking network ip availability stats + """ + network_ip_availabilities = [] + for i in range(0, count): + network_ip_availability = \ + FakeIPAvailability.create_one_ip_availability() + network_ip_availabilities.append(network_ip_availability) + + return network_ip_availabilities + + class FakeNetwork(object): """Fake one or more networks.""" |
