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

Function ClusterController

examples/cluster.py:974–990  ·  view source on GitHub ↗

Custom Controller() constructor which updates its intf IP address

( *args, **kwargs)

Source from the content-addressed store, hash-verified

972 return RemoteOVSSwitch( name, *args, **params )
973
974def ClusterController( *args, **kwargs):
975 "Custom Controller() constructor which updates its intf IP address"
976 intf = kwargs.pop( 'intf', '' )
977 controller = Controller( *args, **kwargs )
978 # Find out its IP address so that cluster switches can connect
979 if not intf:
980 output = controller.cmd(
981 r"ip a | egrep -o '\w+:\s\w+'" ).split( '\n' )
982 for line in output:
983 intf = line.split()[ -1 ]
984 if intf != 'lo':
985 break
986 if intf == 'lo':
987 raise Exception( 'Could not find non-loopback interface'
988 'for %s' % controller )
989 Intf( intf, node=controller ).updateIP()
990 return controller
991
992def testRemoteTopo( link=RemoteGRELink ):
993 "Test remote Node classes using Mininet()/Topo() API"

Callers

nothing calls this directly

Calls 4

ControllerClass · 0.90
IntfClass · 0.90
updateIPMethod · 0.80
cmdMethod · 0.45

Tested by

no test coverage detected