Skip to content

Use path, rather than URL for some Magellan fields#110

Closed
bmcdonald3 wants to merge 1 commit into
OpenCHAMI:mainfrom
bmcdonald3:BMC-action-target
Closed

Use path, rather than URL for some Magellan fields#110
bmcdonald3 wants to merge 1 commit into
OpenCHAMI:mainfrom
bmcdonald3:BMC-action-target

Conversation

@bmcdonald3

Copy link
Copy Markdown
Member

In Magellan, some of the fields were being added to SMD with full paths (i.e., they had https://<hostname>/ appended to the start. This was causing unexpected behavior when these fields are attempted to be used by other services (e.g., PCS).

This PR fixes that by stripping off the URL elements and just leaving the path. Note, this is very similar in it's need to #98.

Commands to run:

magellan collect "https://${BMC_IP}" --username "${BMC_USER}" --password "${BMC_PASS}" -v  > collected.txt
cat collected.txt | magellan send http://localhost:2777
curl -sS http://localhost:27779/hsm/v2/Inventory/ComponentEndpoints | jq

Here is the contents of a single record in collected.txt without these changes:

            {
                "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087",
                "uuid": "317091ec-8be6-11e8-ab21-a4bf013f6b40",
                "manufacturer": "Intel Corporation",
                "system_type": "Physical",
                "name": "S2600BPB",
                "model": "S2600BPB",
                "serial": "QSBP82909087",
                "bios_version": "SE5C620.86B.02.01.0014.C0001.082620210524",
                "ethernet_interfaces": [
                    {
                        "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/3",
                        "mac": "ff-ff-ff-ff-ff-ff",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 3"
                    },
                    {
                        "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/1",
                        "mac": "a4-bf-01-3f-6b-40",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 1"
                    },
                    {
                        "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/2",
                        "mac": "a4-bf-01-3f-6b-41",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 2"
                    },
                    {
                        "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/4",
                        "mac": "02-09-01-08-38-c5",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 4"
                    },
                    {
                        "uri": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/5",
                        "mac": "02-09-01-08-46-9a",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 5"
                    }
                ],
                "actions": [
                    "PushPowerButton",
                    "On",
                    "GracefulShutdown",
                    "ForceRestart",
                    "Nmi",
                    "ForceOn",
                    "ForceOff"
                ],
                "power": {
                    "state": "On"
                },
                "processor_count": 2,
                "processor_type": "Intel Xeon processor",
                "memory_total": 64,
                "links": {
                    "managers": [
                        "/redfish/v1/Managers/BMC"
                    ]
                }
            }
        ],

Here is the contents of collected.txt with these changes:

            {
                "uri": "/redfish/v1/Systems/QSBP82909274",
                "uuid": "317091e8-8be6-11e8-ab21-a4bf013f6ee7",
                "manufacturer": "Intel Corporation",
                "system_type": "Physical",
                "name": "S2600BPB",
                "model": "S2600BPB",
                "serial": "QSBP82909274",
                "bios_version": "SE5C620.86B.02.01.0014.C0001.082620210524",
                "ethernet_interfaces": [
                    {
                        "uri": "/redfish/v1/Systems/QSBP82909274/EthernetInterfaces/3",
                        "mac": "ff-ff-ff-ff-ff-ff",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 3"
                    },
                    {
                        "uri": "/redfish/v1/Systems/QSBP82909274/EthernetInterfaces/1",
                        "mac": "a4-bf-01-3f-6e-e7",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 1"
                    },
                    {
                        "uri": "/redfish/v1/Systems/QSBP82909274/EthernetInterfaces/2",
                        "mac": "a4-bf-01-3f-6e-e8",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 2"
                    },
                    {
                        "uri": "/redfish/v1/Systems/QSBP82909274/EthernetInterfaces/4",
                        "mac": "02-09-01-08-4f-9b",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 4"
                    },
                    {
                        "uri": "/redfish/v1/Systems/QSBP82909274/EthernetInterfaces/5",
                        "mac": "02-09-01-08-42-45",
                        "name": "Computer System Ethernet Interface",
                        "description": "System NIC 5"
                    }
                ],
                "actions": [
                    "PushPowerButton",
                    "On",
                    "GracefulShutdown",
                    "ForceRestart",
                    "Nmi",
                    "ForceOn",
                    "ForceOff"
                ],
                "power": {
                    "state": "On"
                },
                "processor_count": 2,
                "processor_type": "Intel Xeon processor",
                "memory_total": 64,
                "links": {
                    "managers": [
                        "/redfish/v1/Managers/BMC"
                    ]
                }
            }
        ],

Here is what we were seeing in SMD before:

    {
      "ID": "x1000c1s7b1n0",
      "Type": "Node",
      "RedfishType": "ComputerSystem",
      "RedfishSubtype": "Physical",
      "UUID": "317091ec-8be6-11e8-ab21-a4bf013f6b40",
      "OdataID": "/redfish/v1/Systems/QSBP82909087",
      "RedfishEndpointID": "x1000c1s7b1",
      "Enabled": true,
      "RedfishEndpointFQDN": "172.24.0.3",
      "RedfishURL": "172.24.0.3/redfish/v1/Systems/QSBP82909087",
      "ComponentEndpointType": "ComponentEndpointComputerSystem",
      "RedfishSystemInfo": {
        "Name": "S2600BPB",
        "Actions": {
          "#ComputerSystem.Reset": {
            "ResetType@Redfish.AllowableValues": [
              "PushPowerButton",
              "On",
              "GracefulShutdown",
              "ForceRestart",
              "Nmi",
              "ForceOn",
              "ForceOff"
            ],
            "@Redfish.ActionInfo": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/ResetActionInfo",
            "target": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/Actions/ComputerSystem.Reset"
          }
        },
        "EthernetNICInfo": [
          {
            "RedfishId": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/3",
            "@odata.id": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/3",
            "Description": "System NIC 3",
            "InterfaceEnabled": true,
            "MACAddress": "ff-ff-ff-ff-ff-ff"
          },
          {
            "RedfishId": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/2",
            "@odata.id": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/2",
            "Description": "System NIC 2",
            "InterfaceEnabled": true,
            "MACAddress": "a4-bf-01-3f-6b-41"
          },
          {
            "RedfishId": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/1",
            "@odata.id": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/1",
            "Description": "System NIC 1",
            "InterfaceEnabled": true,
            "MACAddress": "a4-bf-01-3f-6b-40"
          },
          {
            "RedfishId": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/4",
            "@odata.id": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/4",
            "Description": "System NIC 4",
            "InterfaceEnabled": true,
            "MACAddress": "02-09-01-08-38-c5"
          },
          {
            "RedfishId": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/5",
            "@odata.id": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/5",
            "Description": "System NIC 5",
            "InterfaceEnabled": true,
            "MACAddress": "02-09-01-08-46-9a"
          }
        ],
        "PowerURL": "/redfish/v1/Chassis/RackMount/Power",
        "PowerControl": [
          {
            "@odata.id": "/redfish/v1/Chassis/RackMount/Baseboard/Power#/PowerControl/0",
            "MemberId": "0",
            "Name": "System Power Control",
            "RelatedItem": [
              {
                "@odata.id": "/redfish/v1/Systems/QSBP82909087"
              },
              {
                "@odata.id": "/redfish/v1/Chassis/RackMount/Baseboard"
              }
            ]
          }
        ]
      }
    }
  ]

Here is what we see in SMD after:

    {
      "ID": "x1000c1s7b1n0",
      "Type": "Node",
      "RedfishType": "ComputerSystem",
      "RedfishSubtype": "Physical",
      "UUID": "317091ec-8be6-11e8-ab21-a4bf013f6b40",
      "OdataID": "/redfish/v1/Systems/QSBP82909087",
      "RedfishEndpointID": "x1000c1s7b1",
      "Enabled": true,
      "RedfishEndpointFQDN": "172.24.0.3",
      "RedfishURL": "172.24.0.3/redfish/v1/Systems/QSBP82909087",
      "ComponentEndpointType": "ComponentEndpointComputerSystem",
      "RedfishSystemInfo": {
        "Name": "S2600BPB",
        "Actions": {
          "#ComputerSystem.Reset": {
            "ResetType@Redfish.AllowableValues": [
              "PushPowerButton",
              "On",
              "GracefulShutdown",
              "ForceRestart",
              "Nmi",
              "ForceOn",
              "ForceOff"
            ],
            "@Redfish.ActionInfo": "/redfish/v1/Systems/QSBP82909087/ResetActionInfo",
            "target": "/redfish/v1/Systems/QSBP82909087/Actions/ComputerSystem.Reset"
          }
        },
        "EthernetNICInfo": [
          {
            "RedfishId": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/3",
            "@odata.id": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/3",
            "Description": "System NIC 3",
            "InterfaceEnabled": true,
            "MACAddress": "ff-ff-ff-ff-ff-ff"
          },
          {
            "RedfishId": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/1",
            "@odata.id": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/1",
            "Description": "System NIC 1",
            "InterfaceEnabled": true,
            "MACAddress": "a4-bf-01-3f-6b-40"
          },
          {
            "RedfishId": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/2",
            "@odata.id": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/2",
            "Description": "System NIC 2",
            "InterfaceEnabled": true,
            "MACAddress": "a4-bf-01-3f-6b-41"
          },
          {
            "RedfishId": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/4",
            "@odata.id": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/4",
            "Description": "System NIC 4",
            "InterfaceEnabled": true,
            "MACAddress": "02-09-01-08-38-c5"
          },
          {
            "RedfishId": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/5",
            "@odata.id": "/redfish/v1/Systems/QSBP82909087/EthernetInterfaces/5",
            "Description": "System NIC 5",
            "InterfaceEnabled": true,
            "MACAddress": "02-09-01-08-46-9a"
          }
        ],
        "PowerURL": "/redfish/v1/Chassis/RackMount/Power",
        "PowerControl": [
          {
            "@odata.id": "/redfish/v1/Chassis/RackMount/Baseboard/Power#/PowerControl/0",
            "MemberId": "0",
            "Name": "System Power Control",
            "RelatedItem": [
              {
                "@odata.id": "/redfish/v1/Systems/QSBP82909087"
              },
              {
                "@odata.id": "/redfish/v1/Chassis/RackMount/Baseboard"
              }
            ]
          }
        ]
      }
    }
  ]

Now we see:

            "@Redfish.ActionInfo": "/redfish/v1/Systems/QSBP82909087/ResetActionInfo",
            "target": "/redfish/v1/Systems/QSBP82909087/Actions/ComputerSystem.Reset"

Before we were seeing:

            "@Redfish.ActionInfo": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/ResetActionInfo",
            "target": "https://172.24.0.3:443/redfish/v1/Systems/QSBP82909087/Actions/ComputerSystem.Reset"

This PR also changes the other fields, like the ethernet info, but the what I needed for PCS wer the two listed above.

Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
@davidallendj

Copy link
Copy Markdown
Collaborator

I don't think we want to strip off the first part here like this since we will lose information.

Current output:

{
                "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0",
                "manufacturer": "HPE",
                "system_type": "Physical",
                "name": "Node0",
                "model": "HPE CRAY EX235a",
                "serial": "NUX9940765739",
                "bios_version": "ex235a.bios-1.3.6",
                "ethernet_interfaces": [
                    {
                        "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0/EthernetInterfaces/ManagementEthernet",
                        "mac": "02:0b:b8:00:30:00",
                        "description": "Node Maintenance Network"
                    },
                    {
                        "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet2",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet1",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet3",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "https://172.21.0.1:5000/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet0",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    }
                ],
                "power": {
                    "state": "On"
                },
                "processor_count": 9,
                "processor_type": "AMD INSTINCT MI200 (MCM) OAM LC",
                "memory_total": 512,
                "links": {}
            }

New output:

{
                "uri": "/redfish/v1/Systems/Node0",
                "manufacturer": "HPE",
                "system_type": "Physical",
                "name": "Node0",
                "model": "HPE CRAY EX235a",
                "serial": "NUX9940765739",
                "bios_version": "ex235a.bios-1.3.6",
                "ethernet_interfaces": [
                    {
                        "uri": "/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet2",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet1",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "/redfish/v1/Systems/Node0/EthernetInterfaces/ManagementEthernet",
                        "mac": "02:0b:b8:00:30:00",
                        "description": "Node Maintenance Network"
                    },
                    {
                        "uri": "/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet3",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    },
                    {
                        "uri": "/redfish/v1/Systems/Node0/EthernetInterfaces/HPCNet0",
                        "mac": "Not Available",
                        "description": "SS11 200Gb 2P NIC Mezz REV02 (HSN)"
                    }
                ],
                "power": {
                    "state": "On"
                },
                "processor_count": 9,
                "processor_type": "AMD INSTINCT MI200 (MCM) OAM LC",
                "memory_total": 512,
                "links": {}
            }

@bmcdonald3

bmcdonald3 commented Jul 16, 2025

Copy link
Copy Markdown
Member Author

What information is lost? Assuming that node0 is the real xname, that is essentially the alias for the https://172.21.0.1:5000. Is this information being used by a different service in a different way? We need the format that is made in this change to get PCS to work properly, but it's possible I'm unaware of other uses.
Edit: wait, I got that wrong, one sec...

@davidallendj

Copy link
Copy Markdown
Collaborator

Can you parse the path on the SMD side using url.Parse()? I think we would want to keep the information if the output is used for scripting with flat files. You should be able to extract that part using the Path field like in this example.

@davidallendj

Copy link
Copy Markdown
Collaborator

Closing this in favor of OpenCHAMI/smd#70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants