Committed by
Gerrit Code Review
onos.py: compute hazelcast interface based on IP address
Change-Id: Ifadfaed81f3febd0a4644a763092e19672746e37
Showing
1 changed file
with
5 additions
and
1 deletions
| ... | @@ -97,13 +97,17 @@ class ONOS( Controller ): | ... | @@ -97,13 +97,17 @@ class ONOS( Controller ): |
| 97 | self.terminate() | 97 | self.terminate() |
| 98 | 98 | ||
| 99 | def updateHazelcast( self ): | 99 | def updateHazelcast( self ): |
| 100 | + hz = '192.168.123.*' | ||
| 101 | + if self.ip is not None: | ||
| 102 | + hz = '.'.join(self.ip.split('.')[:-1]) + '.*' | ||
| 103 | + | ||
| 100 | readfile = self.karafDir + 'etc/hazelcast.xml' | 104 | readfile = self.karafDir + 'etc/hazelcast.xml' |
| 101 | writefile = self.instanceDir + 'etc/hazelcast.xml' | 105 | writefile = self.instanceDir + 'etc/hazelcast.xml' |
| 102 | with open( readfile, 'r' ) as r: | 106 | with open( readfile, 'r' ) as r: |
| 103 | with open( writefile, 'w' ) as w: | 107 | with open( writefile, 'w' ) as w: |
| 104 | for line in r.readlines(): | 108 | for line in r.readlines(): |
| 105 | if '<interface>' in line: | 109 | if '<interface>' in line: |
| 106 | - line = '<interface>' + '192.168.123.*' + '</interface>\n' | 110 | + line = '<interface>' + hz + '</interface>\n' |
| 107 | w.write( line ) | 111 | w.write( line ) |
| 108 | 112 | ||
| 109 | def updateFeatures( self ): | 113 | def updateFeatures( self ): | ... | ... |
-
Please register or login to post a comment