From b3649a54cd59dc069c76cbbcd876a1610aee00c0 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Thu, 24 Mar 2016 19:22:07 +0800 Subject: Add --address-scope option "subnet pool create/set" This patch adds --address-scope option to "subnet pool create/set" commands, and --no-address-scope option to "subnet pool set" command to clear the address scope setting. Change-Id: Ie2c370a50b52574fa6ec268083ad013b7544361e Partial-Bug: #1544586 Partial-Bug: #1544591 --- openstackclient/tests/network/v2/fakes.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'openstackclient/tests/network/v2/fakes.py') diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 7f89ef7a..409b18f2 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -71,6 +71,43 @@ class TestNetworkV2(utils.TestCommand): ) +class FakeAddressScope(object): + """Fake one or more address scopes.""" + + @staticmethod + def create_one_address_scope(attrs=None): + """Create a fake address scope. + + :param Dictionary attrs: + A dictionary with all attributes + :return: + A FakeResource object with name, id, etc. + """ + if attrs is None: + attrs = {} + + # Set default attributes. + address_scope_attrs = { + 'name': 'address-scope-name-' + uuid.uuid4().hex, + 'id': 'address-scope-id-' + uuid.uuid4().hex, + 'tenant_id': 'project-id-' + uuid.uuid4().hex, + 'shared': False, + 'ip_version': 4, + } + + # Overwrite default attributes. + address_scope_attrs.update(attrs) + + address_scope = fakes.FakeResource( + info=copy.deepcopy(address_scope_attrs), + loaded=True) + + # Set attributes with special mapping in OpenStack SDK. + address_scope.project_id = address_scope_attrs['tenant_id'] + + return address_scope + + class FakeAvailabilityZone(object): """Fake one or more network availability zones (AZs).""" -- cgit v1.2.1