Ejemplo n.º 1
0
 def attachNodesToRoutedControlNetwork(self,
                                       nodes='',
                                       cip='',
                                       prefixLen=16):
     "Attching nodes to control network."
     controller = self.controllers[0]
     info(controller.name + ' <->')
     for node in nodes:
         info(' ' + node.name)
         link = self.link(node, controller, port1=0)
         nintf, cintf = link.intf1, link.intf2
         node.controlIntf = nintf
         self.snum += 1
         while self.snum & 0xff in [0, 255]:
             self.snum += 1
         nip = ipStr(self.snum)
         cintf.setIP(cip, prefixLen)
         nintf.setIP(nip, prefixLen)
         controller.setHostRoute(nip, cintf)
         node.setHostRoute(cip, nintf)
     info('\n')
     info('*** Testing control network\n')
     while not cintf.isUp():
         info('*** Waiting for', cintf, 'to come up\n')
         sleep(1)
     for node in nodes:
         while not nintf.isUp():
             info('*** Waiting for', nintf, 'to come up\n')
             sleep(1)
         if self.ping(hosts=[node, controller]) != 0:
             error('*** Error: control network test failed\n')
             exit(1)
Ejemplo n.º 2
0
 def attachNodesToRoutedControlNetwork( self , nodes='' , cip='', prefixLen=16):
     "Attching nodes to control network."
     controller = self.controllers[ 0 ]
     info( controller.name + ' <->' )
     for node in nodes:
         info( ' ' + node.name )
         link = self.link( node, controller, port1=0 )
         nintf, cintf = link.intf1, link.intf2
         node.controlIntf = nintf
         self.snum += 1
         while self.snum & 0xff in [ 0, 255 ]:
             self.snum += 1
         nip = ipStr( self.snum )
         cintf.setIP( cip, prefixLen )
         nintf.setIP( nip, prefixLen )
         controller.setHostRoute( nip, cintf )
         node.setHostRoute( cip, nintf )
     info( '\n' )
     info( '*** Testing control network\n' )
     while not cintf.isUp():
         info( '*** Waiting for', cintf, 'to come up\n' )
         sleep( 1 )
     for node in nodes:
         while not nintf.isUp():
             info( '*** Waiting for', nintf, 'to come up\n' )
             sleep( 1 )
         if self.ping( hosts=[ node, controller ] ) != 0:
             error( '*** Error: control network test failed\n' )
             exit( 1 )
Ejemplo n.º 3
0
 def configure(self, ip=None, mask=None):
   # bring up the eth0 and set ip address
   if ip is None:
     # 10.0.0.0 + id
     ip = ipStr(self.id)
     mask = 8
   cmd("vzctl exec %d ifconfig eth0 %s/%s" % (self.id, ip, mask))
   self.ip = ip
   self.mask = mask
Ejemplo n.º 4
0
 def attachNodesToSwitchedControlNetwork( self , switch='', nodes='' , cip='', prefixLen=16):
     "Attching nodes to the switched control network."
     controller = self.controllers[ 0 ]
     link = self.link( switch, controller, port1=0 )
     sintf, cintf = link.intf1, link.intf2
     cintf.setIP( cip, prefixLen )
     controller.setHostRoute( cip, cintf )
     info( ' Connecting ')
     for node in nodes:
         info( ' ' + node.name )
         link = self.link( node, switch, port1=0 )
         nintf, sintf = link.intf1, link.intf2
         # node.controlIntf = nintf
         self.snum += 1
         while self.snum & 0xff in [ 0, 255 ]:
             self.snum += 1
         nip = ipStr( self.snum )
         nintf.setIP( nip, prefixLen )
         node.setHostRoute( nip, nintf )
     info( ' to switch '+ switch.name + '\n' )
Ejemplo n.º 5
0
 def attachNodesToSwitchedControlNetwork(self,
                                         switch='',
                                         nodes='',
                                         cip='',
                                         prefixLen=16):
     "Attching nodes to the switched control network."
     controller = self.controllers[0]
     link = self.link(switch, controller, port1=0)
     sintf, cintf = link.intf1, link.intf2
     cintf.setIP(cip, prefixLen)
     controller.setHostRoute(cip, cintf)
     info(' Connecting ')
     for node in nodes:
         info(' ' + node.name)
         link = self.link(node, switch, port1=0)
         nintf, sintf = link.intf1, link.intf2
         # node.controlIntf = nintf
         self.snum += 1
         while self.snum & 0xff in [0, 255]:
             self.snum += 1
         nip = ipStr(self.snum)
         nintf.setIP(nip, prefixLen)
         node.setHostRoute(nip, nintf)
     info(' to switch ' + switch.name + '\n')