Skip to content

Commit db7020e

Browse files
authored
Merge pull request #30 from karimra/cleanup
cleanup
2 parents 1940561 + 978ad18 commit db7020e

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ on:
66
- v*
77
env:
88
GOVER: 1.20.5
9-
GORELEASER_VER: v0.180.3
9+
GORELEASER_VER: v1.19.2
1010

1111
jobs:
1212
test:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- uses: actions/checkout@v3
1616
- uses: actions/setup-go@v4
@@ -21,7 +21,7 @@ jobs:
2121
CGO_ENABLED: 0
2222

2323
release:
24-
runs-on: ubuntu-20.04
24+
runs-on: ubuntu-22.04
2525
needs:
2626
- test
2727
steps:
@@ -37,6 +37,6 @@ jobs:
3737
uses: goreleaser/goreleaser-action@v4
3838
with:
3939
version: latest
40-
args: release --rm-dist -f .goreleaser.yml
40+
args: release --clean -f .goreleaser.yml
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- "!releases/**"
99
env:
1010
GOVER: 1.20.5
11-
GORELEASER_VER: v0.180.3
1211

1312
jobs:
1413
test:

config.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,28 @@ func (a *app) handleNwInstCfg(ctx context.Context, cfg *ndk.NetworkInstanceNotif
161161
func (a *app) handleGrpcTunnel(ctx context.Context, txCfg *ndk.ConfigNotification) {
162162
switch txCfg.GetOp() {
163163
case ndk.SdkMgrOperation_Create:
164+
log.Infof("Create: .system.grpc_tunnel: %+v", txCfg)
164165
a.handleGrpcTunnelCreate(ctx, txCfg.GetData())
165166
case ndk.SdkMgrOperation_Update:
167+
log.Infof("Update: .system.grpc_tunnel: %+v", txCfg)
166168
a.handleGrpcTunnelChange(ctx, txCfg.GetData())
167169
case ndk.SdkMgrOperation_Delete:
170+
log.Infof("Delete: .system.grpc_tunnel: %+v", txCfg)
168171
a.handleGrpcTunnelDelete(ctx)
169172
}
170173
}
171174

172-
func (a *app) handleGrpcTunnelCreate(ctx context.Context, cfgData *ndk.ConfigData) {}
175+
func (a *app) handleGrpcTunnelCreate(ctx context.Context, cfgData *ndk.ConfigData) {
176+
newAppCfg := new(appConfig)
177+
err := json.Unmarshal([]byte(cfgData.GetJson()), newAppCfg)
178+
if err != nil {
179+
log.Errorf("failed to unmarshal path %q config %+v", grpcTunnelPath, cfgData)
180+
return
181+
}
182+
a.config.app = newAppCfg
183+
a.config.app.OperState = operDown
184+
a.updateRootLevelTelemetry(a.config.app)
185+
}
173186

174187
func (a *app) handleGrpcTunnelChange(ctx context.Context, cfgData *ndk.ConfigData) {
175188
// unmarshal changed config
@@ -185,7 +198,6 @@ func (a *app) handleGrpcTunnelChange(ctx context.Context, cfgData *ndk.ConfigDat
185198
case a.config.app.AdminState == adminDisable && a.config.app.OperState == operUp:
186199
// stop all tunnels
187200
a.stopAll(ctx)
188-
// TODO: update all telemetry
189201
a.config.app.OperState = operDown
190202
case a.config.app.AdminState == adminEnable && a.config.app.OperState != operUp:
191203
// start all tunnels

telemetry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func (a *app) updateTelemetryPathConfig(jsPath string, jsData string) {
14+
log.Infof("updating: %s: %s", jsPath, jsData)
1415
key := &ndk.TelemetryKey{JsPath: jsPath}
1516
data := &ndk.TelemetryData{JsonContent: jsData}
1617
info := &ndk.TelemetryInfo{Key: key, Data: data}

yaml/grpc-tunnel.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ grpc-tunnel:
55
launch-command: ./srl-grpc-tunnel
66
search-command: ./srl-grpc-tunnel
77
version-command: /usr/local/bin/srl-grpc-tunnel -v
8+
wait-for-config: Yes
89
start-order: 100
910
config-delivery-format: proto-json # json, proto-json, binary-tlvs
1011
failure-threshold: 10

0 commit comments

Comments
 (0)