Skip to content

Commit

Permalink
fix scripts and example
Browse files Browse the repository at this point in the history
  • Loading branch information
karimra committed Feb 15, 2024
1 parent c615257 commit 5050bda
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ private
tests
builds
rpm
pkg
docs
dist
example/clab-*
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ For an automated lab deployment with 2 SR Linux, 2 gNMIc (tunnel server), a Prom

### Manual installation

Download the pre build RPM file from the repo's [release page](https://github.com/karimra/srl-grpc-tunnel/releases), or run:
Download the pre build .deb file from the repo's [release page](https://github.com/karimra/srl-grpc-tunnel/releases), or run:

```bash
wget https://github.com/karimra/srl-grpc-tunnel/releases/download/v0.0.1/srl-grpc-tunnel_0.0.1_Linux_x86_64.rpm
version=0.1.8
wget https://github.com/karimra/srl-grpc-tunnel/releases/download/v${version}/srl-grpc-tunnel_${version}_Linux_x86_64.deb
```

Copy the RPM file to your SR Linux instance and run (from bash)
Copy the .deb file to your SR Linux instance and run (from bash)

```bash
sudo rpm -i srl-grpc-tunnel_0.0.1_Linux_x86_64.rpm
sudo dpkg -i srl-grpc-tunnel_${version}_Linux_x86_64.deb
```

Reload the application manager
Expand All @@ -64,6 +65,22 @@ A:srl1#

## Configuration

This application relies on SRL's gNMI server unix socket to serve sessions towards GNMI_GNOI targets. It should be enabled before starting the grpc-tunnel application.

```shell
enter candidate
# enable the gnmi-server unix-socket
/ system gnmi-server unix-socket admin-state enable
# disable authentication (optional)
/ system gnmi-server unix-socket use-authentication false
# enable gNMI and gNOI (optional) services
/ system gnmi-server unix-socket services [ gnmi gnoi ]
# commit
commit now
```

The application configuration has 3 sections; its `admin-state`, the list of `destinations` and the `tunnels`

``` shell
--{ + running }--[ system grpc-tunnel ]--
A:srl1#
Expand Down Expand Up @@ -231,7 +248,7 @@ commit now

```bash
gnmic -a clab-grpc-tunnel-srl1 -u admin -p admin --skip-verify set \
--update /system/grpc-tunnel/tunnel[name=t1]/admin-state:::json_ietf:::enable \
--update /system/grpc-tunnel/tunnel[name=t1]/admin-state:::json_ietf:::enable
```

## State
Expand Down
8 changes: 8 additions & 0 deletions example/confg_gnmi_unix_sock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
updates:
- path: /system/gnmi-server/unix-socket
encoding: json_ietf
value:
admin-state: enable
use-authentication: false
services:
- gnmi
2 changes: 1 addition & 1 deletion example/config_grpc_tunnel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ updates:
admin-state: enable
destination:
- name: d1
- name: d2
# - name: d2
target:
name: tg1
id:
Expand Down
4 changes: 2 additions & 2 deletions example/config_grpc_tunnel_vars.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Destination1: 172.20.20.4
Destination2: 172.20.20.5
Destination1: 172.20.20.7
Destination2: 172.20.20.8
4 changes: 2 additions & 2 deletions example/grpc_tunnel.clab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: grpc-tunnel
topology:
kinds:
srl:
image: ghcr.io/nokia/srlinux:latest
image: ghcr.io/nokia/srlinux:23.10.1
binds:
- ./rpm:/tmp/rpm:ro
- ./pkg:/tmp/pkg:ro

nodes:
srl1:
Expand Down
34 changes: 18 additions & 16 deletions example/run.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
#!/bin/bash

# download the RPM file

wget -qL https://github.com/karimra/srl-grpc-tunnel/releases/download/v0.0.1/srl-grpc-tunnel_0.1.5_Linux_x86_64.rpm -P rpm/
version="0.1.8"
username=admin
password=NokiaSrl1!
#nodes="clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2"
nodes="clab-grpc-tunnel-srl1"

# download the deb file
rm -rf pkg/
wget -qL https://github.com/karimra/srl-grpc-tunnel/releases/download/v${version}/srl-grpc-tunnel_${version}_Linux_x86_64.deb -P pkg/

#deploy the lab
sudo clab deploy -t grpc_tunnel.clab.yaml --reconfigure
username=admin
password=NokiaSrl1!

# enable gnmi unix-socket
gnmic -u $username -p $password -a clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2 --skip-verify -e json_ietf set \
--update-path /system/gnmi-server/unix-socket/admin-state \
--update-path /system/gnmi-server/unix-socket/use-authentication \
--update-value enable \
--update-value true
gnmic -u $username -p $password -a $nodes --skip-verify -e json_ietf set \
--request-file confg_gnmi_unix_sock.yaml

# ACLs
gnmic -u $username -p $password -a clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2 --skip-verify -e json_ietf set \
gnmic -u $username -p $password -a $nodes --skip-verify -e json_ietf set \
--request-file acls.yaml

# install the RPM located in /tmp/rpm
sudo clab exec --topo grpc_tunnel.clab.yaml --label clab-node-kind=srl --label containerlab=grpc-tunnel --cmd "sudo rpm -U /tmp/rpm/*rpm"
# install the pkg located in /tmp/pkg
sudo clab exec --topo grpc_tunnel.clab.yaml --label clab-node-kind=srl --label containerlab=grpc-tunnel --cmd "sudo dpkg -i /tmp/pkg/srl-grpc-tunnel_${version}_Linux_x86_64.deb"

sleep 15
# reload the app manager so it picks up the newly installed app
sudo clab exec --topo grpc_tunnel.clab.yaml --label clab-node-kind=srl --label containerlab=grpc-tunnel --cmd "sr_cli tools system app-management application app_mgr reload"

Expand All @@ -38,10 +41,9 @@ echo "Destination1: $gnmic1_ip" > config_grpc_tunnel_vars.yaml
echo "Destination2: $gnmic2_ip" >> config_grpc_tunnel_vars.yaml

# configure both SRL1 and SRL2
gnmic -u $username -p $password -a clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2 --skip-verify -e json_ietf set \
gnmic -u $username -p $password -a $nodes --skip-verify -e json_ietf set \
--request-file config_grpc_tunnel.yaml -d

# check system/grpc-tunnel config and state
gnmic -u $username -p $password -a clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2 --skip-verify -e json_ietf get --path /system/grpc-tunnel -t config
gnmic -u $username -p $password -a clab-grpc-tunnel-srl1,clab-grpc-tunnel-srl2 --skip-verify -e json_ietf get --path /system/grpc-tunnel -t state

gnmic -u $username -p $password -a $nodes --skip-verify -e json_ietf get --path /system/grpc-tunnel -t config
gnmic -u $username -p $password -a $nodes --skip-verify -e json_ietf get --path /system/grpc-tunnel -t state
2 changes: 0 additions & 2 deletions scripts/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ if [[ $appmgr != "not running" ]]
then
sr_cli tools system app-management application app_mgr reload
fi

gorele

0 comments on commit 5050bda

Please sign in to comment.