Package: labby
LabbyCLI Tool for interacting with Network Simulation systems to build and interact with Network Labs in an automated way.1. DocumentationNoteUnder Construction...∏Labby1. Documentation2. Install2.1 Developer version2.2 Using labby docker container3. Requirements4. How it works4.1 Labby Configuration file4.2 Environments and Providers4.3 Projects, Nodes, Templates and Links4.4 Labby state file5. Extra Links2. InstallIt is as simple aspipinstalllabby2.1 Developer versionYou will need to usepoetryto handle installation and dependencies.# Clone the repositorygitclonehttps://github.com/davidban77/labby.gitcdlabby# Start poetry shell and install the dependenciespoetryshell
poetryinstall2.2 Using labby docker containerLabby is also packaged under a container,davidban77/labby, based on python-slim image.>dockerrun-v$HOME/.config/labby/labby.toml:/opt/labby/labby.toml\-v$HOME/.config/labby/.labby_state.json:/opt/labby/.labby_state.json\-i-t\davidban77/labby:v0.2.0-py3.8bashIt is particularly useful if you don't want to setup a virtual environment to install all the dependencies.3. RequirementsBesides having thelabbytool installed, you will need:Aprovider. For now the only supported Network Simulation provider is GNS3.Alabby configuration file. Sets the necessary settings for connecting to a provider.telnet(for console connection) and/orsshinstalled. So labby can perform some ad-hoc connections actions if needed.4. How it worksOnce you have the configuration file setup, andlabbyinstalled on your system then you are good to go!.The CLI tool serves multiple purposes, for example it is a way great to discover the projects or network topologies available on the Network Simulation system, start or stop the nodes, push configuration, etc...For examplem to show the available projects and their status in GNS3:Now, let's get the details of the network labtopology-01:It is a small topology with 2 Aristaceosdevices connected between each other, and are also connected to acloudandmgmtswitch to allow them to be reachable to the outside world.TheMgmt Addressshows the IP address information for their management interfaces. You can find more information in thenode configuration section.You can start one by one the nodes of the project, for example:Devices are up and you can check their status and more details:You can connect to the nodes via SSH (if IP address for management is set and is reachable), or you can connect over console if available. For example:And there are more features as well...Ad-hoc configuration rendering and pushAutomated console configuration bootstrap, this means to start a node and run the configuration dialog to push Day 0 conifguration for the device be reachable via SSH for example.Note:this feature might need some more love.Automaticbuildof a network lab in a declarative way. Using thelabby buildcommand, more information can be found atbuild network labs section.4.1 Labby Configuration fileFor labby to work, you need a configuration file (labby.toml) that specifies theprovidersyou have at your disposal to connect.By defaultlabbywill search for the configuration file at the current directory, if not found it will search at the labby configuration space of the user's home directory ($HOME/.config/labby/labby.toml)Here is an example configuration file:[main]environment="default"[environment.default]provider="home-gns3"description="Home lab environment"[environment.default.providers.home-gns3]server_url="http://gns3-server:80"verify_cert="false"kind="gns3"labbyintroducesproviderswhich should be seen as the Network Simulation system (a GNS3 server for example), andenvironmentswhich should be seen as the environment where that network simulation is hosted.The idea behind this structure is to provide flexibility to use multiple providers and labs in different environments (home lab and/or cloud based).4.2 Environments and Providerslabbyrelies onprovidersto interact, create and destroy with the Network Topologies. The provider supported so far isGNS3by the use ofgns3fy.Aprovideris just a representation of a Network Simulation systems, like a GNS3 server for example.Anenvironmentserves as a construct that holds attributes of multipleproviders.4.3 Projects, Nodes, Templates and LinksEachproviderprovidesprojectswhich should be seen as network labs. These projects is where you can createnodesbased fromtemplates, and createlinksto finally build a network topology.Using the GNS3 provider as an example:Alabby projectis a network topology in GNS3. It needs to start in order to access it.Alabby nodeis a network object. This can be a router, switch or container, among others in GNS3.Alabby templateis the base settings to be able tocreate a node. Is where the main information of thenodeis inherited.Alabby linkis a network link in GNS3. It provides a way to connect between 2 nodes and can provide functionality like packet loss or jitter on the link.Labby serves as a CLI tool that interacts with all these entities.4.4 Labby state filelabbyrelies havily on the state of the currentproviderto get information about the objects that interacts with. Now, not all the necessary attributes of an object can be retrieved from theprovider, solabbyuses astate file.Labby augments these objects by providing extra attributes, likelabelsfor example, and stores them at an specific location ($HOME/.config/labby/.labby_state.json).Some of these attributes are:labelsAn array of metadata useful to categorize an object (project,nodeorlink).mgmt_portManagement interface of thenode, useful for generating bootstrap configuration for the node.mgmt_ipManagement IP Address of thenode, useful for generating bootstrap configuration and also connecting to the node.templateName reference of the nodetemplateused to create it.net_os,modelandversionare attributes of the node and its operating system. It is needed to differentiate configuration templates for example.config_managedis a boolean attribute which lets you know if the device can be managed bylabbyor not.The attributes are generally added at the time of the object creation, but they can also be added at a later stage if needed (this is normally done withlabby updatecommand).5. Extra LinksNode Configuration Management