Committed by
Gerrit Code Review
Attempt to fix ONOS-3460
Restart UDP listener thread and create a new RADIUS server socket when the AAA app configuration changes. Change-Id: If81479ee54609f56cf86e21aa5c5d83732c6a9fe
Showing
1 changed file
with
17 additions
and
10 deletions
... | @@ -166,6 +166,19 @@ public class AaaManager { | ... | @@ -166,6 +166,19 @@ public class AaaManager { |
166 | return eth; | 166 | return eth; |
167 | } | 167 | } |
168 | 168 | ||
169 | + private void initializeLocalState() { | ||
170 | + try { | ||
171 | + radiusSocket = new DatagramSocket(radiusServerPort); | ||
172 | + } catch (Exception ex) { | ||
173 | + log.error("Can't open RADIUS socket", ex); | ||
174 | + } | ||
175 | + | ||
176 | + executor = Executors.newSingleThreadExecutor( | ||
177 | + new ThreadFactoryBuilder() | ||
178 | + .setNameFormat("AAA-radius-%d").build()); | ||
179 | + executor.execute(radiusListener); | ||
180 | + } | ||
181 | + | ||
169 | @Activate | 182 | @Activate |
170 | public void activate() { | 183 | public void activate() { |
171 | netCfgService.addListener(cfgListener); | 184 | netCfgService.addListener(cfgListener); |
... | @@ -182,16 +195,7 @@ public class AaaManager { | ... | @@ -182,16 +195,7 @@ public class AaaManager { |
182 | 195 | ||
183 | StateMachine.initializeMaps(); | 196 | StateMachine.initializeMaps(); |
184 | 197 | ||
185 | - try { | 198 | + initializeLocalState(); |
186 | - radiusSocket = new DatagramSocket(radiusServerPort); | ||
187 | - } catch (Exception ex) { | ||
188 | - log.error("Can't open RADIUS socket", ex); | ||
189 | - } | ||
190 | - | ||
191 | - executor = Executors.newSingleThreadExecutor( | ||
192 | - new ThreadFactoryBuilder() | ||
193 | - .setNameFormat("AAA-radius-%d").build()); | ||
194 | - executor.execute(radiusListener); | ||
195 | log.info("Started"); | 199 | log.info("Started"); |
196 | } | 200 | } |
197 | 201 | ||
... | @@ -568,6 +572,9 @@ public class AaaManager { | ... | @@ -568,6 +572,9 @@ public class AaaManager { |
568 | 572 | ||
569 | AaaConfig cfg = netCfgService.getConfig(appId, AaaConfig.class); | 573 | AaaConfig cfg = netCfgService.getConfig(appId, AaaConfig.class); |
570 | reconfigureNetwork(cfg); | 574 | reconfigureNetwork(cfg); |
575 | + radiusSocket.close(); | ||
576 | + executor.shutdownNow(); | ||
577 | + initializeLocalState(); | ||
571 | log.info("Reconfigured"); | 578 | log.info("Reconfigured"); |
572 | } | 579 | } |
573 | } | 580 | } | ... | ... |
-
Please register or login to post a comment