Skip to content

Commit 46bb4fb

Browse files
committed
confd: Add migrate script to migrate configuration to new YANG syntax
1 parent 724aa2f commit 46bb4fb

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

src/confd/configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ AC_CONFIG_FILES([
2020
share/migrate/1.4/Makefile
2121
share/migrate/1.5/Makefile
2222
share/migrate/1.6/Makefile
23+
share/migrate/1.7/Makefile
2324
yang/Makefile
2425
yang/confd/Makefile
2526
yang/test-mode/Makefile
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
# Migrate NETCONF server TCP parameters to new YANG schema (RFC 9643)
3+
# The 'local-address' leaf has been moved into a 'local-bind' list
4+
# Old: tcp-server-parameters/local-address
5+
# New: tcp-server-parameters/local-bind[]/local-address
6+
7+
file=$1
8+
temp=${file}.tmp
9+
10+
jq '
11+
if .["ietf-netconf-server:netconf-server"]?.listen?.endpoints?.endpoint then
12+
.["ietf-netconf-server:netconf-server"].listen.endpoints.endpoint |= map(
13+
if .ssh?."tcp-server-parameters"?."local-address" then
14+
# Extract and remove the old local-address value, then add new structure
15+
.ssh."tcp-server-parameters"."local-address" as $addr |
16+
.ssh."tcp-server-parameters" |= (del(."local-address") | . + {
17+
"local-bind": [{
18+
"local-address": $addr
19+
}]
20+
})
21+
else
22+
.
23+
end
24+
)
25+
else
26+
.
27+
end
28+
' "$file" > "$temp" && mv "$temp" "$file"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
migratedir = $(pkgdatadir)/migrate/1.7
2+
#dist_migrate_DATA = 10-netconf-server-tcp-params.sh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SUBDIRS = 1.0 1.1 1.2 1.3 1.4 1.5 1.6
1+
SUBDIRS = 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7
22
migratedir = $(pkgdatadir)/migrate

0 commit comments

Comments
 (0)