Display enabled interfaces for underlying driver
Adds support for displaying the enabled interfaces for underlying driver. A new column is added in the driver validation table to display the enabled interfaces for different types of interface that driver supports. Change-Id: I8c732d3b7a7806ccd4e83aefe96cca3b09c44a9e Partial-Bug: #1672729
This commit is contained in:
parent
1881611c1a
commit
0142c9e89f
@ -25,7 +25,7 @@ from horizon.utils.memoized import memoized # noqa
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
|
||||
DEFAULT_IRONIC_API_VERSION = '1.27'
|
||||
DEFAULT_IRONIC_API_VERSION = '1.31'
|
||||
DEFAULT_INSECURE = False
|
||||
DEFAULT_CACERT = None
|
||||
IRONIC_CLIENT_CLASS_NAME = 'baremetal'
|
||||
|
@ -53,7 +53,15 @@
|
||||
maintenance: false,
|
||||
maintenance_reason: null,
|
||||
name: null,
|
||||
boot_interface: null,
|
||||
console_interface: null,
|
||||
deploy_interface: null,
|
||||
inspect_interface: null,
|
||||
network_interface: "flat",
|
||||
power_interface: null,
|
||||
raid_interface: null,
|
||||
storage_interface: null,
|
||||
vendor_interface: null,
|
||||
power_state: null,
|
||||
properties: {},
|
||||
provision_state: "enroll",
|
||||
@ -116,6 +124,15 @@
|
||||
// List of images
|
||||
var images = [];
|
||||
|
||||
//list of interfaces returned by ironic node_validate API
|
||||
var defaultNodeInterfaces = [
|
||||
{
|
||||
interface: 'network',
|
||||
result: 'True',
|
||||
reason: ' '
|
||||
}
|
||||
];
|
||||
|
||||
var service = {
|
||||
params: params,
|
||||
init: init,
|
||||
@ -128,7 +145,9 @@
|
||||
getDrivers: getDrivers,
|
||||
getImages: getImages,
|
||||
getPort: getPort,
|
||||
getPortgroup: getPortgroup
|
||||
getPortgroup: getPortgroup,
|
||||
defaultNodeInterfaces: defaultNodeInterfaces,
|
||||
defaultNode: defaultNode
|
||||
};
|
||||
|
||||
var responseCode = {
|
||||
@ -564,7 +583,7 @@
|
||||
$httpBackend.whenGET(/\/api\/ironic\/nodes\/([^\/]+)\/validate$/,
|
||||
undefined,
|
||||
['nodeId'])
|
||||
.respond(responseCode.SUCCESS, []);
|
||||
.respond(responseCode.SUCCESS, defaultNodeInterfaces);
|
||||
|
||||
// Get the currently available drivers
|
||||
$httpBackend.whenGET(/\/api\/ironic\/drivers\/$/)
|
||||
|
@ -146,6 +146,19 @@
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @name horizon.dashboard.admin.ironic.NodeDetailsController.nodeGetInterface
|
||||
* @description Retrieve the current underlying interface for specified interface
|
||||
* type.
|
||||
*
|
||||
* @param {string} interfacename - Name of interface, e.g. power, boot, etc.
|
||||
* @return {string} current name of interface for the requested interface type.
|
||||
*/
|
||||
function nodeGetInterface(interfacename) {
|
||||
return ctrl.node[interfacename + '_interface'] === null ? 'None'
|
||||
: ctrl.node[interfacename + '_interface'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name horizon.dashboard.admin.ironic.NodeDetailsController.retrievePorts
|
||||
* @description Retrieve the ports associated with the current node,
|
||||
@ -202,10 +215,11 @@
|
||||
ironic.validateNode(ctrl.node.uuid).then(function(response) {
|
||||
var nodeValidation = [];
|
||||
ctrl.nodeValidationMap = {};
|
||||
angular.forEach(response.data, function(status) {
|
||||
status.id = status.interface;
|
||||
nodeValidation.push(status);
|
||||
ctrl.nodeValidationMap[status.interface] = status;
|
||||
angular.forEach(response.data, function(interfaceStatus) {
|
||||
interfaceStatus.id = interfaceStatus.interface;
|
||||
ctrl.nodeValidationMap[interfaceStatus.interface] = interfaceStatus;
|
||||
interfaceStatus.hw_interface = nodeGetInterface(interfaceStatus.interface);
|
||||
nodeValidation.push(interfaceStatus);
|
||||
});
|
||||
ctrl.nodeValidation = nodeValidation;
|
||||
});
|
||||
|
@ -233,9 +233,27 @@
|
||||
fail();
|
||||
});
|
||||
ironicBackendMockService.flush();
|
||||
|
||||
var defaultNodeInterfaces = ironicBackendMockService.defaultNodeInterfaces;
|
||||
defaultNodeInterfaces[0].hw_interface = 'flat';
|
||||
defaultNodeInterfaces[0].id = defaultNodeInterfaces[0].interface;
|
||||
expect(ctrl.nodeValidation).toBeDefined();
|
||||
expect(ctrl.nodeValidation).toEqual([]);
|
||||
expect(ctrl.nodeValidation).toEqual(defaultNodeInterfaces);
|
||||
});
|
||||
|
||||
it('should have driver interfaces', function () {
|
||||
var ctrl;
|
||||
createNode()
|
||||
.then(function(node) {
|
||||
ctrl = createController(node);
|
||||
})
|
||||
.catch(function() {
|
||||
fail();
|
||||
});
|
||||
ironicBackendMockService.flush();
|
||||
var interfaceName = ironicBackendMockService.defaultNodeInterfaces[0].interface;
|
||||
var hwInterface = ironicBackendMockService.defaultNode['' + interfaceName + '_interface'];
|
||||
expect(ctrl.node['' + interfaceName + '_interface']).toBeDefined();
|
||||
expect(ctrl.nodeValidation[0].hw_interface).toEqual(hwInterface);
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
@ -319,6 +319,9 @@
|
||||
<th translate class="rsp-p1">
|
||||
Valid
|
||||
</th>
|
||||
<th translate class="rsp-p1" style="white-space:nowrap">
|
||||
Current Interface
|
||||
</th>
|
||||
<th translate class="rsp-p2" style="width:100%;">
|
||||
Reason
|
||||
</th>
|
||||
@ -334,6 +337,10 @@
|
||||
<span ng-switch-when="false" class="fa fa-close text-danger"></span>
|
||||
<span ng-switch-default class="fa fa-minus"></span>
|
||||
</td>
|
||||
<td class="rsp-p1">
|
||||
<span ng-if="item.result">
|
||||
{$ item.hw_interface $}</span>
|
||||
</td>
|
||||
<td class="rsp-p2">
|
||||
{$ item.reason $}
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user