Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Features of the gnmi-target
Facing to the outside, the gnmi-target represents the information of the particular network element to be managed as yang model instances.
However, for each and every leaf of a yang model, a corresponding handler must be implemented. The handler gets or sets the information from the operating system. Additionally, for every top-level yang model (e.g, ACL or system) some handling code is required, probably mostly to set up everything for later use.
By now,
1. some models may be part of the generated yang models but not have the corresponding handling code yet ready implemented;
2. some models and their handling code may be supported in general, but not in a specific gnmi-target build.
For 1) the yang leaf will just be empty.
For 2) there needs to be a away to enable or disable the handling code for certain models.
We call the handling code a gnmi-target feature, or just short feature.
The next sections describe how features are added in principle and how they can be enabled or disabled during compile time.
## Where to find the Features?
Go in the source code to gnmi-target and these files:
- config.go: the main file where in the initialization of the target. You will see a number of if GT_FEATURE_XXX statements.
- config_NAME.go: where NAME is the OC top-level name. It can be, for instance, acl. This file is used during the default feature set build
- feature_config.go: this defines the default features of the target.
## Adding Features
Adding a new feature requires to:
- add the feature to feature_config.go, by adding a new constant GT_FEAT_XXX
- adding the implementation of the initialization of the features as config_FEATURENAME.go
- add the feature to config.go
## Enable or Disable Features
There are two steps required to enable an optional feature:
- set the corresponding constant GT_FEATURE_XXX in the file feature_config.go
- include the appropriate build flag in the build process (e.g., go build -tags="XXX")