Skip to content

Commit

Permalink
Merge pull request #57 from srl-labs/24.3.3
Browse files Browse the repository at this point in the history
added 24.3.3
  • Loading branch information
hellt authored Jul 11, 2024
2 parents ae8a5e4 + 180e27a commit 1f1d3ec
Show file tree
Hide file tree
Showing 28 changed files with 465,791 additions and 18 deletions.
27 changes: 15 additions & 12 deletions refer/extract-features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# the script first creates a json file per each platform with the features extracted from the platform using `info from state system features` command
# then it aggregates all the json files into a single file that is then processed by the yang browser

# note, that some features reported by the platform might not be present in the YANG, which cause the pyang to error.
# note, that some features for platforms prior to 24.3.1 release reported by the platform might not be present in the YANG, which cause the pyang to error.
# to date the following features were identified as invalid for D2L platform, they have to be removed from the JSON file before `generate.sh` script is called
# bgp-app-warm-restart
# cam-cammgr-thread-programming
Expand All @@ -29,29 +29,38 @@
# example:
# SRL_VERSION=23.10.4 LIC_PATH=/opt/nokia/srl/23-10.lic bash refer/extract-features.sh
# note, that the script doesn't remove the lab after the features are extracted.
# the script must be executed from the root of this repo.

set -e

# export SRL_VERSION that is used by the containerlab to spin up the needed version of srl container
export SRL_VERSION

RELEASE_DIR=./static/releases/v${SRL_VERSION}
FEATURES_DIR=${RELEASE_DIR}/platform_features

# move the features file to the release folder
echo "making directory ${FEATURES_DIR}"
mkdir -p ${FEATURES_DIR}

sudo -E containerlab deploy -c -t ./refer/all.clab.yml

# remove all json files that might be there from previous extraction
rm -f ./tmp/*.json
rm -f ${FEATURES_DIR}/*.json

for node in "7220-IXR-D1" "7220-IXR-D2" "7220-IXR-D2L" "7220-IXR-D3" "7220-IXR-D3L" "7220-IXR-D4" "7220-IXR-D5" "7220-IXR-H2" "7220-IXR-H3" "7220-IXR-H4" "7250-IXR-6" "7250-IXR-6e" "7250-IXR-10" "7250-IXR-10e"
do
docker exec clab-all-${node} sr_cli 'info from state system features | as json' | jq .system.features >> ./tmp/${node}.json &
docker exec clab-all-${node} sr_cli 'info from state system features | as json' | jq .system.features >> ${FEATURES_DIR}/${node}.json &
done

wait
echo "Features have been extracted to JSON files, proceeding with aggregating them into a single file..."

# change to ./tmp
pushd ./tmp
# change to platform features directory
pushd ${FEATURES_DIR}
# file name to extract features for all platforms
fn="features.txt"
# it resides in the release dir, and not features dir
fn="../features.txt"

# Remove the output file if it already exists
if [ -f $fn ]; then
Expand All @@ -70,10 +79,4 @@ for entry in *.json; do
done
popd

# move the features file to the release folder
echo "making directory ./static/releases/v$SRL_VERSION"
mkdir -p ./static/releases/v$SRL_VERSION

mv ./tmp/$fn ./static/releases/v$SRL_VERSION

echo "Features aggregated into a features.txt file!"
13 changes: 7 additions & 6 deletions refer/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
# execute from repo root as `bash refer/generate.sh <srl_nokia | openconfig> [<srl_release1> <srl_release2> ...]`
# example: bash refer/generate.sh srl_nokia 22.11.1

SCRIPT_DIR="$(realpath $(dirname "$0"))"

# convert features from the D2L json file to pyang format so that we can generate
# tree and jstree output for a featureset of D2L
extract_pyang_features() {
features_mod="srl_nokia-features"
# read the 7220-IXR-D2L.json file and extract comma separated features
# the paths are relative to the ./refer/srl-$SRL_VER-yang-models folder
# the relative paths are relative to the ./refer/srl-$SRL_VER-yang-models folder
# if sr linux release is > 24 than use the simplified feature list
if [ $(echo $SRL_VER | cut -d'.' -f1) -ge 24 ]; then
fs=$(cat ../../tmp/7220-IXR-D2L.json | jq -r 'join(",")')
fs=$(cat ${SCRIPT_DIR}/../static/releases/v${SRL_VER}/platform_features/7220-IXR-D2L.json | jq -r 'join(",")')
else
fs=$(jq --argjson unusedFeatures "$(cat ../unused-features.json)" 'map(select(. as $in | any($unusedFeatures[]; . == $in) | not))' ../../tmp/7220-IXR-D2L.json | jq -r 'join(",")')
fs=$(jq --argjson unusedFeatures "$(cat ../unused-features.json)" 'map(select(. as $in | any($unusedFeatures[]; . == $in) | not))' ${SCRIPT_DIR}/../static/releases/v${SRL_VER}/platform_features/7220-IXR-D2L.json | jq -r 'join(",")')
fi

echo ${features_mod}:${fs}
Expand All @@ -29,7 +31,7 @@ MODEL_TYPE="$1"
# SR Linux release version are passed as a space separated list of release version
SRL_VER_LIST="${@:2}"

GNMIC_CONTAINER=ghcr.io/openconfig/gnmic:0.32.0
GNMIC_CONTAINER=ghcr.io/openconfig/gnmic:0.38.0

PYANG_CONTAINER=ghcr.io/hellt/pyang:2.5.3

Expand All @@ -46,7 +48,6 @@ else
fi

# change into the script directory
SCRIPT_DIR="$(realpath $(dirname "$0"))"
cd $SCRIPT_DIR

# PYANG RESPONSE HANDLER
Expand All @@ -67,7 +68,7 @@ for SRL_VER in ${SRL_VER_LIST[@]}; do
SRL_VER_CYCLE=v$(echo $SRL_VER | cut -d'-' -f1)

# PULL SRL YANG MODEL
YANG_DIR_NAME="$(pwd)/srl-$SRL_VER-yang-models"
YANG_DIR_NAME="${SCRIPT_DIR}/srl-$SRL_VER-yang-models"

docker pull ghcr.io/nokia/srlinux:$SRL_VER || echo "using local image"
id=$(docker create ghcr.io/nokia/srlinux:$SRL_VER foo)
Expand Down
3 changes: 3 additions & 0 deletions src/lib/releases.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v24.3.3:
openconfig: true
features: true
v24.3.2:
openconfig: true
features: true
Expand Down
Loading

0 comments on commit 1f1d3ec

Please # to comment.