scripts/rpc.py: pass named args to log.py and net.py
Change-Id: I299b147a644f19d63f4e3d9acc431367e6849f65 Signed-off-by: heluwei <simple_hlw@163.com> Reviewed-on: https://review.gerrithub.io/419637 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1cfff49fe9
commit
66a91a0498
@ -825,7 +825,7 @@ if __name__ == "__main__":
|
||||
# log
|
||||
@call_cmd
|
||||
def set_trace_flag(args):
|
||||
rpc.log.set_trace_flag(args.client, args)
|
||||
rpc.log.set_trace_flag(args.client, flag=args.flag)
|
||||
|
||||
p = subparsers.add_parser('set_trace_flag', help='set trace flag')
|
||||
p.add_argument(
|
||||
@ -834,7 +834,7 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def clear_trace_flag(args):
|
||||
rpc.log.clear_trace_flag(args.client, args)
|
||||
rpc.log.clear_trace_flag(args.client, flag=args.flag)
|
||||
|
||||
p = subparsers.add_parser('clear_trace_flag', help='clear trace flag')
|
||||
p.add_argument(
|
||||
@ -843,14 +843,14 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def get_trace_flags(args):
|
||||
print_dict(rpc.log.get_trace_flags(args.client, args))
|
||||
print_dict(rpc.log.get_trace_flags(args.client))
|
||||
|
||||
p = subparsers.add_parser('get_trace_flags', help='get trace flags')
|
||||
p.set_defaults(func=get_trace_flags)
|
||||
|
||||
@call_cmd
|
||||
def set_log_level(args):
|
||||
rpc.log.set_log_level(args.client, args)
|
||||
rpc.log.set_log_level(args.client, level=args.level)
|
||||
|
||||
p = subparsers.add_parser('set_log_level', help='set log level')
|
||||
p.add_argument('level', help='log level we want to set. (for example "DEBUG").')
|
||||
@ -858,14 +858,14 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def get_log_level(args):
|
||||
print_dict(rpc.log.get_log_level(args.client, args))
|
||||
print_dict(rpc.log.get_log_level(args.client))
|
||||
|
||||
p = subparsers.add_parser('get_log_level', help='get log level')
|
||||
p.set_defaults(func=get_log_level)
|
||||
|
||||
@call_cmd
|
||||
def set_log_print_level(args):
|
||||
rpc.log.set_log_print_level(args.client, args)
|
||||
rpc.log.set_log_print_level(args.client, level=args.level)
|
||||
|
||||
p = subparsers.add_parser('set_log_print_level', help='set log print level')
|
||||
p.add_argument('level', help='log print level we want to set. (for example "DEBUG").')
|
||||
@ -873,7 +873,7 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def get_log_print_level(args):
|
||||
print_dict(rpc.log.get_log_print_level(args.client, args))
|
||||
print_dict(rpc.log.get_log_print_level(args.client))
|
||||
|
||||
p = subparsers.add_parser('get_log_print_level', help='get log print level')
|
||||
p.set_defaults(func=get_log_print_level)
|
||||
@ -1111,7 +1111,7 @@ if __name__ == "__main__":
|
||||
# net
|
||||
@call_cmd
|
||||
def add_ip_address(args):
|
||||
rpc.net.add_ip_address(args.client, args)
|
||||
rpc.net.add_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
||||
|
||||
p = subparsers.add_parser('add_ip_address', help='Add IP address')
|
||||
p.add_argument('ifc_index', help='ifc index of the nic device.', type=int)
|
||||
@ -1120,7 +1120,7 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def delete_ip_address(args):
|
||||
rpc.net.delete_ip_address(args.client, args)
|
||||
rpc.net.delete_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
||||
|
||||
p = subparsers.add_parser('delete_ip_address', help='Delete IP address')
|
||||
p.add_argument('ifc_index', help='ifc index of the nic device.', type=int)
|
||||
@ -1129,7 +1129,7 @@ if __name__ == "__main__":
|
||||
|
||||
@call_cmd
|
||||
def get_interfaces(args):
|
||||
print_dict(rpc.net.get_interfaces(args.client, args))
|
||||
print_dict(rpc.net.get_interfaces(args.client))
|
||||
|
||||
p = subparsers.add_parser(
|
||||
'get_interfaces', help='Display current interface list')
|
||||
|
@ -1,30 +1,65 @@
|
||||
def set_trace_flag(client, args):
|
||||
params = {'flag': args.flag}
|
||||
def set_trace_flag(client, flag):
|
||||
"""Set trace flag.
|
||||
|
||||
Args:
|
||||
flag: trace mask we want to set. (for example "nvme")
|
||||
"""
|
||||
params = {'flag': flag}
|
||||
return client.call('set_trace_flag', params)
|
||||
|
||||
|
||||
def clear_trace_flag(client, args):
|
||||
params = {'flag': args.flag}
|
||||
def clear_trace_flag(client, flag):
|
||||
"""Clear trace flag.
|
||||
|
||||
Args:
|
||||
flag: trace mask we want to clear. (for example "nvme")
|
||||
"""
|
||||
params = {'flag': flag}
|
||||
return client.call('clear_trace_flag', params)
|
||||
|
||||
|
||||
def get_trace_flags(client, args):
|
||||
def get_trace_flags(client):
|
||||
"""Get trace flags
|
||||
|
||||
Returns:
|
||||
List of trace flag
|
||||
"""
|
||||
return client.call('get_trace_flags')
|
||||
|
||||
|
||||
def set_log_level(client, args):
|
||||
params = {'level': args.level}
|
||||
def set_log_level(client, level):
|
||||
"""Set log level.
|
||||
|
||||
Args:
|
||||
level: log level we want to set. (for example "DEBUG")
|
||||
"""
|
||||
params = {'level': level}
|
||||
return client.call('set_log_level', params)
|
||||
|
||||
|
||||
def get_log_level(client, args):
|
||||
def get_log_level(client):
|
||||
"""Get log level
|
||||
|
||||
Returns:
|
||||
Current log level
|
||||
"""
|
||||
return client.call('get_log_level')
|
||||
|
||||
|
||||
def set_log_print_level(client, args):
|
||||
params = {'level': args.level}
|
||||
def set_log_print_level(client, level):
|
||||
"""Set log print level.
|
||||
|
||||
Args:
|
||||
level: log print level we want to set. (for example "DEBUG")
|
||||
"""
|
||||
params = {'level': level}
|
||||
return client.call('set_log_print_level', params)
|
||||
|
||||
|
||||
def get_log_print_level(client, args):
|
||||
def get_log_print_level(client):
|
||||
"""Get log print level
|
||||
|
||||
Returns:
|
||||
Current log print level
|
||||
"""
|
||||
return client.call('get_log_print_level')
|
||||
|
@ -1,12 +1,29 @@
|
||||
def add_ip_address(client, args):
|
||||
params = {'ifc_index': args.ifc_index, 'ip_address': args.ip_addr}
|
||||
def add_ip_address(client, ifc_index, ip_addr):
|
||||
"""Add IP address.
|
||||
|
||||
Args:
|
||||
ifc_index: ifc index of the nic device (int)
|
||||
ip_addr: ip address will be added
|
||||
"""
|
||||
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
||||
return client.call('add_ip_address', params)
|
||||
|
||||
|
||||
def delete_ip_address(client, args):
|
||||
params = {'ifc_index': args.ifc_index, 'ip_address': args.ip_addr}
|
||||
def delete_ip_address(client, ifc_index, ip_addr):
|
||||
"""Delete IP address.
|
||||
|
||||
Args:
|
||||
ifc_index: ifc index of the nic device (int)
|
||||
ip_addr: ip address will be deleted
|
||||
"""
|
||||
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
||||
return client.call('delete_ip_address', params)
|
||||
|
||||
|
||||
def get_interfaces(client, args):
|
||||
def get_interfaces(client):
|
||||
"""Display current interface list
|
||||
|
||||
Returns:
|
||||
List of current interface
|
||||
"""
|
||||
return client.call('get_interfaces')
|
||||
|
Loading…
x
Reference in New Issue
Block a user