Git Product home page Git Product logo

Comments (6)

billdodd avatar billdodd commented on August 22, 2024

I don't have access to a Cisco UCS server, but the basic idea is to just traverse the resources from the Chassis to the NetworkAdapters, etc. If that service follows the standard schemas, something like this should work:

import redfish


def main():
    context = redfish.redfish_client(base_url='https://contoso.com',
                                     username='...', password='...')
    context.login(auth="session")

    service_root = context.get("/redfish/v1/")
    if 'Chassis' not in service_root.dict:
        print('No Chassis found')
        return

    chassis_col = context.get(service_root.dict["Chassis"]["@odata.id"])
    for chassis_member in chassis_col.dict["Members"]:
        chassis = context.get(chassis_member["@odata.id"])
        print('Chassis: %s' % chassis.dict['Id'])
        if 'NetworkAdapters' in chassis.dict:
            na_col = context.get(chassis.dict['NetworkAdapters']["@odata.id"])
            for na_member in na_col.dict["Members"]:
                na_res = context.get(na_member["@odata.id"])
                print('  NetworkAdapter: %s' % na_res.dict['Id'])
                if 'NetworkDeviceFunctions' in na_res.dict:
                    ndf_col = context.get(na_res.dict['NetworkDeviceFunctions']['@odata.id'])
                    for ndf_member in ndf_col.dict["Members"]:
                        ndf_res = context.get(ndf_member["@odata.id"])
                        print('    NetworkDeviceFunction: %s' % ndf_res.dict['Id'])
                        if 'Ethernet' in ndf_res.dict:
                            if 'MACAddress' in ndf_res.dict['Ethernet']:
                                mac = ndf_res.dict['Ethernet']['MACAddress']
                                print('      MACAddress: %s' % mac)


if __name__ == "__main__":
    main()

from python-redfish-library.

nagaphani23 avatar nagaphani23 commented on August 22, 2024

I have already tried that and unfortunately i am getting nil under NetworkAdapters response.

{
"Members":[{
"@odata.id":"/redfish/v1/Chassis/1/NetworkAdapters/nil"
}]

Let me know in case if there's any other way to find this.

from python-redfish-library.

mraineri avatar mraineri commented on August 22, 2024

Is the service actually returning the URI /redfish/v1/Chassis/1/NetworkAdapters/nil? Can you open that URI in a browser?

This sounds like an issue with the implementation you're working with and may need to contact the vendor for support.

from python-redfish-library.

mraineri avatar mraineri commented on August 22, 2024

The other thing to consider is some implementations might only support the EthernetInterfaces resource for this, which would be found under the respective ComputerSystem resource.

from python-redfish-library.

mraineri avatar mraineri commented on August 22, 2024

@nagaphani23 do the previous responses answer your question? Can we close out this issue?

from python-redfish-library.

nagaphani23 avatar nagaphani23 commented on August 22, 2024

@mraineri I was not able to get the proper output with the above url. This might differ from specific vendor to vendor.
Anyways I am closing this now and will reopen in case if required.

from python-redfish-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.