hwt/simulator/agentConnector.py
def autoAddAgents(unit):
    """
    Walk all interfaces on unit and instantiate agent for every interface.

    :return: all monitor/driver functions which should be added to simulation
         as processes
    """
    proc = []
    for intf in unit._interfaces:
        if not intf._isExtern:
            continue

        intf._initSimAgent()
        assert intf._ag is not None, intf
        agents = [intf._ag, ]

        if intf._direction == INTF_DIRECTION.MASTER:
            agProcs = list(map(lambda a: a.getMonitors(), agents))
        elif intf._direction == INTF_DIRECTION.SLAVE:
            agProcs = list(map(lambda a: a.getDrivers(), agents))
        else:
            raise NotImplementedError("intf._direction %r for %r" % (
                intf._direction, intf))

        for p in agProcs:
            proc.extend(p)

    return proc
def autoAddAgents(unit):
    proc = []
    for intf in unit._interfaces:
        if not intf._isExtern:
            continue

        intf._initSimAgent()
        assert intf._ag is not None, intf
        agents = [intf._ag, ]

        if intf._direction == INTF_DIRECTION.MASTER:
            agProcs = list(map(lambda a: a.getMonitors(), agents))
        elif intf._direction == INTF_DIRECTION.SLAVE:
            agProcs = list(map(lambda a: a.getDrivers(), agents))
        else:
            raise NotImplementedError("intf._direction %r for %r" % (
                intf._direction, intf))

        for p in agProcs:
            proc.extend(p)

    return proc
def autoAddAgents ( unit ) : proc = [ ] for intf in unit . _interfaces : if not intf . _isExtern : continue intf . _initSimAgent ( ) assert intf . _ag is not None , intf agents = [ intf . _ag , ] if intf . _direction == INTF_DIRECTION . MASTER : agProcs = list ( map ( lambda a : a . getMonitors ( ) , agents ) ) elif intf . _direction == INTF_DIRECTION . SLAVE : agProcs = list ( map ( lambda a : a . getDrivers ( ) , agents ) ) else : raise NotImplementedError ( "intf._direction %r for %r" % ( intf . _direction , intf ) ) for p in agProcs : proc . extend ( p ) return proc
Walk all interfaces on unit and instantiate agent for every interface.

    :return: all monitor/driver functions which should be added to simulation
         as processes
Walk all interfaces on unit and instantiate agent for every interface .