summaryrefslogtreecommitdiff
path: root/snapcraft
diff options
context:
space:
mode:
authorMartin Winter <mwinter@opensourcerouting.org>2017-04-21 02:49:39 -0700
committerMartin Winter <mwinter@opensourcerouting.org>2017-04-21 02:49:39 -0700
commitd851b2fc0d872e461b3c90056f0a1b551c0e4cf6 (patch)
tree19c9c06df33312bf26284f751c2463da23e8a8ee /snapcraft
parent80b4df3b082f5f51afc0add1f2e59dc5822deef1 (diff)
snapcraft: Add FPM module with command to set mode or disable it
- New snap command: frr.set fpm {disable | protobuf | netlink} Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Diffstat (limited to 'snapcraft')
-rw-r--r--snapcraft/README.usage.md16
-rw-r--r--snapcraft/scripts/Makefile1
-rwxr-xr-xsnapcraft/scripts/set-options40
-rw-r--r--snapcraft/scripts/zebra-service8
-rw-r--r--snapcraft/snapcraft.yaml.in5
5 files changed, 68 insertions, 2 deletions
diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md
index c678c8805c..537147303a 100644
--- a/snapcraft/README.usage.md
+++ b/snapcraft/README.usage.md
@@ -30,6 +30,8 @@ Commands defined by this snap
options
- `frr.readme`:
Returns this document `cat README_usage.md`
+- `frr.set`:
+ Allows to enable `FPM` module. See FPM section below
and for debugging defined at this time (May get removed later - do not
depend on them). These are mainly intended to debug the Snap
@@ -86,6 +88,20 @@ are named `eth0`, `eth1` and `eth2`, then the additional lines in
These settings require either a reboot or a manual configuration with
`sysctl` as well.
+FPM Module
+----------
+The `frr.set` allows to turn FPM module on or off.
+
+ frr.set fpm {disable|protobuf|netlink}
+
+ Disables FPM or enables FPM with selected mode
+
+By default, the FPM module is disabled, but installed with netlink and
+protobuf support. To enable the FPM module, use the `frr.set fpm protobuf`
+or `frr.set fpm netlink` command. The command will only enable the mode
+for the next restart of zebra. Please reboot or restart zebra after
+changing the mode to become effective.
+
FAQ
---
- frr.vtysh displays `--MORE--` on long output. How to suppress this?
diff --git a/snapcraft/scripts/Makefile b/snapcraft/scripts/Makefile
index 0f9a24b649..2a60d4d652 100644
--- a/snapcraft/scripts/Makefile
+++ b/snapcraft/scripts/Makefile
@@ -12,3 +12,4 @@ install:
install -D -m 0755 pimd-service $(DESTDIR)/bin/
install -D -m 0755 ldpd-service $(DESTDIR)/bin/
install -D -m 0755 nhrpd-service $(DESTDIR)/bin/
+ install -D -m 0755 set-options $(DESTDIR)/bin/
diff --git a/snapcraft/scripts/set-options b/snapcraft/scripts/set-options
new file mode 100755
index 0000000000..e76e321ef8
--- /dev/null
+++ b/snapcraft/scripts/set-options
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+set -e
+
+case $1 in
+ fpm)
+ case $2 in
+ disable)
+ rm -f $SNAP_DATA/fpm.conf
+ echo "FPM module disabled. Please restart FRR"
+ ;;
+ protobuf)
+ echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
+ echo "FPM enabled and set to protobuf mode. Please restart FRR"
+ ;;
+ netlink)
+ echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
+ echo "FPM enabled and set to netlink mode. Please restart FRR"
+ ;;
+ *)
+ echo "Usage:"
+ echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
+ echo ""
+ echo " Disables FPM module or enables it with specified mode"
+ echo " Mode will be saved for next restart of zebra, but zebra"
+ echo " is not automatically restarted"
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage:"
+ echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
+ echo ""
+ echo " Disables FPM or enables FPM with selected mode"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/snapcraft/scripts/zebra-service b/snapcraft/scripts/zebra-service
index 9119a4055d..2ee131f9e5 100644
--- a/snapcraft/scripts/zebra-service
+++ b/snapcraft/scripts/zebra-service
@@ -8,9 +8,13 @@ fi
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
fi
+EXTRA_OPTIONS=""
+if [ -e $SNAP_DATA/fpm.conf ]; then
+ EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`"
+fi
exec $SNAP/sbin/zebra \
-f $SNAP_DATA/zebra.conf \
--pid_file $SNAP_DATA/zebra.pid \
--socket $SNAP_DATA/zsock \
- --vty_socket $SNAP_DATA
-
+ --vty_socket $SNAP_DATA \
+ --moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS
diff --git a/snapcraft/snapcraft.yaml.in b/snapcraft/snapcraft.yaml.in
index 54a1cfd4f0..b5fb24a361 100644
--- a/snapcraft/snapcraft.yaml.in
+++ b/snapcraft/snapcraft.yaml.in
@@ -90,6 +90,8 @@ apps:
- network
- network-bind
- network-control
+ set:
+ command: bin/set-options
zebra-debug:
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
@@ -177,6 +179,7 @@ parts:
- bison
- flex
- python3-dev
+ - protobuf-c-compiler
stage-packages:
- coreutils
- iproute2
@@ -208,6 +211,8 @@ parts:
- --enable-group=root
- --enable-pimd
- --enable-ldpd
+ - --enable-fpm
+ - --enable-protobuf
- --enable-configfile-mask=0640
- --enable-logfile-mask=0640
- --localstatedir=/var/run