Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interface and related functions renaming #472

Merged
merged 13 commits into from
Jun 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
initial sweeping changes to call all usages of various interface rela…
…ted variables and functions (netif, interface, if, ifc, etc) to use a consistent name iface
bharnden committed Jun 16, 2020
commit 0725199d6d2f9f5420628201861e0e78b64bd4b7
72 changes: 36 additions & 36 deletions daemon/core/api/grpc/client.py
Original file line number Diff line number Diff line change
@@ -110,27 +110,27 @@ def __init__(self, ip4_prefix: str = None, ip6_prefix: str = None) -> None:
"""
self.prefixes: IpPrefixes = IpPrefixes(ip4_prefix, ip6_prefix)

def create_interface(
self, node_id: int, interface_id: int, name: str = None, mac: str = None
def create_iface(
self, node_id: int, iface_id: int, name: str = None, mac: str = None
) -> core_pb2.Interface:
"""
Create an interface protobuf object.

:param node_id: node id to create interface for
:param interface_id: interface id
:param iface_id: interface id
:param name: name of interface
:param mac: mac address for interface
:return: interface protobuf
"""
interface_data = self.prefixes.gen_interface(node_id, name, mac)
iface_data = self.prefixes.gen_iface(node_id, name, mac)
return core_pb2.Interface(
id=interface_id,
name=interface_data.name,
ip4=interface_data.ip4,
ip4mask=interface_data.ip4_mask,
ip6=interface_data.ip6,
ip6mask=interface_data.ip6_mask,
mac=interface_data.mac,
id=iface_id,
name=iface_data.name,
ip4=iface_data.ip4,
ip4mask=iface_data.ip4_mask,
ip6=iface_data.ip6,
ip6mask=iface_data.ip6_mask,
mac=iface_data.mac,
)


@@ -611,8 +611,8 @@ def add_link(
session_id: int,
node1_id: int,
node2_id: int,
interface1: core_pb2.Interface = None,
interface2: core_pb2.Interface = None,
iface1: core_pb2.Interface = None,
iface2: core_pb2.Interface = None,
options: core_pb2.LinkOptions = None,
) -> core_pb2.AddLinkResponse:
"""
@@ -621,8 +621,8 @@ def add_link(
:param session_id: session id
:param node1_id: node one id
:param node2_id: node two id
:param interface1: node one interface data
:param interface2: node two interface data
:param iface1: node one interface data
:param iface2: node two interface data
:param options: options for link (jitter, bandwidth, etc)
:return: response with result of success or failure
:raises grpc.RpcError: when session or one of the nodes don't exist
@@ -631,8 +631,8 @@ def add_link(
node1_id=node1_id,
node2_id=node2_id,
type=core_pb2.LinkType.WIRED,
interface1=interface1,
interface2=interface2,
iface1=iface1,
iface2=iface2,
options=options,
)
request = core_pb2.AddLinkRequest(session_id=session_id, link=link)
@@ -644,8 +644,8 @@ def edit_link(
node1_id: int,
node2_id: int,
options: core_pb2.LinkOptions,
interface1_id: int = None,
interface2_id: int = None,
iface1_id: int = None,
iface2_id: int = None,
) -> core_pb2.EditLinkResponse:
"""
Edit a link between nodes.
@@ -654,8 +654,8 @@ def edit_link(
:param node1_id: node one id
:param node2_id: node two id
:param options: options for link (jitter, bandwidth, etc)
:param interface1_id: node one interface id
:param interface2_id: node two interface id
:param iface1_id: node one interface id
:param iface2_id: node two interface id
:return: response with result of success or failure
:raises grpc.RpcError: when session or one of the nodes don't exist
"""
@@ -664,8 +664,8 @@ def edit_link(
node1_id=node1_id,
node2_id=node2_id,
options=options,
interface1_id=interface1_id,
interface2_id=interface2_id,
iface1_id=iface1_id,
iface2_id=iface2_id,
)
return self.stub.EditLink(request)

@@ -674,26 +674,26 @@ def delete_link(
session_id: int,
node1_id: int,
node2_id: int,
interface1_id: int = None,
interface2_id: int = None,
iface1_id: int = None,
iface2_id: int = None,
) -> core_pb2.DeleteLinkResponse:
"""
Delete a link between nodes.

:param session_id: session id
:param node1_id: node one id
:param node2_id: node two id
:param interface1_id: node one interface id
:param interface2_id: node two interface id
:param iface1_id: node one interface id
:param iface2_id: node two interface id
:return: response with result of success or failure
:raises grpc.RpcError: when session doesn't exist
"""
request = core_pb2.DeleteLinkRequest(
session_id=session_id,
node1_id=node1_id,
node2_id=node2_id,
interface1_id=interface1_id,
interface2_id=interface2_id,
iface1_id=iface1_id,
iface2_id=iface2_id,
)
return self.stub.DeleteLink(request)

@@ -1028,20 +1028,20 @@ def get_emane_models(self, session_id: int) -> GetEmaneModelsResponse:
return self.stub.GetEmaneModels(request)

def get_emane_model_config(
self, session_id: int, node_id: int, model: str, interface_id: int = -1
self, session_id: int, node_id: int, model: str, iface_id: int = -1
) -> GetEmaneModelConfigResponse:
"""
Get emane model configuration for a node or a node's interface.

:param session_id: session id
:param node_id: node id
:param model: emane model name
:param interface_id: node interface id
:param iface_id: node interface id
:return: response with a list of configuration groups
:raises grpc.RpcError: when session doesn't exist
"""
request = GetEmaneModelConfigRequest(
session_id=session_id, node_id=node_id, model=model, interface=interface_id
session_id=session_id, node_id=node_id, model=model, iface_id=iface_id
)
return self.stub.GetEmaneModelConfig(request)

@@ -1051,7 +1051,7 @@ def set_emane_model_config(
node_id: int,
model: str,
config: Dict[str, str] = None,
interface_id: int = -1,
iface_id: int = -1,
) -> SetEmaneModelConfigResponse:
"""
Set emane model configuration for a node or a node's interface.
@@ -1060,12 +1060,12 @@ def set_emane_model_config(
:param node_id: node id
:param model: emane model name
:param config: emane model configuration
:param interface_id: node interface id
:param iface_id: node interface id
:return: response with result of success or failure
:raises grpc.RpcError: when session doesn't exist
"""
model_config = EmaneModelConfig(
node_id=node_id, model=model, config=config, interface_id=interface_id
node_id=node_id, model=model, config=config, iface_id=iface_id
)
request = SetEmaneModelConfigRequest(
session_id=session_id, emane_model_config=model_config
@@ -1128,7 +1128,7 @@ def emane_link(
)
return self.stub.EmaneLink(request)

def get_interfaces(self) -> core_pb2.GetInterfacesResponse:
def get_ifaces(self) -> core_pb2.GetInterfacesResponse:
"""
Retrieves a list of interfaces available on the host machine that are not
a part of a CORE session.
2 changes: 1 addition & 1 deletion daemon/core/api/grpc/events.py
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ def handle_config_event(event: ConfigData) -> core_pb2.ConfigEvent:
data_values=event.data_values,
possible_values=event.possible_values,
groups=event.groups,
interface=event.interface_number,
iface_id=event.iface_id,
network_id=event.network_id,
opaque=event.opaque,
data_types=event.data_types,
Loading