]> git.puffer.fish Git - mirror/frr.git/commitdiff
snapcraft: Add FPM module with command to set mode or disable it 388/head
authorMartin Winter <mwinter@opensourcerouting.org>
Fri, 21 Apr 2017 09:49:39 +0000 (02:49 -0700)
committerMartin Winter <mwinter@opensourcerouting.org>
Fri, 21 Apr 2017 09:49:39 +0000 (02:49 -0700)
- New snap command:
    frr.set fpm {disable | protobuf | netlink}

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
snapcraft/README.usage.md
snapcraft/scripts/Makefile
snapcraft/scripts/set-options [new file with mode: 0755]
snapcraft/scripts/zebra-service
snapcraft/snapcraft.yaml.in

index c678c8805c42725eefa0b492504f52bf76ee80a8..537147303a82344ada20552d5849bc60de4d0929 100644 (file)
@@ -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?
index 0f9a24b649c0bb15303da966f90a97b1d0e76174..2a60d4d6522642a1493ead01dd0c203baaacdf83 100644 (file)
@@ -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 (executable)
index 0000000..e76e321
--- /dev/null
@@ -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
index 9119a4055d4559a7fedb8b8655f3236bf1a4ccbe..2ee131f9e5bc0efcc4bc0fcd83d0e0c28d6d008d 100644 (file)
@@ -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
index 54a1cfd4f014c354e48b2df45314cb9ef958416c..b5fb24a36163d92cb9b9b801bb6e39703e44ca32 100644 (file)
@@ -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