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

Class RemoteController

mininet/node.py:1550–1596  ·  view source on GitHub ↗

Controller running outside of Mininet's control.

Source from the content-addressed store, hash-verified

1548
1549
1550class RemoteController( Controller ):
1551 "Controller running outside of Mininet's control."
1552
1553 def __init__( self, name, ip='127.0.0.1',
1554 port=None, **kwargs):
1555 """Init.
1556 name: name to give controller
1557 ip: the IP address where the remote controller is
1558 listening
1559 port: the port where the remote controller is listening"""
1560 Controller.__init__( self, name, ip=ip, port=port, **kwargs )
1561
1562 def start( self ):
1563 "Overridden to do nothing."
1564 return
1565
1566 # pylint: disable=arguments-differ
1567 def stop( self ):
1568 "Overridden to do nothing."
1569 return
1570
1571 def checkListening( self ):
1572 "Warn if remote controller is not accessible"
1573 if self.port is not None:
1574 self.isListening( self.ip, self.port )
1575 else:
1576 for port in 6653, 6633:
1577 if self.isListening( self.ip, port ):
1578 self.port = port
1579 info( "Connecting to remote controller"
1580 " at %s:%d\n" % ( self.ip, self.port ))
1581 break
1582
1583 if self.port is None:
1584 self.port = 6653
1585 warn( "Setting remote controller"
1586 " to %s:%d\n" % ( self.ip, self.port ))
1587
1588 def isListening( self, ip, port ):
1589 "Check if a remote controller is listening at a specific ip and port"
1590 listening = self.cmd( "echo A | telnet -e A %s %d" % ( ip, port ) )
1591 if 'Connected' not in listening:
1592 warn( "Unable to contact the remote controller"
1593 " at %s:%d\n" % ( ip, port ) )
1594 return False
1595 else:
1596 return True
1597
1598
1599DefaultControllers = ( Controller, OVSController )

Callers 1

controllers.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected