]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Add vlan aware bridge examples
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Sun, 16 Nov 2014 07:22:01 +0000 (23:22 -0800)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Sun, 16 Nov 2014 07:22:01 +0000 (23:22 -0800)
Ticket: CM-3346
Reviewed By: pending review
Testing Done: example files are tested

docs/examples/vlan_aware_bridges/interfaces.1 [new file with mode: 0644]
docs/examples/vlan_aware_bridges/interfaces.2 [new file with mode: 0644]
docs/examples/vlan_aware_bridges/interfaces.3 [new file with mode: 0644]
docs/examples/vlan_aware_bridges/interfaces.4 [new file with mode: 0644]
setup.py

diff --git a/docs/examples/vlan_aware_bridges/interfaces.1 b/docs/examples/vlan_aware_bridges/interfaces.1
new file mode 100644 (file)
index 0000000..74e4d73
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# vlan-aware bridge simple example
+#
+# bridge br is a vlan aware bridge with all ports (swp1-52).
+# native vlan is by default 1
+#
+# 'bridge-vids' attribute is used to declare vlans.
+# 'bridge-pvid' attribute is used to specify native vlans if other than 1
+# 'bridge-access' attribute is used to declare access port
+# 
+
+#
+# ports swp1-swp52 are trunk ports which inherit vlans from the bridge br
+# ie vlans 310 700 707 712 850 910
+      
+#
+# the following is a vlan aware bridge with ports swp1-swp52
+# It has stp on
+#
+auto br
+iface br
+      bridge-vlan-aware yes
+      bridge-ports glob swp1-52
+      bridge-stp on
+      bridge-vids 310 700 707 712 850 910
diff --git a/docs/examples/vlan_aware_bridges/interfaces.2 b/docs/examples/vlan_aware_bridges/interfaces.2
new file mode 100644 (file)
index 0000000..5a032ec
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# vlan-aware bridge access ports and pruned vlan example
+#
+# bridge br is a vlan aware bridge with all ports (swp1-52).
+# native vlan is by default 1
+#
+# 'bridge-vids' attribute is used to declare vlans.
+# 'bridge-pvid' attribute is used to specify native vlans if other than 1
+# 'bridge-access' attribute is used to declare access port
+#
+# 
+
+# The following is an access port to vlan 310, no trunking
+auto swp1
+iface swp1
+      bridge-access 310
+      mstpctl-portautoedge yes
+      mstpctl-bpduguard yes
+
+# The following is a truk port that is "pruned".
+# native vlan is 1, but only .1q tags of 707, 712, 850 are
+# sent and received
+#
+auto swp2
+iface swp2
+      bridge-vids 707 712 850
+      mstpctl-portautoedge yes
+      mstpctl-bpduguard yes
+     
+# The following port is the trunk uplink and inherits all vlans
+# from bridge br
+auto swp49
+iface swp49
+      mstpctl-portpathcost 10
+
+# The following port is the trunk uplink and inherits all vlans
+# from bridge br
+auto swp50
+iface swp50
+      mstpctl-portpathcost 0
+
+#
+# ports swp3-swp48 are trunk ports which inherit vlans from the bridge br
+# ie vlans 310,700,707,712,850,910
+      
+#
+# the following is a vlan aware bridge with ports swp1-swp52
+# It has stp on
+#
+auto br
+iface br
+      bridge-vlan-aware yes
+      bridge-ports glob swp1-52
+      bridge-stp on
+      bridge-vids 310 700 707 712 850 910
diff --git a/docs/examples/vlan_aware_bridges/interfaces.3 b/docs/examples/vlan_aware_bridges/interfaces.3
new file mode 100644 (file)
index 0000000..0064a6a
--- /dev/null
@@ -0,0 +1,92 @@
+#
+# vlan-aware bridge with bonds example
+#
+# uplink1, peerlink and downlink are bond interfaces.
+# bridge br is a vlan aware bridge with ports uplink1, peerlink
+# and downlink (swp2-20).
+# 
+# native vlan is by default 1
+#
+# 'bridge-vids' attribute is used to declare vlans.
+# 'bridge-pvid' attribute is used to specify native vlans if other than 1
+# 'bridge-access' attribute is used to declare access port
+# 
+auto lo
+iface lo
+
+auto eth0
+iface eth0 inet dhcp
+
+# bond interface
+auto uplink1
+iface uplink1
+    bond-slaves swp32
+    bond-mode 802.3ad
+    bond-miimon 100
+    bond-use-carrier 1
+    bond-lacp-rate 1
+    bond-min-links 1
+    bond-xmit-hash-policy layer2
+    bridge-vids 2000-2079
+
+# bond interface
+auto peerlink
+iface peerlink
+    bond-slaves swp30 swp31
+    bond-mode 802.3ad
+    bond-miimon 100
+    bond-use-carrier 1
+    bond-lacp-rate 1
+    bond-min-links 1
+    bond-xmit-hash-policy layer3+4
+    bridge-vids 2000-2079 4094
+
+# bond interface
+auto downlink
+iface downlink
+    bond-slaves swp1
+    bond-mode 802.3ad
+    bond-miimon 100
+    bond-use-carrier 1
+    bond-lacp-rate 1
+    bond-min-links 1
+    bond-xmit-hash-policy layer3+4
+    bridge-vids 2000-2079
+
+#
+# Declare vlans for all swp ports
+# swp2-20 get vlans from 2004 to 2022.
+# The below uses mako templates to generate iface sections
+# with vlans for swp ports
+#
+%for port, vlanid in zip(range(2, 20), range(2004, 2022)) :
+    auto swp${port}
+    iface swp${port}
+        bridge-vids ${vlanid}
+
+%endfor
+
+# svi vlan 4094
+auto br.4094
+iface br.4094
+    address 11.100.1.252/24
+
+# l2 attributes for vlan 4094
+auto br.4094
+vlan br.4094
+    bridge-igmp-querier-src 172.16.101.1
+
+#
+# vlan aware bridge br
+#
+auto br
+iface br
+    bridge-vlan-aware yes
+    bridge-ports uplink1 peerlink downlink glob swp2-20
+    bridge-stp on
+
+# svi peerlink vlan
+auto peerlink.4094
+iface peerlink.4094
+    address 192.168.10.1/30
+    broadcast 192.168.10.3
diff --git a/docs/examples/vlan_aware_bridges/interfaces.4 b/docs/examples/vlan_aware_bridges/interfaces.4
new file mode 100644 (file)
index 0000000..3f8b3ac
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# vlan-aware bridge with clag example
+#
+#
+# bridge 'br' is a vlan aware bridge with ports:
+#      'peer-bond spine-bond glob host-bond-0[1-2]'
+#
+# All ports inherit 'vlans 10 20-23' from the 'bridge-vids' attribute
+# under the bridge
+# 
+# native vlan is by default 1
+#
+# 'bridge-vids' attribute is used to declare vlans.
+# 'bridge-pvid' attribute is used to specify native vlans if other than 1
+# 'bridge-access' attribute is used to declare access port
+# 
+# 
+
+# spine bond
+#
+auto spine-bond
+iface spine-bond
+      bond-slaves glob swp19-22
+      bond-mode 802.3ad
+      bond-miimon 100
+      bond-use-carrier 1
+      bond-lacp-rate 1
+      bond-min-links 1
+      bond-xmit-hash-policy layer3+4
+
+# mlag bond and peer interface
+#
+auto peer-bond
+iface peer-bond
+      bond-slaves glob swp23-24
+      bond-mode 802.3ad
+      bond-miimon 100
+      bond-use-carrier 1
+      bond-lacp-rate 1
+      bond-min-links 1
+      bond-xmit-hash-policy layer3+4
+
+# sub-interface for clagd communication
+#
+auto peer-bond.4094
+iface peer-bond.4094
+      address 169.254.0.1/31
+      clagd-peer-ip 11.0.5.2
+      clagd-sys-mac 00:00:00:aa:bb:01
+      clagd-args --vm
+
+# host ports
+#
+auto host-bond-01
+iface host-bond-01
+      bond-slaves swp1
+      bond-mode 802.3ad
+      bond-miimon 100
+      bond-use-carrier 1
+      bond-lacp-rate 1
+      bond-min-links 1
+      bond-xmit-hash-policy layer3+4
+
+auto host-bond-02
+iface host-bond-02
+      bond-slaves swp2
+      bond-mode 802.3ad
+      bond-miimon 100
+      bond-use-carrier 1
+      bond-lacp-rate 1
+      bond-min-links 1
+      bond-xmit-hash-policy layer3+4
+
+# the bridge
+#
+auto br
+iface br
+      bridge-vlan-aware yes
+      bridge-ports peer-bond spine-bond glob host-bond-0[1-2]
+      bridge-stp on
+      bridge-vids 10 20-23
index 100f8194dee3431f393688831fb6c015f903a20f..fe2dc44e45052b999c34d28a3a4593fd83a513fd 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,13 @@ setup(name='ifupdown2',
                   ('/usr/share/doc/python-ifupdown2/examples/',
                       ['docs/examples/interfaces',
                        'docs/examples/interfaces_bridge_template_func',
-                       'docs/examples/interfaces_with_template']),
+                       'docs/examples/interfaces_with_template',
+                       'docs/examples/interfaces_bridge_igmp_mstp']),
+                  ('/usr/share/doc/python-ifupdown2/examples/vlan_aware_bridges',
+                      ['docs/examples/vlan_aware_bridges/interfaces.1',
+                       'docs/examples/vlan_aware_bridges/interfaces.2',
+                       'docs/examples/vlan_aware_bridges/interfaces.3',
+                       'docs/examples/vlan_aware_bridges/interfaces.4']),
                   ('/etc/bash_completion.d/', ['completion/ifup']),
                   ('/usr/share/ifupdownaddons/', ['addons/bridge.py',
                       'addons/ifenslave.py', 'addons/vlan.py',