From c63e4b216eec0579b54653ae6e6b15061876ec4a Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Fri, 28 May 2021 10:24:26 +0200 Subject: [PATCH] added tests for inspect command to display ip addresses --- .github/workflows/cicd.yml | 1 + tests/01-smoke/01-basic-flow.robot | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index fd3d63726..3f4e8230d 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -28,6 +28,7 @@ jobs: filters: | code: - 'clab/**' + - 'runtime/**' - 'cmd/**' - 'tests/**' - '.github/workflows/cicd.yml' diff --git a/tests/01-smoke/01-basic-flow.robot b/tests/01-smoke/01-basic-flow.robot index 95feead76..41691d242 100644 --- a/tests/01-smoke/01-basic-flow.robot +++ b/tests/01-smoke/01-basic-flow.robot @@ -1,5 +1,6 @@ *** Settings *** Library OperatingSystem +Library String Suite Teardown Run sudo containerlab destroy -t ${CURDIR}/01-linux-nodes.clab.yml --cleanup *** Variables *** @@ -43,6 +44,22 @@ Verify links in node l2 Should Be Equal As Integers ${rc} 0 Should Contain ${output} state UP +Ensure "inspect all" outputs IP addresses + ${rc} ${output} = Run And Return Rc And Output + ... sudo containerlab inspect --all + Log ${output} + Should Be Equal As Integers ${rc} 0 + ${line} = String.Get Line ${output} -2 + Log ${line} + @{data} = Split String ${line} | + Log ${data} + # verify ipv4 address + ${ipv4} = String.Strip String ${data}[10] + Should Match Regexp ${ipv4} ^[\\d\\.]+/\\d{1,2}$ + # verify ipv6 address + ${ipv6} = String.Strip String ${data}[11] + Should Match Regexp ${ipv6} ^[\\d:]+/\\d{1,2}$ + Destroy ${lab-name} lab ${rc} ${output} = Run And Return Rc And Output ... sudo containerlab destroy -t ${CURDIR}/01-linux-nodes.clab.yml --cleanup