| peusterm | 5831076 | 2016-01-12 17:09:20 +0100 | [diff] [blame] | 1 | #!/usr/bin/python |
| peusterm | 72f0988 | 2018-05-15 17:10:27 +0200 | [diff] [blame] | 2 | # Copyright (c) 2015 SONATA-NFV and Paderborn University |
| 3 | # ALL RIGHTS RESERVED. |
| 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 | # Neither the name of the SONATA-NFV, Paderborn University |
| 18 | # nor the names of its contributors may be used to endorse or promote |
| 19 | # products derived from this software without specific prior written |
| 20 | # permission. |
| 21 | # |
| 22 | # This work has been performed in the framework of the SONATA project, |
| 23 | # funded by the European Commission under Grant number 671517 through |
| 24 | # the Horizon 2020 and 5G-PPP programmes. The authors would like to |
| 25 | # acknowledge the contributions of their colleagues of the SONATA |
| 26 | # partner consortium (www.sonata-nfv.eu). |
| peusterm | 5831076 | 2016-01-12 17:09:20 +0100 | [diff] [blame] | 27 | import sys |
| hadik3r | 558504a | 2016-06-27 17:59:04 +0200 | [diff] [blame] | 28 | from emuvim.cli.rest import compute as restcom |
| 29 | from emuvim.cli.rest import datacenter as restdc |
| stevenvanrossem | 73efd19 | 2016-06-29 01:44:07 +0200 | [diff] [blame] | 30 | from emuvim.cli.rest import monitor as restmon |
| 31 | from emuvim.cli.rest import network as restnetw |
| hadik3r | 558504a | 2016-06-27 17:59:04 +0200 | [diff] [blame] | 32 | |
| peusterm | 72f0988 | 2018-05-15 17:10:27 +0200 | [diff] [blame] | 33 | |
| peusterm | 68aaedb | 2017-06-15 14:27:46 +0200 | [diff] [blame] | 34 | def help(): |
| 35 | print("Missing arguments.\n") |
| peusterm | 20e5445 | 2018-08-06 16:09:23 +0200 | [diff] [blame] | 36 | print("Usage: vim-emu compute|datacenter|network <arguments>\n") |
| peusterm | 68aaedb | 2017-06-15 14:27:46 +0200 | [diff] [blame] | 37 | print("Get more help:") |
| peusterm | 20e5445 | 2018-08-06 16:09:23 +0200 | [diff] [blame] | 38 | print("\tvim-emu compute --help") |
| 39 | print("\tvim-emu datacenter --help") |
| 40 | print("\tvim-emu network --help") |
| peusterm | 68aaedb | 2017-06-15 14:27:46 +0200 | [diff] [blame] | 41 | exit(0) |
| peusterm | 5831076 | 2016-01-12 17:09:20 +0100 | [diff] [blame] | 42 | |
| peusterm | 72f0988 | 2018-05-15 17:10:27 +0200 | [diff] [blame] | 43 | |
| peusterm | 5831076 | 2016-01-12 17:09:20 +0100 | [diff] [blame] | 44 | def main(): |
| 45 | if len(sys.argv) < 2: |
| peusterm | 68aaedb | 2017-06-15 14:27:46 +0200 | [diff] [blame] | 46 | help() |
| stevenvanrossem | 73efd19 | 2016-06-29 01:44:07 +0200 | [diff] [blame] | 47 | elif sys.argv[1] == "monitor": |
| 48 | restmon.main(sys.argv[2:]) |
| 49 | elif sys.argv[1] == "network": |
| 50 | restnetw.main(sys.argv[2:]) |
| hadik3r | 558504a | 2016-06-27 17:59:04 +0200 | [diff] [blame] | 51 | elif sys.argv[1] == "compute": |
| 52 | restcom.main(sys.argv[2:]) |
| 53 | elif sys.argv[1] == "datacenter": |
| 54 | restdc.main(sys.argv[2:]) |
| peusterm | 68aaedb | 2017-06-15 14:27:46 +0200 | [diff] [blame] | 55 | else: |
| 56 | help() |
| hadik3r | 558504a | 2016-06-27 17:59:04 +0200 | [diff] [blame] | 57 | |
| peusterm | 5831076 | 2016-01-12 17:09:20 +0100 | [diff] [blame] | 58 | |
| 59 | if __name__ == '__main__': |
| 60 | main() |