From a1d6a04eea44bcefe1d6db8b9a43a144230e2cbf Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 15:48:47 -0800 Subject: [PATCH 01/40] Add Results from openconfig/public demo runs as PR comments --- .github/workflows/demo.yml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 271bdc7..cb4950c 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -59,5 +59,40 @@ jobs: - name: Demo output on openconfig/public continue-on-error: true + id: demo run: | - go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang + go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output + status=$? + message="## Result of POSIX test cases on openconfig/public\n" + if [ "$status" -eq "0" ]; then + message+="${message}all tests passed" + echo ::set-output name=message::$message + else + message+="${message}failing test cases:\n${output}" + echo ::set-output name=message::$message + fi + + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc-posix + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'OpenConfigBot' + body-includes: '## Result of POSIX test cases on openconfig/public' + + - name: Create comment + if: steps.fc-posix.outputs.comment-id == '' + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + ${{ steps.demo.outputs.message }} + + - name: Update comment + if: steps.fc-posix.outputs.comment-id != '' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + body: | + ${{ steps.demo.outputs.message }} + From a001276a835bb843a22c2d7fde6c2080b4641662 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:05:58 -0800 Subject: [PATCH 02/40] modify message --- .github/workflows/demo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index cb4950c..4b01f32 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -63,12 +63,12 @@ jobs: run: | go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? - message="## Result of POSIX test cases on openconfig/public\n" + message="## Result of POSIX test cases on openconfig/public" if [ "$status" -eq "0" ]; then - message+="${message}all tests passed" + message=$(printf "${message}\nall tests passed") echo ::set-output name=message::$message else - message+="${message}failing test cases:\n${output}" + message=$(printf "${message}\nfailing test cases:\n${output}" echo ::set-output name=message::$message fi From 2c8660c49a734c4e267bfcf53e417392c77c6e26 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:12:29 -0800 Subject: [PATCH 03/40] modify message --- .github/workflows/demo.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 4b01f32..7320234 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -85,14 +85,12 @@ jobs: uses: peter-evans/create-or-update-comment@v1 with: issue-number: ${{ github.event.pull_request.number }} - body: | - ${{ steps.demo.outputs.message }} + body: ${{ steps.demo.outputs.message }} - name: Update comment if: steps.fc-posix.outputs.comment-id != '' uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ steps.fc.outputs.comment-id }} - body: | - ${{ steps.demo.outputs.message }} + body: ${{ steps.demo.outputs.message }} From db72f7e905c543a3ce8aefd902f92c4cdc712b09 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:16:37 -0800 Subject: [PATCH 04/40] modify message --- .github/workflows/demo.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 7320234..ec224dd 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -85,12 +85,16 @@ jobs: uses: peter-evans/create-or-update-comment@v1 with: issue-number: ${{ github.event.pull_request.number }} - body: ${{ steps.demo.outputs.message }} + body: | + Test output + ${{ steps.demo.outputs.message }} - name: Update comment if: steps.fc-posix.outputs.comment-id != '' uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ steps.fc.outputs.comment-id }} - body: ${{ steps.demo.outputs.message }} + body: | + Test output + ${{ steps.demo.outputs.message }} From 7c514b07a44843df3cc3c85e3e0c4ffd46a4108e Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:23:34 -0800 Subject: [PATCH 05/40] modify message --- .github/workflows/demo.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index ec224dd..d0fc887 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -65,10 +65,13 @@ jobs: status=$? message="## Result of POSIX test cases on openconfig/public" if [ "$status" -eq "0" ]; then - message=$(printf "${message}\nall tests passed") + message="${message}\ + all tests passed") echo ::set-output name=message::$message else - message=$(printf "${message}\nfailing test cases:\n${output}" + message="${message}\ + failing test cases:\ + ${output}" echo ::set-output name=message::$message fi @@ -86,7 +89,6 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - Test output ${{ steps.demo.outputs.message }} - name: Update comment @@ -95,6 +97,5 @@ jobs: with: comment-id: ${{ steps.fc.outputs.comment-id }} body: | - Test output ${{ steps.demo.outputs.message }} From f435ea34b5be7f7ad23161b9db0c8bd9e54335ae Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:31:17 -0800 Subject: [PATCH 06/40] modify message --- .github/workflows/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index d0fc887..c19d48e 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -66,7 +66,7 @@ jobs: message="## Result of POSIX test cases on openconfig/public" if [ "$status" -eq "0" ]; then message="${message}\ - all tests passed") + all tests passed" echo ::set-output name=message::$message else message="${message}\ From c8462b5693f62accacbb8108fe4d6efc0a181856 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:41:34 -0800 Subject: [PATCH 07/40] modify message --- .github/workflows/demo.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index c19d48e..9cf0840 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -63,15 +63,11 @@ jobs: run: | go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? - message="## Result of POSIX test cases on openconfig/public" if [ "$status" -eq "0" ]; then - message="${message}\ - all tests passed" + message="all tests passed" echo ::set-output name=message::$message else - message="${message}\ - failing test cases:\ - ${output}" + message="${output}" echo ::set-output name=message::$message fi @@ -89,6 +85,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | + "## Result of POSIX test cases on openconfig/public" ${{ steps.demo.outputs.message }} - name: Update comment @@ -97,5 +94,6 @@ jobs: with: comment-id: ${{ steps.fc.outputs.comment-id }} body: | + "## Result of POSIX test cases on openconfig/public" ${{ steps.demo.outputs.message }} From cdeae7d46556938810b0d5b1badd00cab4edb5ff Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 16:57:25 -0800 Subject: [PATCH 08/40] modify message --- .github/workflows/demo.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 9cf0840..d1505cb 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -63,6 +63,8 @@ jobs: run: | go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? + title="## Result of POSIX test cases on openconfig/public" + echo ::set-output name=title::$title if [ "$status" -eq "0" ]; then message="all tests passed" echo ::set-output name=message::$message @@ -77,7 +79,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'OpenConfigBot' - body-includes: '## Result of POSIX test cases on openconfig/public' + body-includes: ${{ steps.demo.outputs.title }} - name: Create comment if: steps.fc-posix.outputs.comment-id == '' @@ -85,7 +87,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - "## Result of POSIX test cases on openconfig/public" + ${{ steps.demo.outputs.title }} ${{ steps.demo.outputs.message }} - name: Update comment @@ -94,6 +96,6 @@ jobs: with: comment-id: ${{ steps.fc.outputs.comment-id }} body: | - "## Result of POSIX test cases on openconfig/public" + ${{ steps.demo.outputs.title }} ${{ steps.demo.outputs.message }} From ff97ff6cd8b41e9f3b87a4d477e7ff67f4f482e6 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 17:07:21 -0800 Subject: [PATCH 09/40] debug --- .github/workflows/demo.yml | 2 +- testdata/regexp-test.yang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index d1505cb..c8b3a1c 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -63,7 +63,7 @@ jobs: run: | go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? - title="## Result of POSIX test cases on openconfig/public" + title="### Test Results on openconfig/public" echo ::set-output name=title::$title if [ "$status" -eq "0" ]; then message="all tests passed" diff --git a/testdata/regexp-test.yang b/testdata/regexp-test.yang index 36940e5..9a736bb 100644 --- a/testdata/regexp-test.yang +++ b/testdata/regexp-test.yang @@ -9,7 +9,7 @@ module regexp-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.255"; + pt:pattern-test-pass "255.255.255.256"; pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; From 737ed78a8d8a2303f25ae8b60fa438050cac3d3a Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 17:18:32 -0800 Subject: [PATCH 10/40] debug --- testdata/regexp-test.yang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/regexp-test.yang b/testdata/regexp-test.yang index 9a736bb..36940e5 100644 --- a/testdata/regexp-test.yang +++ b/testdata/regexp-test.yang @@ -9,7 +9,7 @@ module regexp-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.256"; + pt:pattern-test-pass "255.255.255.255"; pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; From aba70c2d89e79b105c4a1e5b82e91ee7a785a919 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 17:42:18 -0800 Subject: [PATCH 11/40] debug --- .github/workflows/demo.yml | 15 +++------------ testdata/regexp-test.yang | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index c8b3a1c..04d044d 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -81,21 +81,12 @@ jobs: comment-author: 'OpenConfigBot' body-includes: ${{ steps.demo.outputs.title }} - - name: Create comment - if: steps.fc-posix.outputs.comment-id == '' - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - ${{ steps.demo.outputs.title }} - ${{ steps.demo.outputs.message }} - - - name: Update comment - if: steps.fc-posix.outputs.comment-id != '' + - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} body: | ${{ steps.demo.outputs.title }} ${{ steps.demo.outputs.message }} - + edit-mode: replace diff --git a/testdata/regexp-test.yang b/testdata/regexp-test.yang index 36940e5..9a736bb 100644 --- a/testdata/regexp-test.yang +++ b/testdata/regexp-test.yang @@ -9,7 +9,7 @@ module regexp-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.255"; + pt:pattern-test-pass "255.255.255.256"; pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; From 5ba264c641d1c313ba43287c1dc00d53b39454b8 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 17:57:26 -0800 Subject: [PATCH 12/40] debug --- .github/workflows/demo.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 04d044d..9072d40 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,7 +61,7 @@ jobs: continue-on-error: true id: demo run: | - go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output + output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang) status=$? title="### Test Results on openconfig/public" echo ::set-output name=title::$title @@ -69,8 +69,7 @@ jobs: message="all tests passed" echo ::set-output name=message::$message else - message="${output}" - echo ::set-output name=message::$message + echo ::set-output name=message::$output fi - name: Find Comment From 1668532e1737edfa6740df0753aca22462495b65 Mon Sep 17 00:00:00 2001 From: wenovus Date: Wed, 24 Feb 2021 18:08:20 -0800 Subject: [PATCH 13/40] debug --- .github/workflows/demo.yml | 2 +- pytests/pattern_test.sh | 2 +- {testdata => regexp-test}/regexp-test.yang | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {testdata => regexp-test}/regexp-test.yang (100%) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 9072d40..6f802a0 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,7 +61,7 @@ jobs: continue-on-error: true id: demo run: | - output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang) + go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang > output 2>&1 status=$? title="### Test Results on openconfig/public" echo ::set-output name=title::$title diff --git a/pytests/pattern_test.sh b/pytests/pattern_test.sh index 22a7dc6..eb8f219 100755 --- a/pytests/pattern_test.sh +++ b/pytests/pattern_test.sh @@ -10,7 +10,7 @@ TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" REPO_DIR="$TEST_DIR/.." tmpstderr=$(mktemp) -pyang -p $OCDIR -p "$REPO_DIR/testdata" --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns "$REPO_DIR/testdata/regexp-test.yang" 2> $tmpstderr +pyang -p $OCDIR -p "$REPO_DIR/testdata" --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns "$REPO_DIR/regexp-test/*.yang" 2> $tmpstderr retcode=$? if [ $retcode -ne 0 ]; then >&2 echo "| Line # | typedef | error |" diff --git a/testdata/regexp-test.yang b/regexp-test/regexp-test.yang similarity index 100% rename from testdata/regexp-test.yang rename to regexp-test/regexp-test.yang From 8639cc85f166b3c12a68e83a56bf80216bf67534 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 13:21:43 -0800 Subject: [PATCH 14/40] debug --- .github/workflows/demo.yml | 4 ++-- README.md | 16 +++++++++++----- gotests/output | 4 ++++ {testdata => regexp-test}/pattern-test.yang | 0 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 gotests/output rename {testdata => regexp-test}/pattern-test.yang (100%) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 6f802a0..2dd1e34 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,7 +61,7 @@ jobs: continue-on-error: true id: demo run: | - go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang > output 2>&1 + go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? title="### Test Results on openconfig/public" echo ::set-output name=title::$title @@ -69,7 +69,7 @@ jobs: message="all tests passed" echo ::set-output name=message::$message else - echo ::set-output name=message::$output + echo ::set-output name=message::$(cat output) fi - name: Find Comment diff --git a/README.md b/README.md index 0adfda1..9ee05c3 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,11 @@ using a [pyang](https://github.com/mbj4668/pyang) plugin and [oc-ext:posix-pattern](https://github.com/openconfig/public/blob/master/release/models/openconfig-extensions.yang#L114) using [goyang](https://github.com/openconfig/goyang). -## Demo CI Workflow +## How to Contribute to this Repository -There is a demo CI workflow that runs on Pull Requests. They are used to demo -the result of running the tests on the current YANG models. If they cause an -expected test failure (perhaps because you added an uncaught corner case), it -will not block merge and a minor version increment will be given. +Pattern statement tests reside in the `regexp-test` module in the +[regexp-test](regexp-test) folder. Currently, all tests reside in +regexp-test.yang, but submodules can be created to include more tests. ## Releases @@ -21,6 +20,13 @@ pattern regex), then the minor version must be incremented. At this time, major version updates are not anticipated, but could occur as a result of major changes to the repository. +### Demo CI Workflow + +There is a demo CI workflow that runs on Pull Requests. They are used to demo +the result of running the tests on the current openconfig/public YANG models. +It's possible test failure are expected (e.g. wrong existing pattern). If this +is the case a minor version increment should be given. + -------------------------------------------------------------------------------- [OpenConfig YANG models](https://github.com/openconfig/public/blob/master/README.md) diff --git a/gotests/output b/gotests/output new file mode 100644 index 0000000..d8fc27e --- /dev/null +++ b/gotests/output @@ -0,0 +1,4 @@ +| leaf | typedef | error | +| --- | --- | --- | +| `ipv4-address` | `ipv4-address` | `255.255.255.256` did not match | +exit status 1 diff --git a/testdata/pattern-test.yang b/regexp-test/pattern-test.yang similarity index 100% rename from testdata/pattern-test.yang rename to regexp-test/pattern-test.yang From e3c857d2fee6af026ff9311f12a13cdd2e1b8dcc Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 13:25:09 -0800 Subject: [PATCH 15/40] debug --- README.md | 4 ++-- {regexp-test => testdata}/pattern-test.yang | 0 {regexp-test => testdata}/regexp-test.yang | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {regexp-test => testdata}/pattern-test.yang (100%) rename {regexp-test => testdata}/regexp-test.yang (100%) diff --git a/README.md b/README.md index 9ee05c3..3324aa7 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ using [goyang](https://github.com/openconfig/goyang). ## How to Contribute to this Repository Pattern statement tests reside in the `regexp-test` module in the -[regexp-test](regexp-test) folder. Currently, all tests reside in -regexp-test.yang, but submodules can be created to include more tests. +[testdata](testdata) folder. Currently, all tests reside in regexp-test.yang, +but submodules can be created to include more tests. ## Releases diff --git a/regexp-test/pattern-test.yang b/testdata/pattern-test.yang similarity index 100% rename from regexp-test/pattern-test.yang rename to testdata/pattern-test.yang diff --git a/regexp-test/regexp-test.yang b/testdata/regexp-test.yang similarity index 100% rename from regexp-test/regexp-test.yang rename to testdata/regexp-test.yang From 526885f4f6127d9eed4ef8b7002ec1b23c92fea5 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 13:30:27 -0800 Subject: [PATCH 16/40] debug --- .github/workflows/demo.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 2dd1e34..6c173e1 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,15 +61,20 @@ jobs: continue-on-error: true id: demo run: | + echo <1> go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? + echo <2> title="### Test Results on openconfig/public" echo ::set-output name=title::$title + echo <3> if [ "$status" -eq "0" ]; then message="all tests passed" echo ::set-output name=message::$message + echo <4> else echo ::set-output name=message::$(cat output) + echo <5> fi - name: Find Comment From 5dc75c583a0ece92607d6feb00c702a8dfb231f5 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 13:33:00 -0800 Subject: [PATCH 17/40] debug --- .github/workflows/demo.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 6c173e1..5dc0162 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,20 +61,20 @@ jobs: continue-on-error: true id: demo run: | - echo <1> + echo "<1>" go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output status=$? - echo <2> + echo "<2>" title="### Test Results on openconfig/public" echo ::set-output name=title::$title - echo <3> + echo "<3>" if [ "$status" -eq "0" ]; then message="all tests passed" echo ::set-output name=message::$message - echo <4> + echo "<4>" else echo ::set-output name=message::$(cat output) - echo <5> + echo "<5>" fi - name: Find Comment From 1c6d23ca5cef61345f11625704e44a448733d0f1 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:31:02 -0800 Subject: [PATCH 18/40] debug --- .github/workflows/demo.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 5dc0162..fb60ad2 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,20 +61,16 @@ jobs: continue-on-error: true id: demo run: | - echo "<1>" - go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang &> output - status=$? - echo "<2>" title="### Test Results on openconfig/public" echo ::set-output name=title::$title - echo "<3>" + + echo "<1>" + echo ::set-output name=message::$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang) + echo "<2>" + if [ "$status" -eq "0" ]; then message="all tests passed" echo ::set-output name=message::$message - echo "<4>" - else - echo ::set-output name=message::$(cat output) - echo "<5>" fi - name: Find Comment From bd5fad2dce3de75405c5d3f4dc54c1cb980e2716 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:36:59 -0800 Subject: [PATCH 19/40] debug --- .github/workflows/demo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index fb60ad2..06c5d53 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -64,9 +64,9 @@ jobs: title="### Test Results on openconfig/public" echo ::set-output name=title::$title - echo "<1>" - echo ::set-output name=message::$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang) - echo "<2>" + echo ::set-output name=message::$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) + status=$? + echo "$status" if [ "$status" -eq "0" ]; then message="all tests passed" From 39de488093d97a98bce1c59d1868741f018f2b6c Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:41:21 -0800 Subject: [PATCH 20/40] debug --- .github/workflows/demo.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 06c5d53..3d2979e 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -64,9 +64,8 @@ jobs: title="### Test Results on openconfig/public" echo ::set-output name=title::$title - echo ::set-output name=message::$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) - status=$? - echo "$status" + output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? + echo ::set-output name=message::$output if [ "$status" -eq "0" ]; then message="all tests passed" From 5279bb78172faa76bc26660019ed7c7552651432 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:45:12 -0800 Subject: [PATCH 21/40] debug --- .github/workflows/demo.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 3d2979e..9f7d177 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -62,14 +62,14 @@ jobs: id: demo run: | title="### Test Results on openconfig/public" - echo ::set-output name=title::$title + echo ::set-output name=title::"$title" output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? - echo ::set-output name=message::$output + echo ::set-output name=message::"$output" if [ "$status" -eq "0" ]; then message="all tests passed" - echo ::set-output name=message::$message + echo ::set-output name=message::"$message" fi - name: Find Comment @@ -78,7 +78,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'OpenConfigBot' - body-includes: ${{ steps.demo.outputs.title }} + body-includes: Test Results on openconfig/public - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 From 0026ba71980105b5b3f77bf42ad1d1328df0fa54 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:47:36 -0800 Subject: [PATCH 22/40] debug --- .github/workflows/demo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 9f7d177..affff50 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -62,14 +62,14 @@ jobs: id: demo run: | title="### Test Results on openconfig/public" - echo ::set-output name=title::"$title" + echo "::set-output name=title::$title" output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? - echo ::set-output name=message::"$output" + echo "::set-output name=message::$output" if [ "$status" -eq "0" ]; then message="all tests passed" - echo ::set-output name=message::"$message" + echo "::set-output name=message::$message" fi - name: Find Comment From 45b175836cdac1b659befeb88488ed00aef1c56f Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 14:50:46 -0800 Subject: [PATCH 23/40] debug --- .github/workflows/demo.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index affff50..d9c4378 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -65,6 +65,10 @@ jobs: echo "::set-output name=title::$title" output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? + # https://github.community/t/set-output-truncates-multiline-strings/16852 + output="${output//'%'/'%25'}" + output="${output//$'\n'/'%0A'}" + output="${output//$'\r'/'%0D'}" echo "::set-output name=message::$output" if [ "$status" -eq "0" ]; then From 70aca42ff0e226698f95abab385ecca5fd9cd842 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 15:10:40 -0800 Subject: [PATCH 24/40] debug --- .github/workflows/demo.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index d9c4378..893941b 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -64,12 +64,12 @@ jobs: title="### Test Results on openconfig/public" echo "::set-output name=title::$title" - output=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? + out=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 - output="${output//'%'/'%25'}" - output="${output//$'\n'/'%0A'}" - output="${output//$'\r'/'%0D'}" - echo "::set-output name=message::$output" + out="${out//'%'/'%25'}" + out="${out//$'\n'/'%0A'}" + out="${out//$'\r'/'%0D'}" + echo "::set-output name=message::$out" if [ "$status" -eq "0" ]; then message="all tests passed" From 895a33a0423d9c1968bfc02a0604effc77d1a3dc Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 15:17:36 -0800 Subject: [PATCH 25/40] debug --- .github/workflows/demo.yml | 2 +- gotests/output | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 gotests/output diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 893941b..92ccc9e 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -81,7 +81,7 @@ jobs: id: fc-posix with: issue-number: ${{ github.event.pull_request.number }} - comment-author: 'OpenConfigBot' + comment-author: 'github-actions[bot]' body-includes: Test Results on openconfig/public - name: Create or update comment diff --git a/gotests/output b/gotests/output deleted file mode 100644 index d8fc27e..0000000 --- a/gotests/output +++ /dev/null @@ -1,4 +0,0 @@ -| leaf | typedef | error | -| --- | --- | --- | -| `ipv4-address` | `ipv4-address` | `255.255.255.256` did not match | -exit status 1 From be2cc21c633dfdad5c908bd69158292e2bbdf4d8 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 15:22:46 -0800 Subject: [PATCH 26/40] debug --- .github/workflows/demo.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 92ccc9e..3a1ea5e 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -61,9 +61,6 @@ jobs: continue-on-error: true id: demo run: | - title="### Test Results on openconfig/public" - echo "::set-output name=title::$title" - out=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 out="${out//'%'/'%25'}" @@ -82,7 +79,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: Test Results on openconfig/public + body-includes: '### Test Results on openconfig/public' - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 @@ -90,6 +87,6 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - ${{ steps.demo.outputs.title }} + '### Test Results on openconfig/public' ${{ steps.demo.outputs.message }} edit-mode: replace From 644b2128b3b0498659fff4f5ae27c0c6a25760e6 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:08:27 -0800 Subject: [PATCH 27/40] debug --- .github/workflows/demo.yml | 39 +++- README.md | 11 +- pytests/pattern_test.sh | 2 +- testdata/openconfig-bgp-types-test.yang | 73 ++++++++ testdata/openconfig-inet-types-test.yang | 80 +++++++++ .../openconfig-packet-match-types-test.yang | 29 +++ testdata/regexp-test.yang | 168 ------------------ 7 files changed, 225 insertions(+), 177 deletions(-) create mode 100644 testdata/openconfig-bgp-types-test.yang create mode 100644 testdata/openconfig-inet-types-test.yang create mode 100644 testdata/openconfig-packet-match-types-test.yang delete mode 100644 testdata/regexp-test.yang diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 3a1ea5e..bf9dcf9 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -29,8 +29,37 @@ jobs: - name: Demo output on openconfig/public continue-on-error: true + id: demo run: | - OCDIR=~/tmp/public pytests/pattern_test.sh + out=$(OCDIR=~/tmp/public pytests/pattern_test.sh 2>&1) || status=$? + # https://github.community/t/set-output-truncates-multiline-strings/16852 + out="${out//'%'/'%25'}" + out="${out//$'\n'/'%0A'}" + out="${out//$'\r'/'%0D'}" + echo "::set-output name=message::$out" + + if [ "$status" -eq "0" ]; then + message="all tests passed" + echo "::set-output name=message::$message" + fi + + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc-xsd + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: '### XSD Demo Test Results on openconfig/public' + + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc-xsd.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + '### XSD Demo Test Results on openconfig/public' + ${{ steps.demo.outputs.message }} + edit-mode: replace posix-pattern: name: posix-pattern statement @@ -61,7 +90,7 @@ jobs: continue-on-error: true id: demo run: | - out=$(go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang 2>&1) || status=$? + out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 out="${out//'%'/'%25'}" out="${out//$'\n'/'%0A'}" @@ -79,14 +108,14 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: '### Test Results on openconfig/public' + body-includes: '### POSIX Demo Test Results on openconfig/public' - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 with: - comment-id: ${{ steps.fc.outputs.comment-id }} + comment-id: ${{ steps.fc-posix.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - '### Test Results on openconfig/public' + '### POSIX Demo Test Results on openconfig/public' ${{ steps.demo.outputs.message }} edit-mode: replace diff --git a/README.md b/README.md index 3324aa7..efc0e1c 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,14 @@ using [goyang](https://github.com/openconfig/goyang). ## How to Contribute to this Repository -Pattern statement tests reside in the `regexp-test` module in the -[testdata](testdata) folder. Currently, all tests reside in regexp-test.yang, -but submodules can be created to include more tests. +Pattern statement tests reside in various modules in the [testdata](testdata) +folder. When adding tests, group pattern tests in test modules named after where +the patterns are found. + +### Limitations + +Only typedef tests are currently supported. The current OpenConfig models only +contain patterns in typedef statements. ## Releases diff --git a/pytests/pattern_test.sh b/pytests/pattern_test.sh index eb8f219..12ff472 100755 --- a/pytests/pattern_test.sh +++ b/pytests/pattern_test.sh @@ -10,7 +10,7 @@ TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" REPO_DIR="$TEST_DIR/.." tmpstderr=$(mktemp) -pyang -p $OCDIR -p "$REPO_DIR/testdata" --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns "$REPO_DIR/regexp-test/*.yang" 2> $tmpstderr +pyang -p $OCDIR -p "$REPO_DIR/testdata" --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns "$REPO_DIR"/testdata/*.yang 2> $tmpstderr retcode=$? if [ $retcode -ne 0 ]; then >&2 echo "| Line # | typedef | error |" diff --git a/testdata/openconfig-bgp-types-test.yang b/testdata/openconfig-bgp-types-test.yang new file mode 100644 index 0000000..e33d487 --- /dev/null +++ b/testdata/openconfig-bgp-types-test.yang @@ -0,0 +1,73 @@ +module openconfig-bgp-types-test { + prefix "rt"; + namespace "urn:openconfig-bgp-types-test"; + + import pattern-test { prefix "pt"; } + import openconfig-bgp-types { prefix "ocbgpt"; } + + leaf bgp-std-community { + type ocbgpt:bgp-std-community-type; + pt:pattern-test-pass "15169:42"; + pt:pattern-test-pass "6643:21438"; + pt:pattern-test-pass "29636:4444"; + pt:pattern-test-pass "65535:65535"; + pt:pattern-test-pass "0:0"; + pt:pattern-test-fail "65536:1"; + pt:pattern-test-fail "1:65536"; + pt:pattern-test-fail "425353:comm"; + } + leaf bgp-ext-community { + type ocbgpt:bgp-ext-community-type; + // Type 1 extended communities (2b AS: 4b integer) + pt:pattern-test-pass "29636:10"; + pt:pattern-test-pass "5413:4294967295"; + pt:pattern-test-pass "4445:0"; + pt:pattern-test-fail "1273:4294967296"; + pt:pattern-test-pass "2856:400"; + pt:pattern-test-fail "5400:invalid"; + pt:pattern-test-fail "i6643:10"; + pt:pattern-test-pass "15169:22432"; + // Type 2 extended communities: (4b IP: 2b integer) + pt:pattern-test-fail "1.1.1.1:4294967296"; + pt:pattern-test-fail "1.2.3.4.5:10"; + pt:pattern-test-pass "82.42.12.35:65535"; + pt:pattern-test-fail "82.42.12.35:66536"; + pt:pattern-test-fail "254.254.256.254:10"; + pt:pattern-test-pass "0.0.0.0:200"; + pt:pattern-test-fail "leading192.0.2.1:65535"; + // 4b AS : 2b integer + pt:pattern-test-fail "4294967296:65535"; + pt:pattern-test-pass "4294967295:65535"; + pt:pattern-test-pass "0:65535"; + pt:pattern-test-pass "4294967295:0"; + pt:pattern-test-fail "4294967296:0"; + // Route Target Type 1 - route-target:<2b AS>:<4b local> + pt:pattern-test-fail "route-target:64"; + pt:pattern-test-pass "route-target:65535:10"; + pt:pattern-test-fail "route-TARGET:65535:10"; + pt:pattern-test-fail "route-target:15169:4294967296"; + pt:pattern-test-pass "route-target:15169:4294967295"; + // Route Target Type 2 - route-target::<2b local> + pt:pattern-test-fail "route-target:256.0.2.36:10"; + pt:pattern-test-pass "route-target:192.0.2.1:10"; + pt:pattern-test-fail "route-target:192.0.2.1:65536"; + // Route Target w/ 4B AS:<2b local> + pt:pattern-test-pass "route-target:4294967295:10"; + pt:pattern-test-fail "route-target:4294967296:10"; + pt:pattern-test-pass "route-target:5413:65535"; + // Route Origin Type 1 - route-target:<2b AS>:<4b local> + pt:pattern-test-fail "route-origin:53"; + pt:pattern-test-pass "route-origin:65535:10"; + pt:pattern-test-fail "route-ORIGINTRAIL:65535:10"; + pt:pattern-test-fail "route-origin:15169:4294967296"; + pt:pattern-test-pass "route-origin:15169:4294967295"; + // Route Origin Type 2 - route-target::<2b local> + pt:pattern-test-fail "route-origin:512.0.2.36:10"; + pt:pattern-test-pass "route-origin:10.18.253.24:10"; + pt:pattern-test-fail "route-origin:192.168.1.1:65536"; + // Route Origin w/ 4B AS:<2b local> + pt:pattern-test-pass "route-origin:4294967295:5353"; + pt:pattern-test-fail "route-origin:4294967296:9009"; + pt:pattern-test-pass "route-origin:5413:65535"; + } +} diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang new file mode 100644 index 0000000..e8a35e6 --- /dev/null +++ b/testdata/openconfig-inet-types-test.yang @@ -0,0 +1,80 @@ +module openconfig-inet-types-test { + prefix "ocinet-t"; + namespace "urn:openconfig-inet-types-test"; + + import pattern-test { prefix "pt"; } + import openconfig-inet-types { prefix "ocinet"; } + + leaf ipv4-address { + type ocinet:ipv4-address; + pt:pattern-test-pass "255.255.255.256"; + pt:pattern-test-pass "0.0.0.0"; + pt:pattern-test-pass "1.1.1.1"; + pt:pattern-test-fail "256.255.255.255"; + pt:pattern-test-fail "1.1.1.256"; + pt:pattern-test-fail "256.1.1.1%eth0"; + } + leaf ipv4-address-zoned { + type ocinet:ipv4-address-zoned; + pt:pattern-test-pass "255.1.1.1%eth0"; + pt:pattern-test-pass "255.255.255.255%eth1"; + pt:pattern-test-pass "0.0.0.0%PoRt3"; + pt:pattern-test-pass "1.1.1.1%FOX10_mouse5"; + pt:pattern-test-fail "255.1.1.1%"; + pt:pattern-test-fail "255.255.255.255"; + pt:pattern-test-fail "0.0.0.0"; + pt:pattern-test-fail "1.1.1.1"; + pt:pattern-test-fail "256.255.255.255"; + pt:pattern-test-fail "1.1.1.256"; + pt:pattern-test-fail "256.1.1.1%eth0"; + } + leaf ip-address { + type ocinet:ip-address; + pt:pattern-test-pass "255.255.255.255"; + pt:pattern-test-pass "2001:db8::1"; + pt:pattern-test-fail "invalid-data"; + pt:pattern-test-pass "::1"; + } + leaf ipv6-address { + type ocinet:ipv6-address; + pt:pattern-test-pass "2620::1000:3202:23e:e1ff:fec7:7112"; + pt:pattern-test-pass "fe80::23e:e1ff:fec7:7112"; + pt:pattern-test-fail "fe80::23e:NOTVALID:fec7:7112"; + pt:pattern-test-fail "FFFF::NOTE::FFFF"; + pt:pattern-test-fail "FFFF::1::42"; + } + leaf ipv4-prefix { + type ocinet:ipv4-prefix; + pt:pattern-test-pass "0.0.0.0/0"; + pt:pattern-test-pass "255.255.255.255/32"; + pt:pattern-test-fail "256.0.0.0/31"; + pt:pattern-test-pass "1.2.3.0/24"; + pt:pattern-test-fail "1.2.3.4/33"; + } + leaf ipv6-prefix { + type ocinet:ipv6-prefix; + pt:pattern-test-pass "::/0"; + pt:pattern-test-pass "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/128"; + pt:pattern-test-fail "FFFF:FFFF:FFFF:NOTVALID:FFFF:FFFF:FFFF:FFFF/64"; + pt:pattern-test-pass "2001:DB8::/32"; + pt:pattern-test-fail "2001:4C20::/129"; + } + leaf ip-prefix { + type ocinet:ip-prefix; + pt:pattern-test-pass "0.0.0.0/0"; + pt:pattern-test-pass "192.0.2.1/32"; + pt:pattern-test-fail "192.0.2.2/33"; + pt:pattern-test-pass "FE80::CAFE/128"; + pt:pattern-test-fail "FE81::CAFE:DEAD:BEEF/129"; + } + leaf domain-name { + type ocinet:domain-name; + pt:pattern-test-pass "ambroseesorbma"; + pt:pattern-test-fail "ambrose esorbma"; + pt:pattern-test-pass "claire."; + pt:pattern-test-fail "~~~-+=."; + pt:pattern-test-fail "ambrose esorbma"; + pt:pattern-test-pass "012345678901234567890123456789012345678901234567890123456789012."; + pt:pattern-test-fail "0123456789012345678901234567890123456789012345678901234567890123"; + } +} diff --git a/testdata/openconfig-packet-match-types-test.yang b/testdata/openconfig-packet-match-types-test.yang new file mode 100644 index 0000000..d386af0 --- /dev/null +++ b/testdata/openconfig-packet-match-types-test.yang @@ -0,0 +1,29 @@ +module openconfig-packet-match-types-test { + prefix "openconfig-packet-match-types-test"; + namespace "urn:openconfig-packet-match-types-test"; + + import pattern-test { prefix "pt"; } + import openconfig-packet-match-types { prefix "oc-pkt-match-types"; } + + leaf port-num-range { + type oc-pkt-match-types:port-num-range; + pt:pattern-test-pass "0..0"; + pt:pattern-test-pass "00000..00000"; + pt:pattern-test-pass "00..00"; + pt:pattern-test-pass "01..01"; + pt:pattern-test-pass "0..65535"; + pt:pattern-test-pass "01111..09999"; + pt:pattern-test-pass "9999..59999"; + pt:pattern-test-pass "60536..60999"; + pt:pattern-test-pass "60999..61999"; + pt:pattern-test-pass "62999..63999"; + pt:pattern-test-pass "64999..65535"; + pt:pattern-test-fail "65535..66646"; + pt:pattern-test-fail "65535..65536"; + pt:pattern-test-fail "65535..65545"; + pt:pattern-test-fail "65535..65635"; + pt:pattern-test-fail "66535..65535"; + pt:pattern-test-fail "66999..67890"; + pt:pattern-test-fail "70000..70000"; + } +} diff --git a/testdata/regexp-test.yang b/testdata/regexp-test.yang deleted file mode 100644 index 9a736bb..0000000 --- a/testdata/regexp-test.yang +++ /dev/null @@ -1,168 +0,0 @@ -module regexp-test { - prefix "rt"; - namespace "urn:openconfig-regexp-test"; - - import pattern-test { prefix "pt"; } - import openconfig-bgp-types { prefix "ocbgpt"; } - import openconfig-inet-types { prefix "ocinet"; } - import openconfig-packet-match-types { prefix "oc-pkt-match-types"; } - - leaf ipv4-address { - type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.256"; - pt:pattern-test-pass "0.0.0.0"; - pt:pattern-test-pass "1.1.1.1"; - pt:pattern-test-fail "256.255.255.255"; - pt:pattern-test-fail "1.1.1.256"; - pt:pattern-test-fail "256.1.1.1%eth0"; - } - leaf ipv4-address-zoned { - type ocinet:ipv4-address-zoned; - pt:pattern-test-pass "255.1.1.1%eth0"; - pt:pattern-test-pass "255.255.255.255%eth1"; - pt:pattern-test-pass "0.0.0.0%PoRt3"; - pt:pattern-test-pass "1.1.1.1%FOX10_mouse5"; - pt:pattern-test-fail "255.1.1.1%"; - pt:pattern-test-fail "255.255.255.255"; - pt:pattern-test-fail "0.0.0.0"; - pt:pattern-test-fail "1.1.1.1"; - pt:pattern-test-fail "256.255.255.255"; - pt:pattern-test-fail "1.1.1.256"; - pt:pattern-test-fail "256.1.1.1%eth0"; - } - leaf ip-address { - type ocinet:ip-address; - pt:pattern-test-pass "255.255.255.255"; - pt:pattern-test-pass "2001:db8::1"; - pt:pattern-test-fail "invalid-data"; - pt:pattern-test-pass "::1"; - } - leaf bgp-std-community { - type ocbgpt:bgp-std-community-type; - pt:pattern-test-pass "15169:42"; - pt:pattern-test-pass "6643:21438"; - pt:pattern-test-pass "29636:4444"; - pt:pattern-test-pass "65535:65535"; - pt:pattern-test-pass "0:0"; - pt:pattern-test-fail "65536:1"; - pt:pattern-test-fail "1:65536"; - pt:pattern-test-fail "425353:comm"; - } - leaf bgp-ext-community { - type ocbgpt:bgp-ext-community-type; - // Type 1 extended communities (2b AS: 4b integer) - pt:pattern-test-pass "29636:10"; - pt:pattern-test-pass "5413:4294967295"; - pt:pattern-test-pass "4445:0"; - pt:pattern-test-fail "1273:4294967296"; - pt:pattern-test-pass "2856:400"; - pt:pattern-test-fail "5400:invalid"; - pt:pattern-test-fail "i6643:10"; - pt:pattern-test-pass "15169:22432"; - // Type 2 extended communities: (4b IP: 2b integer) - pt:pattern-test-fail "1.1.1.1:4294967296"; - pt:pattern-test-fail "1.2.3.4.5:10"; - pt:pattern-test-pass "82.42.12.35:65535"; - pt:pattern-test-fail "82.42.12.35:66536"; - pt:pattern-test-fail "254.254.256.254:10"; - pt:pattern-test-pass "0.0.0.0:200"; - pt:pattern-test-fail "leading192.0.2.1:65535"; - // 4b AS : 2b integer - pt:pattern-test-fail "4294967296:65535"; - pt:pattern-test-pass "4294967295:65535"; - pt:pattern-test-pass "0:65535"; - pt:pattern-test-pass "4294967295:0"; - pt:pattern-test-fail "4294967296:0"; - // Route Target Type 1 - route-target:<2b AS>:<4b local> - pt:pattern-test-fail "route-target:64"; - pt:pattern-test-pass "route-target:65535:10"; - pt:pattern-test-fail "route-TARGET:65535:10"; - pt:pattern-test-fail "route-target:15169:4294967296"; - pt:pattern-test-pass "route-target:15169:4294967295"; - // Route Target Type 2 - route-target::<2b local> - pt:pattern-test-fail "route-target:256.0.2.36:10"; - pt:pattern-test-pass "route-target:192.0.2.1:10"; - pt:pattern-test-fail "route-target:192.0.2.1:65536"; - // Route Target w/ 4B AS:<2b local> - pt:pattern-test-pass "route-target:4294967295:10"; - pt:pattern-test-fail "route-target:4294967296:10"; - pt:pattern-test-pass "route-target:5413:65535"; - // Route Origin Type 1 - route-target:<2b AS>:<4b local> - pt:pattern-test-fail "route-origin:53"; - pt:pattern-test-pass "route-origin:65535:10"; - pt:pattern-test-fail "route-ORIGINTRAIL:65535:10"; - pt:pattern-test-fail "route-origin:15169:4294967296"; - pt:pattern-test-pass "route-origin:15169:4294967295"; - // Route Origin Type 2 - route-target::<2b local> - pt:pattern-test-fail "route-origin:512.0.2.36:10"; - pt:pattern-test-pass "route-origin:10.18.253.24:10"; - pt:pattern-test-fail "route-origin:192.168.1.1:65536"; - // Route Origin w/ 4B AS:<2b local> - pt:pattern-test-pass "route-origin:4294967295:5353"; - pt:pattern-test-fail "route-origin:4294967296:9009"; - pt:pattern-test-pass "route-origin:5413:65535"; - } - leaf ipv6-address { - type ocinet:ipv6-address; - pt:pattern-test-pass "2620::1000:3202:23e:e1ff:fec7:7112"; - pt:pattern-test-pass "fe80::23e:e1ff:fec7:7112"; - pt:pattern-test-fail "fe80::23e:NOTVALID:fec7:7112"; - pt:pattern-test-fail "FFFF::NOTE::FFFF"; - pt:pattern-test-fail "FFFF::1::42"; - } - leaf ipv4-prefix { - type ocinet:ipv4-prefix; - pt:pattern-test-pass "0.0.0.0/0"; - pt:pattern-test-pass "255.255.255.255/32"; - pt:pattern-test-fail "256.0.0.0/31"; - pt:pattern-test-pass "1.2.3.0/24"; - pt:pattern-test-fail "1.2.3.4/33"; - } - leaf ipv6-prefix { - type ocinet:ipv6-prefix; - pt:pattern-test-pass "::/0"; - pt:pattern-test-pass "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/128"; - pt:pattern-test-fail "FFFF:FFFF:FFFF:NOTVALID:FFFF:FFFF:FFFF:FFFF/64"; - pt:pattern-test-pass "2001:DB8::/32"; - pt:pattern-test-fail "2001:4C20::/129"; - } - leaf ip-prefix { - type ocinet:ip-prefix; - pt:pattern-test-pass "0.0.0.0/0"; - pt:pattern-test-pass "192.0.2.1/32"; - pt:pattern-test-fail "192.0.2.2/33"; - pt:pattern-test-pass "FE80::CAFE/128"; - pt:pattern-test-fail "FE81::CAFE:DEAD:BEEF/129"; - } - leaf domain-name { - type ocinet:domain-name; - pt:pattern-test-pass "ambroseesorbma"; - pt:pattern-test-fail "ambrose esorbma"; - pt:pattern-test-pass "claire."; - pt:pattern-test-fail "~~~-+=."; - pt:pattern-test-fail "ambrose esorbma"; - pt:pattern-test-pass "012345678901234567890123456789012345678901234567890123456789012."; - pt:pattern-test-fail "0123456789012345678901234567890123456789012345678901234567890123"; - } - leaf port-num-range { - type oc-pkt-match-types:port-num-range; - pt:pattern-test-pass "0..0"; - pt:pattern-test-pass "00000..00000"; - pt:pattern-test-pass "00..00"; - pt:pattern-test-pass "01..01"; - pt:pattern-test-pass "0..65535"; - pt:pattern-test-pass "01111..09999"; - pt:pattern-test-pass "9999..59999"; - pt:pattern-test-pass "60536..60999"; - pt:pattern-test-pass "60999..61999"; - pt:pattern-test-pass "62999..63999"; - pt:pattern-test-pass "64999..65535"; - pt:pattern-test-fail "65535..66646"; - pt:pattern-test-fail "65535..65536"; - pt:pattern-test-fail "65535..65545"; - pt:pattern-test-fail "65535..65635"; - pt:pattern-test-fail "66535..65535"; - pt:pattern-test-fail "66999..67890"; - pt:pattern-test-fail "70000..70000"; - } -} From d60aecd13a7df79141979ca420b7cee7937ae954 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:11:06 -0800 Subject: [PATCH 28/40] debug --- .github/workflows/demo.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index bf9dcf9..c9f8a36 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -31,6 +31,8 @@ jobs: continue-on-error: true id: demo run: | + title="### XSD Demo Test Results on openconfig/public" + echo "::set-output name=message::$title" out=$(OCDIR=~/tmp/public pytests/pattern_test.sh 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 out="${out//'%'/'%25'}" @@ -49,7 +51,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: '### XSD Demo Test Results on openconfig/public' + body-includes: ${{ steps.demo.outputs.title }} - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 @@ -57,7 +59,7 @@ jobs: comment-id: ${{ steps.fc-xsd.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - '### XSD Demo Test Results on openconfig/public' + ${{ steps.demo.outputs.title }} ${{ steps.demo.outputs.message }} edit-mode: replace @@ -90,6 +92,8 @@ jobs: continue-on-error: true id: demo run: | + title="### POSIX Demo Test Results on openconfig/public" + echo "::set-output name=message::$title" out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 out="${out//'%'/'%25'}" @@ -108,7 +112,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: '### POSIX Demo Test Results on openconfig/public' + body-includes: ${{ steps.demo.outputs.title }} - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 @@ -116,6 +120,6 @@ jobs: comment-id: ${{ steps.fc-posix.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - '### POSIX Demo Test Results on openconfig/public' + ${{ steps.demo.outputs.title }} ${{ steps.demo.outputs.message }} edit-mode: replace From 679a717a51fac629a45bcc11ba9830258e9e4ccd Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:14:26 -0800 Subject: [PATCH 29/40] debug --- .github/workflows/demo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index c9f8a36..a6fec2c 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -51,7 +51,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: ${{ steps.demo.outputs.title }} + body-includes: XSD Demo Test Results on openconfig/public - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 @@ -112,7 +112,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: ${{ steps.demo.outputs.title }} + body-includes: POSIX Demo Test Results on openconfig/public - name: Create or update comment uses: peter-evans/create-or-update-comment@v1 From 5177699798ec69de05c2ed2ea37304b4ab6ec196 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:25:06 -0800 Subject: [PATCH 30/40] debug --- .github/workflows/demo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index a6fec2c..60196c6 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -59,7 +59,7 @@ jobs: comment-id: ${{ steps.fc-xsd.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - ${{ steps.demo.outputs.title }} + XSD Demo Test Results on openconfig/public ${{ steps.demo.outputs.message }} edit-mode: replace @@ -92,7 +92,7 @@ jobs: continue-on-error: true id: demo run: | - title="### POSIX Demo Test Results on openconfig/public" + title="### posix demo test results on openconfig/public" echo "::set-output name=message::$title" out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? # https://github.community/t/set-output-truncates-multiline-strings/16852 @@ -120,6 +120,6 @@ jobs: comment-id: ${{ steps.fc-posix.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - ${{ steps.demo.outputs.title }} + POSIX Demo Test Results on openconfig/public ${{ steps.demo.outputs.message }} edit-mode: replace From 2cc75da1cb3496c4ad5ff648b2dd508032da81f2 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:26:53 -0800 Subject: [PATCH 31/40] debug --- testdata/openconfig-inet-types-test.yang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang index e8a35e6..7287de8 100644 --- a/testdata/openconfig-inet-types-test.yang +++ b/testdata/openconfig-inet-types-test.yang @@ -7,7 +7,7 @@ module openconfig-inet-types-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.256"; + pt:pattern-test-pass "255.255.255.255"; pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; From f50510e863b994014d8a60c4d1df68b77c6a5e08 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:31:14 -0800 Subject: [PATCH 32/40] debug --- .github/workflows/demo.yml | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 60196c6..1215817 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -32,18 +32,16 @@ jobs: id: demo run: | title="### XSD Demo Test Results on openconfig/public" - echo "::set-output name=message::$title" out=$(OCDIR=~/tmp/public pytests/pattern_test.sh 2>&1) || status=$? - # https://github.community/t/set-output-truncates-multiline-strings/16852 - out="${out//'%'/'%25'}" - out="${out//$'\n'/'%0A'}" - out="${out//$'\r'/'%0D'}" - echo "::set-output name=message::$out" - if [ "$status" -eq "0" ]; then - message="all tests passed" - echo "::set-output name=message::$message" + out="all tests passed" fi + message="${title}\n${out}" + # https://github.community/t/set-output-truncates-multiline-strings/16852 + message="${message//'%'/'%25'}" + message="${message//$'\n'/'%0A'}" + message="${message//$'\r'/'%0D'}" + echo "::set-output name=message::$message" - name: Find Comment uses: peter-evans/find-comment@v1 @@ -59,7 +57,6 @@ jobs: comment-id: ${{ steps.fc-xsd.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - XSD Demo Test Results on openconfig/public ${{ steps.demo.outputs.message }} edit-mode: replace @@ -92,19 +89,17 @@ jobs: continue-on-error: true id: demo run: | - title="### posix demo test results on openconfig/public" - echo "::set-output name=message::$title" + title="### POSIX demo test results on openconfig/public" out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? - # https://github.community/t/set-output-truncates-multiline-strings/16852 - out="${out//'%'/'%25'}" - out="${out//$'\n'/'%0A'}" - out="${out//$'\r'/'%0D'}" - echo "::set-output name=message::$out" - if [ "$status" -eq "0" ]; then - message="all tests passed" - echo "::set-output name=message::$message" + out="all tests passed" fi + message="${title}\n${out}" + # https://github.community/t/set-output-truncates-multiline-strings/16852 + message="${message//'%'/'%25'}" + message="${message//$'\n'/'%0A'}" + message="${message//$'\r'/'%0D'}" + echo "::set-output name=message::$message" - name: Find Comment uses: peter-evans/find-comment@v1 @@ -120,6 +115,5 @@ jobs: comment-id: ${{ steps.fc-posix.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - POSIX Demo Test Results on openconfig/public ${{ steps.demo.outputs.message }} edit-mode: replace From 21d26e2346d937d2c6d4704eb54efc7a1752db49 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:35:37 -0800 Subject: [PATCH 33/40] debug --- .github/workflows/demo.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 1215817..efba7a8 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -36,7 +36,8 @@ jobs: if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}\n${out}" + message="${title}%0A${out}" + echo "$message" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" message="${message//$'\n'/'%0A'}" @@ -94,7 +95,8 @@ jobs: if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}\n${out}" + message="${title}%0A${out}" + echo "$message" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" message="${message//$'\n'/'%0A'}" From 60bff74bc8042f27aee1353bc550e223323e55fe Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:37:47 -0800 Subject: [PATCH 34/40] debug --- .github/workflows/demo.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index efba7a8..a2785c2 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -32,11 +32,12 @@ jobs: id: demo run: | title="### XSD Demo Test Results on openconfig/public" + status=0 out=$(OCDIR=~/tmp/public pytests/pattern_test.sh 2>&1) || status=$? if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}%0A${out}" + message="${title}\n${out}" echo "$message" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" @@ -91,11 +92,12 @@ jobs: id: demo run: | title="### POSIX demo test results on openconfig/public" + status=0 out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}%0A${out}" + message="${title}\n${out}" echo "$message" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" From 22614e6977ef56e4df1cbdbbbe86acabd33349de Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:40:33 -0800 Subject: [PATCH 35/40] debug --- .github/workflows/demo.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index a2785c2..99d4790 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -37,8 +37,7 @@ jobs: if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}\n${out}" - echo "$message" + message="${title}"$'\n'"${out}" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" message="${message//$'\n'/'%0A'}" @@ -97,8 +96,7 @@ jobs: if [ "$status" -eq "0" ]; then out="all tests passed" fi - message="${title}\n${out}" - echo "$message" + message="${title}"$'\n'"${out}" # https://github.community/t/set-output-truncates-multiline-strings/16852 message="${message//'%'/'%25'}" message="${message//$'\n'/'%0A'}" From 485ed56f331de22e7c34dc347e0af5c807556ce3 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:46:48 -0800 Subject: [PATCH 36/40] Test failing comment update --- testdata/openconfig-inet-types-test.yang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang index 7287de8..1850b88 100644 --- a/testdata/openconfig-inet-types-test.yang +++ b/testdata/openconfig-inet-types-test.yang @@ -7,8 +7,8 @@ module openconfig-inet-types-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.255"; - pt:pattern-test-pass "0.0.0.0"; + pt:pattern-test-pass "255.255.255.256"; + pt:pattern-test-pass "0.0.0.-1"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; pt:pattern-test-fail "1.1.1.256"; From b9e77212c17cdc712776e1603485ff09304bfa31 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:49:13 -0800 Subject: [PATCH 37/40] Test passing comment update --- .github/workflows/demo.yml | 2 +- testdata/openconfig-inet-types-test.yang | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index 99d4790..2e8205f 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -90,7 +90,7 @@ jobs: continue-on-error: true id: demo run: | - title="### POSIX demo test results on openconfig/public" + title="### POSIX Demo Test Results on openconfig/public" status=0 out=$(go run gotests/main.go -model-root ~/tmp/public testdata/*.yang 2>&1) || status=$? if [ "$status" -eq "0" ]; then diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang index 1850b88..7287de8 100644 --- a/testdata/openconfig-inet-types-test.yang +++ b/testdata/openconfig-inet-types-test.yang @@ -7,8 +7,8 @@ module openconfig-inet-types-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.256"; - pt:pattern-test-pass "0.0.0.-1"; + pt:pattern-test-pass "255.255.255.255"; + pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; pt:pattern-test-fail "1.1.1.256"; From 5a53bac4345ce4da14110af0736b6d819e779370 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:50:20 -0800 Subject: [PATCH 38/40] Test failing comment update --- testdata/openconfig-inet-types-test.yang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang index 7287de8..1850b88 100644 --- a/testdata/openconfig-inet-types-test.yang +++ b/testdata/openconfig-inet-types-test.yang @@ -7,8 +7,8 @@ module openconfig-inet-types-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.255"; - pt:pattern-test-pass "0.0.0.0"; + pt:pattern-test-pass "255.255.255.256"; + pt:pattern-test-pass "0.0.0.-1"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; pt:pattern-test-fail "1.1.1.256"; From 88fcdee38e58d876628534d84333e725476bc4f8 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 17:51:07 -0800 Subject: [PATCH 39/40] Test passing comment update --- testdata/openconfig-inet-types-test.yang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testdata/openconfig-inet-types-test.yang b/testdata/openconfig-inet-types-test.yang index 1850b88..7287de8 100644 --- a/testdata/openconfig-inet-types-test.yang +++ b/testdata/openconfig-inet-types-test.yang @@ -7,8 +7,8 @@ module openconfig-inet-types-test { leaf ipv4-address { type ocinet:ipv4-address; - pt:pattern-test-pass "255.255.255.256"; - pt:pattern-test-pass "0.0.0.-1"; + pt:pattern-test-pass "255.255.255.255"; + pt:pattern-test-pass "0.0.0.0"; pt:pattern-test-pass "1.1.1.1"; pt:pattern-test-fail "256.255.255.255"; pt:pattern-test-fail "1.1.1.256"; From f4d1f8753344e4b8411aeda9787b01909b0581c0 Mon Sep 17 00:00:00 2001 From: wenovus Date: Thu, 25 Feb 2021 18:14:34 -0800 Subject: [PATCH 40/40] Update README --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index efc0e1c..1c550b4 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,19 @@ Pattern statement tests reside in various modules in the [testdata](testdata) folder. When adding tests, group pattern tests in test modules named after where the patterns are found. +### Workflow for Fixing a Bad Pattern in [openconfig/public](https://github.com/openconfig/public) + +1. Add new pattern tests under [testdata](testdata) and post a PR demonstrating + the failure on openconfig/public. +2. In the PR, note to the reviewers that the failure is expected due to an + incorrect existing pattern. +3. After merge, increment the new minor version of + openconfig/pattern-regex-tests. +4. Open a PR in openconfig/public that updates the new version of + openconfig/pattern-regex-tests in its CI config + https://github.com/openconfig/public/blob/master/cloudbuild.yaml, while + making the corresponding pattern fix in the YANG model. + ### Limitations Only typedef tests are currently supported. The current OpenConfig models only