Conversation
|
Unsure if cml_utils.py line 72 works: documentation does not specify if link.node_a is an object or a string. Currently attempting to test this and will confirm if it works or not |
|
Tested all features of the module locally and all work as intended |
| x: | ||
| description: X coordinate on topology canvas | ||
| required: false | ||
| type: int | ||
|
|
||
| y: | ||
| description: Y coordinate on topology canvas | ||
| required: false | ||
| type: int | ||
|
|
||
| tags: | ||
| description: List of tags | ||
| required: false | ||
| type: list | ||
| elements: str | ||
|
|
||
| wait: | ||
| description: Wait for lab virtual machines to boot before continuing | ||
| required: false | ||
| type: bool | ||
| default: False |
There was a problem hiding this comment.
obsolete for this module, should be deleted
| tags=dict(type='list', elements='str'), | ||
| x=dict(type='int'), | ||
| y=dict(type='int'), | ||
| wait=dict(type='bool', default=False), |
There was a problem hiding this comment.
obsolete for this module, should be deleted
| cml.exit_json(**cml.result) | ||
| return | ||
|
|
||
| link = cml.get_link_by_nodes(lab, source_node, destination_node) |
There was a problem hiding this comment.
virl2-client node supports this natively:
link = source_node.get_link_to(destination_node) def get_link_to(self, other_node: Node) -> Link | None:
"""
Return one link between this node and another.
:param other_node: The other node.
:returns: A link between this node and the other node, if one exists.
"""
for link in self.links():
if other_node in link.nodes:
return link
return None| def get_link_by_nodes(self, lab, node1, node2): | ||
| for link in lab.links(): | ||
| if ((link.node_a.label == node1.label and link.node_b.label == node2.label) | ||
| or (link.node_b.label == node1.label and link.node_a.label == node2.label)): | ||
| return link | ||
| return None | ||
|
|
There was a problem hiding this comment.
obsolete as per other comment:
https://github.com/CiscoDevNet/ansible-cml/pull/27/files#r1877889843
|
I am working on adjusting this to support specifying interfaces for nodes by labels (or maybe even slots). |
Added cml_link_node.py with code to link two nodes together
supports create update delete, and nodes are specified using their name
three node names are supported to allow for an update feature (node1->node2, can update to node1->node3)
added get_link_by_nodes method in cml_utils to allow searching the lab for a link between two specified nodes