Merge "Revert "Revert "Remove Cisco-specific neutron client commands"""

This commit is contained in:
Jenkins 2015-11-12 16:58:33 +00:00 committed by Gerrit Code Review
commit 5d08fd5867
8 changed files with 0 additions and 654 deletions

View File

@ -1,68 +0,0 @@
# 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.
#
from neutronclient.i18n import _
from neutronclient.neutron import v2_0 as neutronV20
class ListCredential(neutronV20.ListCommand):
"""List credentials that belong to a given tenant."""
resource = 'credential'
_formatters = {}
list_columns = ['credential_id', 'credential_name', 'user_name',
'password', 'type']
class ShowCredential(neutronV20.ShowCommand):
"""Show information of a given credential."""
resource = 'credential'
allow_names = False
class CreateCredential(neutronV20.CreateCommand):
"""Create a credential."""
resource = 'credential'
def add_known_arguments(self, parser):
parser.add_argument(
'credential_name',
help=_('Name/IP address for credential.'))
parser.add_argument(
'credential_type',
help=_('Type of the credential.'))
parser.add_argument(
'--username',
help=_('Username for the credential.'))
parser.add_argument(
'--password',
help=_('Password for the credential.'))
def args2body(self, parsed_args):
body = {'credential_name': parsed_args.credential_name}
if parsed_args.credential_type:
body['type'] = parsed_args.credential_type
if parsed_args.username:
body['user_name'] = parsed_args.username
if parsed_args.password:
body['password'] = parsed_args.password
return {'credential': body}
class DeleteCredential(neutronV20.DeleteCommand):
"""Delete a given credential."""
resource = 'credential'
allow_names = False

View File

@ -1,131 +0,0 @@
# 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.
#
from __future__ import print_function
from neutronclient.i18n import _
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import parse_args_to_dict
RESOURCE = 'network_profile'
SEGMENT_TYPE_CHOICES = ['vlan', 'overlay', 'multi-segment', 'trunk']
class ListNetworkProfile(neutronV20.ListCommand):
"""List network profiles that belong to a given tenant."""
resource = RESOURCE
_formatters = {}
list_columns = ['id', 'name', 'segment_type', 'sub_type', 'segment_range',
'physical_network', 'multicast_ip_index',
'multicast_ip_range']
class ShowNetworkProfile(neutronV20.ShowCommand):
"""Show information of a given network profile."""
resource = RESOURCE
allow_names = True
class CreateNetworkProfile(neutronV20.CreateCommand):
"""Create a network profile."""
resource = RESOURCE
def add_known_arguments(self, parser):
parser.add_argument('name',
help=_('Name for network profile.'))
parser.add_argument('segment_type',
choices=SEGMENT_TYPE_CHOICES,
help='Segment type.')
# TODO(Abhishek): Check on sub-type choices depending on segment_type
parser.add_argument('--sub_type',
help=_('Sub-type for the segment. Available '
'sub-types for overlay segments: '
'native, enhanced; For trunk segments: '
'vlan, overlay.'))
parser.add_argument('--segment_range',
help=_('Range for the segment.'))
parser.add_argument('--physical_network',
help=_('Name for the physical network.'))
parser.add_argument('--multicast_ip_range',
help=_('Multicast IPv4 range.'))
parser.add_argument("--add-tenant",
action='append', dest='add_tenants',
help=_("Add tenant to the network profile. "
"You can repeat this option."))
def args2body(self, parsed_args):
body = {'name': parsed_args.name}
neutronV20.update_dict(parsed_args, body,
['segment_type', 'sub_type', 'segment_range',
'physical_network', 'multicast_ip_range',
'add_tenants'])
return {'network_profile': body}
class DeleteNetworkProfile(neutronV20.DeleteCommand):
"""Delete a given network profile."""
resource = RESOURCE
allow_names = True
class UpdateNetworkProfile(neutronV20.UpdateCommand):
"""Update network profile's information."""
resource = RESOURCE
def add_known_arguments(self, parser):
parser.add_argument("--remove-tenant",
action='append', dest='remove_tenants',
help=_("Remove tenant from the network profile. "
"You can repeat this option."))
parser.add_argument("--add-tenant",
action='append', dest='add_tenants',
help=_("Add tenant to the network profile. "
"You can repeat this option."))
def args2body(self, parsed_args):
body = {}
neutronV20.update_dict(parsed_args, body,
['remove_tenants', 'add_tenants'])
return {'network_profile': body}
# Aaron: This function is deprecated
class UpdateNetworkProfileV2(neutronV20.NeutronCommand):
api = 'network'
resource = RESOURCE
def get_parser(self, prog_name):
parser = super(UpdateNetworkProfileV2, self).get_parser(prog_name)
parser.add_argument("--remove-tenant",
help="Remove tenant from the network profile.")
return parser
def run(self, parsed_args):
self.log.debug('run(%s)' % parsed_args)
neutron_client = self.get_client()
neutron_client.format = parsed_args.request_format
data = {self.resource: parse_args_to_dict(parsed_args)}
if parsed_args.remove_tenant:
data[self.resource]['remove_tenant'] = parsed_args.remove_tenant
neutron_client.update_network_profile(parsed_args.id,
{self.resource: data})
print((_('Updated %(resource)s: %(id)s') %
{'id': parsed_args.id, 'resource': self.resource}),
file=self.app.stdout)
return

View File

@ -1,72 +0,0 @@
# 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.
#
from __future__ import print_function
from neutronclient.i18n import _
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import parse_args_to_dict
RESOURCE = 'policy_profile'
class ListPolicyProfile(neutronV20.ListCommand):
"""List policy profiles that belong to a given tenant."""
resource = RESOURCE
_formatters = {}
list_columns = ['id', 'name']
class ShowPolicyProfile(neutronV20.ShowCommand):
"""Show information of a given policy profile."""
resource = RESOURCE
allow_names = True
class UpdatePolicyProfile(neutronV20.UpdateCommand):
"""Update policy profile's information."""
resource = RESOURCE
class UpdatePolicyProfileV2(neutronV20.UpdateCommand):
"""Update policy profile's information."""
api = 'network'
resource = RESOURCE
def get_parser(self, prog_name):
parser = super(UpdatePolicyProfileV2, self).get_parser(prog_name)
parser.add_argument("--add-tenant",
help=_("Add tenant to the policy profile."))
parser.add_argument("--remove-tenant",
help=_("Remove tenant from the policy profile."))
return parser
def run(self, parsed_args):
self.log.debug('run(%s)' % parsed_args)
neutron_client = self.get_client()
neutron_client.format = parsed_args.request_format
data = {self.resource: parse_args_to_dict(parsed_args)}
if parsed_args.add_tenant:
data[self.resource]['add_tenant'] = parsed_args.add_tenant
if parsed_args.remove_tenant:
data[self.resource]['remove_tenant'] = parsed_args.remove_tenant
neutron_client.update_policy_profile(parsed_args.id,
{self.resource: data})
print((_('Updated %(resource)s: %(id)s') %
{'id': parsed_args.id, 'resource': self.resource}),
file=self.app.stdout)
return

View File

@ -43,7 +43,6 @@ from neutronclient.i18n import _
from neutronclient.neutron.v2_0 import address_scope from neutronclient.neutron.v2_0 import address_scope
from neutronclient.neutron.v2_0 import agent from neutronclient.neutron.v2_0 import agent
from neutronclient.neutron.v2_0 import agentscheduler from neutronclient.neutron.v2_0 import agentscheduler
from neutronclient.neutron.v2_0 import credential
from neutronclient.neutron.v2_0 import extension from neutronclient.neutron.v2_0 import extension
from neutronclient.neutron.v2_0.flavor import flavor from neutronclient.neutron.v2_0.flavor import flavor
from neutronclient.neutron.v2_0.flavor import flavor_profile from neutronclient.neutron.v2_0.flavor import flavor_profile
@ -63,10 +62,8 @@ from neutronclient.neutron.v2_0.lb import vip as lb_vip
from neutronclient.neutron.v2_0 import metering from neutronclient.neutron.v2_0 import metering
from neutronclient.neutron.v2_0 import netpartition from neutronclient.neutron.v2_0 import netpartition
from neutronclient.neutron.v2_0 import network from neutronclient.neutron.v2_0 import network
from neutronclient.neutron.v2_0 import networkprofile
from neutronclient.neutron.v2_0.nsx import networkgateway from neutronclient.neutron.v2_0.nsx import networkgateway
from neutronclient.neutron.v2_0.nsx import qos_queue from neutronclient.neutron.v2_0.nsx import qos_queue
from neutronclient.neutron.v2_0 import policyprofile
from neutronclient.neutron.v2_0 import port from neutronclient.neutron.v2_0 import port
from neutronclient.neutron.v2_0.qos import bandwidth_limit_rule from neutronclient.neutron.v2_0.qos import bandwidth_limit_rule
from neutronclient.neutron.v2_0.qos import policy as qos_policy from neutronclient.neutron.v2_0.qos import policy as qos_policy
@ -303,18 +300,6 @@ COMMAND_V2 = {
'firewall-create': firewall.CreateFirewall, 'firewall-create': firewall.CreateFirewall,
'firewall-update': firewall.UpdateFirewall, 'firewall-update': firewall.UpdateFirewall,
'firewall-delete': firewall.DeleteFirewall, 'firewall-delete': firewall.DeleteFirewall,
'cisco-credential-list': credential.ListCredential,
'cisco-credential-show': credential.ShowCredential,
'cisco-credential-create': credential.CreateCredential,
'cisco-credential-delete': credential.DeleteCredential,
'cisco-network-profile-list': networkprofile.ListNetworkProfile,
'cisco-network-profile-show': networkprofile.ShowNetworkProfile,
'cisco-network-profile-create': networkprofile.CreateNetworkProfile,
'cisco-network-profile-delete': networkprofile.DeleteNetworkProfile,
'cisco-network-profile-update': networkprofile.UpdateNetworkProfile,
'cisco-policy-profile-list': policyprofile.ListPolicyProfile,
'cisco-policy-profile-show': policyprofile.ShowPolicyProfile,
'cisco-policy-profile-update': policyprofile.UpdatePolicyProfile,
'ipsec-site-connection-list': ( 'ipsec-site-connection-list': (
ipsec_site_connection.ListIPsecSiteConnection ipsec_site_connection.ListIPsecSiteConnection
), ),

View File

@ -1,79 +0,0 @@
# Copyright 2013 Cisco Systems Inc.
# All Rights Reserved
#
# 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.
#
import sys
from neutronclient.neutron.v2_0 import credential
from neutronclient.tests.unit import test_cli20
class CLITestV20Credential(test_cli20.CLITestV20Base):
non_admin_status_resources = ['credential']
def test_create_credential(self):
"""Create credential: myid."""
resource = 'credential'
cmd = credential.CreateCredential(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
type = 'mytype'
args = [name, type]
position_names = ['credential_name', 'type']
position_values = [name, type]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
def test_list_credentials_detail(self):
"""List credentials: -D."""
resources = 'credentials'
cmd = credential.ListCredential(test_cli20.MyApp(sys.stdout), None)
contents = [{'credential_name': 'myname', 'type': 'mytype'}]
self._test_list_resources(resources, cmd, True,
response_contents=contents)
def test_list_credential_known_option_after_unknown(self):
"""List credential: -- --tags a b --request-format xml."""
resources = 'credentials'
cmd = credential.ListCredential(test_cli20.MyApp(sys.stdout), None)
contents = [{'credential_name': 'myname', 'type': 'mytype'}]
self._test_list_resources(resources, cmd, tags=['a', 'b'],
response_contents=contents)
def test_list_credential_fields(self):
"""List credential: --fields a --fields b -- --fields c d."""
resources = 'credentials'
cmd = credential.ListCredential(test_cli20.MyApp(sys.stdout), None)
contents = [{'credential_name': 'myname', 'type': 'mytype'}]
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'],
response_contents=contents)
def test_show_credential(self):
"""Show credential: --fields id --fields name myid."""
resource = 'credential'
cmd = credential.ShowCredential(test_cli20.MyApp(sys.stdout), None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args,
['id', 'name'])
def test_delete_credential(self):
"""Delete credential: myid."""
resource = 'credential'
cmd = credential.DeleteCredential(test_cli20.MyApp(sys.stdout), None)
myid = 'myid'
args = [myid]
self._test_delete_resource(resource, cmd, myid, args)

View File

@ -1,135 +0,0 @@
# Copyright 2013 Cisco Systems Inc.
# All Rights Reserved
#
# 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.
#
import sys
from neutronclient.neutron.v2_0 import networkprofile
from neutronclient.tests.unit import test_cli20
class CLITestV20NetworkProfile(test_cli20.CLITestV20Base):
non_admin_status_resources = ['network_profile']
def test_create_networkprofile(self):
"""Create networkprofile: myid."""
resource = 'network_profile'
cmd = networkprofile.CreateNetworkProfile(test_cli20.
MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
segment_type = 'vlan'
args = [name, segment_type]
position_names = ['name', 'segment_type']
position_values = [name, segment_type]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
def test_list_networkprofile_detail(self):
"""List networkprofile: -D."""
resources = 'network_profiles'
cmd = networkprofile.ListNetworkProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd, True,
response_contents=contents)
def test_list_networkprofile_known_option_after_unknown(self):
"""List networkprofile: -- --tags a b --request-format xml."""
resources = 'network_profiles'
cmd = networkprofile.ListNetworkProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd, tags=['a', 'b'],
response_contents=contents)
def test_list_networkprofile_fields(self):
"""List networkprofile: --fields a --fields b -- --fields c d."""
resources = 'network_profiles'
cmd = networkprofile.ListNetworkProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'],
response_contents=contents)
def test_show_networkprofile(self):
"""Show networkprofile: --fields id --fields name myid."""
resource = 'network_profile'
cmd = networkprofile.ShowNetworkProfile(test_cli20.MyApp(sys.stdout),
None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args,
['id', 'name'])
def test_delete_networkprofile(self):
"""Delete networkprofile: myid."""
resource = 'network_profile'
cmd = networkprofile.DeleteNetworkProfile(test_cli20.
MyApp(sys.stdout), None)
myid = 'myid'
args = [myid]
self._test_delete_resource(resource, cmd, myid, args)
def test_create_networkprofile_trunk(self):
"""Create networkprofile: myid."""
resource = 'network_profile'
cmd = networkprofile.CreateNetworkProfile(test_cli20.
MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
segment_type = 'trunk'
args = [name, segment_type, '--sub_type', 'vlan']
position_names = ['name', 'segment_type', ]
position_values = [name, segment_type, ]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values,
sub_type='vlan')
def test_list_networkprofile_trunk_detail(self):
"""List networkprofile: -D."""
resources = 'network_profiles'
cmd = networkprofile.ListNetworkProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'trunk',
'--sub_type': 'vlan'}]
self._test_list_resources(resources, cmd, True,
response_contents=contents)
def test_create_networkprofile_multi_tenants(self):
"""Create networkprofile with mulitple tenants: myid."""
resource = 'network_profile'
cmd = networkprofile.CreateNetworkProfile(test_cli20.
MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
segment_type = 'vlan'
args = [name, segment_type, '--add-tenant', 'demo',
'--add-tenant', 'admin']
position_names = ['name', 'segment_type', 'add_tenants']
position_values = [name, segment_type, ['demo', 'admin']]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
def test_update_networkprofile_multi_tenants(self):
resource = 'network_profile'
cmd = networkprofile.UpdateNetworkProfile(test_cli20.
MyApp(sys.stdout), None)
args = ['myid', '--add-tenant', 'service', '--add-tenant', 'demo',
'--remove-tenant', 'demo']
extrafields = {'add_tenants': ['service', 'demo'],
'remove_tenants': ['demo']}
self._test_update_resource(resource, cmd, 'myid', args, extrafields)

View File

@ -1,73 +0,0 @@
# Copyright 2013 Cisco Systems Inc.
# All Rights Reserved
#
# 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.
#
import sys
from neutronclient.neutron.v2_0 import policyprofile
from neutronclient.tests.unit import test_cli20
class CLITestV20PolicyProfile(test_cli20.CLITestV20Base):
non_admin_status_resources = ['policy_profile']
def test_list_policyprofile_detail(self):
"""List policyprofile: -D."""
resources = 'policy_profiles'
cmd = policyprofile.ListPolicyProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd, True,
response_contents=contents)
def test_list_policyprofile_known_option_after_unknown(self):
"""List policyprofile: -- --tags a b --request-format xml."""
resources = 'policy_profiles'
cmd = policyprofile.ListPolicyProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd, tags=['a', 'b'],
response_contents=contents)
def test_list_policyprofile_fields(self):
"""List policyprofile: --fields a --fields b -- --fields c d."""
resources = 'policy_profiles'
cmd = policyprofile.ListPolicyProfile(test_cli20.MyApp(sys.stdout),
None)
contents = [{'name': 'myname', 'segment_type': 'vlan'}]
self._test_list_resources(resources, cmd,
fields_1=['a', 'b'], fields_2=['c', 'd'],
response_contents=contents)
def test_show_policyprofile(self):
"""Show policyprofile: --fields id --fields name myid."""
resource = 'policy_profile'
cmd = policyprofile.ShowPolicyProfile(test_cli20.MyApp(sys.stdout),
None)
args = ['--fields', 'id', '--fields', 'name', self.test_id]
self._test_show_resource(resource, cmd, self.test_id, args,
['id', 'name'])
def test_update_policyprofile(self):
"""Update policyprofile: myid --name myname --tags a b."""
resource = 'policy_profile'
cmd = policyprofile.UpdatePolicyProfile(test_cli20.MyApp(sys.stdout),
None)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--name', 'myname',
'--tags', 'a', 'b'],
{'name': 'myname', 'tags': ['a', 'b'], }
)

View File

@ -398,14 +398,6 @@ class Client(ClientBase):
gateway_devices_path = "/gateway-devices" gateway_devices_path = "/gateway-devices"
gateway_device_path = "/gateway-devices/%s" gateway_device_path = "/gateway-devices/%s"
service_providers_path = "/service-providers" service_providers_path = "/service-providers"
credentials_path = "/credentials"
credential_path = "/credentials/%s"
network_profiles_path = "/network_profiles"
network_profile_path = "/network_profiles/%s"
network_profile_bindings_path = "/network_profile_bindings"
policy_profiles_path = "/policy_profiles"
policy_profile_path = "/policy_profiles/%s"
policy_profile_bindings_path = "/policy_profile_bindings"
metering_labels_path = "/metering/metering-labels" metering_labels_path = "/metering/metering-labels"
metering_label_path = "/metering/metering-labels/%s" metering_label_path = "/metering/metering-labels/%s"
metering_label_rules_path = "/metering/metering-label-rules" metering_label_rules_path = "/metering/metering-label-rules"
@ -1511,79 +1503,6 @@ class Client(ClientBase):
return self.list('service_providers', self.service_providers_path, return self.list('service_providers', self.service_providers_path,
retrieve_all, **_params) retrieve_all, **_params)
def list_credentials(self, **_params):
"""Fetch a list of all credentials for a tenant."""
return self.get(self.credentials_path, params=_params)
@APIParamsCall
def show_credential(self, credential, **_params):
"""Fetch a credential."""
return self.get(self.credential_path % (credential), params=_params)
@APIParamsCall
def create_credential(self, body=None):
"""Create a new credential."""
return self.post(self.credentials_path, body=body)
@APIParamsCall
def update_credential(self, credential, body=None):
"""Update a credential."""
return self.put(self.credential_path % (credential), body=body)
@APIParamsCall
def delete_credential(self, credential):
"""Delete the specified credential."""
return self.delete(self.credential_path % (credential))
def list_network_profile_bindings(self, **params):
"""Fetch a list of all tenants associated for a network profile."""
return self.get(self.network_profile_bindings_path, params=params)
@APIParamsCall
def list_network_profiles(self, **params):
"""Fetch a list of all network profiles for a tenant."""
return self.get(self.network_profiles_path, params=params)
@APIParamsCall
def show_network_profile(self, profile, **params):
"""Fetch a network profile."""
return self.get(self.network_profile_path % (profile), params=params)
@APIParamsCall
def create_network_profile(self, body=None):
"""Create a network profile."""
return self.post(self.network_profiles_path, body=body)
@APIParamsCall
def update_network_profile(self, profile, body=None):
"""Update a network profile."""
return self.put(self.network_profile_path % (profile), body=body)
@APIParamsCall
def delete_network_profile(self, profile):
"""Delete the network profile."""
return self.delete(self.network_profile_path % profile)
@APIParamsCall
def list_policy_profile_bindings(self, **params):
"""Fetch a list of all tenants associated for a policy profile."""
return self.get(self.policy_profile_bindings_path, params=params)
@APIParamsCall
def list_policy_profiles(self, **params):
"""Fetch a list of all network profiles for a tenant."""
return self.get(self.policy_profiles_path, params=params)
@APIParamsCall
def show_policy_profile(self, profile, **params):
"""Fetch a network profile."""
return self.get(self.policy_profile_path % (profile), params=params)
@APIParamsCall
def update_policy_profile(self, profile, body=None):
"""Update a policy profile."""
return self.put(self.policy_profile_path % (profile), body=body)
@APIParamsCall @APIParamsCall
def create_metering_label(self, body=None): def create_metering_label(self, body=None):
"""Creates a metering label.""" """Creates a metering label."""