Skip to content

Commit

Permalink
added debug ouput for container login info
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed Aug 30, 2020
1 parent ab7399f commit 7d8d7f9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 3 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
## Description

Container-lab binary is setting up and destroying labs for networking containers.
Currently supporting standard linux containers as clients and networkign containers using SR-Linux
Currently supporting standard linux containers as clients and networking containers using Nokia SR-Linux, Arista cEOS

## installation

### cloning the repo

git clone https://github.com/srl-wim/container-lab

### using rpm installation

rpm -i contaianerlab-1.0.0.x86_64.rpm

## Usage
Expand All @@ -21,11 +25,11 @@ There are some examples in the labs sub directory

### Deploy the lab

sudo ./containerlab -a deploy
sudo ./containerlab -t labs/wan-topo.yml -a deploy

### destroy the lab

sudo ./containerlab -a destroy
sudo ./containerlab -t labs/wan-topo.yml -a destroy

### generating a graph

Expand All @@ -35,3 +39,19 @@ containerlab has the option to generate a topology graph using graphviz that can

dot -Tps graph/wan-topo.dot -o graph/wan-topo.ps
dot -Tpng -Gdpi=300 graph/wan-topo.dot > graph/wan-topo.png

## logging in into the containers

### SRL

#### SRL login to the cli shell

docker exec -ti <container-name> sr_cli

#### SRL login to the bash shell

docker exec -ti <container-name> /bin.bash

### cEOS

docker exec -ti <container-name> Cli
Binary file modified bin/containerlab
Binary file not shown.
18 changes: 18 additions & 0 deletions labs/fabric-topo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Prefix: test
Docker_info:
bridge: srlinux_bridge
ipv4_subnet: "172.19.19.0/24"
ipv6_subnet: "2001:172:19:19::/80"

SRL_image: srlinux:20.6.1-286
SRL_config: srl_config/test.json
SRL_license: srl_config/license.key
Client_image: henderiw/client-alpine:1.0.0

Duts:
wan1: ["srl", "bb", "ixr6", "srl_config/config.json"]
wan2: ["srl", "bb", "ixr6", "srl_config/config.json"]


Links:
- endpoints: ["wan1:e1-1", "wan2:e1-1"]
3 changes: 3 additions & 0 deletions src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ type Node struct {
Binds []string
Pid int
Cid string
MgmtIPv4 string
MgmtIPv6 string
MgmtMac string
}

// Link is a struct that contains the information of a link between 2 containers
Expand Down
5 changes: 5 additions & 0 deletions src/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ func (d *Docker) createContainer(name string, node *Node) (err error) {
return err
}
node.Pid = s.State.Pid
node.MgmtIPv4 = s.NetworkSettings.Networks["srlinux_bridge"].IPAddress
node.MgmtIPv6 = s.NetworkSettings.Networks["srlinux_bridge"].GlobalIPv6Address
node.MgmtMac = s.NetworkSettings.Networks["srlinux_bridge"].MacAddress

log.Debug("Container pid: ", node.Pid)
log.Debug("Container pid: ", node.MgmtIPv4)

return nil
}
Expand Down
7 changes: 7 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"fmt"

log "github.com/sirupsen/logrus"

"github.com/spf13/pflag"
Expand Down Expand Up @@ -88,6 +90,11 @@ func main() {
}
}

//show management ip addresses per Node
for dutName, node := range Nodes {
log.Info(fmt.Sprintf("Mgmt IP addresses of container: %s, IPv4: %s, IPv6: %s, MAC: %s", dutName, node.MgmtIPv4, node.MgmtIPv6, node.MgmtMac))
}

case "destroy":
log.Info("Destroying container lab: ... ", topo)
// delete containers
Expand Down

0 comments on commit 7d8d7f9

Please sign in to comment.