Committed by
Gerrit Code Review
Unset empty vars; pass IPs to onos-gen-partitions
We really don't need the OCx variables, but for now at least we are unsetting the ones that are incorrect and calling onos-gen-partitions with the explicit IP addresses. Change-Id: I8bd3d69bee4857e00070288b586255455c9c8adf
Showing
1 changed file
with
8 additions
and
5 deletions
... | @@ -199,9 +199,10 @@ class ONOSNode( Controller ): | ... | @@ -199,9 +199,10 @@ class ONOSNode( Controller ): |
199 | 199 | ||
200 | # pylint: disable=arguments-differ | 200 | # pylint: disable=arguments-differ |
201 | 201 | ||
202 | - def start( self, env ): | 202 | + def start( self, env, nodes=() ): |
203 | """Start ONOS on node | 203 | """Start ONOS on node |
204 | - env: environment var dict""" | 204 | + env: environment var dict |
205 | + nodes: all nodes in cluster""" | ||
205 | env = dict( env ) | 206 | env = dict( env ) |
206 | self.cmd( 'rm -rf', self.dir ) | 207 | self.cmd( 'rm -rf', self.dir ) |
207 | self.ONOS_HOME = unpackONOS( self.dir, run=self.ucmd ) | 208 | self.ONOS_HOME = unpackONOS( self.dir, run=self.ucmd ) |
... | @@ -212,7 +213,8 @@ class ONOSNode( Controller ): | ... | @@ -212,7 +213,8 @@ class ONOSNode( Controller ): |
212 | self.cmd( 'export PATH=%s:%s:$PATH' % ( onosbin, karafbin ) ) | 213 | self.cmd( 'export PATH=%s:%s:$PATH' % ( onosbin, karafbin ) ) |
213 | self.cmd( 'cd', self.ONOS_HOME ) | 214 | self.cmd( 'cd', self.ONOS_HOME ) |
214 | self.ucmd( 'mkdir -p config && ' | 215 | self.ucmd( 'mkdir -p config && ' |
215 | - 'onos-gen-partitions config/cluster.json' ) | 216 | + 'onos-gen-partitions config/cluster.json', |
217 | + ' '.join( node.IP() for node in nodes ) ) | ||
216 | info( '(starting %s)' % self ) | 218 | info( '(starting %s)' % self ) |
217 | service = join( self.ONOS_HOME, 'bin/onos-service' ) | 219 | service = join( self.ONOS_HOME, 'bin/onos-service' ) |
218 | self.ucmd( service, 'server 1>../onos.log 2>../onos.log' | 220 | self.ucmd( service, 'server 1>../onos.log 2>../onos.log' |
... | @@ -261,7 +263,8 @@ class ONOSNode( Controller ): | ... | @@ -261,7 +263,8 @@ class ONOSNode( Controller ): |
261 | 263 | ||
262 | def updateEnv( self, envDict ): | 264 | def updateEnv( self, envDict ): |
263 | "Update environment variables" | 265 | "Update environment variables" |
264 | - cmd = ';'.join( 'export %s="%s"' % ( var, val ) | 266 | + cmd = ';'.join( ( 'export %s="%s"' % ( var, val ) |
267 | + if val else 'unset %s' % var ) | ||
265 | for var, val in envDict.iteritems() ) | 268 | for var, val in envDict.iteritems() ) |
266 | self.cmd( cmd ) | 269 | self.cmd( cmd ) |
267 | 270 | ||
... | @@ -312,7 +315,7 @@ class ONOSCluster( Controller ): | ... | @@ -312,7 +315,7 @@ class ONOSCluster( Controller ): |
312 | info( '*** ONOS_APPS = %s\n' % ONOS_APPS ) | 315 | info( '*** ONOS_APPS = %s\n' % ONOS_APPS ) |
313 | self.net.start() | 316 | self.net.start() |
314 | for node in self.nodes(): | 317 | for node in self.nodes(): |
315 | - node.start( self.env ) | 318 | + node.start( self.env, self.nodes() ) |
316 | info( '\n' ) | 319 | info( '\n' ) |
317 | self.configPortForwarding( ports=self.forward, action='A' ) | 320 | self.configPortForwarding( ports=self.forward, action='A' ) |
318 | self.waitStarted() | 321 | self.waitStarted() | ... | ... |
-
Please register or login to post a comment