mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 04:40:21 +00:00
topogen: use shorter names for equipments
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.
This commit is contained in:
parent
3079edf96b
commit
31bfa9df79
@ -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"];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -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"];
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 11 KiB |
@ -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"
|
||||
|
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user