Skip to content

Commit

Permalink
added models for 10.2-6 (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
skomajwa authored Sep 11, 2023
1 parent 0f94196 commit 43f3599
Show file tree
Hide file tree
Showing 160 changed files with 266,977 additions and 2 deletions.
199,675 changes: 199,675 additions & 0 deletions vendor/cisco/nx/10.2-6/Cisco-NX-OS-device.yang

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions vendor/cisco/nx/10.2-6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## YANG Models and Platform Capabilities for Cisco NX-OS 10.2(6)

The YANG files in this directory detail the native and OpenConfig YANG models with deviations supported by NX-OS 10.2(6) release.

As a convenience, a copy of the "hello" message is also provided (netconf-capabilities.xml).

### YANG Syntax Issues With ```Cisco-NX-OS-device.yang```

The core native device model for NX-OS is [```Cisco-NX-OS-device.yang```](Cisco-NX-OS-device.yang). This model currently has a number of problems relating to non-compliant regular expresssion constraints (per RFC 6020) and incorrect default values. These issues will be fixed in a subsequent release. Developers can examine the script [```check.sh```](../check.sh) for details of how the model is currently compiled to pass CI builds.

### Generating models for a specific agent/controller

For netconf (default): `./prepare.sh`
Creates ./netconf_models

For restconf: `./prepare.sh -a restconf`
Creates ./restconf_models

For gnmi: `./prepare.sh -a gnmi`
Creates ./gnmi_models

All your models will be in the created models directory.

### Compliance With "pyang --lint"

The native YANG models are not fully compliant with all IETF guidelines as exemplified by running the pyang tool with the ```--lint``` flag. The errors and warnings exhibited by running pyang with the ```--lint``` flag are currently deemed to be non-critical as they do not impact the semantic of the models or prevent the models being used as part of toolchains. A script has been provided, "check-models.sh", that runs pyang with ```--lint``` validation enabled, but ignoring certain errors. This allows the developer to determine what issues may be present.


### Revision Statements

From NX-OS 7.0.3 and onwards, the revision statements embedded in the YANG files **should** accurately reflect whether or not a new revision has been introduced. However, there are some bugs. These will be noted by running the ```check-models.sh``` script with the ```-b``` option.


### RPM Download

The RPMs supporting YANG models are available for download at the Cisco Artifactory http://devhub.cisco.com/artifactory/open-nxos-agents/10.2-6/
106 changes: 106 additions & 0 deletions vendor/cisco/nx/10.2-6/check-models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/sh
#
# Simple run of pyang with the "--lint" flag over all yang files in
# this directory, ignoring some warnings. Prior to pushing to git, the
# validation was run with pyang 1.5. This script should be run with
# the working doirectory set to a directory containing the yang files
# to run "pyang --lint" over.
#
# The modules as uploaded exhibit a number of RFC 6087 amd RFC 6020
# errors and warnings that are judged to be cosmetic at this time and
# which do not impact the ability of a client to interact with a
# device supporting the module. The exact content ignored may be
# identified by reviewing the "grep -v" commands below.
#
EGREP=`command -v egrep`
GREP=`command -v grep`
PYANG=`command -v pyang`
CHECK_BC=""
PYANG_FLAGS="-p ../../../../standard/ietf/RFC"

trap ctrl_c INT

function ctrl_c() {
echo 'User interruption, exiting ..'
exit -1
}
#
# simple function to check for existence of a binary on the current
# path
#
checkExists() {
bin=`command -v $1`
if [ -z "$bin" ]
then
echo this script requires $1 to be on your path
exit 1
fi
}

#
# check we have the utilties we need
#
checkExists pyang
checkExists egrep
checkExists grep

#
# brief help for the options we support
#
show_help () {
echo Options for check-models.sh:
printf "\n"
printf " -h Show this help\n"
printf "\n"
}

OPTIND=1
while getopts "h" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
esac
done

#
# Run pyang over all the yang modules, ignoring certain errors and
# warnings.
#
echo Checking all models with "--lint" flag
compile_yang() {
m=$1
pyang_flags=${FLAGS}
if test "${m#*"openconfig-"}" != "$m"; then
pyang_flags=""
fi

echo "pyang $pyang_flags $m"
pyang $pyang_flags $m 2>&1 | \
grep -v "warning: RFC 6087" | \
grep -v "error: RFC 6087: 4.2" | \
grep -v "error: RFC 6087: 4.7" | \
grep -v "error: RFC 6087: 4.11,4.12" | \
grep -v "error: RFC 6087: 4.12" | \
grep -v "not in canonical order" | \
grep -v "warning: locally scoped grouping" | \
egrep -v "warning: imported module\s[a-zA-Z0-9\-]+\snot used"
}

FLAGS="$PYANG_FLAGS "
for m in *.yang
do
if test "${m#*"openconfig-"}" != "$m"; then
continue
fi
compile_yang $m
done

if [ -d "extensions" ]; then
temp_dir="temp"
for m in extensions/*.yang
do
compile_yang $m
done
fi
136 changes: 136 additions & 0 deletions vendor/cisco/nx/10.2-6/cisco-nx-openconfig-acl-deviations.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@

module cisco-nx-openconfig-acl-deviations {

namespace "http://openconfig.net/yang/acl-deviations";

prefix "oc-acl-devs";

import openconfig-acl { prefix oc-acl; }
import openconfig-packet-match-types { prefix oc-pkt-match-types; }

organization "Cisco Systems, Inc.";

contact
"Cisco Systems, Inc.
Customer Service
Postal: 170 West Tasman Drive
San Jose, CA 95134
Tel: +1 800 553-NETS
E-mail: [email protected]";

description
"This module contains a set of deviations of the openconfig-acl module
set for Cisco NXOS.
Copyright (c) 2015-2017, 2020-2021 by Cisco Systems, Inc.
All rights reserved.";

revision "2018-02-28" {
description
"Initial revision applicable to NXOS";
}

deviation /oc-acl:acl/oc-acl:state/oc-acl:counter-capability {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:config/oc-acl:type {
deviate add {
must "../oc-acl:type != 'oc-acl:ACL_MIXED'" {
error-message "ACL_MIXED not supported";
}

}
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:config/oc-acl:description {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:state/oc-acl:description {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:config/oc-acl:description {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:state/oc-acl:description {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:state/oc-acl:matched-octets {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:config/oc-acl:source-flow-label {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:config/oc-acl:destination-flow-label {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:config/oc-acl:hop-limit {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:state/oc-acl:source-flow-label {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:state/oc-acl:destination-flow-label {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:ipv6/oc-acl:state/oc-acl:hop-limit {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:transport/oc-acl:config/oc-acl:tcp-flags {
deviate add {
must "../oc-acl:tcp-flags != 'oc-pkt-match-types:TCP_CWR'" {
error-message "TCP_CWR not supported";
}

}
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:transport/oc-acl:state/oc-acl:tcp-flags {
deviate add {
must "../oc-acl:tcp-flags != 'oc-pkt-match-types:TCP_CWR'" {
error-message "TCP_CWR not supported";
}

}
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:input-interface/oc-acl:interface-ref/oc-acl:config/oc-acl:interface {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:input-interface/oc-acl:interface-ref/oc-acl:config/oc-acl:subinterface {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:input-interface/oc-acl:interface-ref/oc-acl:state/oc-acl:interface {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:input-interface/oc-acl:interface-ref/oc-acl:state/oc-acl:subinterface {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:actions/oc-acl:config/oc-acl:log-action {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:actions/oc-acl:config/oc-acl:forwarding-action {
deviate add {
must "../oc-acl:forwarding-action != 'oc-acl:REJECT'" {
error-message "REJECT not supported";
}

}
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:actions/oc-acl:state/oc-acl:forwarding-action {
deviate add {
must "../oc-acl:forwarding-action != 'oc-acl:REJECT'" {
error-message "REJECT not supported";
}

}
}
deviation /oc-acl:acl/oc-acl:acl-sets/oc-acl:acl-set/oc-acl:acl-entries/oc-acl:acl-entry/oc-acl:actions/oc-acl:state/oc-acl:log-action {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:interfaces/oc-acl:interface/oc-acl:state/oc-acl:id {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:interfaces/oc-acl:interface/oc-acl:ingress-acl-sets/oc-acl:ingress-acl-set/oc-acl:acl-entries/oc-acl:acl-entry {
deviate "not-supported";
}
deviation /oc-acl:acl/oc-acl:interfaces/oc-acl:interface/oc-acl:egress-acl-sets/oc-acl:egress-acl-set/oc-acl:acl-entries/oc-acl:acl-entry {
deviate "not-supported";
}

}
Loading

0 comments on commit 43f3599

Please sign in to comment.