App Dev · · 4 min read
NetLay: Fibre, quiet devices, building plans and a folder you can carry
Cable types on uplinks, devices that are allowed to stay silent, several building plans on one map, and packing the whole application into a folder I can take to work.
A release made of small annoyances#
Not every build is one big idea. This one is a handful of things that had been irritating me while actually using NetLay, which is the best source of work there is.
Not all cable is the same.#
An uplink between two cabinets is not the same thing as an uplink between two switches in the same rack, and the map had been drawing both as an anonymous blue line.
Uplinks now carry a medium and a length. Copper, direct attach, multimode fibre in OM3 or OM4, or single mode OS2 for the runs between buildings. Links on an SFP or QSFP port default to multimode because that is what is usually on the end of one, and stack cables default to direct attach for the same reason. The lines are drawn dashed in aqua or yellow depending on the glass, the label carries the port names along with the medium and the length, and the legend explains which is which.
The length is there because the first question anybody asks about a fibre run is how long it is, and the second is whether there is enough slack in the tray.
Devices that are allowed to stay quiet.#
Some things do not answer pings and never will, either because ICMP is turned off or because they are the sort of appliance that stays silent on principle. Up to now they sat there permanently red, which trains you to ignore red, which defeats the entire point of putting status on a map.
So there is a switch on each device now that turns monitoring off for it. Instead of a status dot it gets a pause mark, meaning nobody is claiming anything about this one. If you turn it off on a host, its virtual machines go quiet too, because a VM you cannot reach through a host you are not watching is not telling you anything useful either.
More than one building.#
The background was one image. Real sites are not one image, they are a main building and a workshop and a portable cabin that somebody has had for eleven years.
A layout now holds as many building plans as you like, each one positioned, scaled, faded and layered, with send to back and bring to front so an overlapping one can be dealt with. There is a lock that stops you dragging images around by accident, because for about a day the most common way to move a building was to try to pan the map.
There was a bug in that work worth repeating. The scale box always said one hundred, whatever size the image actually was, and typing a number applied it as a multiplier of the current size rather than setting it. So scaling something to eighty percent twice gave you sixty four percent and a box still cheerfully claiming one hundred. The fix was to store the image's natural size when it is uploaded, show the real percentage with the original dimensions next to it, and add a one to one button for when you have made a mess of it.
That is a good example of a bug that is not really a bug in the code. Every line worked. It was the number on the screen that was lying.
Taking it to work.#
The last part of this release is the one that changed how I use the thing.
bundle.ps1 builds the whole application into a folder. A bundled Python, a relocatable virtual environment with the packages in it, the built web interface and a start.cmd. The machine at the other end needs Windows and nothing else. No installer, no Python, no internet connection, no administrator.
Two PowerShell traps cost me an evening between them, and both are the sort of thing that only bites on version 5.1. The first is that native programs writing to standard error get turned into terminating errors when you have told PowerShell to stop on errors, which means a tool printing a harmless progress bar kills your build. The second is sillier: I had a variable called $zip and a switch parameter called -Zip, and PowerShell variable names ignore case, so the two were the same thing and the script fought itself.
Then I made the mistake of using it. I took the bundle to work, opened it, and found myself looking at my home network on an office machine. Two copies of the map now exist and neither of them should travel.
So the bundle is built with a flag that leaves the data behind. No database, no building images, no session key, no vendor list. The folder is the application and nothing else, and the first time you open it at the far end it creates an empty database and asks you to make an account. I tested that by running the packaged copy against an empty data folder before zipping it, which I recommend, because the alternative is finding out in front of somebody.
Next time, making the map feel alive, letting other people in, and showing that something is slow without drawing a graph.