diff --git a/ironic_ui/api/ironic.py b/ironic_ui/api/ironic.py index 8a1a0ba4..d247669a 100755 --- a/ironic_ui/api/ironic.py +++ b/ironic_ui/api/ironic.py @@ -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' diff --git a/ironic_ui/static/dashboard/admin/ironic/ironic.backend-mock.service.js b/ironic_ui/static/dashboard/admin/ironic/ironic.backend-mock.service.js index 2901f347..98d67ffc 100644 --- a/ironic_ui/static/dashboard/admin/ironic/ironic.backend-mock.service.js +++ b/ironic_ui/static/dashboard/admin/ironic/ironic.backend-mock.service.js @@ -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\/$/) diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js index 28ebf3b1..afba8689 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js @@ -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; }); diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js index 04e230a7..abe2aedd 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js @@ -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); }); }); })(); diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html index 0950bc0e..2d10e1ad 100644 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html @@ -319,6 +319,9 @@ Valid + + Current Interface + Reason @@ -334,6 +337,10 @@ + + + {$ item.hw_interface $} + {$ item.reason $}