Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/package
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

MAKE_SRC_DIR=make

# Delete existing make files
rm -rf $MAKE_SRC_DIR/usr

# Copy testrun script to /bin
mkdir -p $MAKE_SRC_DIR/bin
cp bin/testrun $MAKE_SRC_DIR/bin/testrun
Expand Down
2 changes: 2 additions & 0 deletions framework/python/src/common/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def get_finished(self):

def stop(self):
self.set_status('Stopping')
self.finish()

def finish(self):
# Set any in progress test results to Error
for test_result in self._results:
if test_result.result == 'In Progress':
Expand Down
10 changes: 10 additions & 0 deletions framework/python/src/net_orc/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,18 @@ def __init__(self, session):

def start_listener(self):
"""Start sniffing packets on the device interface."""

# Don't start the listener if it is already running
if self._sniffer.running:
LOGGER.debug('Listener was already running')
return

self._sniffer.start()

def reset(self):
self._callbacks = []
self._discovered_devices = []

def stop_listener(self):
"""Stop sniffing packets on the device interface."""
if self._sniffer.running:
Expand Down
18 changes: 12 additions & 6 deletions framework/python/src/net_orc/network_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ def start_network(self):
"""Start the virtual testing network."""
LOGGER.info('Starting network')

#self.build_network_modules()

self.create_net()
self.start_network_services()

Expand All @@ -140,6 +138,11 @@ def stop(self, kill=False):
self.stop_validator(kill=kill)
self.stop_network(kill=kill)

# Listener may not have been defined yet
if self.get_listener() is not None:
self.get_listener().stop_listener()
self.get_listener().reset()

def stop_validator(self, kill=False):
"""Stop the network validator."""
# Shutdown the validator
Expand Down Expand Up @@ -339,7 +342,10 @@ def create_net(self):

self._create_private_net()

self._listener = Listener(self._session)
# Listener may have already been created. Only create if not
if self._listener is None:
self._listener = Listener(self._session)

self.get_listener().register_callback(self._device_discovered,
[NetworkEvent.DEVICE_DISCOVERED])
self.get_listener().register_callback(self._dhcp_lease_ack,
Expand Down Expand Up @@ -486,12 +492,12 @@ def _stop_service_module(self, net_module, kill=False):
container = self._get_service_container(net_module)
if container is not None:
if kill:
LOGGER.debug('Killing container:' + net_module.container_name)
LOGGER.debug('Killing container: ' + net_module.container_name)
container.kill()
else:
LOGGER.debug('Stopping container:' + net_module.container_name)
LOGGER.debug('Stopping container: ' + net_module.container_name)
container.stop()
LOGGER.debug('Container stopped:' + net_module.container_name)
LOGGER.debug('Container stopped: ' + net_module.container_name)
except Exception as error: # pylint: disable=W0703
LOGGER.error('Container stop error')
LOGGER.error(error)
Expand Down
4 changes: 2 additions & 2 deletions framework/python/src/test_orc/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ def run_test_modules(self):

LOGGER.info("All tests complete")

self._session.stop()
self._session.finish()

# Do not carry on (generating a report) if Testrun has been stopped
if self.get_session().get_status() != "In Progress":
return None
return "Cancelled"

report = TestReport()
report.from_json(self._generate_report())
Expand Down