Added tests for OpenConfig compress.
This commit is contained in:
parent
e0ea85d6d5
commit
aeff754110
1 changed files with 56 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Tests for using the auto cli.
|
# Tests for using the auto cli.
|
||||||
# In particular setting a config, displaying as cli commands and reconfigure it
|
# In particular setting a config, displaying as cli commands and reconfigure it
|
||||||
|
|
@ -25,11 +26,20 @@ fi
|
||||||
|
|
||||||
# Use yang in example
|
# Use yang in example
|
||||||
|
|
||||||
|
if [ ! -d "$OPENCONFIG" ]; then
|
||||||
|
# err "Hmm Openconfig dir does not seem to exist, try git clone https://github.com/openconfig/public?"
|
||||||
|
echo "...skipped: OPENCONFIG not set"
|
||||||
|
if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
OCDIR=$OPENCONFIG/release/models
|
||||||
|
|
||||||
cat <<EOF > $cfg
|
cat <<EOF > $cfg
|
||||||
<clixon-config xmlns="http://clicon.org/config">
|
<clixon-config xmlns="http://clicon.org/config">
|
||||||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||||
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
|
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
|
||||||
|
<CLICON_YANG_DIR>$OCDIR/</CLICON_YANG_DIR>
|
||||||
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
|
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
|
||||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||||
<CLICON_CLISPEC_DIR>$clidir</CLICON_CLISPEC_DIR>
|
<CLICON_CLISPEC_DIR>$clidir</CLICON_CLISPEC_DIR>
|
||||||
|
|
@ -49,6 +59,7 @@ cat <<EOF > $fyang
|
||||||
module $APPNAME {
|
module $APPNAME {
|
||||||
namespace "urn:example:clixon";
|
namespace "urn:example:clixon";
|
||||||
prefix ex;
|
prefix ex;
|
||||||
|
import openconfig-extensions { prefix oc-ext; }
|
||||||
container table{
|
container table{
|
||||||
list parameter{
|
list parameter{
|
||||||
key name;
|
key name;
|
||||||
|
|
@ -69,6 +80,42 @@ module $APPNAME {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
container interfaces {
|
||||||
|
oc-ext:operational;
|
||||||
|
list interface {
|
||||||
|
key name;
|
||||||
|
leaf name {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
container config {
|
||||||
|
leaf enabled {
|
||||||
|
type boolean;
|
||||||
|
default false;
|
||||||
|
description "Whether the interface is enabled or not.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container state {
|
||||||
|
config false;
|
||||||
|
leaf oper-status {
|
||||||
|
type enumeration {
|
||||||
|
enum UP {
|
||||||
|
value 1;
|
||||||
|
description "Ready to pass packets.";
|
||||||
|
}
|
||||||
|
enum DOWN {
|
||||||
|
value 2;
|
||||||
|
description "The interface does not pass any packets.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leaf enabled {
|
||||||
|
type boolean;
|
||||||
|
default false;
|
||||||
|
description "Whether the interface is enabled or not.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
@ -127,6 +174,9 @@ function testrun()
|
||||||
elif [ $mode = HIDE ]; then
|
elif [ $mode = HIDE ]; then
|
||||||
table=
|
table=
|
||||||
name=
|
name=
|
||||||
|
elif [ $mode = OC_COMPRESS ]; then
|
||||||
|
table=
|
||||||
|
name=
|
||||||
else
|
else
|
||||||
table=" table"
|
table=" table"
|
||||||
name=
|
name=
|
||||||
|
|
@ -190,6 +240,9 @@ testrun HIDE
|
||||||
new "keywords=ALL"
|
new "keywords=ALL"
|
||||||
testrun ALL
|
testrun ALL
|
||||||
|
|
||||||
|
new "keywords=OC_COMPRESS"
|
||||||
|
testrun OC_COMPRESS
|
||||||
|
|
||||||
new "keywords=VARS"
|
new "keywords=VARS"
|
||||||
testrun VARS
|
testrun VARS
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue