]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topogen: use shorter names for equipments
authorRafael Zalamena <rzalamena@gmail.com>
Mon, 26 Jun 2017 13:57:57 +0000 (10:57 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:11 +0000 (20:22 -0500)
After some feedback from mwinter@, the names of equipments are now
shorter to make it easier to type them and to keep consistency with
mininet documentation. While here, update the template and make it use
optional name parameters for clarity.

tests/topotests/GUIDELINES.md
tests/topotests/example-test/test_template.dot
tests/topotests/example-test/test_template.jpg
tests/topotests/example-test/test_template.py
tests/topotests/lib/topogen.py

index 9edf795aca8f6888e0cdc84e628a32ca5ddbfef9..bbaa26f5ab90c9206b461b91d4220c1dee9059a1 100644 (file)
@@ -113,34 +113,34 @@ Here is an example of Graphviz dot file that generates the
 outdated, please see the linked file):
 
 ```dot
-graph ospf_topo1 {
-       label="Template Topology";
-
-       # Make the Graph fit a A4 paper sheet
-       # 11inches x 8inches -> ~297mm x ~210mm
-       size="11,8!";
-       # Uncomment this one for vertical A4 paper sheet
-       #size="8,11!";
+graph template {
+       label="template";
 
        # Routers
-       router1 [
+       r1 [
                shape=octagon,
-               label="router1",
+               label="r1",
        ];
-       router2 [
+       r2 [
                shape=octagon
-               label="router2\nrtr-id 10.0.255.1",
+               label="r2",
        ];
 
        # Switches
-       switch1 [shape=box];
-       switch2 [shape=box];
+       s1 [
+               shape=box,
+               label="s1\n192.168.0.0/24",
+       ];
+       s2 [
+               shape=box,
+               label="s2\n192.168.1.0/24",
+       ];
 
        # Connections
-       router1 -- switch1 [label="router1-eth0\n192.168.0.1/24"];
+       r1 -- s1 [label="eth0\n.1"];
 
-       router1 -- switch2 [label="router1-eth1\n192.168.1.100/24"];
-       router2 -- switch2 [label="router2-eth0\n192.168.1.1/24"];
+       r1 -- s2 [label="eth1\n.100"];
+       r2 -- s2 [label="eth0\n.1"];
 }
 ```
 
index 4937bee1ac2ac333eb9463ee306aeaba872c0e5c..26def69597c413fc41cfcee7dbbaa3f7b05a8c24 100644 (file)
@@ -1,29 +1,29 @@
-graph ospf_topo1 {
-       label="Template Topology";
-
-       # Make the Graph fit a A4 paper sheet
-       # 11inches x 8inches -> ~297mm x ~210mm
-       size="11,8!";
-       # Uncomment this one for vertical A4 paper sheet
-       #size="8,11!";
+graph template {
+       label="template";
 
        # Routers
-       router1 [
+       r1 [
                shape=octagon,
-               label="router1",
+               label="r1",
        ];
-       router2 [
+       r2 [
                shape=octagon
-               label="router2\nrtr-id 10.0.255.1",
+               label="r2",
        ];
 
        # Switches
-       switch1 [shape=box];
-       switch2 [shape=box];
+       s1 [
+               shape=box,
+               label="s1\n192.168.0.0/24",
+       ];
+       s2 [
+               shape=box,
+               label="s2\n192.168.1.0/24",
+       ];
 
        # Connections
-       router1 -- switch1 [label="router1-eth0\n192.168.0.1/24"];
+       r1 -- s1 [label="eth0\n.1"];
 
-       router1 -- switch2 [label="router1-eth1\n192.168.1.100/24"];
-       router2 -- switch2 [label="router2-eth0\n192.168.1.1/24"];
+       r1 -- s2 [label="eth1\n.100"];
+       r2 -- s2 [label="eth0\n.1"];
 }
index 2e76c22ee17fd7ad84609af98579a949a329f09f..d8d77993942f0b9dfd5d5bd358820dcdf84e312b 100644 (file)
Binary files a/tests/topotests/example-test/test_template.jpg and b/tests/topotests/example-test/test_template.jpg differ
index d5d3b7afb39aa1e85fe7b075a0810cc91ebfadab..ac6faeaa6388800e421508f7b007b8045f617159 100644 (file)
@@ -52,18 +52,18 @@ class TemplateTopo(Topo):
         # Example
         #
         # Create 2 routers
-        for _router in range(1, 3):
-            tgen.add_router()
+        for routern in range(1, 3):
+            tgen.add_router('r{}'.format(routern))
 
         # Create a switch with just one router connected to it to simulate a
         # empty network.
-        switch = tgen.add_switch()
-        switch.add_link(tgen.gears['router1'])
+        switch = tgen.add_switch('s1')
+        switch.add_link(tgen.gears['r1'])
 
-        # Create a connection between router1 and router2
-        switch = tgen.add_switch()
-        switch.add_link(tgen.gears['router1'])
-        switch.add_link(tgen.gears['router2'])
+        # Create a connection between r1 and r2
+        switch = tgen.add_switch('s2')
+        switch.add_link(tgen.gears['r1'])
+        switch.add_link(tgen.gears['r2'])
 
 def setup_module(_m):
     "Sets up the pytest environment"
index 19c36ed0d754d091f610fefe05b496d09c9e4f76..f4374015173cac5282ec14669a261902654256e0 100644 (file)
@@ -111,7 +111,7 @@ class Topogen(object):
         Returns a TopoRouter.
         """
         if name is None:
-            name = 'router{}'.format(self.routern)
+            name = 'r{}'.format(self.routern)
         if name in self.gears:
             raise KeyError('router already exists')
 
@@ -127,7 +127,7 @@ class Topogen(object):
         Returns the switch name and number.
         """
         if name is None:
-            name = 'switch{}'.format(self.switchn)
+            name = 's{}'.format(self.switchn)
         if name in self.gears:
             raise KeyError('switch already exists')