コード例 #1
0
def setup_board_routes(app: Application, write_enabled: bool):

    # Create /api end point as root node
    r_api = tree("api", data=get_node_api())

    # Add /api/sled to represent entire SLED
    r_sled = tree("sled", data=get_node_sled())
    r_api.addChild(r_sled)

    # Add mb /api/sled/mb
    r_mb = tree("mb", data=get_node_server_2s(1, "mb"))
    r_sled.addChild(r_mb)

    # Add /api/sled/mb/fruid end point
    r_temp = tree("fruid", data=get_node_fruid("mb"))
    r_mb.addChild(r_temp)

    # /api/sled/mb/bmc end point
    r_temp = tree("bmc", data=get_node_bmc())
    r_mb.addChild(r_temp)

    # /api/sled/mb/sensors end point
    r_temp = tree("sensors", data=get_node_sensors("mb"))
    r_mb.addChild(r_temp)

    # /api/sled/mb/logs end point
    r_temp = tree("logs", data=get_node_logs("mb"))
    r_mb.addChild(r_temp)

    r_api.setup(app, write_enabled)
コード例 #2
0
def init_plat_tree():

    # Create /api end point as root node
    r_api = tree("api", data = get_node_api())

    # Add /api/sled to represent entire SLED
    r_sled = tree("sled", data = get_node_sled())
    r_api.addChild(r_sled)


    # Add mb /api/sled/mb
    r_mb = tree("mb", data = get_node_server_2s())
    r_sled.addChild(r_mb)

    # Add /api/sled/mb/fruid end point
    r_temp = tree("fruid", data = get_node_fruid("mb"))
    r_mb.addChild(r_temp)

    # /api/sled/mb/bmc end point
    r_temp = tree("bmc", data = get_node_bmc())
    r_mb.addChild(r_temp)

    r_temp = tree("vboot", data = get_node_vboot())
    r_mb.addChild(r_temp)

    # /api/sled/mb/sensors end point
    r_temp = tree("sensors", data = get_node_sensors("mb"))
    r_mb.addChild(r_temp)

    # /api/sled/mb/logs end point
    r_temp = tree("logs", data = get_node_logs("mb"))
    r_mb.addChild(r_temp)

    # Add /api/sled/mezz to represent Network Mezzaine card
    r_mezz = tree("mezz", data = get_node_mezz())
    r_sled.addChild(r_mezz)

    # Add /api/mezz/fruid end point
    r_temp = tree("fruid", data = get_node_fruid("nic"))
    r_mezz.addChild(r_temp)

    # /api/mezz/sensors end point
    r_temp = tree("sensors", data = get_node_sensors("nic"))
    r_mezz.addChild(r_temp)

    # /api/mezz/logs end point
    r_temp = tree("logs", data = get_node_logs("nic"))
    r_mezz.addChild(r_temp)

    return r_api