Exemple #1
0
#    under the License.

import sys

from oslo.config import cfg

from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.debug import debug_agent
from neutron.openstack.common import importutils
from neutronclient.common import exceptions as exc
from neutronclient.common import utils
from neutronclient import shell

COMMAND_V2 = {
    'probe-create': utils.import_class('neutron.debug.commands.CreateProbe'),
    'probe-delete': utils.import_class('neutron.debug.commands.DeleteProbe'),
    'probe-list': utils.import_class('neutron.debug.commands.ListProbe'),
    'probe-clear': utils.import_class('neutron.debug.commands.ClearProbe'),
    'probe-exec': utils.import_class('neutron.debug.commands.ExecProbe'),
    'ping-all': utils.import_class('neutron.debug.commands.PingAll'),
    #TODO(nati)  ping, netcat , nmap, bench
}
COMMANDS = {'2.0': COMMAND_V2}


class NeutronDebugShell(shell.NeutronShell):
    def __init__(self, api_version):
        super(NeutronDebugShell, self).__init__(api_version)
        for k, v in COMMANDS[api_version].items():
            self.command_manager.add_command(k, v)
 def test_import_class(self):
     dt = utils.import_class('datetime.datetime')
     self.assertTrue(sys.modules['datetime'].datetime is dt)
 def test_import_class(self):
     dt = utils.import_class('datetime.datetime')
     self.assertTrue(sys.modules['datetime'].datetime is dt)
Exemple #4
0
#    under the License.

import sys

from oslo.config import cfg

from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.debug import debug_agent
from neutron.openstack.common import importutils
from neutronclient.common import exceptions as exc
from neutronclient.common import utils
from neutronclient import shell

COMMAND_V2 = {
    'probe-create': utils.import_class(
        'neutron.debug.commands.CreateProbe'),
    'probe-delete': utils.import_class(
        'neutron.debug.commands.DeleteProbe'),
    'probe-list': utils.import_class(
        'neutron.debug.commands.ListProbe'),
    'probe-clear': utils.import_class(
        'neutron.debug.commands.ClearProbe'),
    'probe-exec': utils.import_class(
        'neutron.debug.commands.ExecProbe'),
    'ping-all': utils.import_class(
        'neutron.debug.commands.PingAll'),
    #TODO(nati)  ping, netcat , nmap, bench
}
COMMANDS = {'2.0': COMMAND_V2}

 def test_import_class(self):
     dt = utils.import_class("datetime.datetime")
     self.assertTrue(sys.modules["datetime"].datetime is dt)