diff --git a/gbpservice/neutron/services/sfc/aim/cli_patch.py b/gbpservice/neutron/services/sfc/aim/cli_patch.py new file mode 100644 index 000000000..5e232b793 --- /dev/null +++ b/gbpservice/neutron/services/sfc/aim/cli_patch.py @@ -0,0 +1,64 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +try: + from networking_sfc.cli import port_pair_group + from networking_sfc.osc.sfc import port_pair_group as osc_ppg + + API_NAME = 'sfc_patch' + API_VERSION_OPTION = '' + + def build_option_parser(parser): + """Hook to add global options""" + return parser + + # Removing field limitation + def add_known_arguments(self, parser): + parser.add_argument( + 'name', + metavar='NAME', + help=port_pair_group._('Name of the Port Pair Group.')) + port_pair_group.add_common_arguments(parser) + parser.add_argument( + '--port-pair-group-parameters', + type=port_pair_group.utils.str2dict, + help=port_pair_group._( + 'Dictionary of Port pair group parameters. ')) + + def get_parser(self, prog_name): + parser = super(osc_ppg.CreatePortPairGroup, self).get_parser(prog_name) + parser.add_argument( + 'name', + metavar='NAME', + help=osc_ppg._('Name of the Port Pair Group.')) + parser.add_argument( + '--description', + help=osc_ppg._('Description for the Port Pair Group.')) + parser.add_argument( + '--port-pair', + metavar='PORT-PAIR', + dest='port_pairs', + default=[], + action='append', + help=osc_ppg._('ID or name of the Port Pair.' + 'This option can be repeated.')) + parser.add_argument( + '--port-pair-group-parameters', + type=osc_ppg.nc_utils.str2dict, + help=osc_ppg._('Dictionary of Port pair group parameters. ')) + return parser + + port_pair_group.PortPairGroupCreate.add_known_arguments = ( + add_known_arguments) + osc_ppg.CreatePortPairGroup.get_parser = get_parser +except ImportError: + pass diff --git a/setup.cfg b/setup.cfg index c5e06fd4f..7b8bcb7b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -85,6 +85,10 @@ networking_sfc.sfc.drivers = aim = gbpservice.neutron.services.sfc.aim.sfc_driver:SfcAIMDriver networking_sfc.flowclassifier.drivers = aim = gbpservice.neutron.services.sfc.aim.flowc_driver:FlowclassifierAIMDriver +neutronclient.extension= + port_pair_group_patch = gbpservice.neutron.services.sfc.aim.cli_patch +openstack.cli.extension = + port_pair_group_patch = gbpservice.neutron.services.sfc.aim.cli_patch [build_sphinx] source-dir = doc/source