Skip to content

Refactor the do_switch command to accept multiple switches#1112

Open
cheriimoya wants to merge 1 commit intomininet:masterfrom
cheriimoya:fix/557
Open

Refactor the do_switch command to accept multiple switches#1112
cheriimoya wants to merge 1 commit intomininet:masterfrom
cheriimoya:fix/557

Conversation

@cheriimoya
Copy link
Contributor

@cheriimoya cheriimoya commented Feb 4, 2022

This commit changes the syntax of the switch command as follows

mininet> switch {start, stop} <switch name> [<switch name>] [...]

I tested this change:

$ sudo mn --topo=linear,5
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 h5
*** Adding switches:
s1 s2 s3 s4 s5
*** Adding links:
(h1, s1) (h2, s2) (h3, s3) (h4, s4) (h5, s5) (s2, s1) (s3, s2) (s4, s3) (s5, s4)
*** Configuring hosts
h1 h2 h3 h4 h5
*** Starting controller
c0
*** Starting 5 switches
s1 s2 s3 s4 s5 ...
*** Starting CLI:
mininet> switch stop s1 s2
mininet> pingall
*** Ping: testing ping reachability
h1 -> X X X X
h2 -> X X X X
h3 -> X X h4 h5
h4 -> X X h3 h5
h5 -> X X h3 h4
*** Results: 70% dropped (6/20 received)
mininet> switch start s1 s2
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 h5
h2 -> h1 h3 h4 h5
h3 -> h1 h2 h4 h5
h4 -> h1 h2 h3 h5
h5 -> h1 h2 h3 h4
*** Results: 0% dropped (20/20 received)
mininet> switch reset s1 s2
mininet> switch reset s1 s2
first argument for the switch command must be "start" or "stop"
mininet> switch stop s1 s2 s3 s4 h1
invalid switch: h1
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4 h5
h2 -> h1 h3 h4 h5
h3 -> h1 h2 h4 h5
h4 -> h1 h2 h3 h5
h5 -> h1 h2 h3 h4
*** Results: 0% dropped (20/20 received)
mininet>

This could be seen as a breaking change, because the old syntax is not accepted anymore.

The example commands above show that any start/stop commands are only executed if the "line" is correct.

@cheriimoya
Copy link
Contributor Author

Closes #557

This commit changes the syntax of the switch command as follows

mininet> switch {start, stop} <switch name> [<switch name>] [...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant