Adding new topologies to mininet
Change-Id: Id1bafcd72e6f50d69b7985ded3947cb2eda774df
diff --git a/mininet/Chart.yaml b/mininet/Chart.yaml
index 0a5f10e..feed890 100644
--- a/mininet/Chart.yaml
+++ b/mininet/Chart.yaml
@@ -18,4 +18,4 @@
appVersion: 1.1.0
description: A Helm chart for Mininet
name: mininet
-version: 1.2.1
+version: 1.2.2-dev
diff --git a/mininet/templates/deployment.yaml b/mininet/templates/deployment.yaml
index 9ad2e5b..1e5ac06 100644
--- a/mininet/templates/deployment.yaml
+++ b/mininet/templates/deployment.yaml
@@ -52,7 +52,20 @@
- name: "topo-config"
mountPath: "/toposcripts"
resources:
-{{ toYaml .Values.resources | indent 12 }}
+ requests:
+ {{- if .Values.resources.requests.memory }}
+ memory: {{ .Values.resources.requests.memory }}
+ {{- end }}
+ {{- if .Values.resources.requests.cpu }}
+ cpu: {{ .Values.resources.requests.cpu }}
+ {{- end }}
+ limits:
+ {{- if .Values.resources.limits.memory }}
+ memory: {{ .Values.resources.limits.memory }}
+ {{- end }}
+ {{- if .Values.resources.limits.cpu }}
+ cpu: {{ .Values.resources.limits.cpu }}
+ {{- end }}
volumes:
- name: "topo-config"
configMap:
diff --git a/mininet/toposcripts/topo-leafspine-2-by-3.py b/mininet/toposcripts/topo-leafspine-2-by-3.py
new file mode 100644
index 0000000..2d3ba6b
--- /dev/null
+++ b/mininet/toposcripts/topo-leafspine-2-by-3.py
@@ -0,0 +1,149 @@
+#!/usr/bin/python
+
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+
+import argparse
+
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from stratum import StratumBmv2Switch
+
+from mn_lib import IPv4Host
+from mn_lib import TaggedIPv4Host
+
+CPU_PORT = 255
+
+
+class TutorialTopo(Topo):
+ """2x3 fabric topology with IPv4 hosts"""
+
+ def __init__(self, *args, **kwargs):
+ Topo.__init__(self, *args, **kwargs)
+
+ # Leaves
+ # gRPC port 50001
+ leaf1 = self.addSwitch('leaf1', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50002
+ leaf2 = self.addSwitch('leaf2', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50003
+ leaf3 = self.addSwitch('leaf3', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+
+ # Spines
+ # gRPC port 50004
+ spine1 = self.addSwitch('spine1', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50005
+ spine2 = self.addSwitch('spine2', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+
+ # Switch Links
+ self.addLink(spine1, leaf1)
+ self.addLink(spine1, leaf2)
+ self.addLink(spine1, leaf3)
+ self.addLink(spine2, leaf1)
+ self.addLink(spine2, leaf2)
+ self.addLink(spine2, leaf3)
+
+ # IPv4 hosts attached to leaf 1
+ h1a = self.addHost('h1a', cls=IPv4Host, mac="00:00:00:00:00:1A",
+ ip='172.16.1.1/24', gw='172.16.1.254')
+ h1b = self.addHost('h1b', cls=IPv4Host, mac="00:00:00:00:00:1B",
+ ip='172.16.1.2/24', gw='172.16.1.254')
+ h1c = self.addHost('h1c', cls=TaggedIPv4Host, mac="00:00:00:00:00:1C",
+ ip='172.16.1.3/24', gw='172.16.1.254', vlan=100)
+ h2a = self.addHost('h2a', cls=TaggedIPv4Host, mac="00:00:00:00:00:2A",
+ ip='172.16.2.1/24', gw='172.16.2.254', vlan=200)
+ h2b = self.addHost('h2b', cls=TaggedIPv4Host, mac="00:00:00:00:00:2B",
+ ip='172.16.2.2/24', gw='172.16.2.254', vlan=200)
+ h2c = self.addHost('h2c', cls=IPv4Host, mac="00:00:00:00:00:2C",
+ ip='172.16.2.3/24', gw='172.16.2.254')
+ h3a = self.addHost('h3a', cls=TaggedIPv4Host, mac="00:00:00:00:00:3A",
+ ip='172.16.3.1/24', gw='172.16.3.254', vlan=300)
+ h3b = self.addHost('h3b', cls=IPv4Host, mac="00:00:00:00:00:3B",
+ ip='172.16.3.2/24', gw='172.16.3.254')
+ h3c = self.addHost('h3c', cls=IPv4Host, mac="00:00:00:00:00:3C",
+ ip='172.16.3.3/24', gw='172.16.3.254')
+ self.addLink(h1a, leaf1) # port 3
+ self.addLink(h1b, leaf1) # port 4
+ self.addLink(h1c, leaf1) # port 5
+ self.addLink(h2a, leaf1) # port 6
+ self.addLink(h2b, leaf1) # port 7
+ self.addLink(h2c, leaf1) # port 8
+ self.addLink(h3a, leaf1) # port 9
+ self.addLink(h3b, leaf1) # port 10
+ self.addLink(h3c, leaf1) # port 11
+
+ # IPv4 hosts attached to leaf 2
+ h4a = self.addHost('h4a', cls=IPv4Host, mac="00:00:00:00:00:4A",
+ ip='172.16.4.1/24', gw='172.16.4.254')
+ h4b = self.addHost('h4b', cls=IPv4Host, mac="00:00:00:00:00:4B",
+ ip='172.16.4.2/24', gw='172.16.4.254')
+ h4c = self.addHost('h4c', cls=TaggedIPv4Host, mac="00:00:00:00:00:4C",
+ ip='172.16.4.3/24', gw='172.16.4.254', vlan=400)
+ h5a = self.addHost('h5a', cls=TaggedIPv4Host, mac="00:00:00:00:00:5A",
+ ip='172.16.5.1/24', gw='172.16.5.254', vlan=500)
+ h5b = self.addHost('h5b', cls=TaggedIPv4Host, mac="00:00:00:00:00:5B",
+ ip='172.16.5.2/24', gw='172.16.5.254', vlan=500)
+ h5c = self.addHost('h5c', cls=IPv4Host, mac="00:00:00:00:00:5C",
+ ip='172.16.5.3/24', gw='172.16.5.254')
+ h6a = self.addHost('h6a', cls=TaggedIPv4Host, mac="00:00:00:00:00:6A",
+ ip='172.16.6.1/24', gw='172.16.6.254', vlan=600)
+ h6b = self.addHost('h6b', cls=IPv4Host, mac="00:00:00:00:00:6B",
+ ip='172.16.6.2/24', gw='172.16.6.254')
+ h6c = self.addHost('h6c', cls=IPv4Host, mac="00:00:00:00:00:6C",
+ ip='172.16.6.3/24', gw='172.16.6.254')
+ self.addLink(h4a, leaf2) # port 3
+ self.addLink(h4b, leaf2) # port 4
+ self.addLink(h4c, leaf2) # port 5
+ self.addLink(h5a, leaf2) # port 6
+ self.addLink(h5b, leaf2) # port 7
+ self.addLink(h5c, leaf2) # port 8
+ self.addLink(h6a, leaf2) # port 9
+ self.addLink(h6b, leaf2) # port 10
+ self.addLink(h6c, leaf2) # port 11
+
+ # IPv4 hosts attached to leaf 3
+ h7a = self.addHost('h7a', cls=IPv4Host, mac="00:00:00:00:00:7A",
+ ip='172.16.7.1/24', gw='172.16.7.254')
+ h7b = self.addHost('h7b', cls=IPv4Host, mac="00:00:00:00:00:7B",
+ ip='172.16.7.2/24', gw='172.16.7.254')
+ h7c = self.addHost('h7c', cls=TaggedIPv4Host, mac="00:00:00:00:00:7C",
+ ip='172.16.7.3/24', gw='172.16.7.254', vlan=700)
+ h8a = self.addHost('h8a', cls=TaggedIPv4Host, mac="00:00:00:00:00:8A",
+ ip='172.16.8.1/24', gw='172.16.8.254', vlan=800)
+ h8b = self.addHost('h8b', cls=TaggedIPv4Host, mac="00:00:00:00:00:8B",
+ ip='172.16.8.2/24', gw='172.16.8.254', vlan=800)
+ h8c = self.addHost('h8c', cls=IPv4Host, mac="00:00:00:00:00:8C",
+ ip='172.16.8.3/24', gw='172.16.8.254')
+ h9a = self.addHost('h9a', cls=TaggedIPv4Host, mac="00:00:00:00:00:9A",
+ ip='172.16.9.1/24', gw='172.16.9.254', vlan=900)
+ h9b = self.addHost('h9b', cls=IPv4Host, mac="00:00:00:00:00:9B",
+ ip='172.16.9.2/24', gw='172.16.9.254')
+ h9c = self.addHost('h9c', cls=IPv4Host, mac="00:00:00:00:00:9C",
+ ip='172.16.9.3/24', gw='172.16.9.254')
+ self.addLink(h7a, leaf3) # port 3
+ self.addLink(h7b, leaf3) # port 4
+ self.addLink(h7c, leaf3) # port 5
+ self.addLink(h8a, leaf3) # port 6
+ self.addLink(h8b, leaf3) # port 7
+ self.addLink(h8c, leaf3) # port 8
+ self.addLink(h9a, leaf3) # port 9
+ self.addLink(h9b, leaf3) # port 10
+ self.addLink(h9c, leaf3) # port 11
+
+
+def main():
+ net = Mininet(topo=TutorialTopo(), controller=None)
+ net.start()
+ CLI(net)
+ net.stop()
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description='Mininet topology script for 2x2 fabric with stratum_bmv2 and IPv4 hosts')
+ args = parser.parse_args()
+ setLogLevel('info')
+
+ main()
diff --git a/mininet/toposcripts/topo-leafspine-2-by-4.py b/mininet/toposcripts/topo-leafspine-2-by-4.py
new file mode 100644
index 0000000..d782702
--- /dev/null
+++ b/mininet/toposcripts/topo-leafspine-2-by-4.py
@@ -0,0 +1,107 @@
+#!/usr/bin/python
+
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+
+import argparse
+
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from stratum import StratumBmv2Switch
+
+from mn_lib import IPv4Host
+from mn_lib import TaggedIPv4Host
+
+CPU_PORT = 255
+
+
+class TutorialTopo(Topo):
+ """2x4 fabric topology with IPv4 hosts"""
+
+ def __init__(self, *args, **kwargs):
+ Topo.__init__(self, *args, **kwargs)
+
+ # Leaves
+ # gRPC port 50001
+ leaf1 = self.addSwitch('leaf1', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50002
+ leaf2 = self.addSwitch('leaf2', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50003
+ leaf3 = self.addSwitch('leaf3', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50004
+ leaf4 = self.addSwitch('leaf4', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+
+ # Spines
+ # gRPC port 50005
+ spine1 = self.addSwitch('spine1', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50006
+ spine2 = self.addSwitch('spine2', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+
+ # Switch Links
+ self.addLink(spine1, leaf1)
+ self.addLink(spine1, leaf2)
+ self.addLink(spine1, leaf3)
+ self.addLink(spine1, leaf4)
+ self.addLink(spine2, leaf1)
+ self.addLink(spine2, leaf2)
+ self.addLink(spine2, leaf3)
+ self.addLink(spine2, leaf4)
+
+ # IPv4 hosts attached to leaf 1
+ h1a = self.addHost('h1a', cls=IPv4Host, mac="00:00:00:00:00:1A",
+ ip='172.16.1.1/24', gw='172.16.1.254')
+ h1b = self.addHost('h1b', cls=IPv4Host, mac="00:00:00:00:00:1B",
+ ip='172.16.1.2/24', gw='172.16.1.254')
+ h1c = self.addHost('h1c', cls=TaggedIPv4Host, mac="00:00:00:00:00:1C",
+ ip='172.16.1.3/24', gw='172.16.1.254', vlan=100)
+ h2 = self.addHost('h2', cls=TaggedIPv4Host, mac="00:00:00:00:00:20",
+ ip='172.16.2.1/24', gw='172.16.2.254', vlan=200)
+ self.addLink(h1a, leaf1) # port 3
+ self.addLink(h1b, leaf1) # port 4
+ self.addLink(h1c, leaf1) # port 5
+ self.addLink(h2, leaf1) # port 6
+
+ # IPv4 hosts attached to leaf 2
+ h3 = self.addHost('h3', cls=TaggedIPv4Host, mac="00:00:00:00:00:30",
+ ip='172.16.3.1/24', gw='172.16.3.254', vlan=300)
+ h4 = self.addHost('h4', cls=IPv4Host, mac="00:00:00:00:00:40",
+ ip='172.16.4.1/24', gw='172.16.4.254')
+ self.addLink(h3, leaf2) # port 3
+ self.addLink(h4, leaf2) # port 4
+
+ # IPv4 hosts attached to leaf 3
+ h2b = self.addHost('h2b', cls=TaggedIPv4Host, mac="00:00:00:00:00:2B",
+ ip='172.16.5.1/24', gw='172.16.5.254', vlan=500)
+ h1d = self.addHost('h1d', cls=TaggedIPv4Host, mac="00:00:00:00:00:1D",
+ ip='172.16.6.1/24', gw='172.16.6.254', vlan=600)
+ h3b = self.addHost('h3b', cls=IPv4Host, mac="00:00:00:00:00:3B",
+ ip='172.16.5.2/24', gw='172.16.5.254')
+ self.addLink(h2b, leaf3) # port 3
+ self.addLink(h1d, leaf3) # port 4
+ self.addLink(h3b, leaf3) # port 5
+
+ # IPv4 hosts attached to leaf 4
+ h4b = self.addHost('h4b', cls=TaggedIPv4Host, mac="00:00:00:00:00:4B",
+ ip='172.16.7.1/24', gw='172.16.7.254', vlan=700)
+ h3c = self.addHost('h3c', cls=IPv4Host, mac="00:00:00:00:00:3C",
+ ip='172.16.7.2/24', gw='172.16.7.254')
+ self.addLink(h4b, leaf4) # port 3
+ self.addLink(h3c, leaf4) # port 4
+
+
+def main():
+ net = Mininet(topo=TutorialTopo(), controller=None)
+ net.start()
+ CLI(net)
+ net.stop()
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description='Mininet topology script for 2x2 fabric with stratum_bmv2 and IPv4 hosts')
+ args = parser.parse_args()
+ setLogLevel('info')
+
+ main()
diff --git a/mininet/values.yaml b/mininet/values.yaml
index 8437a3f..0ec4521 100644
--- a/mininet/values.yaml
+++ b/mininet/values.yaml
@@ -30,7 +30,13 @@
global:
registry: ''
-resources: {}
+resources:
+ requests:
+ cpu: 0.5
+ memory: 256Mi # In case of deploying topology with 27 hosts (e.g., 2 by 3 fabric), please consider allocating at least 800 Mb of RAM
+ limits:
+ cpu: ~
+ memory: ~
nodeSelector: {}