Merge "Display enabled interfaces for underlying driver"

This commit is contained in:
Jenkins 2017-07-27 19:28:48 +00:00 committed by Gerrit Code Review
commit d5e0213463
5 changed files with 67 additions and 9 deletions

View File

@ -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'

View File

@ -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\/$/)

View File

@ -149,6 +149,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,
@ -205,10 +218,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;
});

View File

@ -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);
});
});
})();

View File

@ -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>