Skip to content

Conversation

@FloSch62
Copy link
Member

Similar to containerlab tools sshx, this as add a web ui, but instead of web, this is fully local with password protection.

❯ ./containerlab tools gotty attach -u test -P test
18:44:30 INFO Parsing & checking topology file=vlan.clab.yml
18:44:30 INFO Pulling image ghcr.io/srl-labs/network-multitool...
18:44:30 INFO Pulling ghcr.io/srl-labs/network-multitool:latest Docker image
18:44:31 INFO Done pulling ghcr.io/srl-labs/network-multitool:latest
18:44:31 INFO Creating GoTTY container clab-vlan-gotty on network 'test'
18:44:31 INFO Creating container name=clab-vlan-gotty
18:44:31 INFO GoTTY container clab-vlan-gotty started. Waiting for GoTTY service to initialize...
18:44:34 INFO GoTTY web terminal successfully started url=http://HOST_IP:8080 username=test password=test note="From the web terminal, you can connect to lab nodes using SSH: ssh admin@clab-vlan-<node-name>"

@FloSch62
Copy link
Member Author

Still need to add the robot tests and documentation...

@steiler I have some functions to be shared between sshx and gotty, is cmd/common/tools.go a "good" place or should it be in utils?

@steiler
Copy link
Collaborator

steiler commented May 12, 2025

You might want to take a look at this

func (c *CLab) ProcessTopoPath(path string) (string, error) {

Parts of what you're trying here is already implemented here

GetOwner I think is more of a utils function ... it always depends... is it general util usefull in general or not.

var err error

// If lab name is provided directly, use it
if toolLabName != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why don't you rename the function var name to labName then you can spare this if

}

// If topo file is provided or discovered
if Topo == "" && labName == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is a WithTopoPath option, that should handle all of this.

return func(c *CLab) error {

}

// If we have lab name but no topo file, try to find it from containers
if labName != "" && Topo == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thinking about it, this should probably also become a ClabOption itself, then it would by a single switch that initializes one or the other ClabOption.

@FloSch62
Copy link
Member Author

@steiler I tried to solve your remarks. From my side this is ready

@FloSch62 FloSch62 marked this pull request as ready for review May 18, 2025 11:13
@FloSch62 FloSch62 requested review from hellt and steiler May 18, 2025 11:24
@codecov
Copy link

codecov bot commented Jun 15, 2025

Codecov Report

Attention: Patch coverage is 73.34437% with 161 lines in your changes missing coverage. Please review.

Project coverage is 54.91%. Comparing base (89545d8) to head (8e6170f).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
cmd/tool_gotty.go 73.85% 80 Missing and 34 partials ⚠️
clab/clab.go 62.06% 16 Missing and 6 partials ⚠️
cmd/destroy.go 65.78% 12 Missing and 1 partial ⚠️
cmd/tool_sshx.go 83.78% 4 Missing and 2 partials ⚠️
cmd/common/tools.go 88.88% 2 Missing and 1 partial ⚠️
utils/owner.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2583      +/-   ##
==========================================
+ Coverage   54.38%   54.91%   +0.53%     
==========================================
  Files         181      184       +3     
  Lines       19695    20149     +454     
==========================================
+ Hits        10711    11065     +354     
- Misses       7874     7944      +70     
- Partials     1110     1140      +30     
Files with missing lines Coverage Δ
cmd/tools_api_start.go 72.00% <100.00%> (+0.12%) ⬆️
cmd/tools_api_status.go 87.17% <100.00%> (ø)
cmd/common/tools.go 88.88% <88.88%> (ø)
utils/owner.go 40.00% <40.00%> (ø)
cmd/tool_sshx.go 67.90% <83.78%> (+2.57%) ⬆️
cmd/destroy.go 77.07% <65.78%> (+0.93%) ⬆️
clab/clab.go 68.24% <62.06%> (-0.41%) ⬇️
cmd/tool_gotty.go 73.85% <73.85%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hellt hellt merged commit b8abdae into main Jun 15, 2025
66 of 68 checks passed
@hellt hellt deleted the tool_gotty branch June 15, 2025 20:56
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.

4 participants