Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read parameters for vpp host interface creation from config file #1027

Merged
merged 6 commits into from
Mar 20, 2024

Conversation

ljkiraly
Copy link
Contributor

@ljkiraly ljkiraly commented Jan 11, 2024

Improvement details

Parameters of vpp init functions for host interface creation should be exposed.
If a configuration file is present, the parameter values should be read from this config.
If there is no configuration file the current parameter values should be used.
The parameter values of the api functions should be written into the configuration file.

Notes

Parameters and default values:

AF_PACKET:
    mode: 1 # - ethernet mode
    rxFrameSize: 10240
    txFrameSize: 10240
    rxFramesPerBlock: 1024
    txFramesPerBlock: 1024
    numRxQueues: 1
    numTxQueues: 0
    flags: 8 # - AF_PACKET v2 API
AF_XDP:
    mode: 0 # - auto mode
    rxqSize: 8192
    txqSize: 8192
    flags: 0

Configuration file path: /var/lib/networkservicemesh/vppapi-hostint-args.yaml

@ljkiraly ljkiraly force-pushed the test-vppcfg branch 3 times, most recently from 3c987a2 to f43ee92 Compare January 11, 2024 19:41
@ljkiraly ljkiraly force-pushed the test-vppcfg branch 5 times, most recently from 0e43999 to 2a24fdd Compare March 12, 2024 13:21
@ljkiraly ljkiraly changed the title test; Parameters for vpp af interface creation read from config file Read parameters for vpp host interface creation from config file Mar 12, 2024
@ljkiraly ljkiraly marked this pull request as ready for review March 12, 2024 13:46
Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
internal/vppinit/apiparams/apiparams.go Outdated Show resolved Hide resolved
internal/vppinit/apiparams/apiparams.go Outdated Show resolved Hide resolved
internal/vppinit/apiparams/apiparams.go Outdated Show resolved Hide resolved
Copy link
Member

@denis-tingaikin denis-tingaikin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually looks good. Added a few comments mostly related to style

package apiparams

const (
confFilename = "/var/lib/networkservicemesh/vppapi-hostint-args.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move this parameter to the NSM config?
I think it will be easier to see that vppinit can be configured

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, eventually that was my initial approach. I can define this parameter as NSM config parameter and

1/ Pass it to init (Execute function) either changing argument list or using options pattern - each will change the function prototype and made reading/understanding the code harder. For example in main.go the call of this init function is complex already:
vppinit.Must(cfg.VppInit.Execute(ctx, vppConn, cfg.TunnelIP)),

Or
2/ Get the parameter value by os.Getenv() where I want to use the path name in apiparams.go: getConfig(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glazychev-art Going forward with 2nd alternative, detailed in comment above.

- move to vppinit module

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
 - do not dump default configuration

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
- rename the configuration struct

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
- fix linter errors

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
- read the path of the configuration file from an environment variable

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
@denis-tingaikin denis-tingaikin merged commit 665dbbc into networkservicemesh:main Mar 20, 2024
12 checks passed
nsmbot pushed a commit to networkservicemesh/deployments-k8s that referenced this pull request Mar 20, 2024
…d-forwarder-vpp@main

PR link: networkservicemesh/cmd-forwarder-vpp#1027

Commit: 665dbbc
Author: Laszlo Kiraly
Date: 2024-03-20 11:16:26 +0100
Message:
  - Read parameters for vpp host interface creation from config file (#1027)
* Parameters for vpp's host interface creation read from config file

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

* Parameters for vpp's host interface creation read from config file

- move to vppinit module

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

* Parameters for vpp's host interface creation read from config file

 - do not dump default configuration

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

* Parameters for vpp's host interface creation read from config file

- rename the configuration struct

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

* Parameters for vpp's host interface creation read from config file

- fix linter errors

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

* Parameters for vpp's host interface creation read from config file

- read the path of the configuration file from an environment variable

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

---------

Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants