blob: edbd30672c943792d16a10ad3717dfa9e7569568 [file] [log] [blame]
peusterm58310762016-01-12 17:09:20 +01001#!/usr/bin/python
2"""
peusterm79ef6ae2016-07-08 13:53:57 +02003Copyright (c) 2015 SONATA-NFV and Paderborn University
4ALL RIGHTS RESERVED.
peusterm58310762016-01-12 17:09:20 +01005
peusterm79ef6ae2016-07-08 13:53:57 +02006Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing, software
13distributed under the License is distributed on an "AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15See the License for the specific language governing permissions and
16limitations under the License.
17
18Neither the name of the SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
19nor the names of its contributors may be used to endorse or promote
20products derived from this software without specific prior written
21permission.
22
23This work has been performed in the framework of the SONATA project,
24funded by the European Commission under Grant number 671517 through
25the Horizon 2020 and 5G-PPP programmes. The authors would like to
26acknowledge the contributions of their colleagues of the SONATA
27partner consortium (www.sonata-nfv.eu).
28"""
29"""
30 Simple CLI client to interact with a running emulator.
peusterm2ec74e12016-01-13 11:17:53 +010031
peusterm58310762016-01-12 17:09:20 +010032 The CLI offers different tools, e.g., compute, network, ...
33 Each of these tools is implemented as an independent Python
34 module.
35
36 cli compute start dc1 my_name flavor_a
37 cli network create dc1 11.0.0.0/24
38"""
39
40import sys
hadik3r558504a2016-06-27 17:59:04 +020041
cgeoffroy9524ad32016-03-03 18:24:15 +010042from emuvim.cli import compute
cgeoffroy9524ad32016-03-03 18:24:15 +010043from emuvim.cli import datacenter
44from emuvim.cli import monitor
hadik3r558504a2016-06-27 17:59:04 +020045from emuvim.cli import network
46from emuvim.cli.rest import compute as restcom
47from emuvim.cli.rest import datacenter as restdc
stevenvanrossem73efd192016-06-29 01:44:07 +020048from emuvim.cli.rest import monitor as restmon
49from emuvim.cli.rest import network as restnetw
hadik3r558504a2016-06-27 17:59:04 +020050
peusterm58310762016-01-12 17:09:20 +010051
52def main():
53 if len(sys.argv) < 2:
stevenvanrossembb084ef2016-05-20 09:27:01 +020054 print("Usage: son-emu-cli <toolname> <arguments>")
peusterm58310762016-01-12 17:09:20 +010055 exit(0)
hadik3r558504a2016-06-27 17:59:04 +020056 if sys.argv[1] == "compute-zapi":
peusterm58310762016-01-12 17:09:20 +010057 compute.main(sys.argv[2:])
stevenvanrossem73efd192016-06-29 01:44:07 +020058 elif sys.argv[1] == "network-zapi":
peusterm58310762016-01-12 17:09:20 +010059 network.main(sys.argv[2:])
hadik3r558504a2016-06-27 17:59:04 +020060 elif sys.argv[1] == "datacenter-zapi":
peustermd313dc12016-02-04 15:36:02 +010061 datacenter.main(sys.argv[2:])
stevenvanrossem73efd192016-06-29 01:44:07 +020062 elif sys.argv[1] == "monitor-zapi":
stevenvanrossemc5a536a2016-02-16 14:52:39 +010063 monitor.main(sys.argv[2:])
stevenvanrossem73efd192016-06-29 01:44:07 +020064 elif sys.argv[1] == "monitor":
65 restmon.main(sys.argv[2:])
66 elif sys.argv[1] == "network":
67 restnetw.main(sys.argv[2:])
hadik3r558504a2016-06-27 17:59:04 +020068 elif sys.argv[1] == "compute":
69 restcom.main(sys.argv[2:])
70 elif sys.argv[1] == "datacenter":
71 restdc.main(sys.argv[2:])
72
peusterm58310762016-01-12 17:09:20 +010073
74if __name__ == '__main__':
75 main()