X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Fcsit%2Fvariables%2Fbgpuser%2Fvariables.py;fp=test%2Fcsit%2Fvariables%2Fbgpuser%2Fvariables.py;h=0000000000000000000000000000000000000000;hb=59e81c38620fa1b61e15771191e35771450b9499;hp=9e731b13e693ea1fa680ce964b8496f4ccf104ca;hpb=072f6e3a8d1bdf8f4c663843589c22d93ba07791;p=integration%2Ftest.git diff --git a/test/csit/variables/bgpuser/variables.py b/test/csit/variables/bgpuser/variables.py deleted file mode 100644 index 9e731b13e6..0000000000 --- a/test/csit/variables/bgpuser/variables.py +++ /dev/null @@ -1,40 +0,0 @@ -"""Variables file for data loaded from a file. - -Stuff like JSON topology outputs and the like -are fairly long, therefore to improve clarity these -are moved out of the testcase file to their own files. -This module then allows the robot framework suite to -read the file contents and access it as values of variables.""" -# Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0 which accompanies this distribution, -# and is available at http://www.eclipse.org/legal/epl-v10.html - -__author__ = "Jozef Behran" -__copyright__ = "Copyright(c) 2015, Cisco Systems, Inc." -__license__ = "Eclipse Public License v1.0" -__email__ = "jbehran@cisco.com" - -import os -import string - - -def get_variables(mininet_ip): - """Return dict of variables keyed by the (dot-less) names of files. - - Directory where data files are located is the same as where this file is located. - Every dot in file name is replaced by underscore, so that - name of the variable is not interpreted as attribute access. - Replacements may create collisions, so detect them.""" - variables = {} - this_dir = os.path.dirname(os.path.abspath(__file__)) - filename_list = ["empty.json", "filled.json"] - for file_basename in filename_list: - variable_name = file_basename.replace('.', '_') - if variable_name in variables: - raise KeyError("Variable " + variable_name + " already exists.") - file_fullname = this_dir + "/" + file_basename - data_template = string.Template(open(file_fullname).read()) - variables[variable_name] = data_template.substitute({"IP": mininet_ip}) - return variables