-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from openconfig/fix-lists-no-sibling-check
Fix sibling check for lists.
- Loading branch information
Showing
10 changed files
with
295 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
ok: | ||
pyang --plugindir $(PLUGIN_DIR) \ | ||
--openconfig --oc-only -p ${ROOT_DIR}/../common \ | ||
${ROOT_DIR}/openconfig-testcase-succeed.yang | ||
|
||
broken: | ||
pyang --plugindir $(PLUGIN_DIR) \ | ||
--openconfig --oc-only -p ${ROOT_DIR}/../common \ | ||
${ROOT_DIR}/openconfig-testcase-fail.yang ${ROOT_DIR}/openconfig-testcase-fail-augment.yang |
33 changes: 33 additions & 0 deletions
33
tests/oclinter/lists-no-sibling-augment/openconfig-testcase-fail-augment.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module openconfig-testcase-fail-augment { | ||
prefix "oc-tc2"; | ||
namespace "http://openconfig.net/linter/testcase2"; | ||
|
||
import openconfig-extensions { prefix oc-ext; } | ||
import openconfig-testcase-fail { prefix oc-tc; } | ||
|
||
description | ||
"Failure test case for a list having siblings."; | ||
|
||
oc-ext:openconfig-version "0.0.1"; | ||
|
||
revision 2016-09-28 { | ||
reference "0.0.1"; | ||
description | ||
"Revision statement"; | ||
} | ||
|
||
grouping augment-top { | ||
container hello { | ||
container state { | ||
config false; | ||
leaf hello-leaf { type string; } | ||
} | ||
} | ||
} | ||
|
||
|
||
augment '/oc-tc:surrounding-container' { | ||
uses augment-top; | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
tests/oclinter/lists-no-sibling-augment/openconfig-testcase-fail.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module openconfig-testcase-fail { | ||
prefix "oc-tc"; | ||
namespace "http://openconfig.net/linter/testcase"; | ||
|
||
import openconfig-extensions { prefix oc-ext; } | ||
|
||
description | ||
"Failure test case for a list having siblings."; | ||
|
||
oc-ext:openconfig-version "0.0.1"; | ||
|
||
revision 2016-09-28 { | ||
reference "0.0.1"; | ||
description | ||
"Revision statement"; | ||
} | ||
|
||
grouping list-config { | ||
leaf keyleaf { type string; } | ||
} | ||
|
||
grouping foo-top { | ||
container surrounding-container { | ||
list the-list { | ||
key "keyleaf"; | ||
|
||
leaf keyleaf { | ||
type leafref { | ||
path "../config/keyleaf"; | ||
} | ||
} | ||
|
||
container config { | ||
uses list-config; | ||
} | ||
|
||
container state { | ||
config false; | ||
uses list-config; | ||
} | ||
} | ||
} | ||
} | ||
|
||
uses foo-top; | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
tests/oclinter/lists-no-sibling-augment/openconfig-testcase-succeed.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module openconfig-testcase-succeed { | ||
prefix "oc-tc"; | ||
namespace "http://openconfig.net/linter/testcase"; | ||
|
||
import openconfig-extensions { prefix oc-ext; } | ||
|
||
description | ||
"Success test case for a list having siblings."; | ||
|
||
oc-ext:openconfig-version "0.0.1"; | ||
|
||
revision 2016-09-28 { | ||
reference "0.0.1"; | ||
description | ||
"Revision statement"; | ||
} | ||
|
||
grouping list-config { | ||
leaf keyleaf { type string; } | ||
} | ||
|
||
grouping foo-top { | ||
container surrounding-container { | ||
list the-list { | ||
key "keyleaf"; | ||
|
||
leaf keyleaf { | ||
type leafref { | ||
path "../config/keyleaf"; | ||
} | ||
} | ||
|
||
container config { | ||
uses list-config; | ||
} | ||
|
||
container state { | ||
config false; | ||
uses list-config; | ||
} | ||
} | ||
} | ||
} | ||
|
||
uses foo-top; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
ok: | ||
pyang --plugindir $(PLUGIN_DIR) \ | ||
--openconfig --oc-only -p ${ROOT_DIR}/../common \ | ||
${ROOT_DIR}/openconfig-testcase-succeed.yang | ||
|
||
broken: | ||
pyang --plugindir $(PLUGIN_DIR) \ | ||
--openconfig --oc-only -p ${ROOT_DIR}/../common \ | ||
${ROOT_DIR}/openconfig-testcase-fail.yang |
54 changes: 54 additions & 0 deletions
54
tests/oclinter/lists-no-sibling/openconfig-testcase-fail.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module openconfig-testcase-fail { | ||
prefix "oc-tc"; | ||
namespace "http://openconfig.net/linter/testcase"; | ||
|
||
import openconfig-extensions { prefix oc-ext; } | ||
|
||
description | ||
"Failure test case for a list having siblings."; | ||
|
||
oc-ext:openconfig-version "0.0.1"; | ||
|
||
revision 2016-09-28 { | ||
reference "0.0.1"; | ||
description | ||
"Revision statement"; | ||
} | ||
|
||
grouping list-config { | ||
leaf keyleaf { type string; } | ||
} | ||
|
||
grouping foo-top { | ||
container surrounding-container { | ||
container hello { | ||
container state { | ||
config false; | ||
leaf hello-leaf { type string; } | ||
} | ||
} | ||
|
||
list the-list { | ||
key "keyleaf"; | ||
|
||
leaf keyleaf { | ||
type leafref { | ||
path "../config/keyleaf"; | ||
} | ||
} | ||
|
||
container config { | ||
uses list-config; | ||
} | ||
|
||
container state { | ||
config false; | ||
uses list-config; | ||
} | ||
} | ||
} | ||
} | ||
|
||
uses foo-top; | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
tests/oclinter/lists-no-sibling/openconfig-testcase-succeed.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module openconfig-testcase-succeed { | ||
prefix "oc-tc"; | ||
namespace "http://openconfig.net/linter/testcase"; | ||
|
||
import openconfig-extensions { prefix oc-ext; } | ||
|
||
description | ||
"Success test case for a list having siblings."; | ||
|
||
oc-ext:openconfig-version "0.0.1"; | ||
|
||
revision 2016-09-28 { | ||
reference "0.0.1"; | ||
description | ||
"Revision statement"; | ||
} | ||
|
||
grouping list-config { | ||
leaf keyleaf { type string; } | ||
} | ||
|
||
grouping foo-top { | ||
container surrounding-container { | ||
list the-list { | ||
key "keyleaf"; | ||
|
||
leaf keyleaf { | ||
type leafref { | ||
path "../config/keyleaf"; | ||
} | ||
} | ||
|
||
container config { | ||
uses list-config; | ||
} | ||
|
||
container state { | ||
config false; | ||
uses list-config; | ||
} | ||
} | ||
} | ||
} | ||
|
||
uses foo-top; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters