Getting Started
Once NorFab installed, next step is to create a folder that will hold your environment and start creating inventory files with required configurations.
Create norfab
folder and inside of it 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
In this example we are working with Nornir service.
Create nornir
folder (folder name is arbitrary and can be anything)
and inside of it create 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)!
# next comes Nornir inventory and configuration
runner: # (3)!
plugin: RetryRunner
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:
R1:
hostname: r1.lab.local
platform: cisco_ios
username: developer
password: secretpassword
R2:
hostname: 10.0.0.2
platform: cisco_ios
username: developer
password: secretpassword
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 - NFCLI. 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
{
"nornir-worker-1": [
"R1",
"R2"
]
}
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