diff --git a/cdist/conf/type/__bridge/gencode-remote b/cdist/conf/type/__bridge/gencode-remote new file mode 100755 index 00000000..77ad9d25 --- /dev/null +++ b/cdist/conf/type/__bridge/gencode-remote @@ -0,0 +1,20 @@ +#!/bin/sh -e +# +# 2020 Dennis Camera (dennis.camera@ssrq-sds-fds.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + diff --git a/cdist/conf/type/__bridge/man.rst b/cdist/conf/type/__bridge/man.rst new file mode 100644 index 00000000..130aa9d4 --- /dev/null +++ b/cdist/conf/type/__bridge/man.rst @@ -0,0 +1,106 @@ +cdist-type__bridge(7) +===================== + +NAME +---- +cdist-type__bridge - Manage network bridges + + +DESCRIPTION +----------- +This cdist type allows you to manage virtual Ethernet bridges on the target. +It acts as a wrapper around cdist-type__interface(7) to provide more convenient +access to bridge-specific parameters. +Only TCP/IP is supported. For other protocol stacks, use the specific types for +your OS. + + +REQUIRED PARAMETERS +------------------- +port + A port (interface) to be part of the bridge. + This parameter can be used multiple times, to add more than one port to the + bridge. + The ports should not be defined as __interfaces. + + +OPTIONAL PARAMETERS +------------------- +address + The IP address (in CIDR notation) to assign to the network interface. + Can be repeated to assign multiple IP addresses. +bootproto + The boot protocol to use. + + Acceptable values are ``dhcp``, ``static``, ``manual``. + Defaults to ``manual``. +comment + A comment to be stored in the configuration file. +extra-config + Other options to be passed to the implementation type verbatim. + Using this option makes the configuration non-portable to other backends. + If this option is used extensively, it is recommended to use the respective + backend type directly. +gateway + The default gateway to assign to this interface (optional). +name + The name of the physical or logical network device to configure. + Defaults to ``__object_id``. +onchange + The action to perform if the interface configuration has changed. + + Available options are: + + leave (default) + Do nothing. + up + Bring the interface up if it is down. + down + Bring the interface down if it is up. + refresh + Refresh the interface (down && up). +state + ``present`` or ``absent``, defaults to ``present``. +type + The backend to use to store the interface configuration. + Default is to auto detect. + + +BOOLEAN PARAMETERS +------------------ +onboot + Bring the interface up on boot. + Otherwise, it has to be manually brought up using OS utilities + (e.g. ifup\ (8)). +hotplug + | Allow hotplugging the ports on this bridge. + | N.B.: Some backends might not support this. +stp + Enable the Spanning Tree Protocol (STP) on this bridge. + + +EXAMPLES +-------- + +.. code-block:: sh + + # Create a bridge br0 comprised of eth0 and eth1 that is brought up on boot. + __bridge br0 --onboot --port eth0 --port eth1 + + +SEE ALSO +-------- +:strong:`cdist-type__interface`\ (7) + + +AUTHORS +------- +Dennis Camera + + +COPYING +------- +Copyright \(C) 2020 Dennis Camera. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. diff --git a/cdist/conf/type/__bridge/manifest b/cdist/conf/type/__bridge/manifest new file mode 100755 index 00000000..4d5fda84 --- /dev/null +++ b/cdist/conf/type/__bridge/manifest @@ -0,0 +1,41 @@ +#!/bin/sh -e +# +# 2020 Dennis Camera (dennis.camera@ssrq-sds-fds.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + + +os=$(cat "${__global:?}/explorer/os") + +case $os +in + (*) + printf "Your operating system (%s) is currently not supported by this type (%s)\n" "${os}" "${__type##*/}" >&2 + printf "Please contribute an implementation for it if you can.\n" >&2 + exit 1 + ;; +esac + +# Hand over to backend-specific implementation +manifest_file="${__type:?}/files/backends/${impl_type}/manifest" +test -x "${manifest_file}" || { + printf 'Unknown type: %s\n' "${impl_type}" >&2 + exit 1 +} + +# Run backend-specific script +exec "${manifest_file}" diff --git a/cdist/conf/type/__bridge/parameter/boolean b/cdist/conf/type/__bridge/parameter/boolean new file mode 100644 index 00000000..0d323712 --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/boolean @@ -0,0 +1,3 @@ +hotplug +onboot +stp diff --git a/cdist/conf/type/__bridge/parameter/default/bootproto b/cdist/conf/type/__bridge/parameter/default/bootproto new file mode 100644 index 00000000..2905494b --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/default/bootproto @@ -0,0 +1 @@ +manual diff --git a/cdist/conf/type/__bridge/parameter/default/onchange b/cdist/conf/type/__bridge/parameter/default/onchange new file mode 100644 index 00000000..e8f9c907 --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/default/onchange @@ -0,0 +1 @@ +leave diff --git a/cdist/conf/type/__bridge/parameter/default/state b/cdist/conf/type/__bridge/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__bridge/parameter/optional b/cdist/conf/type/__bridge/parameter/optional new file mode 100644 index 00000000..16ae6fba --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/optional @@ -0,0 +1,7 @@ +bootproto +comment +gateway +name +onchange +state +type diff --git a/cdist/conf/type/__bridge/parameter/optional_multiple b/cdist/conf/type/__bridge/parameter/optional_multiple new file mode 100644 index 00000000..5bb11f03 --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/optional_multiple @@ -0,0 +1,2 @@ +address +extra-config diff --git a/cdist/conf/type/__bridge/parameter/required_multiple b/cdist/conf/type/__bridge/parameter/required_multiple new file mode 100644 index 00000000..20e6f145 --- /dev/null +++ b/cdist/conf/type/__bridge/parameter/required_multiple @@ -0,0 +1 @@ +port