dmulyalin / n2g Goto Github PK
View Code? Open in Web Editor NEWNeed To Graph
License: MIT License
Need To Graph
License: MIT License
I am trying to send multiple lines of data to the src/dest labels.
for example,
Gi0/1
mgt
.251
I have tried trgt_label='Gi0/1\nMTU 1500\n.251' but it appears on the same line.
I think it can be supported - because I can manually add the carriage returns in draw.io after the graph has been drawn.
Any ideas?
It would be helpful to be able to assign layers while mapping out a diagram, like network and end devices so you can filter the amount of data your are viewing.
Thank you for providing this tool.
Requesting guidance on using the rt layout to look like screenshot B if possible.
If no root is passed to rt layout the nodes all end up in a horizontal line.
If root is passed to rt layout then the root node ends up higher
but the rest of the nodes remain in a horizontal line in screenshot A.
The node numbering passed to root in the rt layout was determined according
to a standard definition of rt.
Screenshots:
A. The rtlayout-have.png is what I'm getting.
B. The rtlayout-want.png is what I'm trying to get to from a standard definition of rt.
How can I get screenshot B if possible?
Hello,
I would like to use existing drawio library. I successfully extracted the content of each element with few line of code.
However, it is not support to be used in the style parameter.
For example, I extracted some paloalto stencils and tried to use it as a style (sorry for the lenght of the style):
pan_pa220 = '<mxGraphModel style="default-style2"><root><mxCell id="0"/><mxCell id="1" parent="0"/><UserObject label="" Manufacturer="Palo Alto Networks" ProductNumber="PA-220" PartNumber="" View="Front" ProductDescription="PA-220 Firewall Platform" Ipadress="" NetworkName="" RackUnits="" MountingPosition="" Bay="" RowLineup="" Room="" Floor="" Building="" LocationCode="" Department="" PurchaseDate="" InstalledDate="" WarrantyExp="" SupportAgreement="" SupportContactName="" ContactPhone="(866) 898-9087" Comments="" Cost="" AssetNumber="" SerialNumber="" id="2"><mxCell style="vsdxID=5;fillColor=none;gradientColor=none;strokeColor=none;strokeWidth=0;spacingTop=-3;spacingBottom=-3;spacingLeft=-3;spacingRight=-3;labelBackgroundColor=none;rounded=0;html=1;whiteSpace=wrap;" vertex="1" parent="1"><mxGeometry width="81.9" height="16.400000000000002" as="geometry"/></mxCell></UserObject><mxCell id="3" style="vsdxID=6;fillColor=none;gradientColor=none;image;aspect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KIvav1VSCYtGrMn7rvOerbOXFtZDb6UT9zQRpRmV6lqMy+96X0dUq8LjGxXILUfk15XevW+RKn7yYIOF8sSQsjBw389mxBCCCGEENKNqGfzOkhCCCGEEELkQ59NCCGEEEKIfOizCSGEEEIIkQ99NiGEEEIIIfKhzyaEEEIIIUQ+9NmEEEIIIYTIp7V+9sK779h/8dv/vtQ1mBBCCCGEENLJ1//3SveT5vrZ3Tx9+qXfLp4IOSVCCCGEEEKGm6+v3nj/zVe6n3e8H6SxF1Y6hBBCCCGEaE3rfpDdv/vtf5uNPB9CCCGEEEKGia//n83uJ99/85VWPbvjvusL776DP/3f0PMihBBCCCFkyOlhpAf0jez8MdSECCGEEEIIGXrSX+r5dN/1RgB8vc82hBBCCCGEEItuIw2H9UYIIYQQQgghvvn/OPU6SLoI+fkAAAAASUVORK5CYII=;strokeColor=none;strokeWidth=0;spacingTop=-3;spacingBottom=-3;spacingLeft=-3;spacingRight=-3;labelBackgroundColor=none;rounded=0;html=1;whiteSpace=wrap;" vertex="1" parent="2"><mxGeometry x="-0.30000000000000004" y="-0.30000000000000004" width="82.4" height="16.8" as="geometry"/></mxCell></root></mxGraphModel>'
diagram = N2G.drawio_diagram()
diagram.add_diagram("Page-1")
diagram.add_node(id="R1", style=pan_pa220)
diagram.add_node(id="R2")
#diagram.add_link("R1", "R2", label="DF", src_label="Gi1/1", trgt_label="GE23")
diagram.layout(algo="kk")
diagram.dump_file(filename="Sample_graph.drawio", folder="./Output/")
I got the following error :
Traceback (most recent call last):
File "XXX/N2G/read_drawio_lib.py", line 35, in <module>
diagram.add_node(id="R1", style=pan_pa220)
File "XXX//N2G/plugins/diagrams/N2G_DrawIO.py", line 205, in add_node
node = ET.fromstring(
File "/usr/local/Cellar/[email protected]/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/xml/etree/ElementTree.py", line 1342, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 3, column 21
If I only take the content of the last mxcell it works, but I loose some other information about the shape.
If I copy / paste the full extracted mxGraphModel in drawio, it works fine.
Is there a way to fix this ?
I have tried to read the XML file saved from Diagrams.net. It shows zero nodes and edges but it were objects in the file.
Seems the Diagrams.net uses format like following to describe the node.
<mxCell id="GfU-AREGhvKuv_HTweEu-1" value="R1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="320" y="340" width="120" height="60" as="geometry" />
</mxCell>
If I read the source code, it expect in following format:
<object id="{id}" label="{label}"> <mxCell style="{style}" vertex="1" parent="1"> <mxGeometry x="{x_pos}" y="{y_pos}" width="{width}" height="{height}" as="geometry"/> </mxCell> </object>
There is no tag from Diagrams.net's export. Not sure if that is issue.
good day to all,
I try to create sample graph from read me file. Config is like below.
Issue : it is not show any "src_label" in the graph.
It will only show if we click the link / edge and we will see src_label in the "neighborhood" tab.
Expectation : src_label is shown just like trgt_label in the graph.
from N2G import yed_diagram
Hi! do you have in mind any support for Nokia, both OSPF or ISIS? thanks!
Please depend on igraph
instead of python-igraph
, and suggest using pip install igraph
in diagnostic messages. See igraph/python-igraph#699 for an explanation. Places in this package that might need an update:
https://github.com/search?q=repo%3Admulyalin%2FN2G%20python-igraph&type=code
This is one of the most popular packages on PyPI that still hasn't switched to depending on igraph
instead of python-igraph
.
Hi, we have some issue :
but still not successful.
so we dont need to modify .graphml file again.
thanks.
Hy @dmulyalin !
Just want to let you know that we are using your lib in this project:
(FPrime Topology visualisation using Diagrams.Net)[https://github.com/nasa/fprime/discussions/868]
In terms of feature requests.
It would be great to be able to create ports for nodes. Under ports I mean special attachement points for links.
This is a "bug" because of the pattern of using tuple(sorted([source,target,label]))
to create identities. Tried to fix, but see other issue on tests not passing.
Example:
from N2G import drawio_diagram
diagram_dict = {
'nodes' : [
{ 'id': 'a' , 'label' : 'A'},
{ 'id': 'b' , 'label' : 'B'},
],
'edges' : [
{ 'source':'a',
'target':'b',
'style': 'endArrow=classic;endFill=0;sourcePortConstraint=east;targetPortConstraint=west;edgeStyle=orthogonalEdgeStyle;'
},
{ 'source':'b',
'target':'a',
'style': 'endArrow=classic;endFill=0;sourcePortConstraint=east;targetPortConstraint=west;edgeStyle=orthogonalEdgeStyle;'
},
]
}
diagram = drawio_diagram()
diagram.from_dict(diagram_dict)
diagram.layout('kk')
diagram.dump_file('example.drawio','./')
Awesome project! I ran into an issue where I was pulling in a diagram off of a drawio file and attempting to update the node. Here is the code I am using:
diagram = drawio_diagram()
diagram.from_file("test.drawio")
diagram.update_node(id="node-1", label="Update Test")
diagram.dump_file(filename="Sample_graph.drawio", folder="./")
But when it gets to updating the node I receive the following error:
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_xxx\xxx.py in
3 diagram.from_file("test.drawio")
4
----> 5 diagram.update_node(id="node-1", label="Update Test")
6
7 diagram.dump_file(filename="Sample_graph.drawio", folder="./")
~\Anaconda3\lib\site-packages\N2G\plugins\diagrams\N2G_DrawIO.py in update_node(self, id, label, data, url, style, width, height, **kwargs)
247 data = data or {}
248 node_data = {}
--> 249 node = self.current_root.find("./object[@id='{}']".format(id))
250 # update data and url attributes
251 node_data.update(data)
AttributeError: 'NoneType' object has no attribute 'find'
I've confirmed the node ID is accurate and that it is loading in the correct template successfully. I looked at the xml and confirmed the ID there as well, no luck. Any idea what is going on here?
If i have a 2 connections between a pair of switches, it getting over lapped on each other. We have to manually drag the redudant connection & its label.
Hello -
I am trying to see if it's possible to add label information on a node and include a carriage return, so that info will be displayed on the drawio diagram.
Something like this:
from N2G import drawio_diagram
diagram = drawio_diagram()
diagram.add_diagram("mydiagram")
diagram.add_node(
id="device123", label="Name:device123\nIP:1.2.3.4\nSW:v10.1.2.3.4")
diagram.add_node(
id="device456", label="Name:device456\nIP:5.6.7.8\nSW:v11.3.4.5")
diagram.add_link("device123", "device456",
label="Copper", src_label="Gi0/0", trgt_label="Gi1/0/1")
diagram.layout(algo="kk")
diagram.dump_file(filename="Sample_graph.drawio", folder="./Output/")
Any help or tips would be greatly appreciated. Thank you.
docs/source/diagram_plugins/DrawIo Module.rst
from N2G import drawio_diagram
diagram = drawio_diagram()
drawing.from_file("./source/old_office_diagram.drawio")
"it probably is diagram instead of drawing" typing error ?
hi, lets say i have equipment (from sample doc) with :
{'id': 'SW1', 'top_label': 'CORE', 'bottom_label': '1,1,1,1'}
it will create a reacangular with equal spacing at top and bottom.
But if i only have one label, either top_label or bottom_label, it will create unequal spacing.
How to make spacing equal ?
thanks.
Hi,
Im currently working on scripting this together with Ansible/LibreNMS. So far everything is looking very nice but i'm banging my head against the wall trying to group/cluster devices based on their names.
So far Im able to identify and give the node a position but the y_pos argument dosent seem to do anything. Is the x_pos argument mandatory when y_pos has been given?
General thought of what im trying to achieve is something along these lines;
servers/clients, etc
By being able to 'preplace' or group the device it might be easier to finalize the drawing after the initial creation. I was hoping I could use the y_pos argument to place it along an axis and it would automaticly preplace the nodes along this line.
Any thoughts or suggestions would be greatly appriciated
Do you have an example available that shows creating graphml graphs used in yed (yworks) for the following use cases :
Hi there,
First of, thanks for this work, I found out we've done the same only that yours is awesome and reusable and mine was script style hehe.
It's good to see that you actively adding more stuff. I thought it was a one off thing and wouldn't be any more updates and I started to refactor it on a local repo on my machine.
I see you've added src_label and target_label but in a different way of how I've done it.
Following the string declarations for nodes and links I went down this path
# source edge label x="-0.5" y="1"
drawio_link_source_label_xml = """
<mxCell id="{id}" value="{value}" style="{style}" parent="{parent}" vertex="1" connectable="0">
<mxGeometry x="-0.5" y="1" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
"""
# target edge label x="0.5" y="-1"
drawio_link_target_label_xml = """
<mxCell id="{id}" value="{value}" style="{style}" parent="{parent}" vertex="1" connectable="0">
<mxGeometry x="0.5" y="-1" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
"""
And then something like below, basically assuming that if you pass a src_label there will be target_label, otherwise just pass label.
if src_label != '' and tgt_label != '':
src_id = f"{edge_id}-src"
tgt_id = f"{edge_id}-tgt"
source_label = ET.fromstring(
self.drawio_link_source_label_xml.format(
id=f"{edge_id}-src",
value=src_label,
parent=edge_id,
style=style if style else self.default_link_style,
)
)
target_label = ET.fromstring(
self.drawio_link_target_label_xml.format(
id=f"{edge_id}-tgt",
value=tgt_label,
parent=edge_id,
style=style if style else self.default_link_style,
)
)
else:
source_label = None
target_label = None
The XML should look like below, I'm adding a suffix -src
and -tgt
to the link id.
<object label="" id="2d123edf1f03cdcb18fa393bc8d1e719">
<mxCell style="endArrow=none;" parent="1" source="R1" target="SW1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</object>
<mxCell id="2d123edf1f03cdcb18fa393bc8d1e719-src" value="G1/0/1" style="endArrow=none;" parent="2d123edf1f03cdcb18fa393bc8d1e719" vertex="1" connectable="0">
<mxGeometry x="-0.5" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="2d123edf1f03cdcb18fa393bc8d1e719-tgt" value="Eth1/1/1" style="endArrow=none;" parent="2d123edf1f03cdcb18fa393bc8d1e719" vertex="1" connectable="0">
<mxGeometry x="0.5" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
Ignoring the style, the picture below illustrates what I mean.
Additionally I found it a lot easier for my use cases to have a yaml file with styles where I can basically declare more entries on each dict for customization instead of having multiple txt files.
shapes_map:
'bus': 'shape=mxgraph.networks.bus;fillColor=#d5e8d4;strokeColor=#82b366;outlineConnect=0;strokeWidth=2;gradientColor=none;gradientDirection=north;perimeter=backbonePerimeter;backboneSize=20;glass=0;'
'firewall': 'shape=mxgraph.office.concepts.firewall;fillColor=#DA4026;strokeColor=none;outlineConnect=0;aspect=fixed;'
'hafirewall': 'shape=mxgraph.office.concepts.firewall;fillColor=#DA4026;aspect=fixed;'
'router': 'shape=mxgraph.cisco19.rect;prIcon=router;fillColor=#FAFAFA;strokeColor=#005073;aspect=fixed;'
'access switch': 'shape=mxgraph.cisco19.rect;prIcon=l2_switch;fillColor=#FAFAFA;strokeColor=#005073;align=center;outlineConnect=0;aspect=fixed;'
'management switch': 'shape=mxgraph.vvd.switch;strokeColor=none;fillColor=#434445;align=center;outlineConnect=0;aspect=fixed;'
'core switch': 'shape=mxgraph.cisco19.rect;prIcon=secure_catalyst_switch_color2;fillColor=#FAFAFA;strokeColor=#005073;aspect=fixed;'
'distribution switch': 'shape=mxgraph.cisco19.rect;prIcon=l3_switch;fillColor=#FAFAFA;strokeColor=#005073;aspect=fixed;'
'server': 'shape=mxgraph.aws3.traditional_server;fillColor=#7D7C7C;strokeColor=#67AB9F;outlineConnect=0;'
'cloud': 'shape=mxgraph.cisco19.cloud2;fillColor=#FFE9AA;strokeColor=none;aspect=fixed;'
'cluster': 'shape=mxgraph.veeam.cluster;rounded=1;fillColor=#ffe6cc;strokeColor=#d79b00;aspect=fixed;'
'workstation': 'shape=mxgraph.signs.tech.computer;fillColor=#000000;strokeColor=none;'
'other': 'whiteSpace=wrap;html=1;rounded=1;verticalLabelPosition=bottom;verticalAlign=top;align=center;aspect=fixed;'
'ont': 'mxgraph.cisco.modems_and_phones.cable_modem;html=1;dashed=0;fillColor=#036897;strokeColor=#ffffff;strokeWidth=2;'
'media converter': 'mxgraph.cisco.modems_and_phones.cable_modem;html=1;dashed=0;fillColor=#036897;strokeColor=#ffffff;strokeWidth=2;'
'storage': 'mxgraph.cisco_safe.compositeIcon;bgIcon=ellipse;resIcon=mxgraph.cisco_safe.capability.storage;fillColor=#999999;html=1;strokeColor=#ffffff;aspect=fixed;'
'hardware security modules': 'mxgraph.cisco_safe.compositeIcon;bgIcon=ellipse;resIcon=mxgraph.cisco_safe.capability.secure_server;rounded=1;glass=0;fillColor=#999999;strokeColor=#ffffff;aspect=fixed;'
shapes_label:
'bus': 'labelBackgroundColor=none;labelPosition=middle;align=center;html=1;fontStyle=1;fontSize=13;fontColor=#000000;'
'bus_vertical': 'labelBackgroundColor=none;labelPosition=left;verticalLabelPosition=middle;align=rigth;verticalAlign=middle;html=1;fontColor=#000000;spacingTop=999;spacing=0;direction=west;horizontal=0;spacingBottom=-365;'
'firewall': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontSize=13;fontColor=#0066CC;'
'hafirewall': 'labelBackgroundColor=#004C99;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#D4D4D4;'
'router': 'labelBackgroundColor=#004C99;;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#D4D4D4;'
'access switch': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontSize=13;fontColor=#0066CC;'
'management switch': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontSize=13;fontColor=#0066CC;'
'core switch': 'labelBackgroundColor=#99CCFF;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#000000;'
'distribution switch': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#0066CC;'
'server': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#0066CC;'
'cloud': 'labelBackgroundColor=#004C99;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#D4D4D4;'
'cluster': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#0066CC;'
'workstation': 'verticalLabelPosition=bottom;verticalAlign=top;align=center;'
'other': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#0066CC;'
'ont': 'labelBackgroundColor=#99CCFF;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#000000;'
'media converter': 'labelBackgroundColor=#99CCFF;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#000000;'
'storage': 'labelBackgroundColor=none;verticalLabelPosition=bottom;labelPosition=center;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#000000;'
'hardware security modules': 'labelBackgroundColor=#99CCFF;verticalLabelPosition=bottom;align=center;verticalAlign=top;spacing=2;fontStyle=1;fontSize=13;fontColor=#000000;'
shapes_size:
'bus': {'width': '1435', 'height': '20'}
'firewall': {'width': '47', 'height': '43'}
'hafirewall': {'width': '47', 'height': '43'}
'router': {'width': '50', 'height': '50'}
'access switch': {'width': '50', 'height': '50'}
'management switch': {'width': '50', 'height': '50'}
'core switch': {'width': '50', 'height': '50'}
'distribution switch': {'width': '50', 'height': '50'}
'server': {'width': '46', 'height': '60'}
'cloud': {'width': '60', 'height': '60'}
'cluster': {'width': '60', 'height': '60'}
'workstation': {'width': '68', 'height': '68'}
'other': {'width': '60', 'height': '60'}
'ont': {'width': '60', 'height': '30'}
'media converter': {'width': '60', 'height': '30'}
'storage': {'width': '43', 'height': '43'}
'hardware security modules': {'width': '70', 'height': '70'}
Thoughts?
python da_n2g.py
Traceback (most recent call last):
File "da_n2g.py", line 17, in
diagram.add_link("R1", "R2", label="DF", src_label="Gi1/1", trgt_label="GE23")
TypeError: add_link() got an unexpected keyword argument 'src_label'
Did a fork to fix a bug, but current tests do not pass
Running pytest:
collected 60 items
test_IP_drawer.py ....... [ 11%]
test_L2_drawer.py ......................FFF...... [ 63%]
test_drawio_module.py .....F..F.... [ 85%]
test_yed_module.py .........
Hi,
want to suggest to allow script to specify font name and font size.
Currently it is hard coded at "N2G_yEd.py" if not mistaken.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.