demx8as6 | 53d47d4 | 2021-05-31 12:44:37 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | ################################################################################ |
| 3 | # Copyright 2021 highstreet technologies GmbH |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the 'License'); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an 'AS IS' BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
| 18 | from libtmux import Pane, Server, Window, exc |
| 19 | from libtmux.common import has_gte_version |
| 20 | |
| 21 | def createLoggingWindow(): |
| 22 | logging = session.new_window(attach=False, window_name="logging") |
| 23 | sdnr = logging.list_panes()[0] |
| 24 | sdnr.send_keys('echo "sdnr"', enter=True) |
| 25 | sdnr.send_keys('docker exec -it sdnr tail -f /opt/opendaylight/data/log/karaf.log', enter=True) |
| 26 | |
| 27 | ntsim = logging.split_window(attach=False, vertical=True) |
| 28 | ntsim.send_keys('echo "ntsim"', enter=True) |
| 29 | ntsim.send_keys('docker exec -it ntsim-ng-o-du-1122 tail -f /opt/dev/ntsim-ng/log/log.txt', enter=True) |
| 30 | |
| 31 | ves = logging.split_window(attach=False, vertical=False) |
| 32 | ves.send_keys('echo "ves"', enter=True) |
| 33 | ves.send_keys('docker logs -f ves-collector', enter=True) |
| 34 | |
| 35 | env = ntsim.split_window(attach=False, vertical=False) |
| 36 | env.send_keys('htop', enter=True) |
| 37 | |
| 38 | # main |
| 39 | server = Server() |
| 40 | session = server.find_where({ "session_name": "integration" }) |
| 41 | |
| 42 | workspace = session.select_window("workspace") |
| 43 | pane = workspace.list_panes()[0] |
| 44 | # pane.send_keys('clear', enter=True) |
| 45 | pane.send_keys('docker-compose up -d', enter=True) |
| 46 | pane.send_keys('docker-compose ps', enter=True) |
| 47 | |
| 48 | # create logging window, if needed |
| 49 | logging = session.find_where({'window_name':'logging'}) |
| 50 | if logging is None: |
| 51 | createLoggingWindow() |
| 52 | |
| 53 | |
| 54 | |