MCPcopy Create free account
hub / github.com/mininet/mininet / configureRoutedControlNetwork

Method configureRoutedControlNetwork

mininet/net.py:988–1021  ·  view source on GitHub ↗

Configure a routed control network on controller and switches. For use with the user datapath only right now.

( self, ip='192.168.123.1',
                                       prefixLen=16 )

Source from the content-addressed store, hash-verified

986 # in the control network location.
987
988 def configureRoutedControlNetwork( self, ip='192.168.123.1',
989 prefixLen=16 ):
990 """Configure a routed control network on controller and switches.
991 For use with the user datapath only right now."""
992 controller = self.controllers[ 0 ]
993 info( controller.name + ' <->' )
994 cip = ip
995 snum = ipParse( ip )
996 for switch in self.switches:
997 info( ' ' + switch.name )
998 link = self.link( switch, controller, port1=0 )
999 sintf, cintf = link.intf1, link.intf2
1000 switch.controlIntf = sintf
1001 snum += 1
1002 while snum & 0xff in [ 0, 255 ]:
1003 snum += 1
1004 sip = ipStr( snum )
1005 cintf.setIP( cip, prefixLen )
1006 sintf.setIP( sip, prefixLen )
1007 controller.setHostRoute( sip, cintf )
1008 switch.setHostRoute( cip, sintf )
1009 info( '\n' )
1010 info( '*** Testing control network\n' )
1011 while not cintf.isUp():
1012 info( '*** Waiting for', cintf, 'to come up\n' )
1013 sleep( 1 )
1014 for switch in self.switches:
1015 while not sintf.isUp():
1016 info( '*** Waiting for', sintf, 'to come up\n' )
1017 sleep( 1 )
1018 if self.ping( hosts=[ switch, controller ] ) != 0:
1019 error( '*** Error: control network test failed\n' )
1020 exit( 1 )
1021 info( '\n' )

Callers 1

Calls 6

ipParseFunction · 0.90
ipStrFunction · 0.90
setHostRouteMethod · 0.80
isUpMethod · 0.80
setIPMethod · 0.45
pingMethod · 0.45

Tested by

no test coverage detected