srl-labs / containerlab

container-based networking labs
https://containerlab.dev
BSD 3-Clause "New" or "Revised" License
1.56k stars 266 forks source link

"clab inspect <LAB Name>" from any directory #1958

Closed tiago-amado closed 7 months ago

tiago-amado commented 8 months ago

it would be nice if we could inspect a specific lab from any dir in the system. If we want to inspect a unique lab we need to move to the original lab directory. If we execute from other directory it will fail: clab inspect

clab inspect from any dir

clab inspect from any dir other than the one with the .yml file fails

[root@Airframe3 ~]# clab inspect anysec-macsec 
Error: none or more than one topology files found, can't auto select one
[root@Airframe3 ~]# 

clab inspect from .yml directory

if we move to the .yml dir, the clab inspect works fine

[root@Airframe3 ~]# 
[root@Airframe3 ~]# cd /home/tiago/github/sros-anysec-macsec-lab/
[root@Airframe3 sros-anysec-macsec-lab]# clab inspect anysec-macsec 
INFO[0000] Parsing & checking topology file: anysec-macsec.clab.yml 
+----+------------+--------------+-------------------------------------------+------------+---------+-----------------+--------------+
| #  |    Name    | Container ID |                   Image                   |    Kind    |  State  |  IPv4 Address   | IPv6 Address |
+----+------------+--------------+-------------------------------------------+------------+---------+-----------------+--------------+
|  1 | ce5        | 8fef64d48b16 | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.51/24 | N/A          |
|  2 | ce6        | 13991780ebee | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.52/24 | N/A          |
|  3 | client7    | 6ed639de2e17 | ghcr.io/srl-labs/network-multitool        | linux      | running | 172.50.50.31/24 | N/A          |
|  4 | client8    | f74a70906b33 | ghcr.io/srl-labs/network-multitool        | linux      | running | 172.50.50.32/24 | N/A          |
|  5 | gnmic      | 37dd17f9d929 | ghcr.io/openconfig/gnmic:0.29.0           | linux      | running | 172.50.50.21/24 | N/A          |
|  6 | grafana    | 3a156c6ca596 | grafana/grafana:9.5.2                     | linux      | running | 172.50.50.23/24 | N/A          |
|  7 | p3         | 576f085938f0 | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.13/24 | N/A          |
|  8 | p4         | 11d3ef75e541 | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.14/24 | N/A          |
|  9 | pe1        | afa0c4355834 | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.11/24 | N/A          |
| 10 | pe2        | 116e202bdb34 | registry.srlinux.dev/pub/vr-sros:23.10.R1 | nokia_sros | running | 172.50.50.12/24 | N/A          |
| 11 | prometheus | bc55b3425fad | prom/prometheus:v2.35.0                   | linux      | running | 172.50.50.22/24 | N/A          |
+----+------------+--------------+-------------------------------------------+------------+---------+-----------------+--------------+
[root@Airframe3 sros-anysec-macsec-lab]# 
hellt commented 8 months ago

@tiago-amado did you try clab inspect -t <path to the dir with clab file>?

tiago-amado commented 8 months ago

yes, but the idea was to get rid of the path and use only the Lab Name.
not sure if its something easy to deploy. the "clab inspect -a" shows the topo path, is there a way to use it?

hellt commented 8 months ago

yeah, we don't support inspecting the lab by its name at this moment I think

tiago-amado commented 7 months ago

hum... I've upgraded clab to 0.54.1 and now the output when I specify the yml file is showing all containers. should I raise an issue for this?

[root@Airframe3 scripts_3B]# clab inspect -t meo_fase3B.yml 
INFO[0000] Parsing & checking topology file: meo_fase3B.yml 
+----+--------------------------+--------------+-------------------------------------------------+--------------+---------+-----------------+----------------------+
| #  |           Name           | Container ID |                      Image                      |     Kind     |  State  |  IPv4 Address   |     IPv6 Address     |
+----+--------------------------+--------------+-------------------------------------------------+--------------+---------+-----------------+----------------------+
|  1 | awesome_galois           | c9fcad936214 | ghcr.io/srl-labs/clab-io-draw:latest            |              | exited  | N/A             | N/A                  |
|  2 | edgeshark                | aaf5c7e3ca65 | ghcr.io/siemens/packetflix                      |              | created | 172.18.0.5/16   | N/A                  |
|  3 | edgeshark-edgeshark-1    | b1d4a0bf8a87 | ghcr.io/siemens/packetflix                      |              | running | 172.18.0.3/16   | N/A                  |
|  4 | edgeshark-gostwire-1     | 11d9973961bc | ghcr.io/siemens/ghostwire                       |              | running | 172.18.0.2/16   | N/A                  |
|  5 | gostwire                 | d615d1acac89 | ghcr.io/siemens/ghostwire                       |              | running | 172.18.0.4/16   | N/A                  |
|  6 | modest_jackson           | 87dbfd8963c6 | hello-world                                     |              | exited  | N/A             | N/A                  |
|  7 | ce5                      | b20bb8b81545 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.51/24 | N/A                  |
|  8 | ce6                      | 4eb670858fdf | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.52/24 | N/A                  |
|  9 | client7                  | f2a7081860b3 | ghcr.io/srl-labs/network-multitool              | linux        | running | 172.50.50.31/24 | N/A                  |
| 10 | client8                  | d0e984da1e14 | ghcr.io/srl-labs/network-multitool              | linux        | running | 172.50.50.32/24 | N/A                  |
| 11 | gnmic                    | a1659e5201eb | ghcr.io/openconfig/gnmic:0.29.0                 | linux        | running | 172.50.50.21/24 | N/A                  |
| 12 | grafana                  | 9717fd00a399 | grafana/grafana:9.5.2                           | linux        | running | 172.50.50.23/24 | N/A                  |
| 13 | p3                       | e78dad907880 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.13/24 | N/A                  |
| 14 | p4                       | 7dbc14962280 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.14/24 | N/A                  |
| 15 | pe1                      | e0db90708b89 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.11/24 | N/A                  |
| 16 | pe2                      | eb47315af457 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | nokia_sros   | running | 172.50.50.12/24 | N/A                  |
| 17 | prometheus               | 9e2c18cbf2fc | prom/prometheus:v2.35.0                         | linux        | running | 172.50.50.22/24 | N/A                  |
| 18 | clab-cisco_c8000v-c8000v | c1e63a34198f | registry.srlinux.dev/pub/cisco_c8000v:17.11.01a | cisco_c8000v | running | 172.20.20.4/24  | 2001:172:20:20::4/64 |
| 19 | IXR110                   | ed784e184f92 | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.6/24  | 2001:172:20:20::6/64 |
| 20 | IXR111                   | 5fc84679e5ef | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.8/24  | 2001:172:20:20::8/64 |
| 21 | IXR120                   | 956db7c0d64d | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.7/24  | 2001:172:20:20::7/64 |
| 22 | IXR121                   | e0dd7dc0ea57 | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.3/24  | 2001:172:20:20::3/64 |
| 23 | IXR220                   | fd6f0ad666a6 | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.2/24  | 2001:172:20:20::2/64 |
| 24 | IXR221                   | 883357370fbb | ghcr.io/nokia/srlinux:23.7.2                    | srl          | running | 172.20.20.5/24  | 2001:172:20:20::5/64 |
| 25 | sr100                    | c74a01a12b03 | registry.srlinux.dev/pub/vr-sros:23.3.R1        | vr-sros      | running | 172.20.20.14/24 | 2001:172:20:20::e/64 |
| 26 | sr200                    | 3c62d9855861 | registry.srlinux.dev/pub/vr-sros:23.3.R1        | vr-sros      | running | 172.20.20.15/24 | 2001:172:20:20::f/64 |
| 27 | srv130                   | b35a81a68fcb | registry.srlinux.dev/pub/vr-sros:23.10.R3       | vr-sros      | running | 172.20.20.11/24 | 2001:172:20:20::b/64 |
| 28 | srv140                   | 3b9cc7da32c6 | registry.srlinux.dev/pub/vr-sros:23.10.R3       | vr-sros      | running | 172.20.20.13/24 | 2001:172:20:20::d/64 |
| 29 | srv141                   | ddbddd9f0561 | registry.srlinux.dev/pub/vr-sros:23.10.R3       | vr-sros      | running | 172.20.20.12/24 | 2001:172:20:20::c/64 |
| 30 | srv230                   | f05612ba1bd7 | registry.srlinux.dev/pub/vr-sros:23.10.R3       | vr-sros      | running | 172.20.20.9/24  | 2001:172:20:20::9/64 |
| 31 | ssh                      | 09cc52fa502d | netreplica/graphite:webssh2                     | linux        | running | 172.20.20.10/24 | 2001:172:20:20::a/64 |
| 32 | r101                     | b08fc07ab0c8 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | vr-sros      | exited  | N/A             | N/A                  |
| 33 | r102                     | 5ac092ee9020 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | vr-sros      | exited  | N/A             | N/A                  |
| 34 | r103                     | c99948c822ca | registry.srlinux.dev/pub/vr-sros:23.10.R1       | vr-sros      | exited  | N/A             | N/A                  |
| 35 | r104                     | 80fbd8230dd2 | registry.srlinux.dev/pub/vr-sros:23.10.R1       | vr-sros      | exited  | N/A             | N/A                  |
| 36 | core1                    | 3cde0f6a2f46 | vrnetlab/vr-sros:20.10.R10                      | nokia_sros   | running | 172.80.80.3/24  | N/A                  |
| 37 | core2                    | 649baa2a45c0 | vrnetlab/vr-sros:20.10.R10                      | nokia_sros   | running | 172.80.80.2/24  | N/A                  |
| 38 | local1                   | 57009377e342 | vrnetlab/vr-sros:20.10.R10                      | nokia_sros   | running | 172.80.80.4/24  | N/A                  |
| 39 | local2                   | e962a91c8bae | vrnetlab/vr-sros:20.10.R10                      | nokia_sros   | running | 172.80.80.8/24  | N/A                  |
| 40 | local3                   | a186c686af28 | vrnetlab/vr-sros:16.0.R20                       | nokia_sros   | running | 172.80.80.7/24  | N/A                  |
| 41 | remote1                  | 82bbcef4a2d4 | vrnetlab/vr-sros:19.10.R14                      | nokia_sros   | running | 172.80.80.6/24  | N/A                  |
| 42 | remote2                  | eee8c8c9d0d9 | vrnetlab/vr-sros:20.10.R10                      | nokia_sros   | running | 172.80.80.5/24  | N/A                  |
| 43 | clab-sxr-sxr1d32d        | 07069e8569a3 | ghcr.io/nokia/srlinux                           | srl          | exited  | N/A             | N/A                  |
| 44 | clab-sxr-sxr1x44s        | 3499534fd50e | ghcr.io/nokia/srlinux                           | srl          | exited  | N/A             | N/A                  |
+----+--------------------------+--------------+-------------------------------------------------+--------------+---------+-----------------+----------------------+
[root@Airframe3 scripts_3B]# 
hellt commented 7 months ago

Yes, please. And do mention which release you had before the upgrade. I suspect this might be an issue introduced in 0.54.1 when we upgraded the docker API.

Also dump please the output of 'docker info'

tiago-amado commented 7 months ago

Will do. Did a few tests an its working fine up to 0.52.0, and from 0.53.0 is not working.