File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,7 @@ def start(self) -> None:
231
231
OSError: If the server fails to bind to the specified port.
232
232
"""
233
233
self .running = True
234
+ self ._hello_sent = False # reset in case of restart
234
235
self ._bind_socket ()
235
236
self ._thread = threading .Thread (target = self ._run )
236
237
self ._thread .start ()
Original file line number Diff line number Diff line change @@ -292,4 +292,30 @@ def test_when_connecting_using_username_and_wrong_key_then_authentication_fails(
292
292
...
293
293
294
294
# THEN expect error
295
- assert error
295
+ assert error
296
+
297
+
298
+ def test_when_server_restarted_then_connection_passes (netconf_server : NetconfServer ):
299
+ # GIVEN initial connection to server
300
+ with manager .connect (
301
+ host = "localhost" ,
302
+ port = 8830 ,
303
+ username = "admin" ,
304
+ password = "admin" ,
305
+ hostkey_verify = False ,
306
+ ) as m :
307
+ assert m .connected
308
+
309
+ # WHEN server is stopped and then started again
310
+ netconf_server .stop ()
311
+ netconf_server .start ()
312
+
313
+ # THEN expect reconnection to succeed
314
+ with manager .connect (
315
+ host = "localhost" ,
316
+ port = 8830 ,
317
+ username = "admin" ,
318
+ password = "admin" ,
319
+ hostkey_verify = False ,
320
+ ) as m :
321
+ assert m .connected
You can’t perform that action at this time.
0 commit comments