Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] Add GNMI CRL support. #19536

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
url = https://github.com/sonic-net/sonic-host-services
[submodule "src/sonic-gnmi"]
path = src/sonic-gnmi
url = https://github.com/sonic-net/sonic-gnmi.git
url = https://github.com/liuh-80/sonic-gnmi.git
branch = dev/liuh/disable-crl-cert-access
[submodule "src/sonic-genl-packet"]
path = src/sonic-genl-packet
url = https://github.com/sonic-net/sonic-genl-packet
Expand Down
12 changes: 12 additions & 0 deletions dockers/docker-sonic-gnmi/gnmi-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ else
TELEMETRY_ARGS+=" -v=2"
fi

if [ -nz "$GNMI" ]; then
ENABLE_CRL=$(echo $GNMI | jq -r '.enable_crl')
if [ $ENABLE_CRL == "true" ]; then
TELEMETRY_ARGS+=" --enable_crl"
fi

CRL_EXPIRE_DURATION=$(echo $GNMI | jq -r '.crl_expire_duration')
if [ -n $CRL_EXPIRE_DURATION ]; then
TELEMETRY_ARGS+=" --crl_expire_duration $CRL_EXPIRE_DURATION"
fi
fi

# Enable ZMQ for SmartSwitch
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget "DEVICE_METADATA|localhost" "subtype"`
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions dockers/docker-sonic-telemetry/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ else
TELEMETRY_ARGS+=" -v=2"
fi

if [ -nz "$GNMI" ]; then
ENABLE_CRL=$(echo $GNMI | jq -r '.enable_crl')
if [ $ENABLE_CRL == "true" ]; then
TELEMETRY_ARGS+=" --enable_crl"
fi

CRL_EXPIRE_DURATION=$(echo $GNMI | jq -r '.crl_expire_duration')
if [ -n $CRL_EXPIRE_DURATION ]; then
TELEMETRY_ARGS+=" --crl_expire_duration $CRL_EXPIRE_DURATION"
fi
fi

# gNMI save-on-set behavior is disabled by default.
# Save-on-set can be turned on by setting the "TELEMETRY|gnmi|save_on_set"
# to "true".
Expand Down
8 changes: 6 additions & 2 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "50051"
"port": "50051",
"enable_crl": "false",
"crl_expire_duration": "86400"
}
},
"TELEMETRY_CLIENT": {
Expand Down Expand Up @@ -1327,7 +1329,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "50052"
"port": "50052",
"enable_crl": "false",
"crl_expire_duration": "86400"
}
},
"GNMI_CLIENT_CERT": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "50052"
"port": "50052",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -26,7 +28,9 @@
"gnmi": {
"client_auth": "up",
"log_level": "2",
"port": "50052"
"port": "50052",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -42,7 +46,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "abc"
"port": "abc",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -59,7 +65,9 @@
"client_auth": "true",
"log_level": "2",
"port": "50051",
"save_on_set": "wrong"
"save_on_set": "wrong",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -76,7 +84,9 @@
"client_auth": "true",
"log_level": "2",
"port": "50052",
"save_on_set": "false"
"save_on_set": "false",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "50051"
"port": "50051",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -26,7 +28,9 @@
"gnmi": {
"client_auth": "up",
"log_level": "2",
"port": "50051"
"port": "50051",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -42,7 +46,9 @@
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "abc"
"port": "abc",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -59,7 +65,9 @@
"client_auth": "true",
"log_level": "2",
"port": "50051",
"save_on_set": "wrong"
"save_on_set": "wrong",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand All @@ -76,7 +84,9 @@
"client_auth": "true",
"log_level": "2",
"port": "50051",
"save_on_set": "false"
"save_on_set": "false",
"enable_crl": "true",
"crl_expire_duration": "86400"
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-gnmi.yang
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ module sonic-gnmi {
description "Flag for enabling save on set.";
}

leaf enable_crl {
type boolean;
description "Flag for enable certificate revocation list.";
}

leaf crl_expire_duration {
type uint32;
description "Certificate revocation list cache expire duration.";
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-telemetry.yang
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ module sonic-telemetry {
description "Flag for enabling save on set.";
}

leaf enable_crl {
type boolean;
description "Flag for enable certificate revocation list.";
}

leaf crl_expire_duration {
type uint32;
description "Certificate revocation list cache expire duration.";
}
}

}
Expand Down
Loading