Getting Started
The simplest way to start with NorFab is to do local deployment when broker, workers and client processes all run locally, this is what we going to demonstrate in this guide.
Client, broker and worker all should be able to run on same machine Windows, Linux or MAC.
Once NorFab installed, next step is to create a folder that will hold your environment. Run this command to create NorFab folders and files:
nfcli --create-env norfab
This will create norfab
folder and inside of it will create inventory.yaml
, file name is important as NORFAB by default searches for inventory.yaml
, file content is:
broker: # (1)!
endpoint: "tcp://127.0.0.1:5555" # (2)!
workers: # (3)!
nornir-*: # (4)!
- nornir/common.yaml
nornir-worker-1: # (5)!
- nornir/nornir-worker-1.yaml
topology: # (6)!
broker: True # (7)!
workers: # (8)!
- nornir-worker-1
- Broker configuration inventory section
- URL to listen for connections on -
localhost
port5555
in this case - Workers configuration inventory section
- glob pattern that will match all workers with
nornir-
in the name and mapcommon.yaml
file content for each of them - Worker definition to map inventory file to a specific worker that has name
nornir-worker-1
- Topology section to define what components to run
- Start broker process
- List of workers names to start processes for
Command --create-env
assumes we are working with Nornir service and creates nornir
folder and inside of it creates two files. First file common.yaml
to host configuration common for all Nornir service workers:
service: nornir # (1)!
broker_endpoint: "tcp://127.0.0.1:5555" # (2)!
# Nornir inventory and configuration
runner: # (3)!
plugin: RetryRunner
hosts: {}
default: {} # (4)!
groups: {} # (5)!
- Name of the service this worker hosting
- Broker URL to initiate connections with
- Nornir runner plugin configuration
- Nornir
default
data section - Nornir groups definition section
Second file specific to the worker with name nornir-worker-1
which holds Nornir inventory data:
hosts:
ios-device-1:
hostname: 192.168.1.1
platform: cisco_ios
username: admin
password: admin
This is how files structure will look like:
└───norfab
│ inventory.yaml
│
└───nornir
common.yaml
nornir-worker-1.yaml
Now you are ready to start NorFab Interactive Command Line Shell Client. Open terminal window, navigate to the folder where inventory.yaml
located and start NFCLI:
C:\>cd norfab
C:\norfab>nfcli
nf#
this will start the NorFab broker process, Nornir worker process, instantiate NFCLI client and drop you into interactive command line shell
nf#? # (1)!
file File sharing service
netbox Netbox service
nornir Nornir service
show NorFab show commands
exit Exit current shell
help Print help message
pwd Print current shell path
top Exit to top shell
nf#show workers # (2)!
name service status holdtime keepalives tx/rx alive (s)
nornir-worker-1 nornir alive 12.8 58 / 58 149
nf#
nf#nornir # (3)!
nf[nornir]#?
cfg Configure devices over CLI interface
cli Send CLI commands to devices
show Show Nornir service parameters
task Run Nornir task
test Run network tests
end Exit application
exit Exit current shell
help Print help message
pwd Print current shell path
top Exit to top shell
nf[nornir]#show hosts table details
+-----------------+--------------+------------+-------------+--------+----------+------------+
| worker | host | platform | hostname | port | groups | username |
+=================+==============+============+=============+========+==========+============+
| nornir-worker-1 | ios-device-1 | cisco_ios | 192.168.1.1 | None | [] | admin |
+-----------------+--------------+------------+-------------+--------+----------+------------+
nf[nornir]# end
Exiting...
- Question mark plus enter to print commands help
- Run show command
- Drop into Nornir Service command shell
NorFab CLI supports Tab completions, question mark help together with sub-shells, read more about NorFab CLI and how to use it here.
That's it