system: Bridge support for ietf-interfaces config
Introduce a possibility to configure an interface to be enslaved by
another interface.
Our interfaces are not changeable, so the only possible value for a
master interface is a br0 interface, the only bridge in the system.
Change-Id: Ie19192bfed3404781ef4f727695928e50537dd7a
diff --git a/yang/czechlight-network@2021-02-22.yang b/yang/czechlight-network@2021-02-22.yang
index fbdd6fb..2d67e8b 100644
--- a/yang/czechlight-network@2021-02-22.yang
+++ b/yang/czechlight-network@2021-02-22.yang
@@ -73,16 +73,36 @@
}
}
+ augment /if:interfaces/if:interface {
+ description "Add the option to add this link to a bridge.";
+
+ leaf bridge {
+ must '. = "br0"' {
+ error-message "br0 is the only available bridge interface.";
+ }
+
+ when '(not(../ip:ipv4) or ../ip:ipv4/ip:enabled[.="false"]) and
+ (not(../ip:ipv6) or ../ip:ipv6/ip:enabled[.="false"])' {
+ description "IP protocols must be disabled for enslaved link.";
+ }
+
+ type if:interface-ref;
+ mandatory false;
+ description "The name of the bridge to add the link to.";
+ }
+ }
+
// Make it hard to accidentally lose connection by removing ipv4/ipv6 presence containers or all IP addresses
deviation /if:interfaces/if:interface {
deviate add {
must 'if:enabled = "false" or
ip:ipv4/ip:enabled = "true" or
- ip:ipv6/ip:enabled = "true"' {
+ ip:ipv6/ip:enabled = "true" or
+ cla-network:bridge' {
error-message "There must always be at least one protocol active unless the interface is disabled.";
}
- }
- }
+ }
+ }
deviation /if:interfaces/if:interface/ip:ipv4 {
deviate add {