Discovery#
This exercise will focus on network device discovery. We will discover the network devices that were deployed using containerlab in the installation section.
Given sdc is built to support multiple vendors, the first thing we need to do is load the YANG schema for the respective vendor and release. In this exercise we use gNMI, but note that netconf could also be used.
Schema
apiVersion: inv.sdcio.dev/v1alpha1
kind: Schema
metadata:
name: srl.nokia.sdcio.dev-24.3.2
namespace: default
spec:
repoURL: https://github.com/sdcio/yang
provider: srl.nokia.sdcio.dev
version: 24.3.2
kind: branch
ref: v24.3.2
dirs:
- src: .
dst: .
schema:
models:
- srl_nokia/models
includes:
- ietf
- openconfig/extensions
- openconfig/openconfig-extensions.yang
excludes:
- .*tools.*
After the schema is configured we create a set of profiles that sdc uses to connect and sync the configurations from the devices. Also the credentials, using secrets are setup for the respective device.
Connection Profile
Sync Profile
Lastly we configure a discovery rule that is used by sdc to discover the devices within the ip range provided in the setup step.
Discovery rule
apiVersion: inv.sdcio.dev/v1alpha1
kind: DiscoveryRule
metadata:
name: dr-dynamic
namespace: default
spec:
period: 1m
concurrentScans: 2
prefixes:
- prefix: 172.21.0.0/28
excludes:
- 172.21.0.0
- 172.21.0.1
- 172.21.0.15
discoveryProfile:
credentials: srl.nokia.sdcio.dev
connectionProfiles:
- conn-gnmi-skipverify
targetConnectionProfiles:
- credentials: srl.nokia.sdcio.dev
connectionProfile: conn-gnmi-skipverify
syncProfile: sync-gnmi-get
targetTemplate:
labels:
sdcio.dev/region: us-east
Configure sdc
============
# apply the schema for srlinux 24.3.2 [1/5]:
> kubectl apply -f https://raw.githubusercontent.com/kubenet-dev/kubenet/v0.0.1/sdc/schemas/srl24-3-2.yaml
schema.inv.sdcio.dev/srl.nokia.sdcio.dev-24.3.2 created
# apply the gnmi profile to connect to the target (clab node) [2/5]:
> kubectl apply -f https://raw.githubusercontent.com/kubenet-dev/kubenet/v0.0.1/sdc/profiles/conn-gnmi-skipverify.yaml
targetconnectionprofile.inv.sdcio.dev/conn-gnmi-skipverify created
# apply the gnmi sync profile to sync config from the target (clab node) [3/5]:
> kubectl apply -f https://raw.githubusercontent.com/kubenet-dev/kubenet/v0.0.1/sdc/profiles/sync-gnmi-get.yaml
targetsyncprofile.inv.sdcio.dev/sync-gnmi-get created
# apply the srl secret with credentials to authenticate to the target (clab node) [4/5]:
> kubectl apply -f https://raw.githubusercontent.com/kubenet-dev/kubenet/v0.0.1/sdc/profiles/secret.yaml
secret/srl.nokia.sdcio.dev created
# apply the discovery rule to discover the srl devices deployed by containerlab [5/5]:
> kubectl apply -f https://raw.githubusercontent.com/kubenet-dev/kubenet/v0.0.1/sdc/drrules/dr-dynamic.yaml
discoveryrule.inv.sdcio.dev/dr-dynamic created
Let's see if this was successfull.
Wow 🎉 we discovered the 3 devices setup with containerlab, with their respective MAC address, IP address, Provider, etc.
NAME READY REASON PROVIDER ADDRESS PLATFORM SERIALNUMBER MACADDRESS
core01 True srl.nokia.sdcio.dev 172.21.0.3:57400 7220 IXR-D3 Sim Serial No. 1A:D3:02:FF:00:00
edge01 True srl.nokia.sdcio.dev 172.21.0.4:57400 7220 IXR-D2 Sim Serial No. 1A:16:03:FF:00:00
edge02 True srl.nokia.sdcio.dev 172.21.0.5:57400 7220 IXR-D2 Sim Serial No. 1A:1D:04:FF:00:00
The following command allows us to see the running config of the respective devices.
E.g. if you want to backup the config of your devices this command allows you to pull the configuration and back them up in your preferred backup system.
Lets configure the network devices such that we can exchange routes and validate the configuration.