X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=solution%2Ftmux-logging.py;fp=solution%2Ftmux-logging.py;h=46ef28d3197b439131ff6e983ca3976b6f5bd64c;hb=990de7205645f827a36429006f7e5529b5fb6866;hp=0000000000000000000000000000000000000000;hpb=a3be9ade3bec5ca8cd5b41032704872f87d8c065;p=oam.git diff --git a/solution/tmux-logging.py b/solution/tmux-logging.py new file mode 100755 index 0000000..46ef28d --- /dev/null +++ b/solution/tmux-logging.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +################################################################################ +# Copyright 2021 highstreet technologies GmbH +# +# 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. +# + +from libtmux import Pane, Server, Window, exc +from libtmux.common import has_gte_version + +def createLoggingWindow(): + logging = session.new_window(attach=False, window_name="logging") + sdnr = logging.list_panes()[0] + sdnr.send_keys('echo "sdnr"', enter=True) + sdnr.send_keys('docker exec -it sdnr tail -f /opt/opendaylight/data/log/karaf.log', enter=True) + + ntsim = logging.split_window(attach=False, vertical=True) + ntsim.send_keys('echo "ntsim"', enter=True) + ntsim.send_keys('docker exec -it ntsim-ng-o-du-1122 tail -f /opt/dev/ntsim-ng/log/log.txt', enter=True) + + ves = logging.split_window(attach=False, vertical=False) + ves.send_keys('echo "ves"', enter=True) + ves.send_keys('docker logs -f ves-collector', enter=True) + + env = ntsim.split_window(attach=False, vertical=False) + env.send_keys('btop', enter=True) + +# main +server = Server() +session = server.find_where({ "session_name": "integration" }) + +workspace = session.select_window("workspace") +pane = workspace.list_panes()[0] +# pane.send_keys('clear', enter=True) +pane.send_keys('cat README.md', enter=True) +pane.send_keys('docker ps -a', enter=True) + +# create logging window, if needed +logging = session.find_where({'window_name':'logging'}) +if logging is None: + createLoggingWindow()