예제 #1
0
def get_connection_xml(ccxml_path, ccs_path):
    """Returns the full path to the connection xml specified in the ccxml.

    Args:
        ccxml_path (str): full path to ccxml file to modify
        ccs_path (str): full path to ccs installation to use

    Returns:
        (str) path to connection xml
    """
    root = xmlhelper.get_xml_root(ccxml_path)
    xmlpath = None

    connection_name = get_connection(ccxml_path)
    connection_instance = root.find("configuration/instance[@id='%s']" %
                                    connection_name)
    conn_element = root.find("configuration/connection")
    p_conn_element = root.find("configuration/connection/..")

    conn_instance = xmlhelper.get_sibling(conn_element, p_conn_element, -1)
    if conn_instance is None:
        raise CCXMLError("Could not find connection xml from given ccxml file")

    xmlname = conn_instance.attrib['xml']

    xmlpath = get_connections_directory(ccs_path) + '/' + xmlname
    xmlpath = os.path.normpath(xmlpath)

    return xmlpath
예제 #2
0
def __get_device_root(device_path):
    """Returns the root Element of the device file

    Args:
        device_path (str): full path to device file to parse

    Returns:
        xml.Element: root element of device file
    """
    if not os.path.exists(device_path):
        raise DeviceError("Could not find device: %s" % device_path)

    root = xmlhelper.get_xml_root(device_path)

    return root
예제 #3
0
def __get_ccxml_root(ccxml_path):
    """Returns the root Element of the ccxml file

    Args:
        ccxml_path (str): full path to ccxml file to parse

    Returns:
        xml.Element: root element of ccxml file
    """
    if not os.path.exists(ccxml_path):
        raise CCXMLError("Could not find ccxml: %s" % ccxml_path)

    root = xmlhelper.get_xml_root(ccxml_path)

    return root
예제 #4
0
def __get_connection_root(connection_path):
    """Returns the root Element of the connection file

    Args:
        connection_path (str): full path to connection file to parse

    Returns:
        xml.Element: root element of connection file
    """
    if not os.path.exists(connection_path):
        raise ConnectionsError("Could not find connection xml: %s" %
            connection_path)

    root = xmlhelper.get_xml_root(connection_path)

    return root
예제 #5
0
def get_device_xml(ccxml_path, ccs_path):
    """Returns the full path to the device xml specified in the ccxml.

    Args:
        ccxml_path (str): full path to ccxml file to modify
        ccs_path (str): full path to ccs installation to use

    Returns:
        (str) path to device xml
    """
    root = xmlhelper.get_xml_root(ccxml_path)
    xmlpath = None

    device_instance = root.find(
        "configuration/connection/platform/instance[@xml]")
    if device_instance is None:
        raise CCXMLError("Could not find device xml from given ccxml file")

    xmlname = device_instance.attrib['xml']

    xmlpath = get_devices_directory(ccs_path) + '/' + xmlname
    xmlpath = os.path.normpath(xmlpath)

    return xmlpath