Data Generation¶
Network to Code has developed a process that helps generate demo data, with our nautobot-data-generation repo. At a high-level this project builds an environment, generates data by simulating inputs on a design builder plugin, then publishes various output formats (such as in json, mysql, or postgres output).
Most commonly this is done via the GitHub Actions interface, but can be done locally as well. For our purposes, we will simply be doing through how to use the data generated, so that you can quickly have an instance pre-populated with most types of data you would expect in the real world.
Prerequisite¶
Warning
You will need to replace the start method & task decorator in tasks.py with the below code snippit.
@task(
help={
"service": "Which service to target"
}
)
def start(context, service=None):
"""Start Nautobot and its dependencies in detached mode."""
command = "up --detach"
if service:
command = f"up --detach {service}"
print("Starting Nautobot in detached mode...")
docker_compose(context, command=command)
Importing the dataset¶
Download the dataset on your workstation via your Chrome browser from this link. You can explore the other types of data available here. Then double-click on the file downloaded.
Warning
When you unpack the file, it will create a nautobot.sql file, however if one already exists, it will create a nautobot 2.sql file, and so on. Keep in mind which file you are using
Warning
Note: On some browsers and operating systems, the browser might automatically unpack the compressed file once it is downloaded, thus you may not need to unpack the file.
Follow steps below to import dataset:
-
Navigate to Your plugin directory:
where:
{/path/to/nautobot-plugin/}is a Linux path to Nautobot plugin
-
Destroy existing docker deployment and data:
Warning
The below command will result in destroying all of Your data in container and stop running containers:
-
Start the new Postgres database container instance and note the name of created container from the terminal output.
Obtain the name of the container from the output of the above command.
-
Copy the Nautobot SQL dump into Database container
where: -
{DATABASE_CONTAINER_NAME}is a database container name -{PATH/TO/nautobot.sql}is a Linux path to your Postgres SQL dump (nautobot.sql) -
Import database from within docker container
where:
{DATABASE_CONTAINER_NAME}is a database container name- Nautobot's Postgres database user is specified as
nautobotwith-Uparameter
-
View your nautobot with your data
Connect to http://127.0.0.1:8080 to view your instance with data.
Further Details¶
For more information about the project, you can visit the repo and the associated documentation, including how to file names are generated.