corrected code

This commit is contained in:
Cody
2014-05-29 11:52:56 -07:00
parent 3641723193
commit 50f5080912
+6 -6
View File
@@ -8,15 +8,14 @@ and that the ovs ports match the mininet ports.
from mininet.net import Mininet from mininet.net import Mininet
from mininet.node import Controller from mininet.node import Controller
from mininet.cli import CLI
from mininet.log import setLogLevel, info from mininet.log import setLogLevel, info
from mininet.node import Node from mininet.node import Node
def validatePort( self, intf ): def validatePort( switch, intf ):
"Validate intf's OF port number" "Validate intf's OF port number"
ofport = int( self.cmd( 'ovs-vsctl get Interface', intf, ofport = int( switch.cmd( 'ovs-vsctl get Interface', intf,
'ofport' ) ) 'ofport' ) )
if ofport != self.ports[ intf ]: if ofport != switch.ports[ intf ]:
warn( 'WARNING: ofport for', intf, 'is actually', ofport, warn( 'WARNING: ofport for', intf, 'is actually', ofport,
'\n' ) '\n' )
return 0 return 0
@@ -58,8 +57,9 @@ def net():
info( '\n*** printing and validating the ports running on each interface\n' ) info( '\n*** printing and validating the ports running on each interface\n' )
for intfs in s1.intfList(): for intfs in s1.intfList():
if not intfs.name == "lo": if not intfs.name == "lo":
info( intfs, ': ', root.cmd( 'ovs-vsctl get Interface', intfs, 'ofport' ) ) info( intfs, ': ', s1.ports[intfs],
info ( 'Validating ', intfs, '... ' ) '\n' )
info ( 'Validating that', intfs, 'is actually on port', s1.ports[intfs], '... ' )
if validatePort( s1, intfs ): if validatePort( s1, intfs ):
info( 'Validated.\n' ) info( 'Validated.\n' )
print '\n' print '\n'