grpc: updated Interface proto fields to be more consistent with code, ip4mask to ip4_mask, ip6mask to ip6_mask, netid to net_id, flowid to flow_id
This commit is contained in:
parent
351b99aae0
commit
a1734c3bc0
7 changed files with 40 additions and 35 deletions
|
@ -834,7 +834,12 @@ class CoreClient:
|
|||
iface_id = canvas_node.next_iface_id()
|
||||
name = f"eth{iface_id}"
|
||||
iface = core_pb2.Interface(
|
||||
id=iface_id, name=name, ip4=ip4, ip4mask=ip4_mask, ip6=ip6, ip6mask=ip6_mask
|
||||
id=iface_id,
|
||||
name=name,
|
||||
ip4=ip4,
|
||||
ip4_mask=ip4_mask,
|
||||
ip6=ip6,
|
||||
ip6_mask=ip6_mask,
|
||||
)
|
||||
logging.info(
|
||||
"create node(%s) interface(%s) IPv4(%s) IPv6(%s)",
|
||||
|
|
|
@ -248,7 +248,7 @@ class NodeConfigDialog(Dialog):
|
|||
label.grid(row=row, column=0, padx=PADX, pady=PADY)
|
||||
ip4_net = ""
|
||||
if iface.ip4:
|
||||
ip4_net = f"{iface.ip4}/{iface.ip4mask}"
|
||||
ip4_net = f"{iface.ip4}/{iface.ip4_mask}"
|
||||
ip4 = tk.StringVar(value=ip4_net)
|
||||
entry = ttk.Entry(tab, textvariable=ip4, state=state)
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky="ew")
|
||||
|
@ -258,7 +258,7 @@ class NodeConfigDialog(Dialog):
|
|||
label.grid(row=row, column=0, padx=PADX, pady=PADY)
|
||||
ip6_net = ""
|
||||
if iface.ip6:
|
||||
ip6_net = f"{iface.ip6}/{iface.ip6mask}"
|
||||
ip6_net = f"{iface.ip6}/{iface.ip6_mask}"
|
||||
ip6 = tk.StringVar(value=ip6_net)
|
||||
entry = ttk.Entry(tab, textvariable=ip6, state=state)
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky="ew")
|
||||
|
@ -318,12 +318,12 @@ class NodeConfigDialog(Dialog):
|
|||
error = True
|
||||
break
|
||||
if ip4_net:
|
||||
ip4, ip4mask = ip4_net.split("/")
|
||||
ip4mask = int(ip4mask)
|
||||
ip4, ip4_mask = ip4_net.split("/")
|
||||
ip4_mask = int(ip4_mask)
|
||||
else:
|
||||
ip4, ip4mask = "", 0
|
||||
ip4, ip4_mask = "", 0
|
||||
iface.ip4 = ip4
|
||||
iface.ip4mask = ip4mask
|
||||
iface.ip4_mask = ip4_mask
|
||||
|
||||
# validate ip6
|
||||
ip6_net = data.ip6.get()
|
||||
|
@ -331,12 +331,12 @@ class NodeConfigDialog(Dialog):
|
|||
error = True
|
||||
break
|
||||
if ip6_net:
|
||||
ip6, ip6mask = ip6_net.split("/")
|
||||
ip6mask = int(ip6mask)
|
||||
ip6, ip6_mask = ip6_net.split("/")
|
||||
ip6_mask = int(ip6_mask)
|
||||
else:
|
||||
ip6, ip6mask = "", 0
|
||||
ip6, ip6_mask = "", 0
|
||||
iface.ip6 = ip6
|
||||
iface.ip6mask = ip6mask
|
||||
iface.ip6_mask = ip6_mask
|
||||
|
||||
mac = data.mac.get()
|
||||
auto_mac = data.is_auto.get()
|
||||
|
|
|
@ -289,10 +289,10 @@ class CanvasEdge(Edge):
|
|||
label = f"{iface.name}"
|
||||
if iface.ip4 and self.canvas.show_ip4s.get():
|
||||
label = f"{label}\n" if label else ""
|
||||
label += f"{iface.ip4}/{iface.ip4mask}"
|
||||
label += f"{iface.ip4}/{iface.ip4_mask}"
|
||||
if iface.ip6 and self.canvas.show_ip6s.get():
|
||||
label = f"{label}\n" if label else ""
|
||||
label += f"{iface.ip6}/{iface.ip6mask}"
|
||||
label += f"{iface.ip6}/{iface.ip6_mask}"
|
||||
return label
|
||||
|
||||
def create_node_labels(self) -> Tuple[str, str]:
|
||||
|
|
|
@ -15,7 +15,7 @@ if TYPE_CHECKING:
|
|||
def get_index(iface: "core_pb2.Interface") -> Optional[int]:
|
||||
if not iface.ip4:
|
||||
return None
|
||||
net = netaddr.IPNetwork(f"{iface.ip4}/{iface.ip4mask}")
|
||||
net = netaddr.IPNetwork(f"{iface.ip4}/{iface.ip4_mask}")
|
||||
ip_value = net.value
|
||||
cidr_value = net.cidr.value
|
||||
return ip_value - cidr_value
|
||||
|
@ -153,10 +153,10 @@ class InterfaceManager:
|
|||
def get_subnets(self, iface: "core_pb2.Interface") -> Subnets:
|
||||
ip4_subnet = self.ip4_subnets
|
||||
if iface.ip4:
|
||||
ip4_subnet = IPNetwork(f"{iface.ip4}/{iface.ip4mask}").cidr
|
||||
ip4_subnet = IPNetwork(f"{iface.ip4}/{iface.ip4_mask}").cidr
|
||||
ip6_subnet = self.ip6_subnets
|
||||
if iface.ip6:
|
||||
ip6_subnet = IPNetwork(f"{iface.ip6}/{iface.ip6mask}").cidr
|
||||
ip6_subnet = IPNetwork(f"{iface.ip6}/{iface.ip6_mask}").cidr
|
||||
subnets = Subnets(ip4_subnet, ip6_subnet)
|
||||
return self.used_subnets.get(subnets.key(), subnets)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue