Bug 891705
Fix to change reference to the Quantum CLI from within the Cisco extensions' CLI module Removed "tools" from the PYTHONPATH Change-Id: Icbd3800668219d16fc33a25da9170e9ec7fb6ddb
This commit is contained in:
@@ -269,7 +269,7 @@ and value should be used.
|
|||||||
|
|
||||||
The corresponding CLI for this operation is as follows:
|
The corresponding CLI for this operation is as follows:
|
||||||
|
|
||||||
PYTHONPATH=. python quantum/plugins/cisco/client/cli.py create_multiport <tenant_id> <net_id1,net_id2,...>
|
PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py create_multiport <tenant_id> <net_id1,net_id2,...>
|
||||||
|
|
||||||
(Note that you should not be using the create port core API in the above case.)
|
(Note that you should not be using the create port core API in the above case.)
|
||||||
|
|
||||||
@@ -282,18 +282,18 @@ to switch between different CLI modules (it internally invokes the Quantum
|
|||||||
CLI module for the core APIs to ensure consistency when using either). This
|
CLI module for the core APIs to ensure consistency when using either). This
|
||||||
command line client can be invoked as follows:
|
command line client can be invoked as follows:
|
||||||
|
|
||||||
PYTHONPATH=. python quantum/plugins/cisco/client/cli.py
|
PYTHONPATH=.:tools python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py
|
||||||
|
|
||||||
1. Creating the network
|
1. Creating the network
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py create_net -H 10.10.2.6 demo net1
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py create_net -H 10.10.2.6 demo net1
|
||||||
Created a new Virtual Network with ID: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
Created a new Virtual Network with ID: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
for Tenant demo
|
for Tenant demo
|
||||||
|
|
||||||
|
|
||||||
2. Listing the networks
|
2. Listing the networks
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py list_nets -H 10.10.2.6 demo
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py list_nets -H 10.10.2.6 demo
|
||||||
Virtual Networks for Tenant demo
|
Virtual Networks for Tenant demo
|
||||||
Network ID: 0e85e924-6ef6-40c1-9f7a-3520ac6888b3
|
Network ID: 0e85e924-6ef6-40c1-9f7a-3520ac6888b3
|
||||||
Network ID: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
Network ID: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
@@ -301,13 +301,13 @@ Virtual Networks for Tenant demo
|
|||||||
|
|
||||||
3. Creating one port on each of the networks
|
3. Creating one port on each of the networks
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py create_multiport -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a,0e85e924-6ef6-40c1-9f7a-3520ac6888b3
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py create_multiport -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a,0e85e924-6ef6-40c1-9f7a-3520ac6888b3
|
||||||
Created ports: {u'ports': [{u'id': u'118ac473-294d-480e-8f6d-425acbbe81ae'}, {u'id': u'996e84b8-2ed3-40cf-be75-de17ff1214c4'}]}
|
Created ports: {u'ports': [{u'id': u'118ac473-294d-480e-8f6d-425acbbe81ae'}, {u'id': u'996e84b8-2ed3-40cf-be75-de17ff1214c4'}]}
|
||||||
|
|
||||||
|
|
||||||
4. List all the ports on a network
|
4. List all the ports on a network
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py list_ports -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py list_ports -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
Ports on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
Ports on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
for Tenant: demo
|
for Tenant: demo
|
||||||
Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
@@ -315,7 +315,7 @@ for Tenant: demo
|
|||||||
|
|
||||||
5. Show the details of a port
|
5. Show the details of a port
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py show_port -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py show_port -H 10.10.2.6 demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
Logical Port ID: 118ac473-294d-480e-8f6d-425acbbe81ae
|
Logical Port ID: 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
administrative State: ACTIVE
|
administrative State: ACTIVE
|
||||||
interface: <none>
|
interface: <none>
|
||||||
@@ -335,7 +335,7 @@ for Tenant: demo
|
|||||||
will be established only after the plug/attach operation is performed (as
|
will be established only after the plug/attach operation is performed (as
|
||||||
described in the next step).
|
described in the next step).
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py show_port demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py show_port demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
Logical Port ID: 118ac473-294d-480e-8f6d-425acbbe81ae
|
Logical Port ID: 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
administrative State: ACTIVE
|
administrative State: ACTIVE
|
||||||
interface: b73e3585-d074-4379-8dde-931c0fc4db0e(detached)
|
interface: b73e3585-d074-4379-8dde-931c0fc4db0e(detached)
|
||||||
@@ -347,7 +347,7 @@ for Tenant: demo
|
|||||||
Use the interface information obtained in step 6 to plug the interface into
|
Use the interface information obtained in step 6 to plug the interface into
|
||||||
the network.
|
the network.
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py plug_iface demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae b73e3585-d074-4379-8dde-931c0fc4db0e
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py plug_iface demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae b73e3585-d074-4379-8dde-931c0fc4db0e
|
||||||
Plugged interface b73e3585-d074-4379-8dde-931c0fc4db0e
|
Plugged interface b73e3585-d074-4379-8dde-931c0fc4db0e
|
||||||
into Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
into Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
@@ -356,7 +356,7 @@ for Tenant: demo
|
|||||||
|
|
||||||
8. Unplug an interface and port from the network
|
8. Unplug an interface and port from the network
|
||||||
|
|
||||||
# PYTHONPATH=. python quantum/plugins/cisco/client/cli.py unplug_iface demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
# PYTHONPATH=. python plugins/cisco-plugin/lib/quantum/plugins/cisco/client/cli.py unplug_iface demo c4a2bea7-a528-4caf-b16e-80397cd1663a 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
Unplugged interface from Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
Unplugged interface from Logical Port: 118ac473-294d-480e-8f6d-425acbbe81ae
|
||||||
on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
on Virtual Network: c4a2bea7-a528-4caf-b16e-80397cd1663a
|
||||||
for Tenant: demo
|
for Tenant: demo
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ import subprocess
|
|||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
from tools import source_environment
|
||||||
|
import quantum.cli as qcli
|
||||||
|
|
||||||
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||||
os.pardir,
|
os.pardir,
|
||||||
os.pardir))
|
os.pardir))
|
||||||
@@ -151,25 +154,8 @@ COMMANDS = {
|
|||||||
"args": ["tenant-id", "instance-id"]}, }
|
"args": ["tenant-id", "instance-id"]}, }
|
||||||
|
|
||||||
|
|
||||||
class _DynamicModule(object):
|
|
||||||
"""Loading a string as python module"""
|
|
||||||
def load(self, code):
|
|
||||||
execdict = {}
|
|
||||||
exec code in execdict
|
|
||||||
for key in execdict:
|
|
||||||
if not key.startswith('_'):
|
|
||||||
setattr(self, key, execdict[key])
|
|
||||||
|
|
||||||
|
|
||||||
import sys as _sys
|
|
||||||
_ref, _sys.modules[__name__] = _sys.modules[__name__], _DynamicModule()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import cli
|
import cli
|
||||||
FILE_NAME = os.path.join("bin/", "cli")
|
|
||||||
MODULE_CODE = open(FILE_NAME).read()
|
|
||||||
cli.load(MODULE_CODE)
|
|
||||||
usagestr = "Usage: %prog [OPTIONS] <command> [args]"
|
usagestr = "Usage: %prog [OPTIONS] <command> [args]"
|
||||||
PARSER = OptionParser(usage=usagestr)
|
PARSER = OptionParser(usage=usagestr)
|
||||||
PARSER.add_option("-H", "--host", dest="host",
|
PARSER.add_option("-H", "--host", dest="host",
|
||||||
@@ -197,18 +183,17 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
PARSER.print_help()
|
PARSER.print_help()
|
||||||
cli.help()
|
qcli.help()
|
||||||
help()
|
help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
CMD = args[0]
|
CMD = args[0]
|
||||||
if CMD in cli.commands.keys():
|
if CMD in qcli.commands.keys():
|
||||||
args.insert(0, FILE_NAME)
|
qcli.main()
|
||||||
subprocess.call(args)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if CMD not in COMMANDS.keys():
|
if CMD not in COMMANDS.keys():
|
||||||
LOG.error("Unknown command: %s" % CMD)
|
LOG.error("Unknown command: %s" % CMD)
|
||||||
cli.help()
|
qcli.help()
|
||||||
help()
|
help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user