diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-04-04 02:38:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-04-04 02:38:59 +0000 |
| commit | 8a1f4b6592a91ed3b2cd65d6fb0217afa1cf5e8d (patch) | |
| tree | 9733ab0d5ba02eca43f6a5c46cf17189f34c88b9 /openstackclient/network/v2 | |
| parent | 16b822b7692d92e147fbb005b403ee70997e8d50 (diff) | |
| parent | b51310a4bb5997137a4b6c0cf3517f481e178474 (diff) | |
| download | python-openstackclient-8a1f4b6592a91ed3b2cd65d6fb0217afa1cf5e8d.tar.gz | |
Merge "Introduce neutron flavor associate, disassociate to OSC"
Diffstat (limited to 'openstackclient/network/v2')
| -rw-r--r-- | openstackclient/network/v2/network_flavor.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/openstackclient/network/v2/network_flavor.py b/openstackclient/network/v2/network_flavor.py index 3a3324c0..c9d368bf 100644 --- a/openstackclient/network/v2/network_flavor.py +++ b/openstackclient/network/v2/network_flavor.py @@ -58,6 +58,34 @@ def _get_attrs(client_manager, parsed_args): return attrs +class AddNetworkFlavorToProfile(command.Command): + _description = _("Add a service profile to a network flavor") + + def get_parser(self, prog_name): + parser = super( + AddNetworkFlavorToProfile, self).get_parser(prog_name) + parser.add_argument( + 'flavor', + metavar="<flavor>", + help=_("Network flavor (name or ID)") + ) + parser.add_argument( + 'service_profile', + metavar="<service-profile>", + help=_("Service profile (ID only)") + ) + return parser + + def take_action(self, parsed_args): + client = self.app.client_manager.network + obj_flavor = client.find_flavor( + parsed_args.flavor, ignore_missing=False) + obj_service_profile = client.find_service_profile( + parsed_args.service_profile, ignore_missing=False) + client.associate_flavor_with_service_profile( + obj_flavor, obj_service_profile) + + # TODO(dasanind): Use the SDK resource mapped attribute names once the # OSC minimum requirements include SDK 1.0. class CreateNetworkFlavor(command.ShowOne): @@ -175,6 +203,35 @@ class ListNetworkFlavor(command.Lister): ) for s in data)) +class RemoveNetworkFlavorFromProfile(command.Command): + _description = _( + "Remove service profile from network flavor") + + def get_parser(self, prog_name): + parser = super( + RemoveNetworkFlavorFromProfile, self).get_parser(prog_name) + parser.add_argument( + 'flavor', + metavar="<flavor>", + help=_("Network flavor (name or ID)") + ) + parser.add_argument( + 'service_profile', + metavar="<service-profile>", + help=_("Service profile (ID only)") + ) + return parser + + def take_action(self, parsed_args): + client = self.app.client_manager.network + obj_flavor = client.find_flavor( + parsed_args.flavor, ignore_missing=False) + obj_service_profile = client.find_service_profile( + parsed_args.service_profile, ignore_missing=False) + client.disassociate_flavor_from_service_profile( + obj_flavor, obj_service_profile) + + # TODO(dasanind): Use only the SDK resource mapped attribute names once the # OSC minimum requirements include SDK 1.0. class SetNetworkFlavor(command.Command): |
