setup logger name of NeutronCommand automatically

It is a common pattern to add
class XXXCommand(NeutronCommand):
    log = logging.getLogger(__name__ + '.<command name>').
So introduce a metaclass to do that automatically in order to simplify
the code a bit.

Change-Id: I7febdcd806eb2da51781a5866cc5fac5422b1721
This commit is contained in:
Isaku Yamahata
2013-11-26 16:01:29 +09:00
parent 872ab5e336
commit e8debf8d55
31 changed files with 59 additions and 220 deletions

View File

@@ -16,6 +16,7 @@
from __future__ import print_function from __future__ import print_function
import abc
import argparse import argparse
import logging import logging
import re import re
@@ -23,6 +24,7 @@ import re
from cliff.formatters import table from cliff.formatters import table
from cliff import lister from cliff import lister
from cliff import show from cliff import show
import six
from neutronclient.common import command from neutronclient.common import command
from neutronclient.common import exceptions from neutronclient.common import exceptions
@@ -335,9 +337,22 @@ class TableFormater(table.TableFormatter):
stdout.write('\n') stdout.write('\n')
# command.OpenStackCommand is abstract class so that metaclass of
# subclass must be subclass of metaclass of all its base.
# otherwise metaclass conflict exception is raised.
class NeutronCommandMeta(abc.ABCMeta):
def __new__(cls, name, bases, cls_dict):
if 'log' not in cls_dict:
cls_dict['log'] = logging.getLogger(
cls_dict['__module__'] + '.' + name)
return super(NeutronCommandMeta, cls).__new__(cls,
name, bases, cls_dict)
@six.add_metaclass(NeutronCommandMeta)
class NeutronCommand(command.OpenStackCommand): class NeutronCommand(command.OpenStackCommand):
api = 'network' api = 'network'
log = logging.getLogger(__name__ + '.NeutronCommand')
values_specs = [] values_specs = []
json_indent = None json_indent = None

View File

@@ -14,8 +14,6 @@
# under the License. # under the License.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
@@ -30,7 +28,6 @@ class ListAgent(neutronV20.ListCommand):
"""List agents.""" """List agents."""
resource = 'agent' resource = 'agent'
log = logging.getLogger(__name__ + '.ListAgent')
list_columns = ['id', 'agent_type', 'host', 'alive', 'admin_state_up', list_columns = ['id', 'agent_type', 'host', 'alive', 'admin_state_up',
'binary'] 'binary']
_formatters = {'heartbeat_timestamp': _format_timestamp} _formatters = {'heartbeat_timestamp': _format_timestamp}
@@ -46,7 +43,6 @@ class ShowAgent(neutronV20.ShowCommand):
"""Show information of a given agent.""" """Show information of a given agent."""
resource = 'agent' resource = 'agent'
log = logging.getLogger(__name__ + '.ShowAgent')
allow_names = False allow_names = False
json_indent = 5 json_indent = 5
@@ -54,7 +50,6 @@ class ShowAgent(neutronV20.ShowCommand):
class DeleteAgent(neutronV20.DeleteCommand): class DeleteAgent(neutronV20.DeleteCommand):
"""Delete a given agent.""" """Delete a given agent."""
log = logging.getLogger(__name__ + '.DeleteAgent')
resource = 'agent' resource = 'agent'
allow_names = False allow_names = False
@@ -62,6 +57,5 @@ class DeleteAgent(neutronV20.DeleteCommand):
class UpdateAgent(neutronV20.UpdateCommand): class UpdateAgent(neutronV20.UpdateCommand):
"""Update a given agent.""" """Update a given agent."""
log = logging.getLogger(__name__ + '.UpdateAgent')
resource = 'agent' resource = 'agent'
allow_names = False allow_names = False

View File

@@ -16,8 +16,6 @@
from __future__ import print_function from __future__ import print_function
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import network from neutronclient.neutron.v2_0 import network
from neutronclient.neutron.v2_0 import router from neutronclient.neutron.v2_0 import router
@@ -30,8 +28,6 @@ PERFECT_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
class AddNetworkToDhcpAgent(neutronV20.NeutronCommand): class AddNetworkToDhcpAgent(neutronV20.NeutronCommand):
"""Add a network to a DHCP agent.""" """Add a network to a DHCP agent."""
log = logging.getLogger(__name__ + '.AddNetworkToDhcpAgent')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(AddNetworkToDhcpAgent, self).get_parser(prog_name) parser = super(AddNetworkToDhcpAgent, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
@@ -56,7 +52,6 @@ class AddNetworkToDhcpAgent(neutronV20.NeutronCommand):
class RemoveNetworkFromDhcpAgent(neutronV20.NeutronCommand): class RemoveNetworkFromDhcpAgent(neutronV20.NeutronCommand):
"""Remove a network from a DHCP agent.""" """Remove a network from a DHCP agent."""
log = logging.getLogger(__name__ + '.RemoveNetworkFromDhcpAgent')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(RemoveNetworkFromDhcpAgent, self).get_parser(prog_name) parser = super(RemoveNetworkFromDhcpAgent, self).get_parser(prog_name)
@@ -83,7 +78,6 @@ class RemoveNetworkFromDhcpAgent(neutronV20.NeutronCommand):
class ListNetworksOnDhcpAgent(network.ListNetwork): class ListNetworksOnDhcpAgent(network.ListNetwork):
"""List the networks on a DHCP agent.""" """List the networks on a DHCP agent."""
log = logging.getLogger(__name__ + '.ListNetworksOnDhcpAgent')
unknown_parts_flag = False unknown_parts_flag = False
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -105,7 +99,6 @@ class ListDhcpAgentsHostingNetwork(neutronV20.ListCommand):
resource = 'agent' resource = 'agent'
_formatters = {} _formatters = {}
log = logging.getLogger(__name__ + '.ListDhcpAgentsHostingNetwork')
list_columns = ['id', 'host', 'admin_state_up', 'alive'] list_columns = ['id', 'host', 'admin_state_up', 'alive']
unknown_parts_flag = False unknown_parts_flag = False
@@ -133,8 +126,6 @@ class ListDhcpAgentsHostingNetwork(neutronV20.ListCommand):
class AddRouterToL3Agent(neutronV20.NeutronCommand): class AddRouterToL3Agent(neutronV20.NeutronCommand):
"""Add a router to a L3 agent.""" """Add a router to a L3 agent."""
log = logging.getLogger(__name__ + '.AddRouterToL3Agent')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(AddRouterToL3Agent, self).get_parser(prog_name) parser = super(AddRouterToL3Agent, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
@@ -160,8 +151,6 @@ class AddRouterToL3Agent(neutronV20.NeutronCommand):
class RemoveRouterFromL3Agent(neutronV20.NeutronCommand): class RemoveRouterFromL3Agent(neutronV20.NeutronCommand):
"""Remove a router from a L3 agent.""" """Remove a router from a L3 agent."""
log = logging.getLogger(__name__ + '.RemoveRouterFromL3Agent')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(RemoveRouterFromL3Agent, self).get_parser(prog_name) parser = super(RemoveRouterFromL3Agent, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
@@ -187,7 +176,6 @@ class RemoveRouterFromL3Agent(neutronV20.NeutronCommand):
class ListRoutersOnL3Agent(neutronV20.ListCommand): class ListRoutersOnL3Agent(neutronV20.ListCommand):
"""List the routers on a L3 agent.""" """List the routers on a L3 agent."""
log = logging.getLogger(__name__ + '.ListRoutersOnL3Agent')
_formatters = {'external_gateway_info': _formatters = {'external_gateway_info':
router._format_external_gateway_info} router._format_external_gateway_info}
list_columns = ['id', 'name', 'external_gateway_info'] list_columns = ['id', 'name', 'external_gateway_info']
@@ -213,7 +201,6 @@ class ListL3AgentsHostingRouter(neutronV20.ListCommand):
resource = 'agent' resource = 'agent'
_formatters = {} _formatters = {}
log = logging.getLogger(__name__ + '.ListL3AgentsHostingRouter')
list_columns = ['id', 'host', 'admin_state_up', 'alive'] list_columns = ['id', 'host', 'admin_state_up', 'alive']
unknown_parts_flag = False unknown_parts_flag = False
@@ -240,7 +227,6 @@ class ListL3AgentsHostingRouter(neutronV20.ListCommand):
class ListPoolsOnLbaasAgent(neutronV20.ListCommand): class ListPoolsOnLbaasAgent(neutronV20.ListCommand):
"""List the pools on a loadbalancer agent.""" """List the pools on a loadbalancer agent."""
log = logging.getLogger(__name__ + '.ListPoolsOnLbaasAgent')
list_columns = ['id', 'name', 'lb_method', 'protocol', list_columns = ['id', 'name', 'lb_method', 'protocol',
'admin_state_up', 'status'] 'admin_state_up', 'status']
resource = 'pool' resource = 'pool'
@@ -267,7 +253,6 @@ class GetLbaasAgentHostingPool(neutronV20.ListCommand):
""" """
resource = 'agent' resource = 'agent'
log = logging.getLogger(__name__ + '.GetLbaasAgentHostingPool')
list_columns = ['id', 'host', 'admin_state_up', 'alive'] list_columns = ['id', 'host', 'admin_state_up', 'alive']
unknown_parts_flag = False unknown_parts_flag = False

View File

@@ -11,8 +11,6 @@
# under the License. # under the License.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -21,7 +19,6 @@ class ListCredential(neutronV20.ListCommand):
"""List credentials that belong to a given tenant.""" """List credentials that belong to a given tenant."""
resource = 'credential' resource = 'credential'
log = logging.getLogger(__name__ + '.ListCredential')
_formatters = {} _formatters = {}
list_columns = ['credential_id', 'credential_name', 'user_name', list_columns = ['credential_id', 'credential_name', 'user_name',
'password', 'type'] 'password', 'type']
@@ -31,7 +28,6 @@ class ShowCredential(neutronV20.ShowCommand):
"""Show information of a given credential.""" """Show information of a given credential."""
resource = 'credential' resource = 'credential'
log = logging.getLogger(__name__ + '.ShowCredential')
allow_names = False allow_names = False
@@ -39,7 +35,6 @@ class CreateCredential(neutronV20.CreateCommand):
"""Creates a credential.""" """Creates a credential."""
resource = 'credential' resource = 'credential'
log = logging.getLogger(__name__ + '.CreateCredential')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -74,6 +69,5 @@ class CreateCredential(neutronV20.CreateCommand):
class DeleteCredential(neutronV20.DeleteCommand): class DeleteCredential(neutronV20.DeleteCommand):
"""Delete a given credential.""" """Delete a given credential."""
log = logging.getLogger(__name__ + '.DeleteCredential')
resource = 'credential' resource = 'credential'
allow_names = False allow_names = False

View File

@@ -14,8 +14,6 @@
# under the License. # under the License.
# #
import logging
from neutronclient.neutron import v2_0 as cmd_base from neutronclient.neutron import v2_0 as cmd_base
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -24,7 +22,6 @@ class ListExt(cmd_base.ListCommand):
"""List all extensions.""" """List all extensions."""
resource = 'extension' resource = 'extension'
log = logging.getLogger(__name__ + '.ListExt')
list_columns = ['alias', 'name'] list_columns = ['alias', 'name']
@@ -32,7 +29,6 @@ class ShowExt(cmd_base.ShowCommand):
"""Show information of a given resource.""" """Show information of a given resource."""
resource = "extension" resource = "extension"
log = logging.getLogger(__name__ + '.ShowExt')
allow_names = False allow_names = False
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -17,7 +17,6 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -27,7 +26,6 @@ class ListFloatingIP(neutronV20.ListCommand):
"""List floating ips that belong to a given tenant.""" """List floating ips that belong to a given tenant."""
resource = 'floatingip' resource = 'floatingip'
log = logging.getLogger(__name__ + '.ListFloatingIP')
list_columns = ['id', 'fixed_ip_address', 'floating_ip_address', list_columns = ['id', 'fixed_ip_address', 'floating_ip_address',
'port_id'] 'port_id']
pagination_support = True pagination_support = True
@@ -38,7 +36,6 @@ class ShowFloatingIP(neutronV20.ShowCommand):
"""Show information of a given floating ip.""" """Show information of a given floating ip."""
resource = 'floatingip' resource = 'floatingip'
log = logging.getLogger(__name__ + '.ShowFloatingIP')
allow_names = False allow_names = False
@@ -46,7 +43,6 @@ class CreateFloatingIP(neutronV20.CreateCommand):
"""Create a floating ip for a given tenant.""" """Create a floating ip for a given tenant."""
resource = 'floatingip' resource = 'floatingip'
log = logging.getLogger(__name__ + '.CreateFloatingIP')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -83,7 +79,6 @@ class CreateFloatingIP(neutronV20.CreateCommand):
class DeleteFloatingIP(neutronV20.DeleteCommand): class DeleteFloatingIP(neutronV20.DeleteCommand):
"""Delete a given floating ip.""" """Delete a given floating ip."""
log = logging.getLogger(__name__ + '.DeleteFloatingIP')
resource = 'floatingip' resource = 'floatingip'
allow_names = False allow_names = False
@@ -92,7 +87,6 @@ class AssociateFloatingIP(neutronV20.NeutronCommand):
"""Create a mapping between a floating ip and a fixed ip.""" """Create a mapping between a floating ip and a fixed ip."""
api = 'network' api = 'network'
log = logging.getLogger(__name__ + '.AssociateFloatingIP')
resource = 'floatingip' resource = 'floatingip'
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -133,7 +127,6 @@ class DisassociateFloatingIP(neutronV20.NeutronCommand):
""" """
api = 'network' api = 'network'
log = logging.getLogger(__name__ + '.DisassociateFloatingIP')
resource = 'floatingip' resource = 'floatingip'
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -17,7 +17,6 @@
# #
import argparse import argparse
import logging
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -27,7 +26,6 @@ class ListFirewall(neutronv20.ListCommand):
"""List firewalls that belong to a given tenant.""" """List firewalls that belong to a given tenant."""
resource = 'firewall' resource = 'firewall'
log = logging.getLogger(__name__ + '.ListFirewall')
list_columns = ['id', 'name', 'firewall_policy_id'] list_columns = ['id', 'name', 'firewall_policy_id']
_formatters = {} _formatters = {}
pagination_support = True pagination_support = True
@@ -38,14 +36,12 @@ class ShowFirewall(neutronv20.ShowCommand):
"""Show information of a given firewall.""" """Show information of a given firewall."""
resource = 'firewall' resource = 'firewall'
log = logging.getLogger(__name__ + '.ShowFirewall')
class CreateFirewall(neutronv20.CreateCommand): class CreateFirewall(neutronv20.CreateCommand):
"""Create a firewall.""" """Create a firewall."""
resource = 'firewall' resource = 'firewall'
log = logging.getLogger(__name__ + '.CreateFirewall')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -86,11 +82,9 @@ class UpdateFirewall(neutronv20.UpdateCommand):
"""Update a given firewall.""" """Update a given firewall."""
resource = 'firewall' resource = 'firewall'
log = logging.getLogger(__name__ + '.UpdateFirewall')
class DeleteFirewall(neutronv20.DeleteCommand): class DeleteFirewall(neutronv20.DeleteCommand):
"""Delete a given firewall.""" """Delete a given firewall."""
resource = 'firewall' resource = 'firewall'
log = logging.getLogger(__name__ + '.DeleteFirewall')

View File

@@ -19,7 +19,6 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import logging
import string import string
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
@@ -39,7 +38,6 @@ class ListFirewallPolicy(neutronv20.ListCommand):
"""List firewall policies that belong to a given tenant.""" """List firewall policies that belong to a given tenant."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.ListFirewallPolicy')
list_columns = ['id', 'name', 'firewall_rules'] list_columns = ['id', 'name', 'firewall_rules']
_formatters = {'firewall_rules': _format_firewall_rules, _formatters = {'firewall_rules': _format_firewall_rules,
} }
@@ -51,14 +49,12 @@ class ShowFirewallPolicy(neutronv20.ShowCommand):
"""Show information of a given firewall policy.""" """Show information of a given firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.ShowFirewallPolicy')
class CreateFirewallPolicy(neutronv20.CreateCommand): class CreateFirewallPolicy(neutronv20.CreateCommand):
"""Create a firewall policy.""" """Create a firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.CreateFirewallPolicy')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -107,21 +103,18 @@ class UpdateFirewallPolicy(neutronv20.UpdateCommand):
"""Update a given firewall policy.""" """Update a given firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.UpdateFirewallPolicy')
class DeleteFirewallPolicy(neutronv20.DeleteCommand): class DeleteFirewallPolicy(neutronv20.DeleteCommand):
"""Delete a given firewall policy.""" """Delete a given firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.DeleteFirewallPolicy')
class FirewallPolicyInsertRule(neutronv20.UpdateCommand): class FirewallPolicyInsertRule(neutronv20.UpdateCommand):
"""Insert a rule into a given firewall policy.""" """Insert a rule into a given firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.FirewallPolicyInsertRule')
def call_api(self, neutron_client, firewall_policy_id, body): def call_api(self, neutron_client, firewall_policy_id, body):
return neutron_client.firewall_policy_insert_rule(firewall_policy_id, return neutron_client.firewall_policy_insert_rule(firewall_policy_id,
@@ -184,7 +177,6 @@ class FirewallPolicyRemoveRule(neutronv20.UpdateCommand):
"""Remove a rule from a given firewall policy.""" """Remove a rule from a given firewall policy."""
resource = 'firewall_policy' resource = 'firewall_policy'
log = logging.getLogger(__name__ + '.FirewallPolicyRemoveRule')
def call_api(self, neutron_client, firewall_policy_id, body): def call_api(self, neutron_client, firewall_policy_id, body):
return neutron_client.firewall_policy_remove_rule(firewall_policy_id, return neutron_client.firewall_policy_remove_rule(firewall_policy_id,

View File

@@ -17,7 +17,6 @@
# #
import argparse import argparse
import logging
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -27,7 +26,6 @@ class ListFirewallRule(neutronv20.ListCommand):
"""List firewall rules that belong to a given tenant.""" """List firewall rules that belong to a given tenant."""
resource = 'firewall_rule' resource = 'firewall_rule'
log = logging.getLogger(__name__ + '.ListFirewallRule')
list_columns = ['id', 'name', 'firewall_policy_id', 'summary', 'enabled'] list_columns = ['id', 'name', 'firewall_policy_id', 'summary', 'enabled']
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -64,14 +62,12 @@ class ShowFirewallRule(neutronv20.ShowCommand):
"""Show information of a given firewall rule.""" """Show information of a given firewall rule."""
resource = 'firewall_rule' resource = 'firewall_rule'
log = logging.getLogger(__name__ + '.ShowFirewallRule')
class CreateFirewallRule(neutronv20.CreateCommand): class CreateFirewallRule(neutronv20.CreateCommand):
"""Create a firewall rule.""" """Create a firewall rule."""
resource = 'firewall_rule' resource = 'firewall_rule'
log = logging.getLogger(__name__ + '.CreateFirewallRule')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -134,7 +130,6 @@ class UpdateFirewallRule(neutronv20.UpdateCommand):
"""Update a given firewall rule.""" """Update a given firewall rule."""
resource = 'firewall_rule' resource = 'firewall_rule'
log = logging.getLogger(__name__ + '.UpdateFirewallRule')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -158,4 +153,3 @@ class DeleteFirewallRule(neutronv20.DeleteCommand):
"""Delete a given firewall rule.""" """Delete a given firewall rule."""
resource = 'firewall_rule' resource = 'firewall_rule'
log = logging.getLogger(__name__ + '.DeleteFirewallRule')

View File

@@ -18,8 +18,6 @@
from __future__ import print_function from __future__ import print_function
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -28,7 +26,6 @@ class ListHealthMonitor(neutronV20.ListCommand):
"""List healthmonitors that belong to a given tenant.""" """List healthmonitors that belong to a given tenant."""
resource = 'health_monitor' resource = 'health_monitor'
log = logging.getLogger(__name__ + '.ListHealthMonitor')
list_columns = ['id', 'type', 'admin_state_up'] list_columns = ['id', 'type', 'admin_state_up']
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -38,14 +35,12 @@ class ShowHealthMonitor(neutronV20.ShowCommand):
"""Show information of a given healthmonitor.""" """Show information of a given healthmonitor."""
resource = 'health_monitor' resource = 'health_monitor'
log = logging.getLogger(__name__ + '.ShowHealthMonitor')
class CreateHealthMonitor(neutronV20.CreateCommand): class CreateHealthMonitor(neutronV20.CreateCommand):
"""Create a healthmonitor.""" """Create a healthmonitor."""
resource = 'health_monitor' resource = 'health_monitor'
log = logging.getLogger(__name__ + '.CreateHealthMonitor')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -109,7 +104,6 @@ class UpdateHealthMonitor(neutronV20.UpdateCommand):
"""Update a given healthmonitor.""" """Update a given healthmonitor."""
resource = 'health_monitor' resource = 'health_monitor'
log = logging.getLogger(__name__ + '.UpdateHealthMonitor')
allow_names = False allow_names = False
@@ -117,13 +111,11 @@ class DeleteHealthMonitor(neutronV20.DeleteCommand):
"""Delete a given healthmonitor.""" """Delete a given healthmonitor."""
resource = 'health_monitor' resource = 'health_monitor'
log = logging.getLogger(__name__ + '.DeleteHealthMonitor')
class AssociateHealthMonitor(neutronV20.NeutronCommand): class AssociateHealthMonitor(neutronV20.NeutronCommand):
"""Create a mapping between a health monitor and a pool.""" """Create a mapping between a health monitor and a pool."""
log = logging.getLogger(__name__ + '.AssociateHealthMonitor')
resource = 'health_monitor' resource = 'health_monitor'
def get_parser(self, prog_name): def get_parser(self, prog_name):
@@ -151,7 +143,6 @@ class AssociateHealthMonitor(neutronV20.NeutronCommand):
class DisassociateHealthMonitor(neutronV20.NeutronCommand): class DisassociateHealthMonitor(neutronV20.NeutronCommand):
"""Remove a mapping from a health monitor to a pool.""" """Remove a mapping from a health monitor to a pool."""
log = logging.getLogger(__name__ + '.DisassociateHealthMonitor')
resource = 'health_monitor' resource = 'health_monitor'
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -16,8 +16,6 @@
# @author: Ilya Shakhat, Mirantis Inc. # @author: Ilya Shakhat, Mirantis Inc.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -26,7 +24,6 @@ class ListMember(neutronV20.ListCommand):
"""List members that belong to a given tenant.""" """List members that belong to a given tenant."""
resource = 'member' resource = 'member'
log = logging.getLogger(__name__ + '.ListMember')
list_columns = [ list_columns = [
'id', 'address', 'protocol_port', 'weight', 'admin_state_up', 'status' 'id', 'address', 'protocol_port', 'weight', 'admin_state_up', 'status'
] ]
@@ -38,14 +35,12 @@ class ShowMember(neutronV20.ShowCommand):
"""Show information of a given member.""" """Show information of a given member."""
resource = 'member' resource = 'member'
log = logging.getLogger(__name__ + '.ShowMember')
class CreateMember(neutronV20.CreateCommand): class CreateMember(neutronV20.CreateCommand):
"""Create a member.""" """Create a member."""
resource = 'member' resource = 'member'
log = logging.getLogger(__name__ + '.CreateMember')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -89,11 +84,9 @@ class UpdateMember(neutronV20.UpdateCommand):
"""Update a given member.""" """Update a given member."""
resource = 'member' resource = 'member'
log = logging.getLogger(__name__ + '.UpdateMember')
class DeleteMember(neutronV20.DeleteCommand): class DeleteMember(neutronV20.DeleteCommand):
"""Delete a given member.""" """Delete a given member."""
resource = 'member' resource = 'member'
log = logging.getLogger(__name__ + '.DeleteMember')

View File

@@ -16,8 +16,6 @@
# @author: Ilya Shakhat, Mirantis Inc. # @author: Ilya Shakhat, Mirantis Inc.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -30,7 +28,6 @@ class ListPool(neutronV20.ListCommand):
"""List pools that belong to a given tenant.""" """List pools that belong to a given tenant."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.ListPool')
list_columns = ['id', 'name', 'provider', 'lb_method', 'protocol', list_columns = ['id', 'name', 'provider', 'lb_method', 'protocol',
'admin_state_up', 'status'] 'admin_state_up', 'status']
_formatters = {'provider': _format_provider} _formatters = {'provider': _format_provider}
@@ -42,14 +39,12 @@ class ShowPool(neutronV20.ShowCommand):
"""Show information of a given pool.""" """Show information of a given pool."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.ShowPool')
class CreatePool(neutronV20.CreateCommand): class CreatePool(neutronV20.CreateCommand):
"""Create a pool.""" """Create a pool."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.CreatePool')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -102,21 +97,18 @@ class UpdatePool(neutronV20.UpdateCommand):
"""Update a given pool.""" """Update a given pool."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.UpdatePool')
class DeletePool(neutronV20.DeleteCommand): class DeletePool(neutronV20.DeleteCommand):
"""Delete a given pool.""" """Delete a given pool."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.DeletePool')
class RetrievePoolStats(neutronV20.ShowCommand): class RetrievePoolStats(neutronV20.ShowCommand):
"""Retrieve stats for a given pool.""" """Retrieve stats for a given pool."""
resource = 'pool' resource = 'pool'
log = logging.getLogger(__name__ + '.RetrievePoolStats')
def get_data(self, parsed_args): def get_data(self, parsed_args):
self.log.debug('run(%s)' % parsed_args) self.log.debug('run(%s)' % parsed_args)

View File

@@ -16,8 +16,6 @@
# @author: Ilya Shakhat, Mirantis Inc. # @author: Ilya Shakhat, Mirantis Inc.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -26,7 +24,6 @@ class ListVip(neutronV20.ListCommand):
"""List vips that belong to a given tenant.""" """List vips that belong to a given tenant."""
resource = 'vip' resource = 'vip'
log = logging.getLogger(__name__ + '.ListVip')
list_columns = ['id', 'name', 'algorithm', 'address', 'protocol', list_columns = ['id', 'name', 'algorithm', 'address', 'protocol',
'admin_state_up', 'status'] 'admin_state_up', 'status']
pagination_support = True pagination_support = True
@@ -37,14 +34,12 @@ class ShowVip(neutronV20.ShowCommand):
"""Show information of a given vip.""" """Show information of a given vip."""
resource = 'vip' resource = 'vip'
log = logging.getLogger(__name__ + '.ShowVip')
class CreateVip(neutronV20.CreateCommand): class CreateVip(neutronV20.CreateCommand):
"""Create a vip.""" """Create a vip."""
resource = 'vip' resource = 'vip'
log = logging.getLogger(__name__ + '.CreateVip')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -106,11 +101,9 @@ class UpdateVip(neutronV20.UpdateCommand):
"""Update a given vip.""" """Update a given vip."""
resource = 'vip' resource = 'vip'
log = logging.getLogger(__name__ + '.UpdateVip')
class DeleteVip(neutronV20.DeleteCommand): class DeleteVip(neutronV20.DeleteCommand):
"""Delete a given vip.""" """Delete a given vip."""
resource = 'vip' resource = 'vip'
log = logging.getLogger(__name__ + '.DeleteVip')

View File

@@ -14,8 +14,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -24,7 +22,6 @@ class ListMeteringLabel(neutronv20.ListCommand):
"""List metering labels that belong to a given tenant.""" """List metering labels that belong to a given tenant."""
resource = 'metering_label' resource = 'metering_label'
log = logging.getLogger(__name__ + '.ListMeteringLabel')
list_columns = ['id', 'name', 'description', 'shared'] list_columns = ['id', 'name', 'description', 'shared']
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -34,7 +31,6 @@ class ShowMeteringLabel(neutronv20.ShowCommand):
"""Show information of a given metering label.""" """Show information of a given metering label."""
resource = 'metering_label' resource = 'metering_label'
log = logging.getLogger(__name__ + '.ShowMeteringLabel')
allow_names = True allow_names = True
@@ -42,7 +38,6 @@ class CreateMeteringLabel(neutronv20.CreateCommand):
"""Create a metering label for a given tenant.""" """Create a metering label for a given tenant."""
resource = 'metering_label' resource = 'metering_label'
log = logging.getLogger(__name__ + '.CreateMeteringLabel')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -74,7 +69,6 @@ class CreateMeteringLabel(neutronv20.CreateCommand):
class DeleteMeteringLabel(neutronv20.DeleteCommand): class DeleteMeteringLabel(neutronv20.DeleteCommand):
"""Delete a given metering label.""" """Delete a given metering label."""
log = logging.getLogger(__name__ + '.DeleteMeteringLabel')
resource = 'metering_label' resource = 'metering_label'
allow_names = True allow_names = True
@@ -83,7 +77,6 @@ class ListMeteringLabelRule(neutronv20.ListCommand):
"""List metering labels that belong to a given label.""" """List metering labels that belong to a given label."""
resource = 'metering_label_rule' resource = 'metering_label_rule'
log = logging.getLogger(__name__ + '.ListMeteringLabelRule')
list_columns = ['id', 'excluded', 'direction', 'remote_ip_prefix'] list_columns = ['id', 'excluded', 'direction', 'remote_ip_prefix']
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -93,14 +86,12 @@ class ShowMeteringLabelRule(neutronv20.ShowCommand):
"""Show information of a given metering label rule.""" """Show information of a given metering label rule."""
resource = 'metering_label_rule' resource = 'metering_label_rule'
log = logging.getLogger(__name__ + '.ShowMeteringLabelRule')
class CreateMeteringLabelRule(neutronv20.CreateCommand): class CreateMeteringLabelRule(neutronv20.CreateCommand):
"""Create a metering label rule for a given label.""" """Create a metering label rule for a given label."""
resource = 'metering_label_rule' resource = 'metering_label_rule'
log = logging.getLogger(__name__ + '.CreateMeteringLabelRule')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -141,5 +132,4 @@ class CreateMeteringLabelRule(neutronv20.CreateCommand):
class DeleteMeteringLabelRule(neutronv20.DeleteCommand): class DeleteMeteringLabelRule(neutronv20.DeleteCommand):
"""Delete a given metering label.""" """Delete a given metering label."""
log = logging.getLogger(__name__ + '.DeleteMeteringLabelRule')
resource = 'metering_label_rule' resource = 'metering_label_rule'

View File

@@ -14,8 +14,6 @@
# #
# @author: Ronak Shah, Nuage Networks, Alcatel-Lucent USA Inc. # @author: Ronak Shah, Nuage Networks, Alcatel-Lucent USA Inc.
import logging
from neutronclient.neutron.v2_0 import CreateCommand from neutronclient.neutron.v2_0 import CreateCommand
from neutronclient.neutron.v2_0 import DeleteCommand from neutronclient.neutron.v2_0 import DeleteCommand
from neutronclient.neutron.v2_0 import ListCommand from neutronclient.neutron.v2_0 import ListCommand
@@ -25,7 +23,6 @@ from neutronclient.neutron.v2_0 import ShowCommand
class ListNetPartition(ListCommand): class ListNetPartition(ListCommand):
"""List netpartitions that belong to a given tenant.""" """List netpartitions that belong to a given tenant."""
resource = 'net_partition' resource = 'net_partition'
log = logging.getLogger(__name__ + '.ListNetPartition')
list_columns = ['id', 'name'] list_columns = ['id', 'name']
@@ -33,14 +30,12 @@ class ShowNetPartition(ShowCommand):
"""Show information of a given netpartition.""" """Show information of a given netpartition."""
resource = 'net_partition' resource = 'net_partition'
log = logging.getLogger(__name__ + '.ShowNetPartition')
class CreateNetPartition(CreateCommand): class CreateNetPartition(CreateCommand):
"""Create a netpartition for a given tenant.""" """Create a netpartition for a given tenant."""
resource = 'net_partition' resource = 'net_partition'
log = logging.getLogger(__name__ + '.CreateNetPartition')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -56,4 +51,3 @@ class DeleteNetPartition(DeleteCommand):
"""Delete a given netpartition.""" """Delete a given netpartition."""
resource = 'net_partition' resource = 'net_partition'
log = logging.getLogger(__name__ + '.DeleteNetPartition')

View File

@@ -15,7 +15,6 @@
# #
import argparse import argparse
import logging
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
@@ -37,7 +36,6 @@ class ListNetwork(neutronV20.ListCommand):
# id=<uuid>& (with len(uuid)=36) # id=<uuid>& (with len(uuid)=36)
subnet_id_filter_len = 40 subnet_id_filter_len = 40
resource = 'network' resource = 'network'
log = logging.getLogger(__name__ + '.ListNetwork')
_formatters = {'subnets': _format_subnets, } _formatters = {'subnets': _format_subnets, }
list_columns = ['id', 'name', 'subnets'] list_columns = ['id', 'name', 'subnets']
pagination_support = True pagination_support = True
@@ -86,7 +84,6 @@ class ListNetwork(neutronV20.ListCommand):
class ListExternalNetwork(ListNetwork): class ListExternalNetwork(ListNetwork):
"""List external networks that belong to a given tenant.""" """List external networks that belong to a given tenant."""
log = logging.getLogger(__name__ + '.ListExternalNetwork')
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -101,14 +98,12 @@ class ShowNetwork(neutronV20.ShowCommand):
"""Show information of a given network.""" """Show information of a given network."""
resource = 'network' resource = 'network'
log = logging.getLogger(__name__ + '.ShowNetwork')
class CreateNetwork(neutronV20.CreateCommand): class CreateNetwork(neutronV20.CreateCommand):
"""Create a network for a given tenant.""" """Create a network for a given tenant."""
resource = 'network' resource = 'network'
log = logging.getLogger(__name__ + '.CreateNetwork')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -140,12 +135,10 @@ class CreateNetwork(neutronV20.CreateCommand):
class DeleteNetwork(neutronV20.DeleteCommand): class DeleteNetwork(neutronV20.DeleteCommand):
"""Delete a given network.""" """Delete a given network."""
log = logging.getLogger(__name__ + '.DeleteNetwork')
resource = 'network' resource = 'network'
class UpdateNetwork(neutronV20.UpdateCommand): class UpdateNetwork(neutronV20.UpdateCommand):
"""Update network's information.""" """Update network's information."""
log = logging.getLogger(__name__ + '.UpdateNetwork')
resource = 'network' resource = 'network'

View File

@@ -16,8 +16,6 @@
from __future__ import print_function from __future__ import print_function
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import parse_args_to_dict from neutronclient.neutron.v2_0 import parse_args_to_dict
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -30,7 +28,6 @@ class ListNetworkProfile(neutronV20.ListCommand):
"""List network profiles that belong to a given tenant.""" """List network profiles that belong to a given tenant."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.ListNetworkProfile')
_formatters = {} _formatters = {}
list_columns = ['id', 'name', 'segment_type', 'sub_type', 'segment_range', list_columns = ['id', 'name', 'segment_type', 'sub_type', 'segment_range',
'physical_network', 'multicast_ip_index', 'physical_network', 'multicast_ip_index',
@@ -41,7 +38,6 @@ class ShowNetworkProfile(neutronV20.ShowCommand):
"""Show information of a given network profile.""" """Show information of a given network profile."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.ShowNetworkProfile')
allow_names = True allow_names = True
@@ -49,7 +45,6 @@ class CreateNetworkProfile(neutronV20.CreateCommand):
"""Creates a network profile.""" """Creates a network profile."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.CreateNetworkProfile')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument('name', parser.add_argument('name',
@@ -97,7 +92,6 @@ class CreateNetworkProfile(neutronV20.CreateCommand):
class DeleteNetworkProfile(neutronV20.DeleteCommand): class DeleteNetworkProfile(neutronV20.DeleteCommand):
"""Delete a given network profile.""" """Delete a given network profile."""
log = logging.getLogger(__name__ + '.DeleteNetworkProfile')
resource = RESOURCE resource = RESOURCE
allow_names = True allow_names = True
@@ -106,13 +100,11 @@ class UpdateNetworkProfile(neutronV20.UpdateCommand):
"""Update network profile's information.""" """Update network profile's information."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.UpdateNetworkProfile')
class UpdateNetworkProfileV2(neutronV20.NeutronCommand): class UpdateNetworkProfileV2(neutronV20.NeutronCommand):
api = 'network' api = 'network'
log = logging.getLogger(__name__ + '.UpdateNetworkProfileV2')
resource = RESOURCE resource = RESOURCE
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -16,8 +16,6 @@
from __future__ import print_function from __future__ import print_function
import logging
from neutronclient.common import utils from neutronclient.common import utils
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -41,7 +39,6 @@ class ListGatewayDevice(neutronV20.ListCommand):
"""List network gateway devices for a given tenant.""" """List network gateway devices for a given tenant."""
resource = DEV_RESOURCE resource = DEV_RESOURCE
log = logging.getLogger(__name__ + '.ListGatewayDevice')
list_columns = ['id', 'name'] list_columns = ['id', 'name']
@@ -49,7 +46,6 @@ class ShowGatewayDevice(neutronV20.ShowCommand):
"""Show information for a given network gateway device.""" """Show information for a given network gateway device."""
resource = DEV_RESOURCE resource = DEV_RESOURCE
log = logging.getLogger(__name__ + '.ShowGatewayDevice')
def read_cert_file(cert_file): def read_cert_file(cert_file):
@@ -80,7 +76,6 @@ class CreateGatewayDevice(neutronV20.CreateCommand):
"""Create a network gateway device.""" """Create a network gateway device."""
resource = DEV_RESOURCE resource = DEV_RESOURCE
log = logging.getLogger(__name__ + '.CreateGatewayDevice')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -114,7 +109,6 @@ class UpdateGatewayDevice(neutronV20.UpdateCommand):
"""Update a network gateway device.""" """Update a network gateway device."""
resource = DEV_RESOURCE resource = DEV_RESOURCE
log = logging.getLogger(__name__ + '.UpdateGatewayDevice')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -147,14 +141,12 @@ class DeleteGatewayDevice(neutronV20.DeleteCommand):
"""Delete a given network gateway device.""" """Delete a given network gateway device."""
resource = DEV_RESOURCE resource = DEV_RESOURCE
log = logging.getLogger(__name__ + '.DeleteGatewayDevice')
class ListNetworkGateway(neutronV20.ListCommand): class ListNetworkGateway(neutronV20.ListCommand):
"""List network gateways for a given tenant.""" """List network gateways for a given tenant."""
resource = GW_RESOURCE resource = GW_RESOURCE
log = logging.getLogger(__name__ + '.ListNetworkGateway')
list_columns = ['id', 'name'] list_columns = ['id', 'name']
@@ -162,14 +154,12 @@ class ShowNetworkGateway(neutronV20.ShowCommand):
"""Show information of a given network gateway.""" """Show information of a given network gateway."""
resource = GW_RESOURCE resource = GW_RESOURCE
log = logging.getLogger(__name__ + '.ShowNetworkGateway')
class CreateNetworkGateway(neutronV20.CreateCommand): class CreateNetworkGateway(neutronV20.CreateCommand):
"""Create a network gateway.""" """Create a network gateway."""
resource = GW_RESOURCE resource = GW_RESOURCE
log = logging.getLogger(__name__ + '.CreateNetworkGateway')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -199,14 +189,12 @@ class DeleteNetworkGateway(neutronV20.DeleteCommand):
"""Delete a given network gateway.""" """Delete a given network gateway."""
resource = GW_RESOURCE resource = GW_RESOURCE
log = logging.getLogger(__name__ + '.DeleteNetworkGateway')
class UpdateNetworkGateway(neutronV20.UpdateCommand): class UpdateNetworkGateway(neutronV20.UpdateCommand):
"""Update the name for a network gateway.""" """Update the name for a network gateway."""
resource = GW_RESOURCE resource = GW_RESOURCE
log = logging.getLogger(__name__ + '.UpdateNetworkGateway')
class NetworkGatewayInterfaceCommand(neutronV20.NeutronCommand): class NetworkGatewayInterfaceCommand(neutronV20.NeutronCommand):
@@ -244,8 +232,6 @@ class NetworkGatewayInterfaceCommand(neutronV20.NeutronCommand):
class ConnectNetworkGateway(NetworkGatewayInterfaceCommand): class ConnectNetworkGateway(NetworkGatewayInterfaceCommand):
"""Add an internal network interface to a router.""" """Add an internal network interface to a router."""
log = logging.getLogger(__name__ + '.ConnectNetworkGateway')
def run(self, parsed_args): def run(self, parsed_args):
self.log.debug('run(%s)' % parsed_args) self.log.debug('run(%s)' % parsed_args)
neutron_client = self.get_client() neutron_client = self.get_client()
@@ -265,8 +251,6 @@ class ConnectNetworkGateway(NetworkGatewayInterfaceCommand):
class DisconnectNetworkGateway(NetworkGatewayInterfaceCommand): class DisconnectNetworkGateway(NetworkGatewayInterfaceCommand):
"""Remove a network from a network gateway.""" """Remove a network from a network gateway."""
log = logging.getLogger(__name__ + '.DisconnectNetworkGateway')
def run(self, parsed_args): def run(self, parsed_args):
self.log.debug('run(%s)' % parsed_args) self.log.debug('run(%s)' % parsed_args)
neutron_client = self.get_client() neutron_client = self.get_client()

View File

@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -23,7 +21,6 @@ class ListQoSQueue(neutronV20.ListCommand):
"""List queues that belong to a given tenant.""" """List queues that belong to a given tenant."""
resource = 'qos_queue' resource = 'qos_queue'
log = logging.getLogger(__name__ + '.ListQoSQueue')
list_columns = ['id', 'name', 'min', 'max', list_columns = ['id', 'name', 'min', 'max',
'qos_marking', 'dscp', 'default'] 'qos_marking', 'dscp', 'default']
@@ -32,7 +29,6 @@ class ShowQoSQueue(neutronV20.ShowCommand):
"""Show information of a given queue.""" """Show information of a given queue."""
resource = 'qos_queue' resource = 'qos_queue'
log = logging.getLogger(__name__ + '.ShowQoSQueue')
allow_names = True allow_names = True
@@ -40,7 +36,6 @@ class CreateQoSQueue(neutronV20.CreateCommand):
"""Create a queue.""" """Create a queue."""
resource = 'qos_queue' resource = 'qos_queue'
log = logging.getLogger(__name__ + '.CreateQoSQueue')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -83,6 +78,5 @@ class CreateQoSQueue(neutronV20.CreateCommand):
class DeleteQoSQueue(neutronV20.DeleteCommand): class DeleteQoSQueue(neutronV20.DeleteCommand):
"""Delete a given queue.""" """Delete a given queue."""
log = logging.getLogger(__name__ + '.DeleteQoSQueue')
resource = 'qos_queue' resource = 'qos_queue'
allow_names = True allow_names = True

View File

@@ -15,8 +15,6 @@
from __future__ import print_function from __future__ import print_function
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import parse_args_to_dict from neutronclient.neutron.v2_0 import parse_args_to_dict
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -28,7 +26,6 @@ class ListPolicyProfile(neutronV20.ListCommand):
"""List policy profiles that belong to a given tenant.""" """List policy profiles that belong to a given tenant."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.ListProfile')
_formatters = {} _formatters = {}
list_columns = ['id', 'name'] list_columns = ['id', 'name']
@@ -37,7 +34,6 @@ class ShowPolicyProfile(neutronV20.ShowCommand):
"""Show information of a given policy profile.""" """Show information of a given policy profile."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.ShowProfile')
allow_names = True allow_names = True
@@ -45,14 +41,12 @@ class UpdatePolicyProfile(neutronV20.UpdateCommand):
"""Update policy profile's information.""" """Update policy profile's information."""
resource = RESOURCE resource = RESOURCE
log = logging.getLogger(__name__ + '.UpdatePolicyProfile')
class UpdatePolicyProfileV2(neutronV20.UpdateCommand): class UpdatePolicyProfileV2(neutronV20.UpdateCommand):
"""Update policy profile's information.""" """Update policy profile's information."""
api = 'network' api = 'network'
log = logging.getLogger(__name__ + '.UpdatePolicyProfileV2')
resource = RESOURCE resource = RESOURCE
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@@ -15,7 +15,6 @@
# #
import argparse import argparse
import logging
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.common import utils from neutronclient.common import utils
@@ -34,7 +33,6 @@ class ListPort(neutronV20.ListCommand):
"""List ports that belong to a given tenant.""" """List ports that belong to a given tenant."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.ListPort')
_formatters = {'fixed_ips': _format_fixed_ips, } _formatters = {'fixed_ips': _format_fixed_ips, }
list_columns = ['id', 'name', 'mac_address', 'fixed_ips'] list_columns = ['id', 'name', 'mac_address', 'fixed_ips']
pagination_support = True pagination_support = True
@@ -45,7 +43,6 @@ class ListRouterPort(neutronV20.ListCommand):
"""List ports that belong to a given tenant, with specified router.""" """List ports that belong to a given tenant, with specified router."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.ListRouterPort')
_formatters = {'fixed_ips': _format_fixed_ips, } _formatters = {'fixed_ips': _format_fixed_ips, }
list_columns = ['id', 'name', 'mac_address', 'fixed_ips'] list_columns = ['id', 'name', 'mac_address', 'fixed_ips']
pagination_support = True pagination_support = True
@@ -71,7 +68,6 @@ class ShowPort(neutronV20.ShowCommand):
"""Show information of a given port.""" """Show information of a given port."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.ShowPort')
class UpdatePortSecGroupMixin(object): class UpdatePortSecGroupMixin(object):
@@ -144,7 +140,6 @@ class CreatePort(neutronV20.CreateCommand, UpdatePortSecGroupMixin,
"""Create a port for a given tenant.""" """Create a port for a given tenant."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.CreatePort')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -224,7 +219,6 @@ class DeletePort(neutronV20.DeleteCommand):
"""Delete a given port.""" """Delete a given port."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.DeletePort')
class UpdatePort(neutronV20.UpdateCommand, UpdatePortSecGroupMixin, class UpdatePort(neutronV20.UpdateCommand, UpdatePortSecGroupMixin,
@@ -232,7 +226,6 @@ class UpdatePort(neutronV20.UpdateCommand, UpdatePortSecGroupMixin,
"""Update port's information.""" """Update port's information."""
resource = 'port' resource = 'port'
log = logging.getLogger(__name__ + '.UpdatePort')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
self.add_arguments_secgroup(parser) self.add_arguments_secgroup(parser)

View File

@@ -17,7 +17,6 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import logging
from cliff import lister from cliff import lister
from cliff import show from cliff import show
@@ -38,7 +37,6 @@ class DeleteQuota(neutronV20.NeutronCommand):
api = 'network' api = 'network'
resource = 'quota' resource = 'quota'
log = logging.getLogger(__name__ + '.DeleteQuota')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(DeleteQuota, self).get_parser(prog_name) parser = super(DeleteQuota, self).get_parser(prog_name)
@@ -71,7 +69,6 @@ class ListQuota(neutronV20.NeutronCommand, lister.Lister):
api = 'network' api = 'network'
resource = 'quota' resource = 'quota'
log = logging.getLogger(__name__ + '.ListQuota')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(ListQuota, self).get_parser(prog_name) parser = super(ListQuota, self).get_parser(prog_name)
@@ -101,7 +98,6 @@ class ShowQuota(neutronV20.NeutronCommand, show.ShowOne):
""" """
api = 'network' api = 'network'
resource = "quota" resource = "quota"
log = logging.getLogger(__name__ + '.ShowQuota')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(ShowQuota, self).get_parser(prog_name) parser = super(ShowQuota, self).get_parser(prog_name)
@@ -146,7 +142,6 @@ class UpdateQuota(neutronV20.NeutronCommand, show.ShowOne):
"""Define tenant's quotas not to use defaults.""" """Define tenant's quotas not to use defaults."""
resource = 'quota' resource = 'quota'
log = logging.getLogger(__name__ + '.UpdateQuota')
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(UpdateQuota, self).get_parser(prog_name) parser = super(UpdateQuota, self).get_parser(prog_name)

View File

@@ -17,7 +17,6 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import logging
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.common import utils from neutronclient.common import utils
@@ -36,7 +35,6 @@ class ListRouter(neutronV20.ListCommand):
"""List routers that belong to a given tenant.""" """List routers that belong to a given tenant."""
resource = 'router' resource = 'router'
log = logging.getLogger(__name__ + '.ListRouter')
_formatters = {'external_gateway_info': _format_external_gateway_info, } _formatters = {'external_gateway_info': _format_external_gateway_info, }
list_columns = ['id', 'name', 'external_gateway_info'] list_columns = ['id', 'name', 'external_gateway_info']
pagination_support = True pagination_support = True
@@ -47,14 +45,12 @@ class ShowRouter(neutronV20.ShowCommand):
"""Show information of a given router.""" """Show information of a given router."""
resource = 'router' resource = 'router'
log = logging.getLogger(__name__ + '.ShowRouter')
class CreateRouter(neutronV20.CreateCommand): class CreateRouter(neutronV20.CreateCommand):
"""Create a router for a given tenant.""" """Create a router for a given tenant."""
resource = 'router' resource = 'router'
log = logging.getLogger(__name__ + '.CreateRouter')
_formatters = {'external_gateway_info': _format_external_gateway_info, } _formatters = {'external_gateway_info': _format_external_gateway_info, }
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
@@ -85,14 +81,12 @@ class CreateRouter(neutronV20.CreateCommand):
class DeleteRouter(neutronV20.DeleteCommand): class DeleteRouter(neutronV20.DeleteCommand):
"""Delete a given router.""" """Delete a given router."""
log = logging.getLogger(__name__ + '.DeleteRouter')
resource = 'router' resource = 'router'
class UpdateRouter(neutronV20.UpdateCommand): class UpdateRouter(neutronV20.UpdateCommand):
"""Update router's information.""" """Update router's information."""
log = logging.getLogger(__name__ + '.UpdateRouter')
resource = 'router' resource = 'router'
@@ -150,8 +144,6 @@ class RouterInterfaceCommand(neutronV20.NeutronCommand):
class AddInterfaceRouter(RouterInterfaceCommand): class AddInterfaceRouter(RouterInterfaceCommand):
"""Add an internal network interface to a router.""" """Add an internal network interface to a router."""
log = logging.getLogger(__name__ + '.AddInterfaceRouter')
def call_api(self, neutron_client, router_id, body): def call_api(self, neutron_client, router_id, body):
return neutron_client.add_interface_router(router_id, body) return neutron_client.add_interface_router(router_id, body)
@@ -163,8 +155,6 @@ class AddInterfaceRouter(RouterInterfaceCommand):
class RemoveInterfaceRouter(RouterInterfaceCommand): class RemoveInterfaceRouter(RouterInterfaceCommand):
"""Remove an internal network interface from a router.""" """Remove an internal network interface from a router."""
log = logging.getLogger(__name__ + '.RemoveInterfaceRouter')
def call_api(self, neutron_client, router_id, body): def call_api(self, neutron_client, router_id, body):
return neutron_client.remove_interface_router(router_id, body) return neutron_client.remove_interface_router(router_id, body)
@@ -176,7 +166,6 @@ class RemoveInterfaceRouter(RouterInterfaceCommand):
class SetGatewayRouter(neutronV20.NeutronCommand): class SetGatewayRouter(neutronV20.NeutronCommand):
"""Set the external network gateway for a router.""" """Set the external network gateway for a router."""
log = logging.getLogger(__name__ + '.SetGatewayRouter')
api = 'network' api = 'network'
resource = 'router' resource = 'router'
@@ -212,7 +201,6 @@ class SetGatewayRouter(neutronV20.NeutronCommand):
class RemoveGatewayRouter(neutronV20.NeutronCommand): class RemoveGatewayRouter(neutronV20.NeutronCommand):
"""Remove an external network gateway from a router.""" """Remove an external network gateway from a router."""
log = logging.getLogger(__name__ + '.RemoveGatewayRouter')
api = 'network' api = 'network'
resource = 'router' resource = 'router'

View File

@@ -15,7 +15,6 @@
# #
import argparse import argparse
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -25,7 +24,6 @@ class ListSecurityGroup(neutronV20.ListCommand):
"""List security groups that belong to a given tenant.""" """List security groups that belong to a given tenant."""
resource = 'security_group' resource = 'security_group'
log = logging.getLogger(__name__ + '.ListSecurityGroup')
list_columns = ['id', 'name', 'description'] list_columns = ['id', 'name', 'description']
pagination_support = True pagination_support = True
sorting_support = True sorting_support = True
@@ -35,7 +33,6 @@ class ShowSecurityGroup(neutronV20.ShowCommand):
"""Show information of a given security group.""" """Show information of a given security group."""
resource = 'security_group' resource = 'security_group'
log = logging.getLogger(__name__ + '.ShowSecurityGroup')
allow_names = True allow_names = True
@@ -43,7 +40,6 @@ class CreateSecurityGroup(neutronV20.CreateCommand):
"""Create a security group.""" """Create a security group."""
resource = 'security_group' resource = 'security_group'
log = logging.getLogger(__name__ + '.CreateSecurityGroup')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -67,7 +63,6 @@ class CreateSecurityGroup(neutronV20.CreateCommand):
class DeleteSecurityGroup(neutronV20.DeleteCommand): class DeleteSecurityGroup(neutronV20.DeleteCommand):
"""Delete a given security group.""" """Delete a given security group."""
log = logging.getLogger(__name__ + '.DeleteSecurityGroup')
resource = 'security_group' resource = 'security_group'
allow_names = True allow_names = True
@@ -75,7 +70,6 @@ class DeleteSecurityGroup(neutronV20.DeleteCommand):
class UpdateSecurityGroup(neutronV20.UpdateCommand): class UpdateSecurityGroup(neutronV20.UpdateCommand):
"""Update a given security group.""" """Update a given security group."""
log = logging.getLogger(__name__ + '.UpdateSecurityGroup')
resource = 'security_group' resource = 'security_group'
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
@@ -101,7 +95,6 @@ class ListSecurityGroupRule(neutronV20.ListCommand):
"""List security group rules that belong to a given tenant.""" """List security group rules that belong to a given tenant."""
resource = 'security_group_rule' resource = 'security_group_rule'
log = logging.getLogger(__name__ + '.ListSecurityGroupRule')
list_columns = ['id', 'security_group_id', 'direction', 'protocol', list_columns = ['id', 'security_group_id', 'direction', 'protocol',
'remote_ip_prefix', 'remote_group_id'] 'remote_ip_prefix', 'remote_group_id']
replace_rules = {'security_group_id': 'security_group', replace_rules = {'security_group_id': 'security_group',
@@ -170,7 +163,6 @@ class ShowSecurityGroupRule(neutronV20.ShowCommand):
"""Show information of a given security group rule.""" """Show information of a given security group rule."""
resource = 'security_group_rule' resource = 'security_group_rule'
log = logging.getLogger(__name__ + '.ShowSecurityGroupRule')
allow_names = False allow_names = False
@@ -178,7 +170,6 @@ class CreateSecurityGroupRule(neutronV20.CreateCommand):
"""Create a security group rule.""" """Create a security group rule."""
resource = 'security_group_rule' resource = 'security_group_rule'
log = logging.getLogger(__name__ + '.CreateSecurityGroupRule')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -254,6 +245,5 @@ class CreateSecurityGroupRule(neutronV20.CreateCommand):
class DeleteSecurityGroupRule(neutronV20.DeleteCommand): class DeleteSecurityGroupRule(neutronV20.DeleteCommand):
"""Delete a given security group rule.""" """Delete a given security group rule."""
log = logging.getLogger(__name__ + '.DeleteSecurityGroupRule')
resource = 'security_group_rule' resource = 'security_group_rule'
allow_names = False allow_names = False

View File

@@ -14,8 +14,6 @@
# under the License. # under the License.
# #
import logging
from neutronclient.neutron import v2_0 as neutronV20 from neutronclient.neutron import v2_0 as neutronV20
@@ -23,7 +21,6 @@ class ListServiceProvider(neutronV20.ListCommand):
"""List service providers.""" """List service providers."""
resource = 'service_provider' resource = 'service_provider'
log = logging.getLogger(__name__ + '.ListServiceProviders')
list_columns = ['service_type', 'name', 'default'] list_columns = ['service_type', 'name', 'default']
_formatters = {} _formatters = {}
pagination_support = True pagination_support = True

View File

@@ -15,7 +15,6 @@
# #
import argparse import argparse
import logging
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.common import utils from neutronclient.common import utils
@@ -117,7 +116,6 @@ class ListSubnet(neutronV20.ListCommand):
"""List subnets that belong to a given tenant.""" """List subnets that belong to a given tenant."""
resource = 'subnet' resource = 'subnet'
log = logging.getLogger(__name__ + '.ListSubnet')
_formatters = {'allocation_pools': _format_allocation_pools, _formatters = {'allocation_pools': _format_allocation_pools,
'dns_nameservers': _format_dns_nameservers, 'dns_nameservers': _format_dns_nameservers,
'host_routes': _format_host_routes, } 'host_routes': _format_host_routes, }
@@ -130,14 +128,12 @@ class ShowSubnet(neutronV20.ShowCommand):
"""Show information of a given subnet.""" """Show information of a given subnet."""
resource = 'subnet' resource = 'subnet'
log = logging.getLogger(__name__ + '.ShowSubnet')
class CreateSubnet(neutronV20.CreateCommand): class CreateSubnet(neutronV20.CreateCommand):
"""Create a subnet for a given tenant.""" """Create a subnet for a given tenant."""
resource = 'subnet' resource = 'subnet'
log = logging.getLogger(__name__ + '.CreateSubnet')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
add_updatable_arguments(parser) add_updatable_arguments(parser)
@@ -176,14 +172,12 @@ class DeleteSubnet(neutronV20.DeleteCommand):
"""Delete a given subnet.""" """Delete a given subnet."""
resource = 'subnet' resource = 'subnet'
log = logging.getLogger(__name__ + '.DeleteSubnet')
class UpdateSubnet(neutronV20.UpdateCommand): class UpdateSubnet(neutronV20.UpdateCommand):
"""Update subnet's information.""" """Update subnet's information."""
resource = 'subnet' resource = 'subnet'
log = logging.getLogger(__name__ + '.UpdateSubnet')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
add_updatable_arguments(parser) add_updatable_arguments(parser)

View File

@@ -16,8 +16,6 @@
# @author: Swaminathan Vasudevan, Hewlett-Packard. # @author: Swaminathan Vasudevan, Hewlett-Packard.
# #
import logging
from neutronclient.common import utils from neutronclient.common import utils
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.neutron.v2_0.vpn import utils as vpn_utils from neutronclient.neutron.v2_0.vpn import utils as vpn_utils
@@ -28,7 +26,6 @@ class ListIKEPolicy(neutronv20.ListCommand):
"""List IKEPolicies that belong to a tenant.""" """List IKEPolicies that belong to a tenant."""
resource = 'ikepolicy' resource = 'ikepolicy'
log = logging.getLogger(__name__ + '.ListIKEPolicy')
list_columns = ['id', 'name', 'auth_algorithm', list_columns = ['id', 'name', 'auth_algorithm',
'encryption_algorithm', 'ike_version', 'pfs'] 'encryption_algorithm', 'ike_version', 'pfs']
_formatters = {} _formatters = {}
@@ -40,14 +37,12 @@ class ShowIKEPolicy(neutronv20.ShowCommand):
"""Show information of a given IKEPolicy.""" """Show information of a given IKEPolicy."""
resource = 'ikepolicy' resource = 'ikepolicy'
log = logging.getLogger(__name__ + '.ShowIKEPolicy')
class CreateIKEPolicy(neutronv20.CreateCommand): class CreateIKEPolicy(neutronv20.CreateCommand):
"""Create an IKEPolicy.""" """Create an IKEPolicy."""
resource = 'ikepolicy' resource = 'ikepolicy'
log = logging.getLogger(__name__ + '.CreateIKEPolicy')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -111,7 +106,6 @@ class UpdateIKEPolicy(neutronv20.UpdateCommand):
"""Update a given IKE Policy.""" """Update a given IKE Policy."""
resource = 'ikepolicy' resource = 'ikepolicy'
log = logging.getLogger(__name__ + '.UpdateIKEPolicy')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -134,4 +128,3 @@ class DeleteIKEPolicy(neutronv20.DeleteCommand):
"""Delete a given IKE Policy.""" """Delete a given IKE Policy."""
resource = 'ikepolicy' resource = 'ikepolicy'
log = logging.getLogger(__name__ + '.DeleteIKEPolicy')

View File

@@ -16,8 +16,6 @@
# @author: Swaminathan Vasudevan, Hewlett-Packard. # @author: Swaminathan Vasudevan, Hewlett-Packard.
# #
import logging
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.common import utils from neutronclient.common import utils
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
@@ -37,7 +35,6 @@ class ListIPsecSiteConnection(neutronv20.ListCommand):
"""List IPsecSiteConnections that belong to a given tenant.""" """List IPsecSiteConnections that belong to a given tenant."""
resource = 'ipsec_site_connection' resource = 'ipsec_site_connection'
log = logging.getLogger(__name__ + '.ListIPsecSiteConnection')
_formatters = {'peer_cidrs': _format_peer_cidrs} _formatters = {'peer_cidrs': _format_peer_cidrs}
list_columns = [ list_columns = [
'id', 'name', 'peer_address', 'peer_cidrs', 'route_mode', 'id', 'name', 'peer_address', 'peer_cidrs', 'route_mode',
@@ -50,13 +47,11 @@ class ShowIPsecSiteConnection(neutronv20.ShowCommand):
"""Show information of a given IPsecSiteConnection.""" """Show information of a given IPsecSiteConnection."""
resource = 'ipsec_site_connection' resource = 'ipsec_site_connection'
log = logging.getLogger(__name__ + '.ShowIPsecSiteConnection')
class CreateIPsecSiteConnection(neutronv20.CreateCommand): class CreateIPsecSiteConnection(neutronv20.CreateCommand):
"""Create an IPsecSiteConnection.""" """Create an IPsecSiteConnection."""
resource = 'ipsec_site_connection' resource = 'ipsec_site_connection'
log = logging.getLogger(__name__ + '.CreateIPsecSiteConnection')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -165,7 +160,6 @@ class UpdateIPsecSiteConnection(neutronv20.UpdateCommand):
"""Update a given IPsecSiteConnection.""" """Update a given IPsecSiteConnection."""
resource = 'ipsec_site_connection' resource = 'ipsec_site_connection'
log = logging.getLogger(__name__ + '.UpdateIPsecSiteConnection')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
@@ -189,4 +183,3 @@ class DeleteIPsecSiteConnection(neutronv20.DeleteCommand):
"""Delete a given IPsecSiteConnection.""" """Delete a given IPsecSiteConnection."""
resource = 'ipsec_site_connection' resource = 'ipsec_site_connection'
log = logging.getLogger(__name__ + '.DeleteIPsecSiteConnection')

View File

@@ -15,8 +15,6 @@
# #
# @author: Swaminathan Vasudevan, Hewlett-Packard. # @author: Swaminathan Vasudevan, Hewlett-Packard.
import logging
from neutronclient.common import utils from neutronclient.common import utils
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.neutron.v2_0.vpn import utils as vpn_utils from neutronclient.neutron.v2_0.vpn import utils as vpn_utils
@@ -27,7 +25,6 @@ class ListIPsecPolicy(neutronv20.ListCommand):
"""List ipsecpolicies that belongs to a given tenant connection.""" """List ipsecpolicies that belongs to a given tenant connection."""
resource = 'ipsecpolicy' resource = 'ipsecpolicy'
log = logging.getLogger(__name__ + '.ListIPsecPolicy')
list_columns = ['id', 'name', 'auth_algorithm', list_columns = ['id', 'name', 'auth_algorithm',
'encryption_algorithm', 'pfs'] 'encryption_algorithm', 'pfs']
_formatters = {} _formatters = {}
@@ -39,14 +36,12 @@ class ShowIPsecPolicy(neutronv20.ShowCommand):
"""Show information of a given ipsecpolicy.""" """Show information of a given ipsecpolicy."""
resource = 'ipsecpolicy' resource = 'ipsecpolicy'
log = logging.getLogger(__name__ + '.ShowIPsecPolicy')
class CreateIPsecPolicy(neutronv20.CreateCommand): class CreateIPsecPolicy(neutronv20.CreateCommand):
"""Create an ipsecpolicy.""" """Create an ipsecpolicy."""
resource = 'ipsecpolicy' resource = 'ipsecpolicy'
log = logging.getLogger(__name__ + '.CreateIPsecPolicy')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -111,7 +106,6 @@ class UpdateIPsecPolicy(neutronv20.UpdateCommand):
"""Update a given ipsec policy.""" """Update a given ipsec policy."""
resource = 'ipsecpolicy' resource = 'ipsecpolicy'
log = logging.getLogger(__name__ + '.UpdateIPsecPolicy')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -134,4 +128,3 @@ class DeleteIPsecPolicy(neutronv20.DeleteCommand):
"""Delete a given ipsecpolicy.""" """Delete a given ipsecpolicy."""
resource = 'ipsecpolicy' resource = 'ipsecpolicy'
log = logging.getLogger(__name__ + '.DeleteIPsecPolicy')

View File

@@ -16,8 +16,6 @@
# @author: Swaminathan Vasudevan, Hewlett-Packard. # @author: Swaminathan Vasudevan, Hewlett-Packard.
# #
import logging
from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.openstack.common.gettextutils import _ from neutronclient.openstack.common.gettextutils import _
@@ -26,7 +24,6 @@ class ListVPNService(neutronv20.ListCommand):
"""List VPNService configurations that belong to a given tenant.""" """List VPNService configurations that belong to a given tenant."""
resource = 'vpnservice' resource = 'vpnservice'
log = logging.getLogger(__name__ + '.ListVPNService')
list_columns = [ list_columns = [
'id', 'name', 'router_id', 'status' 'id', 'name', 'router_id', 'status'
] ]
@@ -39,13 +36,11 @@ class ShowVPNService(neutronv20.ShowCommand):
"""Show information of a given VPNService.""" """Show information of a given VPNService."""
resource = 'vpnservice' resource = 'vpnservice'
log = logging.getLogger(__name__ + '.ShowVPNService')
class CreateVPNService(neutronv20.CreateCommand): class CreateVPNService(neutronv20.CreateCommand):
"""Create a VPNService.""" """Create a VPNService."""
resource = 'vpnservice' resource = 'vpnservice'
log = logging.getLogger(__name__ + '.CreateVPNService')
def add_known_arguments(self, parser): def add_known_arguments(self, parser):
parser.add_argument( parser.add_argument(
@@ -87,11 +82,9 @@ class UpdateVPNService(neutronv20.UpdateCommand):
"""Update a given VPNService.""" """Update a given VPNService."""
resource = 'vpnservice' resource = 'vpnservice'
log = logging.getLogger(__name__ + '.UpdateVPNService')
class DeleteVPNService(neutronv20.DeleteCommand): class DeleteVPNService(neutronv20.DeleteCommand):
"""Delete a given VPNService.""" """Delete a given VPNService."""
resource = 'vpnservice' resource = 'vpnservice'
log = logging.getLogger(__name__ + '.DeleteVPNService')

View File

@@ -0,0 +1,43 @@
# Copyright 2013 Intel
# Copyright 2013 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# 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.
#
# @author: Isaku Yamahata, Intel
import logging
import testtools
from testtools import helpers
from neutronclient.neutron import v2_0 as neutronV20
class TestCommandMeta(testtools.TestCase):
def test_neutron_command_meta_defines_log(self):
class FakeCommand(neutronV20.NeutronCommand):
pass
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass())
self.assertEqual(FakeCommand.log.name, __name__ + ".FakeCommand")
def test_neutron_command_log_defined_explicitly(self):
class FakeCommand(neutronV20.NeutronCommand):
log = None
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertIsNone(FakeCommand.log)