summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/commands/cli_testcase.py5
-rw-r--r--docker/Dockerfile1
-rw-r--r--utils/functest_vacation.py52
-rw-r--r--utils/openstack_utils.py21
4 files changed, 77 insertions, 2 deletions
diff --git a/cli/commands/cli_testcase.py b/cli/commands/cli_testcase.py
index d8557b962..5d546a216 100644
--- a/cli/commands/cli_testcase.py
+++ b/cli/commands/cli_testcase.py
@@ -13,6 +13,7 @@ import yaml
import functest.ci.tier_builder as tb
import functest.utils.functest_utils as ft_utils
+import functest.utils.functest_vacation as vacation
""" global variables """
with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
@@ -48,7 +49,9 @@ class CliTestcase:
click.echo(description)
def run(self, testname):
- if not os.path.isfile(ENV_FILE):
+ if testname == 'vacation':
+ vacation.main()
+ elif not os.path.isfile(ENV_FILE):
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 04be6f80f..842329730 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -80,6 +80,7 @@ RUN git clone https://github.com/opnfv/promise ${repos_dir}/promise
RUN git clone https://gerrit.opnfv.org/gerrit/ovno ${repos_dir}/ovno
RUN git clone https://gerrit.opnfv.org/gerrit/copper ${repos_dir}/copper
RUN git clone https://gerrit.opnfv.org/gerrit/moon ${repos_dir}/moon
+RUN git clone https://gerrit.opnfv.org/gerrit/sdnvpn ${repos_dir}/sdnvpn
RUN pip install -r ${repos_dir}/functest/docker/requirements.pip
RUN pip install -r ${repos_dir}/rally/requirements.txt
diff --git a/utils/functest_vacation.py b/utils/functest_vacation.py
new file mode 100644
index 000000000..0ba094477
--- /dev/null
+++ b/utils/functest_vacation.py
@@ -0,0 +1,52 @@
+from os import environ
+from curses import initscr, curs_set, newwin, endwin,\
+ KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP
+from random import randrange
+
+
+def main():
+ environ["TERM"] = 'Eterm'
+ initscr()
+ curs_set(0)
+ try:
+ win = newwin(16, 60, 0, 0)
+ win.keypad(True)
+ win.nodelay(True)
+ win.border('|', '|', '-', '-', '+', '+', '+', '+')
+ win.addch(4, 44, '@')
+ win.addstr(0, 5, ' Eat all the OPNFV bugs by FunTest! ')
+ win.addstr(15, 7, ' Left,Right,Up,Down: move; other keys: quit ')
+ snake = [[20, 7], [19, 7], [18, 7], [17, 7],
+ [16, 7], [15, 7], [14, 7], [13, 7]]
+ key = KEY_RIGHT
+ body = '~FUNTEST'
+ ind = 0
+ while key != 27:
+ win.addstr(0, 44, ' Score: '+str(len(snake)-len(body))+' ')
+ win.timeout(140 - 2 * len(snake))
+ getkey = win.getch()
+ key = key if getkey == -1 else getkey
+ snake.insert(
+ 0, [snake[0][0]+(key == KEY_RIGHT and 1 or
+ key == KEY_LEFT and -1),
+ snake[0][1]+(key == KEY_DOWN and 1 or
+ key == KEY_UP and -1)])
+ win.addch(snake[len(snake)-1][1], snake[len(snake)-1][0], ' ')
+ if win.inch(snake[0][1], snake[0][0]) & 255 == 32:
+ snake.pop()
+ elif win.inch(snake[0][1], snake[0][0]) & 255 == ord('@'):
+ c = [n for n in [[randrange(1, 58, 1), randrange(1, 14, 1)]
+ for x in range(len(snake))] if n not in snake]
+ win.addch(c == [] and 4 or c[0][1],
+ c == [] and 44 or c[0][0], '@')
+ else:
+ break
+ ind += 1
+ win.addch(snake[0][1], snake[0][0], body[ind % len(body)])
+ finally:
+ endwin()
+
+ print '\nSnake.PY-26lines by Kris Cieslak (defaultset.blogspot.com).'
+ print 'OPNFV adaptation by Functest dream team.'
+ print 'Thanks for playing, your score: '+str(len(snake)-len(body)-1)+'.'
+ print 'Find and fix more bugs in your real OPNFV setup!\n'
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index b93d38185..b463bf4ae 100644
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -183,7 +183,8 @@ def get_hypervisors(nova_client):
nodes = []
hypervisors = nova_client.hypervisors.list()
for hypervisor in hypervisors:
- nodes.append(hypervisor.hypervisor_hostname)
+ if hypervisor.state == "up":
+ nodes.append(hypervisor.hypervisor_hostname)
return nodes
except Exception, e:
print "Error [get_hypervisors(nova_client)]:", e
@@ -614,9 +615,27 @@ def create_network_full(logger,
return network_dic
+def create_bgpvpn(neutron_client, **kwargs):
+ # route_distinguishers
+ # route_targets
+ json_body = {"bgpvpn": kwargs}
+ return neutron_client.create_bgpvpn(json_body)
+
+
+def create_network_association(neutron_client, bgpvpn_id, neutron_network_id):
+ json_body = {"network_association": {"network_id": neutron_network_id}}
+ return neutron_client.create_network_association(bgpvpn_id, json_body)
+
+
+def update_bgpvpn(neutron_client, bgpvpn_id, **kwargs):
+ json_body = {"bgpvpn": kwargs}
+ return neutron_client.update_bgpvpn(bgpvpn_id, json_body)
+
# *********************************************
# SEC GROUPS
# *********************************************
+
+
def get_security_groups(neutron_client):
try:
security_groups = neutron_client.list_security_groups()[