xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

default node details API implementation when site.hierarchicalattrs is empty #203

Closed bybai closed 5 years ago

bybai commented 5 years ago

For https://github.ibm.com/xcat2/task_management/issues/263

PATH METHOD Description Parameters
/inventory/node//_detail GET get a node object defined in store  

UT:

[root@byrh07 ~]# time curl -X GET "http://10.4.41.7:5000/api/v2/system/nodes/login4/_detail" -H  "accept: application/json"
{
    "meta": {
        "name": "login4"
    },
    "spec": {
        "obj_type": "node",
        "engines": {
            "netboot_engine": {
                "engine_info": {
                    "postbootscripts": "otherpkgs,",
                    "chain": "runcmd=bmcsetup,osimage=compute",
                    "osimage": "login",
                    "postscripts": "syslog,remoteshell,syncfiles,confignetwork -s,setroute,nvidia-exclusive-mode,puppet_agent,gpfsclient,enablekdump"
                },
                "engine_type": "petitboot"
            },
            "hardware_mgt_engine": {
                "engine_type": "openbmc"
            },
            "console_engine": {
                "engine_type": "openbmc"
            },
            "power_mgt_engine": {
                "engine_info": {
                    "pdu": "c24pdu1:2,c24pdu2:2"
                }
            }
        },
        "device_info": {
            "uuid": "8335-gtc-784d27a-70e28414416a",
            "supportedarchs": "ppc64le",
            "characteristics": "mp",
            "memory": "523484MB",
            "cpucount": "128",
            "disksize": "sda:1863GB,sdb:1863GB",
            "mtm": "8335-GTC",
            "cputype": "POWER9 (raw), altivec supported",
            "serial": "784D27A",
            "arch": "ppc64le"
        },
        "obj_info": {
            "groups": "login,user,inf,frontend"
        },
        "role": "compute",
        "position_info": {
            "rack": "c24",
            "unit": "16"
        },
        "device_type": "server",
        "network_info": {
            "primarynic": {
                "ip": "10.134.0.34",
                "mac": [
                    "00:16:3e:23:26:05!*NOIP*",
                    "00:16:3e:73:4c:7c"
                ]
            },
            "nics": {
                "ib0": {
                    "type": [
                        "Infiniband"
                    ],
                    "hostnamesuffixes": [
                        "ib"
                    ],
                    "networks": [
                        "ipoib"
                    ],
                    "ips": [
                        "10.41.0.34"
                    ]
                },
                "bond0": {
                    "nicdevices": [
                        "enP48p1s0f0",
                        "enP48p1s0f1"
                    ],
                    "type": [
                        "bond"
                    ],
                    "networks": [
                        "public"
                    ],
                    "ips": [
                        "10.219.134.74"
                    ]
                },
                "enP48p1s0f0": {
                    "type": [
                        "Ethernet"
                    ]
                },
                "enP48p1s0f1": {
                    "type": [
                        "Ethernet"
                    ]
                }
            },
            "connections": {
                "switch": "c24eth",
                "switchport": "24"
            },
            "otherinterfaces": "login4bmc:10.134.64.34",
            "routenames": "extgwy,alpinetds"
        }
    }
}

real    0m0.762s
user    0m0.009s
sys 0m0.014s

[root@byrh07 ~]# time lsdef login4
Object name: login4
    arch=ppc64le
    chain=runcmd=bmcsetup,osimage=compute
    cons=openbmc
    cpucount=128
    cputype=POWER9 (raw), altivec supported
    disksize=sda:1863GB,sdb:1863GB
    groups=login,user,inf,frontend
    ip=10.134.0.34
    mac=00:16:3e:23:26:05!*NOIP*|00:16:3e:73:4c:7c
    memory=523484MB
    mgt=openbmc
    mtm=8335-GTC
    netboot=petitboot
    nicdevices.bond0=enP48p1s0f0|enP48p1s0f1
    nichostnamesuffixes.ib0=ib
    nicips.ib0=10.41.0.34
    nicips.bond0=10.219.134.74
    nicnetworks.ib0=ipoib
    nicnetworks.bond0=public
    nictypes.ib0=Infiniband
    nictypes.bond0=bond
    nictypes.enP48p1s0f0=Ethernet
    nictypes.enP48p1s0f1=Ethernet
    nodetype=mp
    otherinterfaces=login4bmc:10.134.64.34
    pdu=c24pdu1:2,c24pdu2:2
    postbootscripts=otherpkgs
    postscripts=syslog,remoteshell,syncfiles,confignetwork -s,setroute,nvidia-exclusive-mode,puppet_agent,gpfsclient,enablekdump
    provmethod=login
    rack=c24
    routenames=extgwy,alpinetds
    serial=784D27A
    supportedarchs=ppc64le
    switch=c24eth
    switchport=24
    unit=16

real    0m2.385s
user    0m0.401s
sys 0m0.129s