From 7ef1e9ea96ef15b63304a6bccaf30f8c269f2b76 Mon Sep 17 00:00:00 2001 From: Nakul Dahiwade Date: Fri, 11 Nov 2016 21:42:24 +0000 Subject: OSC Network Flavor Profile Implement Neutron feature of Network Flavor Profile into OpenstackClient This patch implements the following commands: network flavor profile create network flavor profile delete network flavor profile list network flavor profile show network flavor profile set SDK Version needed: 0.9.9 Change-Id: Ie6fe5e53122cfb2eda8d326851d54562739a8386 Partially-Implements: blueprint neutron-client-flavors --- openstackclient/tests/unit/network/v2/fakes.py | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'openstackclient/tests/unit/network/v2/fakes.py') diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index 7afe3328..a2274a34 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -769,6 +769,53 @@ class FakeNetworkRBAC(object): return mock.Mock(side_effect=rbac_policies) +class FakeNetworkFlavorProfile(object): + """Fake network flavor profile.""" + + @staticmethod + def create_one_service_profile(attrs=None): + """Create flavor profile.""" + attrs = attrs or {} + + flavor_profile_attrs = { + 'id': 'flavor-profile-id' + uuid.uuid4().hex, + 'description': 'flavor-profile-description-' + uuid.uuid4().hex, + 'tenant_id': 'project-id-' + uuid.uuid4().hex, + 'driver': 'driver-' + uuid.uuid4().hex, + 'metainfo': 'metainfo-' + uuid.uuid4().hex, + 'enabled': True + } + + flavor_profile_attrs.update(attrs) + + flavor_profile = fakes.FakeResource( + info=copy.deepcopy(flavor_profile_attrs), + loaded=True) + + flavor_profile.project_id = flavor_profile_attrs['tenant_id'] + flavor_profile.is_enabled = flavor_profile_attrs['enabled'] + + return flavor_profile + + @staticmethod + def create_service_profile(attrs=None, count=2): + """Create multiple flavor profiles.""" + + flavor_profiles = [] + for i in range(0, count): + flavor_profiles.append(FakeNetworkFlavorProfile. + create_one_service_profile(attrs)) + return flavor_profiles + + @staticmethod + def get_service_profile(flavor_profile=None, count=2): + """Get a list of flavor profiles.""" + if flavor_profile is None: + flavor_profile = (FakeNetworkFlavorProfile. + create_service_profile(count)) + return mock.Mock(side_effect=flavor_profile) + + class FakeNetworkQosPolicy(object): """Fake one or more QoS policies.""" -- cgit v1.2.1