summaryrefslogtreecommitdiffstats
path: root/test/vpp_qemu_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vpp_qemu_utils.py')
-rw-r--r--test/vpp_qemu_utils.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/vpp_qemu_utils.py b/test/vpp_qemu_utils.py
index 5c433201650..cb1a0dd9f4c 100644
--- a/test/vpp_qemu_utils.py
+++ b/test/vpp_qemu_utils.py
@@ -6,6 +6,22 @@ import subprocess
import sys
+def can_create_namespaces():
+ """Check if the environment allows creating the namespaces"""
+
+ try:
+ namespace = "vpp_chk_4212"
+ result = subprocess.run(["ip", "netns", "add", namespace], capture_output=True)
+ if result.returncode != 0:
+ return False
+ result = subprocess.run(["ip", "netns", "del", namespace], capture_output=True)
+ if result.returncode != 0:
+ return False
+ return True
+ except:
+ return False
+
+
def create_namespace(ns):
"""create one or more namespaces.
@@ -18,7 +34,9 @@ def create_namespace(ns):
namespaces = ns
try:
for namespace in namespaces:
- subprocess.run(["ip", "netns", "add", namespace])
+ result = subprocess.run(["ip", "netns", "add", namespace])
+ if result.returncode != 0:
+ raise Exception(f"Error while creating namespace {namespace}")
except subprocess.CalledProcessError as e:
raise Exception("Error creating namespace:", e.output)
@@ -207,7 +225,11 @@ def delete_namespace(namespaces):
"""
try:
for namespace in namespaces:
- subprocess.run(["ip", "netns", "del", namespace], capture_output=True)
+ result = subprocess.run(
+ ["ip", "netns", "del", namespace], capture_output=True
+ )
+ if result.returncode != 0:
+ raise Exception(f"Error while deleting namespace {namespace}")
except subprocess.CalledProcessError as e:
raise Exception("Error deleting namespace:", e.output)
cf5b8'>diffstats
path: root/tests/vpp/perf/crypto/10ge2p1x710-ethip4ipsec40tnlsw-ip4base-int-aes128gcm-ndrpdr.robot
blob: d4262a52dccdc6d2447c1bde9d9bcf2d26646307 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165