aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 7b61198d1..f879a1a95 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -163,6 +163,20 @@ def remove_interface_router(neutron_client, router_id, subnet_id):
print "Error:", sys.exc_info()[0]
return False
+def create_neutron_port(neutron_client, name, network_id, ip):
+ json_body = {'port': {
+ 'admin_state_up': True,
+ 'name': name,
+ 'network_id': network_id,
+ 'fixed_ips': [{"ip_address": ip}]
+ }}
+ try:
+ port = neutron_client.create_port(body=json_body)
+ return port['port']['id']
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
+
def get_network_id(neutron_client, network_name):
networks = neutron_client.list_networks()['networks']