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

Add inspect interfaces command, refactor cmd package #2437

Merged
merged 16 commits into from
Feb 3, 2025

Conversation

vista-
Copy link
Contributor

@vista- vista- commented Feb 2, 2025

This PR adds the inspect interfaces subcommand, which can be used to list the network interfaces of deployed nodes of a lab. The command provides information about the operational state, type, and interface alias of interfaces of lab nodes.

This is a privileged Containerlab command, as it requires entering network namespaces, which only privileged users can perform.

It can either output with pretty-printed table or JSON formatting.

The inspect and the new inspect interfaces command has been moved into a sub-package of cmd.

This PR also comes with a large refactor of the cmd package, moving common (or shared) variables within the common package inside cmd.

@vista- vista- force-pushed the feature/cmd-inspect-interfaces branch from 16f277f to 05edc31 Compare February 2, 2025 01:53
@kaelemc
Copy link
Contributor

kaelemc commented Feb 2, 2025

@vista- with --format json do you think we could hide the log messages to align with clab ins -a -f json?

This just makes parsing the json a little easier so we don't have to strip out any logging

@hellt
Copy link
Member

hellt commented Feb 2, 2025

I think the idea with json output and log messages that we used in other commands was that log messages are directed to stderr and json was printed to stdout

@hellt
Copy link
Member

hellt commented Feb 3, 2025

thanks a bunch @vista-
lgtm

@hellt hellt merged commit bddefaa into main Feb 3, 2025
67 checks passed
@hellt hellt deleted the feature/cmd-inspect-interfaces branch February 3, 2025 10:09
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 73.49081% with 101 lines in your changes missing coverage. Please review.

Project coverage is 52.41%. Comparing base (515af5d) to head (6c4b5e4).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
cmd/inspect/inspect_interfaces.go 68.03% 59 Missing and 19 partials ⚠️
cmd/disableTxOffload.go 0.00% 6 Missing ⚠️
cmd/config.go 20.00% 4 Missing ⚠️
cmd/inspect/inspect.go 81.81% 2 Missing and 2 partials ⚠️
cmd/config_template.go 0.00% 3 Missing ⚠️
cmd/exec.go 81.81% 1 Missing and 1 partial ⚠️
cmd/root.go 90.00% 1 Missing and 1 partial ⚠️
cmd/generate.go 75.00% 0 Missing and 1 partial ⚠️
cmd/save.go 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2437      +/-   ##
==========================================
+ Coverage   52.16%   52.41%   +0.24%     
==========================================
  Files         171      172       +1     
  Lines       17342    17582     +240     
==========================================
+ Hits         9047     9215     +168     
- Misses       7346     7398      +52     
- Partials      949      969      +20     
Files with missing lines Coverage Δ
clab/config.go 68.16% <100.00%> (+0.06%) ⬆️
cmd/deploy.go 76.84% <100.00%> (ø)
cmd/destroy.go 77.77% <100.00%> (ø)
cmd/graph.go 39.25% <100.00%> (ø)
cmd/redeploy.go 90.62% <100.00%> (ø)
cmd/tools_netem.go 70.87% <100.00%> (ø)
cmd/tools_veth.go 72.78% <100.00%> (ø)
types/types.go 62.88% <ø> (ø)
cmd/generate.go 68.24% <75.00%> (ø)
cmd/save.go 73.33% <90.00%> (ø)
... and 7 more

... and 1 file with indirect coverage changes

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