Skip to content

Commit

Permalink
adding tests for --keep-mgmt-net
Browse files Browse the repository at this point in the history
  • Loading branch information
steiler committed Jul 1, 2021
1 parent e4d1c7d commit 01f558e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/01-smoke/07-keep-mgmt-net.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
*** Comments ***
This test suite verifies
- the management bridge is not deleted when --keep-mgmt-net is present and the lab is destroyed
- the management bridge is deleted by default

*** Settings ***
Library OperatingSystem
Library String
Suite Teardown Run sudo containerlab --runtime ${runtime} destroy -t ${topo} --cleanup

*** Variables ***
${lab-name} 7-keep-mgmt-net
${topo} ${CURDIR}/07-linux-single-node.clab.yml
${mgmt-bridge} 01-07-net

*** Test Cases ***
Deploy ${lab-name} lab
Log ${CURDIR}
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} deploy -t ${topo}
Log ${output}
Should Be Equal As Integers ${rc} 0

Destroy ${lab-name} lab keep mgmt net
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} destroy -t ${topo} --keep-mgmt-net
Log ${output}
Should Be Equal As Integers ${rc} 0

Check ${lab-name} mgmt network remains
${rc} ${output} = Run And Return Rc And Output
... sudo ip l show dev ${mgmt-bridge}
Log ${output}
Should Be Equal As Integers ${rc} 0

Deploy ${lab-name} lab again
Log ${CURDIR}
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} deploy -t ${topo}
Log ${output}
Should Be Equal As Integers ${rc} 0

Destroy ${lab-name} lab dont keep mgmt net
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} destroy -t ${topo} --cleanup
Log ${output}
Should Be Equal As Integers ${rc} 0

Check ${lab-name} mgmt network is gone
${rc} ${output} = Run And Return Rc And Output
... sudo ip l show dev ${mgmt-bridge}
Log ${output}
Should Not Be Equal As Integers ${rc} 0
14 changes: 14 additions & 0 deletions tests/01-smoke/07-linux-single-node.clab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

name: single-node
mgmt:
bridge: 01-07-net

topology:
nodes:
l1:
kind: linux
image: alpine:3
cmd: ash -c "sleep 9999"

0 comments on commit 01f558e

Please sign in to comment.