diff options
author | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2020-04-08 09:47:06 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-04-09 08:49:14 +0000 |
commit | cfa48db5d059b891aa53cb52e512504860863bed (patch) | |
tree | 8563685010d5599ac7744409ed67a61c54c4f083 /test/mocks/pnfsimulator/simulator-cli/cli/client | |
parent | 6e4256fa4db190543ffd84a87b643c27d8591d54 (diff) |
Remove old PNF simulator
Issue-ID: INT-1517
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: I235b0fdf12b265a256c371126e218826e74a9133
Diffstat (limited to 'test/mocks/pnfsimulator/simulator-cli/cli/client')
-rw-r--r-- | test/mocks/pnfsimulator/simulator-cli/cli/client/__init__.py | 19 | ||||
-rw-r--r-- | test/mocks/pnfsimulator/simulator-cli/cli/client/tailf_client.py | 59 |
2 files changed, 0 insertions, 78 deletions
diff --git a/test/mocks/pnfsimulator/simulator-cli/cli/client/__init__.py b/test/mocks/pnfsimulator/simulator-cli/cli/client/__init__.py deleted file mode 100644 index aa8b4f995..000000000 --- a/test/mocks/pnfsimulator/simulator-cli/cli/client/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -### -# ============LICENSE_START======================================================= -# Simulator -# ================================================================================ -# Copyright (C) 2019 Nokia. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### diff --git a/test/mocks/pnfsimulator/simulator-cli/cli/client/tailf_client.py b/test/mocks/pnfsimulator/simulator-cli/cli/client/tailf_client.py deleted file mode 100644 index d1cb60d97..000000000 --- a/test/mocks/pnfsimulator/simulator-cli/cli/client/tailf_client.py +++ /dev/null @@ -1,59 +0,0 @@ -### -# ============LICENSE_START======================================================= -# Simulator -# ================================================================================ -# Copyright (C) 2019 Nokia. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### - -import logging - -import websockets -import asyncio -import signal -import sys - - -class TailfClient(object): - - def __init__(self, url: str, verbose: bool = False) -> None: - self._url = url - self._is_running = False - self._connection = None - self.logger = logging.getLogger() - self.logger.setLevel(logging.DEBUG if verbose else logging.INFO) - signal.signal(signal.SIGINT, self._handle_keyboard_interrupt) - - def tailf_messages(self): - self._is_running = True - self.logger.debug("Attempting to connect to websocket server on %s", self._url) - asyncio.get_event_loop().run_until_complete( - self._tailf_messages() - ) - - async def _tailf_messages(self): - try: - async with websockets.connect(self._url) as connection: - self.logger.debug("Connection with %s established", self._url) - self._connection = connection - while self._is_running: - print(await self._connection.recv(), "\n") - except ConnectionRefusedError: - self.logger.error("Cannot establish connection with %s", self._url) - - def _handle_keyboard_interrupt(self, sig, frame): - self.logger.warning("CTR-C pressed, interrupting.") - self._is_running = False - sys.exit(0) |