mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
copilot: prefer netmiko_device_type over the device_type:<type> tag
The vendored gns3fy Node model and its nodes_inventory() now carry the node's netmiko_device_type field, and get_device_ports_from_topology() resolves the Netmiko device type from it first, falling back to the device_type:<type> tag. Nodes created from a template inherit the value from the template automatically, so automation tooling gets the correct Netmiko driver without tags.
This commit is contained in:
3 files changed
+101
-9
No files matched your search
@@ -535,6 +535,8 @@ class Gns3Connector:
|
||||
|
||||
- `tags` (list): List of tags for the template (e.g.,
|
||||
["device_type:cisco_ios_telnet", "platform:cisco_ios"])
|
||||
- `netmiko_device_type` (str): Netmiko device type (e.g. "cisco_ios_telnet");
|
||||
preferred over the device_type:<type> tag
|
||||
- Any other template attributes supported by GNS3 API
|
||||
"""
|
||||
# Get existing template
|
||||
@@ -571,6 +573,8 @@ class Gns3Connector:
|
||||
|
||||
- `tags` (list): List of tags for the template (e.g.,
|
||||
["device_type:cisco_ios_telnet", "platform:cisco_ios"])
|
||||
- `netmiko_device_type` (str): Netmiko device type (e.g. "cisco_ios_telnet");
|
||||
preferred over the device_type:<type> tag
|
||||
- Any other template attributes supported by GNS3 API
|
||||
|
||||
**Example:**
|
||||
@@ -579,7 +583,8 @@ class Gns3Connector:
|
||||
>>> connector.create_template(
|
||||
... name="cisco_router",
|
||||
... template_type="dynamips",
|
||||
... tags=["device_type:cisco_ios_telnet", "platform:cisco_ios"]
|
||||
... tags=["device_type:cisco_ios_telnet", "platform:cisco_ios"],
|
||||
... netmiko_device_type="cisco_ios_telnet"
|
||||
... )
|
||||
```
|
||||
"""
|
||||
@@ -1366,6 +1371,7 @@ class Node:
|
||||
template_id: str | None = None
|
||||
properties: Any | None = None
|
||||
tags: list[str] | None = None
|
||||
netmiko_device_type: str | None = None
|
||||
|
||||
template: str | None = None
|
||||
links: list[Link] = field(default_factory=list, repr=False)
|
||||
@@ -2482,6 +2488,7 @@ class Project:
|
||||
"x": _n.x,
|
||||
"y": _n.y,
|
||||
"tags": _n.tags if _n.tags else [],
|
||||
"netmiko_device_type": _n.netmiko_device_type,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user