Beispiel #1
0
def registerRurallinkWirelessCard(session_id, host_asset_id, mac):
    """Called by pxe-scripts to register a new wireless card
    
    The card is also attached to the device that is used to PXE boot it
    """

    # Validate MAC address
    if not isValidMAC(mac):
        raise ccs_asset_error("Invalid MAC address!")

    try:
        asset = getAssetByMac(session_id, mac)
    except ccs_asset_error:
        # Asset does not exist
        asset = addRurallinkWirelessAsset(session_id, mac)

    # Check current location
    location = getAssetLocation(session_id, asset["asset_id"])
    if location["attached_to"] == host_asset_id:
        # Up to date
        return asset

    # Get an asset object and attach it to the host asset
    assetobj = ccs_asset(session_id, asset["asset_id"])
    assetobj.attachTo(host_asset_id)

    # Return the asset
    return asset
Beispiel #2
0
def registerRurallinkDevice(session_id, eth0mac):
    """Called by pxe-scripts to register a new rurallink device"""

    # Validate MAC address
    if not isValidMAC(eth0mac):
        raise ccs_asset_error("Invalid MAC address!")

    try:
        asset = getAssetByMac(session_id, eth0mac)
    except ccs_asset_error:
        # Asset does not exist
        asset = addRurallinkAsset(session_id, eth0mac)

    # Return the asset
    return asset