#NEWLINE# def remote_createTunnel( self , name , targetIP ) : #NEWLINE# #INDENT# ' Create a new GRE Tunnel.\n\n            @param name:        Unique name of the network group.\n            @type  name:        str\n\n            @param targetIP:    Target IP for the GRE Tunnel.\n            @type  targetIP:    str\n\n            @return:            Exit status of command.\n            @rtype:             twisted.internet.defer.Deferred\n        ' #NEWLINE# if ( name not in self . _bridges ) : #NEWLINE# #INDENT# raise InternalError ( 'Bridge does not exist.' ) #NEWLINE# #UNINDENT# key = ( name , targetIP ) #NEWLINE# if ( key in self . _uid ) : #NEWLINE# #INDENT# raise InternalError ( 'Tunnel already exists.' ) #NEWLINE# #UNINDENT# while 1 : #NEWLINE# #INDENT# uid = randomString ( self . _UID_LEN ) #NEWLINE# if ( uid not in self . _uid . itervalues ( ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# self . _uid [ key ] = uid #NEWLINE# port = 'gre-{0}' . format ( uid ) #NEWLINE# return execute ( ( '/usr/bin/ovs-vsctl' , 'add-port' , 'br-{0}' . format ( name ) , port , '--' , 'set' , 'interface' , port , 'type=gre' , 'options:remote_ip={0}' . format ( targetIP ) ) , reactor = self . _reactor )