print -> info; end the horror of print vs. print()

Although we could use print() from __future__, this messes
up scripts which use examples as modules.

The simple, if not nicest for 2.7, solution is to use
info(), output() and other mininet.log functions. The disadvantage
is that we may have to adjust things if we change info() to
add automatic newlines, but we can burn that bridge in Mininet
3.x.
This commit is contained in:
Bob Lantz
2016-08-23 01:54:54 -07:00
parent 1eb6f65e40
commit ee15ce2243
18 changed files with 128 additions and 132 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ Example to create a Mininet topology and connect it to the internet via NAT
from mininet.cli import CLI
from mininet.log import lg
from mininet.log import lg, info
from mininet.topolib import TreeNet
@@ -16,8 +16,8 @@ if __name__ == '__main__':
# Add NAT connectivity
net.addNAT().configDefault()
net.start()
print( "*** Hosts are running and should have internet connectivity" )
print( "*** Type 'exit' or control-D to shut down network" )
info( "*** Hosts are running and should have internet connectivity\n" )
info( "*** Type 'exit' or control-D to shut down network\n" )
CLI( net )
# Shut down NAT
net.stop()