-
Notifications
You must be signed in to change notification settings - Fork 22
Holo Guide ‐ Setting up dependencies
It would be great if we could start dealing with holo off the bat, but unfortunately holo doesn't exist in a vacuum (get it ? holo...vacuum).
Away from the dry jokes, we have dependencies we need to install on our machine before we get started.
Run this script to install required dependencies. If Rust is already installed, you can omit lines 8 and 9.
You'll need to install:
- Git
- Rust
- Gcc / cc
- Cmake
- libyang: our yang2 / yang3 libraries are built on top of this, therefore it needs to be installed
- protoc: used for our gRPC connections
We should also remember to install the nightly toolchain in rust:
rustup update
rustup update nightly
Holo uses some nightly features at the time being, so this is necessary for it to run.
Once the various external dependencies are set up, we can now get started.
Clone the repository and switch to the guide
branch:
git clone https://github.com/holo-routing/holo
git checkout tags/v0.5.0
# this moves you to a new branch called guide.
# call the branch whatever you want.
git switch -c guide
We have jumped to the project's v0.5.0, since that is what this tutorial will be based on. If you view the repository at a later date, the VRRP protocol might already have been implemented and this whole journey may not make so much sense, maybe just as a follow along.
After cloning, you'll see the following directories and files:
├── Cargo.lock
├── Cargo.toml
├── INSTALL.md
├── LICENSE
├── README.md
├── codecov.yml
├── docker
├── holo-bfd
├── holo-bgp
├── holo-daemon
├── holo-interface
├── holo-keychain
├── holo-ldp
├── holo-northbound
├── holo-ospf
├── holo-policy
├── holo-protocol
├── holo-rip
├── holo-routing
├── holo-tools
├── holo-utils
├── holo-yang
├── proto
├── rustfmt.toml
└── target
19 directories, 7 files
If you have dealt with networking protocols, some of these should already look familiar(OSPF, BGP, BFD...). Feel free to jump in there and have a look at how a holo
module is structured.
The holo-daemon
module contains the main function, while holo-yang
is where we'll focus on setting up the YANG module for VRRP.
Let's move there:
cd holo-yang/modules/
The structure you see should be roughly similar to what we have in YangModels/yang, where we source most of our models. We don’t add all models at once; instead, we upload them as needed. For this tutorial, we’ll add the VRRP model.
Go to [project-root]/holo-yang/modules
Run the following command to download the VRRP YANG model:
cd ietf
wget https://raw.githubusercontent.com/YangModels/yang/main/standard/ietf/RFC/ietf-vrrp%402018-03-13.yang
Alternatively, you can download the file here and move it to [project-root]/holo-yang/modules/ietf
Check that the file is in the correct directory by listing the contents.
An ls
should show you the following files:
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Can you look at all those yang models, well we have more we will still be working on in future.
Next step, make sure this file is called properly from our Rust program (now the fun begins).
Navigate to the [project-root]/holo-yang/src/lib.rs
file. This is a Rust file with a list of the YANG module together with various helper functions you don't need to worry about yet.
Currently our main concern is to get the VRRP yang model added to the list of yang models.
Locate the YANG_EMBEDDED_MODULES
definition and include the VRRP model:
// [project-root]/holo-yang/src/lib.rs
pub static YANG_EMBEDDED_MODULES: Lazy<EmbeddedModules> = Lazy::new(|| {
hashmap! {
...
EmbeddedModuleKey::new("ietf-vrrp", Some("2018-03-13"), None, None) =>
include_str!("../modules/ietf/[email protected]"),
}
});
Inside the "..." is the list of yang modules and their content. We are going to add the vrrp yang module to this list:
Similarly, update the YANG_IMPLEMENTED_MODULES
list:
// [project-root]/holo-yang/src/lib.rs
pub static YANG_IMPLEMENTED_MODULES: Lazy<Vec<&'static str>> =
Lazy::new(|| {
vec![
...
"ietf-vrrp"
]
});
Let us build the project to make sure everything is running fine:
cargo +nightly build
If it doesn't throw any errors, we commit our progress to git:
git add .
git commit
In the commit message:
yang: add vrrp yang module.
checkpoint 1
Add the vrrp yang module inside the `[project-root]/holo-yang/modules`
modify the holo-yang lib.rs
Signed-off-by: My Name <[email protected]>
We have our first checkpoint. Way to go partner !!!
With VRRP YANG model added, next we are creating the holo-vrrp
module and start looking into how we structure it.
- Architecture
- Management Interfaces
- Developer's Documentation
- Example Topology
- Paul's Practical Guide