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 from openstack_dashboard.api import base
DEFAULT_IRONIC_API_VERSION = '1.27' DEFAULT_IRONIC_API_VERSION = '1.31'
DEFAULT_INSECURE = False DEFAULT_INSECURE = False
DEFAULT_CACERT = None DEFAULT_CACERT = None
IRONIC_CLIENT_CLASS_NAME = 'baremetal' IRONIC_CLIENT_CLASS_NAME = 'baremetal'

View File

@ -53,7 +53,15 @@
maintenance: false, maintenance: false,
maintenance_reason: null, maintenance_reason: null,
name: null, name: null,
boot_interface: null,
console_interface: null,
deploy_interface: null,
inspect_interface: null,
network_interface: "flat", network_interface: "flat",
power_interface: null,
raid_interface: null,
storage_interface: null,
vendor_interface: null,
power_state: null, power_state: null,
properties: {}, properties: {},
provision_state: "enroll", provision_state: "enroll",
@ -116,6 +124,15 @@
// List of images // List of images
var images = []; var images = [];
//list of interfaces returned by ironic node_validate API
var defaultNodeInterfaces = [
{
interface: 'network',
result: 'True',
reason: ' '
}
];
var service = { var service = {
params: params, params: params,
init: init, init: init,
@ -128,7 +145,9 @@
getDrivers: getDrivers, getDrivers: getDrivers,
getImages: getImages, getImages: getImages,
getPort: getPort, getPort: getPort,
getPortgroup: getPortgroup getPortgroup: getPortgroup,
defaultNodeInterfaces: defaultNodeInterfaces,
defaultNode: defaultNode
}; };
var responseCode = { var responseCode = {
@ -564,7 +583,7 @@
$httpBackend.whenGET(/\/api\/ironic\/nodes\/([^\/]+)\/validate$/, $httpBackend.whenGET(/\/api\/ironic\/nodes\/([^\/]+)\/validate$/,
undefined, undefined,
['nodeId']) ['nodeId'])
.respond(responseCode.SUCCESS, []); .respond(responseCode.SUCCESS, defaultNodeInterfaces);
// Get the currently available drivers // Get the currently available drivers
$httpBackend.whenGET(/\/api\/ironic\/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 * @name horizon.dashboard.admin.ironic.NodeDetailsController.retrievePorts
* @description Retrieve the ports associated with the current node, * @description Retrieve the ports associated with the current node,
@ -205,10 +218,11 @@
ironic.validateNode(ctrl.node.uuid).then(function(response) { ironic.validateNode(ctrl.node.uuid).then(function(response) {
var nodeValidation = []; var nodeValidation = [];
ctrl.nodeValidationMap = {}; ctrl.nodeValidationMap = {};
angular.forEach(response.data, function(status) { angular.forEach(response.data, function(interfaceStatus) {
status.id = status.interface; interfaceStatus.id = interfaceStatus.interface;
nodeValidation.push(status); ctrl.nodeValidationMap[interfaceStatus.interface] = interfaceStatus;
ctrl.nodeValidationMap[status.interface] = status; interfaceStatus.hw_interface = nodeGetInterface(interfaceStatus.interface);
nodeValidation.push(interfaceStatus);
}); });
ctrl.nodeValidation = nodeValidation; ctrl.nodeValidation = nodeValidation;
}); });

View File

@ -233,9 +233,27 @@
fail(); fail();
}); });
ironicBackendMockService.flush(); ironicBackendMockService.flush();
var defaultNodeInterfaces = ironicBackendMockService.defaultNodeInterfaces;
defaultNodeInterfaces[0].hw_interface = 'flat';
defaultNodeInterfaces[0].id = defaultNodeInterfaces[0].interface;
expect(ctrl.nodeValidation).toBeDefined(); 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"> <th translate class="rsp-p1">
Valid Valid
</th> </th>
<th translate class="rsp-p1" style="white-space:nowrap">
Current Interface
</th>
<th translate class="rsp-p2" style="width:100%;"> <th translate class="rsp-p2" style="width:100%;">
Reason Reason
</th> </th>
@ -334,6 +337,10 @@
<span ng-switch-when="false" class="fa fa-close text-danger"></span> <span ng-switch-when="false" class="fa fa-close text-danger"></span>
<span ng-switch-default class="fa fa-minus"></span> <span ng-switch-default class="fa fa-minus"></span>
</td> </td>
<td class="rsp-p1">
<span ng-if="item.result">
{$ item.hw_interface $}</span>
</td>
<td class="rsp-p2"> <td class="rsp-p2">
{$ item.reason $} {$ item.reason $}
</td> </td>