Repository navigation
Expand file tree
/
Copy pathtcBasic.py
More file actions
82 lines (58 loc) · 1.99 KB
/
Copy pathtcBasic.py
File metadata and controls
82 lines (58 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import api.tutils
import time
import sys
import api.objmodel
# Start/Remove container test
def startRemoveContainer(testbed, numContainer, numIter, encap="vxlan"):
api.tutils.info("startRemoveContainer starting")
tenant = api.objmodel.tenant('default')
network = tenant.newNetwork('private', pktTag=1001, subnet="10.1.0.0/16", gateway="10.1.1.254", encap=encap)
for iter in range(numIter):
# Start the containers
containers = testbed.runContainers(numContainer)
# Perform ping test on the containers
testbed.pingTest(containers)
# remove containers
for cnt in containers:
cnt.remove()
# Check for errors
testbed.chekForNetpluginErrors()
# Iteration is done
api.tutils.info("startRemoveContainer iteration " + str(iter) + " Passed")
# Delete the network we created
tenant.deleteNetwork('private')
# Check for errors
testbed.chekForNetpluginErrors()
# Test is done
api.tutils.info("startRemoveContainer Test passed")
# start/stop containers
def startStopContainer(testbed, numContainer, numIter, encap="vxlan"):
api.tutils.info("startStopContainer starting")
tenant = api.objmodel.tenant('default')
network = tenant.newNetwork('private', pktTag=1001, subnet="10.1.0.0/16", gateway="10.1.1.254", encap=encap)
# Start the containers
containers = testbed.runContainers(numContainer)
# Perform ping test on the containers
testbed.pingTest(containers)
for iter in range(numIter):
# Stop the containers
for cnt in containers:
cnt.stop()
# Start the containers
for cnt in containers:
cnt.start()
# Perform ping test on the containers
testbed.pingTest(containers)
# Check for errors
testbed.chekForNetpluginErrors()
# Iteration is done
api.tutils.info("startStopContainer iteration " + str(iter) + " Passed")
# remove containers
for cnt in containers:
cnt.remove()
# Delete the network we created
tenant.deleteNetwork('private')
# Check for errors
testbed.chekForNetpluginErrors()
# Test is done
api.tutils.info("startStopContainer Test passed")