rpc: Rename get_interfaces to net_get_interfaces
Change-Id: I137901db9ec2d8f2a85b8e22fc7005081fafb032 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468678 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
89bb6b0eb4
commit
4d62a7cc1f
@ -241,7 +241,7 @@ Example response:
|
||||
"start_subsystem_init",
|
||||
"get_rpc_methods",
|
||||
"get_scsi_devices",
|
||||
"get_interfaces",
|
||||
"net_get_interfaces",
|
||||
"delete_ip_address",
|
||||
"net_interface_add_ip_address",
|
||||
"nbd_get_disks",
|
||||
|
@ -144,8 +144,8 @@ SPDK_RPC_REGISTER("net_interface_delete_ip_address", spdk_rpc_net_interface_dele
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(net_interface_delete_ip_address, delete_ip_address)
|
||||
|
||||
static void
|
||||
spdk_rpc_get_interfaces(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
spdk_rpc_net_get_interfaces(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct spdk_json_write_ctx *w;
|
||||
TAILQ_HEAD(, spdk_interface) *interface_head = spdk_interface_get_list();
|
||||
@ -156,7 +156,7 @@ spdk_rpc_get_interfaces(struct spdk_jsonrpc_request *request,
|
||||
|
||||
if (params != NULL) {
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"get_interfaces requires no parameters");
|
||||
"net_get_interfaces requires no parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -184,6 +184,7 @@ spdk_rpc_get_interfaces(struct spdk_jsonrpc_request *request,
|
||||
|
||||
spdk_jsonrpc_end_result(request, w);
|
||||
}
|
||||
SPDK_RPC_REGISTER("get_interfaces", spdk_rpc_get_interfaces, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER("net_get_interfaces", spdk_rpc_net_get_interfaces, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(net_get_interfaces, get_interfaces)
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("net", SPDK_LOG_NET)
|
||||
|
@ -1526,12 +1526,12 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.add_argument('ip_addr', help='ip address will be deleted.')
|
||||
p.set_defaults(func=net_interface_delete_ip_address)
|
||||
|
||||
def get_interfaces(args):
|
||||
print_dict(rpc.net.get_interfaces(args.client))
|
||||
def net_get_interfaces(args):
|
||||
print_dict(rpc.net.net_get_interfaces(args.client))
|
||||
|
||||
p = subparsers.add_parser(
|
||||
'get_interfaces', help='Display current interface list')
|
||||
p.set_defaults(func=get_interfaces)
|
||||
'net_get_interfaces', aliases=['get_interfaces'], help='Display current interface list')
|
||||
p.set_defaults(func=net_get_interfaces)
|
||||
|
||||
# NVMe-oF
|
||||
def set_nvmf_target_max_subsystems(args):
|
||||
|
@ -25,10 +25,11 @@ def net_interface_delete_ip_address(client, ifc_index, ip_addr):
|
||||
return client.call('net_interface_delete_ip_address', params)
|
||||
|
||||
|
||||
def get_interfaces(client):
|
||||
@deprecated_alias('get_interfaces')
|
||||
def net_get_interfaces(client):
|
||||
"""Display current interface list
|
||||
|
||||
Returns:
|
||||
List of current interface
|
||||
"""
|
||||
return client.call('get_interfaces')
|
||||
return client.call('net_get_interfaces')
|
||||
|
@ -194,7 +194,7 @@ def verify_portal_groups_rpc_methods(rpc_py, rpc_param):
|
||||
"iscsi_get_portal_groups returned {} groups, expected empty".format(jsonvalues))
|
||||
|
||||
lo_ip = (target_ip, other_ip)
|
||||
nics = json.loads(rpc.get_interfaces())
|
||||
nics = json.loads(rpc.net_get_interfaces())
|
||||
for x in nics:
|
||||
if x["ifc_index"] == 'lo':
|
||||
rpc.net_interface_add_ip_address(x["ifc_index"], lo_ip[1])
|
||||
@ -401,20 +401,20 @@ def verify_target_nodes_rpc_methods(rpc_py, rpc_param):
|
||||
print("verify_target_nodes_rpc_methods passed.")
|
||||
|
||||
|
||||
def verify_get_interfaces(rpc_py):
|
||||
def verify_net_get_interfaces(rpc_py):
|
||||
rpc = spdk_rpc(rpc_py)
|
||||
nics = json.loads(rpc.get_interfaces())
|
||||
nics = json.loads(rpc.net_get_interfaces())
|
||||
nics_names = set(x["name"] for x in nics)
|
||||
# parse ip link show to verify the get_interfaces result
|
||||
# parse ip link show to verify the net_get_interfaces result
|
||||
ip_show = ns_cmd + " ip link show"
|
||||
ifcfg_nics = set(re.findall(r'\S+:\s(\S+?)(?:@\S+){0,1}:\s<.*', check_output(ip_show.split()).decode()))
|
||||
verify(nics_names == ifcfg_nics, 1, "get_interfaces returned {}".format(nics))
|
||||
print("verify_get_interfaces passed.")
|
||||
verify(nics_names == ifcfg_nics, 1, "net_get_interfaces returned {}".format(nics))
|
||||
print("verify_net_get_interfaces passed.")
|
||||
|
||||
|
||||
def help_get_interface_ip_list(rpc_py, nic_name):
|
||||
rpc = spdk_rpc(rpc_py)
|
||||
nics = json.loads(rpc.get_interfaces())
|
||||
nics = json.loads(rpc.net_get_interfaces())
|
||||
nic = list([x for x in nics if x["name"] == nic_name])
|
||||
verify(len(nic) != 0, 1,
|
||||
"Nic name: {} is not found in {}".format(nic_name, [x["name"] for x in nics]))
|
||||
@ -423,7 +423,7 @@ def help_get_interface_ip_list(rpc_py, nic_name):
|
||||
|
||||
def verify_net_interface_add_delete_ip_address(rpc_py):
|
||||
rpc = spdk_rpc(rpc_py)
|
||||
nics = json.loads(rpc.get_interfaces())
|
||||
nics = json.loads(rpc.net_get_interfaces())
|
||||
# add ip on up to first 2 nics
|
||||
for x in nics[:2]:
|
||||
faked_ip = "123.123.{}.{}".format(random.randint(1, 254), random.randint(1, 254))
|
||||
@ -485,7 +485,7 @@ if __name__ == "__main__":
|
||||
|
||||
try:
|
||||
verify_log_flag_rpc_methods(rpc_py, rpc_param)
|
||||
verify_get_interfaces(rpc_py)
|
||||
verify_net_get_interfaces(rpc_py)
|
||||
# Add/delete IP will not be supported in VPP.
|
||||
# It has separate vppctl utility for that.
|
||||
if test_type == 'posix':
|
||||
|
Loading…
Reference in New Issue
Block a user