Change 'uses' parameter from UUID to iface name

When creating a new interface, it can be selected a collection of
'used' interfaces by the new one.
This functionality makes use of the sysinv API in which the parameter
of such interfaces is required to be specified by the names of the
interfaces and not by the UUID.

This change looks for the names and replace the UUID for every
selected interface.

Test plan
PASS: * Log in to Starlingx dashboard, navigate to a Host Detail.
      * Go to to the interface tab and click the 'Create Interface'
        button.
      * Select a compatible configuration and make sure to check an
        interface from the 'Interfaces' list.
      * The interface is created successfully.

Closes-bug: 2021893

Signed-off-by: Agustin Carranza <agustin.carranza@windriver.com>
Change-Id: I1242f05a936ff3d69f28cc6ff0ea65fe53ffc4b5
This commit is contained in:
Agustin Carranza 2023-05-30 15:19:48 -03:00
parent c4de9faa26
commit da087c7f04
1 changed files with 6 additions and 1 deletions

View File

@ -567,7 +567,12 @@ class AddInterface(forms.SelfHandlingForm):
if data['ports']:
del data['uses']
else:
uses = data['uses'][:]
uses = []
iface_list = sysinv.host_interface_list(self.request, host_id)
for u in data['uses']:
for i in iface_list:
if u == i.uuid:
uses.append(i.ifname)
data['uses'] = uses
del data['ports']