tests/system/python/conftest.py
def _add_foglamp_south(south_plugin, south_branch, foglamp_url, service_name="play", config=None,
                           plugin_lang="python", use_pip_cache=True, start_service=True, plugin_discovery_name=None):
        """Add south plugin and start the service by default"""

        plugin_discovery_name = south_plugin if plugin_discovery_name is None else plugin_discovery_name
        _config = config if config is not None else {}
        _enabled = "true" if start_service else "false"
        data = {"name": "{}".format(service_name), "type": "South", "plugin": "{}".format(plugin_discovery_name),
                "enabled": _enabled, "config": _config}

        conn = http.client.HTTPConnection(foglamp_url)

        try:
            if plugin_lang == "python":
                subprocess.run(["$FOGLAMP_ROOT/tests/system/python/scripts/install_python_plugin {} south {} {}".format(
                    south_branch, south_plugin, use_pip_cache)], shell=True, check=True)
            else:
                subprocess.run(["$FOGLAMP_ROOT/tests/system/python/scripts/install_c_plugin {} south {}".format(
                    south_branch, south_plugin)], shell=True, check=True)
        except subprocess.CalledProcessError:
            assert False, "{} plugin installation failed".format(south_plugin)

        # Create south service
        conn.request("POST", '/foglamp/service', json.dumps(data))
        r = conn.getresponse()
        assert 200 == r.status
        r = r.read().decode()
        retval = json.loads(r)
        assert service_name == retval["name"]
Add south plugin and start the service by default
Add south plugin and start the service by default
Add south plugin and start the service by default
def _add_foglamp_south(south_plugin, south_branch, foglamp_url, service_name="play", config=None,
                           plugin_lang="python", use_pip_cache=True, start_service=True, plugin_discovery_name=None):
        plugin_discovery_name = south_plugin if plugin_discovery_name is None else plugin_discovery_name
        _config = config if config is not None else {}
        _enabled = "true" if start_service else "false"
        data = {"name": "{}".format(service_name), "type": "South", "plugin": "{}".format(plugin_discovery_name),
                "enabled": _enabled, "config": _config}
        conn = http.client.HTTPConnection(foglamp_url)
        try:
            if plugin_lang == "python":
                subprocess.run(["$FOGLAMP_ROOT/tests/system/python/scripts/install_python_plugin {} south {} {}".format(
                    south_branch, south_plugin, use_pip_cache)], shell=True, check=True)
            else:
                subprocess.run(["$FOGLAMP_ROOT/tests/system/python/scripts/install_c_plugin {} south {}".format(
                    south_branch, south_plugin)], shell=True, check=True)
        except subprocess.CalledProcessError:
            assert False, "{} plugin installation failed".format(south_plugin)
        conn.request("POST", '/foglamp/service', json.dumps(data))
        r = conn.getresponse()
        assert 200 == r.status
        r = r.read().decode()
        retval = json.loads(r)
        assert service_name == retval["name"]
def _add_foglamp_south ( south_plugin , south_branch , foglamp_url , service_name = "play" , config = None , plugin_lang = "python" , use_pip_cache = True , start_service = True , plugin_discovery_name = None ) : plugin_discovery_name = south_plugin if plugin_discovery_name is None else plugin_discovery_name _config = config if config is not None else { } _enabled = "true" if start_service else "false" data = { "name" : "{}" . format ( service_name ) , "type" : "South" , "plugin" : "{}" . format ( plugin_discovery_name ) , "enabled" : _enabled , "config" : _config } conn = http . client . HTTPConnection ( foglamp_url ) try : if plugin_lang == "python" : subprocess . run ( [ "$FOGLAMP_ROOT/tests/system/python/scripts/install_python_plugin {} south {} {}" . format ( south_branch , south_plugin , use_pip_cache ) ] , shell = True , check = True ) else : subprocess . run ( [ "$FOGLAMP_ROOT/tests/system/python/scripts/install_c_plugin {} south {}" . format ( south_branch , south_plugin ) ] , shell = True , check = True ) except subprocess . CalledProcessError : assert False , "{} plugin installation failed" . format ( south_plugin ) conn . request ( "POST" , '/foglamp/service' , json . dumps ( data ) ) r = conn . getresponse ( ) assert 200 == r . status r = r . read ( ) . decode ( ) retval = json . loads ( r ) assert service_name == retval [ "name" ]
Add south plugin and start the service by default
Add south plugin and start the service by default
"""Add south plugin and start the service by default""" # Create south service
south_plugin
south_branch
foglamp_url
service_name
config
plugin_lang
use_pip_cache
start_service
plugin_discovery_name