mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-04-27 06:20:02 +00:00
feat(get_iface): add type information in response
This commit is contained in:
parent
ea2856289a
commit
bab173ee52
@ -324,17 +324,19 @@ async def get_iface(link: Link = Depends(dep_link)) -> dict[str, schemas.UdpPort
|
|||||||
port_type = port.get("type", "")
|
port_type = port.get("type", "")
|
||||||
if "udp" in port_type.lower():
|
if "udp" in port_type.lower():
|
||||||
ifaces_info[node.id] = {
|
ifaces_info[node.id] = {
|
||||||
|
"type": f"{port_type}",
|
||||||
"rhost": port["rhost"],
|
"rhost": port["rhost"],
|
||||||
"lport": port["lport"],
|
"lport": port["lport"],
|
||||||
"rport": port["rport"],
|
"rport": port["rport"],
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
ifaces_info[node.id] = {
|
ifaces_info[node.id] = {
|
||||||
|
"type": f"{port_type}",
|
||||||
"interface": port["interface"],
|
"interface": port["interface"],
|
||||||
}
|
}
|
||||||
|
|
||||||
if not ifaces_info:
|
if not ifaces_info:
|
||||||
raise ControllerError(
|
raise ControllerError(
|
||||||
"Link not connected to Cloud/NAT with UDP tunnel"
|
"Link not connected to Cloud/NAT"
|
||||||
)
|
)
|
||||||
return ifaces_info
|
return ifaces_info
|
||||||
|
@ -102,6 +102,7 @@ class UdpPort(BaseModel):
|
|||||||
lport: int
|
lport: int
|
||||||
rhost: str
|
rhost: str
|
||||||
rport: int
|
rport: int
|
||||||
|
type: str
|
||||||
|
|
||||||
|
|
||||||
class EthernetPort(BaseModel):
|
class EthernetPort(BaseModel):
|
||||||
@ -110,3 +111,4 @@ class EthernetPort(BaseModel):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
interface: str
|
interface: str
|
||||||
|
type: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user