Ejemplo n.º 1
0
def _parse_action(element: etree._Element) -> Action:
    """Parse a NoDL action from an xml element."""
    name = element.get('name')
    action_type = element.get('type')

    server = get_bool_attribute(element, 'server')
    client = get_bool_attribute(element, 'client')
    if not (server or client):
        raise errors.AmbiguousActionInterfaceError(element)

    policy = _parse_qos(element.find('qos'))

    return Action(name=name,
                  action_type=action_type,
                  server=server,
                  client=client,
                  qos=policy)
Ejemplo n.º 2
0
def _parse_topic(element: etree._Element) -> Topic:
    """Parse a NoDL topic from an xml element."""
    name = element.get('name')
    message_type = element.get('type')

    publisher = get_bool_attribute(element, 'publisher')
    subscription = get_bool_attribute(element, 'subscription')
    if not (publisher or subscription):
        raise errors.AmbiguousTopicInterfaceError(element)

    policy = _parse_qos(element.find('qos'))

    return Topic(
        name=name,
        message_type=message_type,
        publisher=publisher,
        subscription=subscription,
        qos=policy,
    )
Ejemplo n.º 3
0
def _parse_service(element: etree._Element) -> Service:
    """Parse a NoDL service from an xml element."""
    name = element.get('name')
    service_type = element.get('type')

    server = get_bool_attribute(element, 'server')
    client = get_bool_attribute(element, 'client')
    if not (server or client):
        raise errors.AmbiguousServiceInterfaceError(element)

    policy = _parse_qos(element.find('qos'))

    return Service(
        name=name,
        service_type=service_type,
        server=server,
        client=client,
        qos=policy,
    )