c395220b101824cc450d7b67f4bc22b25ddac49c
2 Test suite to automatically test emulator REST API endpoints.
7 from emuvim
.test
.api_base
import SimpleTestTopology
11 class testRestApi( SimpleTestTopology
):
13 Tests to check the REST API endpoints of the emulator.
16 def testRestApi(self
):
19 self
.createNet(nswitches
=0, ndatacenter
=2, nhosts
=2, ndockers
=0)
21 self
.net
.addLink(self
.dc
[0], self
.h
[0])
22 self
.net
.addLink(self
.h
[1], self
.dc
[1])
23 self
.net
.addLink(self
.dc
[0], self
.dc
[1])
26 # start Mininet network
28 print('compute start datacenter0, vnf1 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
29 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
30 subprocess
.call("son-emu-cli compute start -d datacenter0 -n vnf1", shell
=True)
31 print('compute start datacenter0, vnf2 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
32 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
33 subprocess
.call("son-emu-cli compute start -d datacenter0 -n vnf2", shell
=True)
34 print('compute start datacenter1, vnf3 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
35 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
36 subprocess
.call("son-emu-cli compute start -d datacenter1 -n vnf3", shell
=True)
37 print('compute list ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
38 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
39 subprocess
.call("son-emu-cli compute list", shell
=True)
40 print('compute stop datacenter0, vnf2 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
41 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
42 subprocess
.call("son-emu-cli compute stop -d datacenter0 -n vnf2", shell
=True)
43 print('compute list ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
44 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
45 subprocess
.call("son-emu-cli compute list", shell
=True)
46 print('compute status datacenter0, vnf1 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
47 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
48 subprocess
.call("son-emu-cli compute status -d datacenter0 -n vnf1", shell
=True)
49 print('datacenter list ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
50 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
51 subprocess
.call("son-emu-cli datacenter list", shell
=True)
52 print('datacenter status datacenter0 ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
53 print('->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
54 subprocess
.call("son-emu-cli datacenter status -d datacenter0", shell
=True)
58 if __name__
== '__main__':