[pve-devel] [PATCH pve-manager 09/11] sdn: add Fabrics view

Gabriel Goller g.goller at proxmox.com
Fri Mar 7 16:57:08 CET 2025


>> +	    Proxmox.Utils.API2Request({
>> +		url: `/cluster/sdn/fabrics/`,
>> +		method: 'GET',
>> +		success: function(response, opts) {
>> +		    let ospf = Object.entries(response.result.data.ospf);
>> +		    let openfabric = Object.entries(response.result.data.openfabric);
>> +
>> +		    // add some metadata so we can merge the objects later and still know the protocol/type
>> +		    ospf = ospf.map(x => {
>> +			if (x["1"].fabric) {
>> +			    return Object.assign(x["1"].fabric, { _protocol: "ospf", _type: "fabric", name: x["0"] });
>> +			} else if (x["1"].node) {
>> +			    let id = x["0"].split("_");
>
>I think we already talked about this, but I don't really remember the
>outcome. Can we return this already from the API so we don't have to
>parse it in the frontend?

Hmm I can't remember. If we want to do this api-side we need to create
new api types, because currently we just return the SectionConfig types.
I don't think there is any way to "parse" (i.e. split at the '_') the
key and throw it into a property.

>> +			    return Object.assign(x["1"].node,
>> +				{
>> +				    _protocol: "ospf",
>> +				    _type: "node",
>> +				    node: id[1],
>> +				    fabric: id[0],
>> +				},
>> +			    );
>> +			} else {
>> +			    return x;
>> +			}
>> +		    });




More information about the pve-devel mailing list