mirror of
https://github.com/Telecominfraproject/oopt-tai.git
synced 2026-01-27 10:22:03 +00:00
taish: support starting shell mode with specified module/netif/hostif
$ taish --module 2 --netif 0 module(2)/netif(0)> Signed-off-by: Wataru Ishida <ishida@nel-america.com>
This commit is contained in:
committed by
Wataru Ishida
parent
99385ad110
commit
4cf80b8e45
@@ -226,14 +226,10 @@ class TAIShellCompleter(Completer):
|
||||
return
|
||||
|
||||
|
||||
def loop(stub, modules):
|
||||
def loop(stub, modules, module, netif, hostif):
|
||||
|
||||
module = None
|
||||
netif = None
|
||||
hostif = None
|
||||
session = PromptSession()
|
||||
|
||||
|
||||
while True:
|
||||
p = "> "
|
||||
if module:
|
||||
@@ -338,39 +334,41 @@ def main():
|
||||
print('specify a reachable host by using --addr option')
|
||||
sys.exit(1)
|
||||
|
||||
if len(args) == 0:
|
||||
loop(stub, modules)
|
||||
|
||||
if args[0] == 'list':
|
||||
show_modules(modules)
|
||||
return
|
||||
|
||||
if options.module == None:
|
||||
options.module = list(modules.keys())[0]
|
||||
|
||||
if options.module not in modules:
|
||||
print('no module whose location is {}'.format(options.module))
|
||||
return
|
||||
module = modules[options.module]
|
||||
module = None
|
||||
if options.module != None:
|
||||
if options.module not in modules:
|
||||
print('no module whose location is {}'.format(options.module))
|
||||
return
|
||||
module = modules[options.module]
|
||||
|
||||
if options.netif != None and options.hostif != None:
|
||||
print('can\'t specify both netif and hostif')
|
||||
return
|
||||
|
||||
netif = None
|
||||
if options.netif != None:
|
||||
if module != None and options.netif != None:
|
||||
if len(module.netifs) <= options.netif:
|
||||
print('invalid index: len: {}'.format(len(module.netifs)))
|
||||
return
|
||||
netif = module.netifs[options.netif]
|
||||
|
||||
hostif = None
|
||||
if options.hostif != None:
|
||||
if module != None and options.hostif != None:
|
||||
if len(module.hostifs) <= options.hostif:
|
||||
print('invalid index: len: {}'.format(len(module.hostifs)))
|
||||
return
|
||||
hostif = module.hostifs[options.hostif]
|
||||
|
||||
if len(args) == 0:
|
||||
loop(stub, modules, module, netif, hostif)
|
||||
|
||||
if args[0] == 'list':
|
||||
show_modules(modules)
|
||||
return
|
||||
|
||||
if module == None:
|
||||
module = modules.values()[0]
|
||||
|
||||
if args[0] == 'list-attr':
|
||||
list_attr(stub, module, netif, hostif)
|
||||
elif args[0] == 'get':
|
||||
|
||||
Reference in New Issue
Block a user