Skip to content

Commit

Permalink
resolved PR conflict with upstream repo and update clone repo ,
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad,Rahman authored and Muhammad,Rahman committed May 17, 2017
2 parents 55a553f + bec8877 commit 7936fed
Show file tree
Hide file tree
Showing 30 changed files with 577 additions and 62 deletions.
2 changes: 1 addition & 1 deletion data/templates/esx-boot-cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bootstate=0
title=Loading ESXi installer
prefix=<%=repo%>
kernel=<%=tbootFile%>
kernelopt=runweasel formatwithmbr com1_baud=115200 com1_Port=<%=comportaddress%> tty2Port=<%=comport%> debugLogToSerial=1 logPort=<%=comport%> ks=<%=installScriptUri%>
kernelopt=runweasel formatwithmbr com1_baud=115200 com1_Port=<%=comportaddress%> tty2Port=<%=comport%> gdbPort=<%=gdbPort%> debugLogToSerial=<%=debugLogToSerial%> logPort=<%=logPort%> ks=<%=installScriptUri%>
modules=<%=moduleFiles%> <%=kargs%>
build=
updated=0
6 changes: 6 additions & 0 deletions data/templates/esx-ks
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1
#Set the ESXi Shell Interactive idle time logout
esxcli system settings advanced set -o /UserVars/ESXiShellInteractiveTimeout -i 3600

#Set Console port redirect
esxcli system settings kernel set -s="gdbPort" -v=<%=gdbPort%>
esxcli system settings kernel set -s="logPort" -v=<%=logPort%>
esxcli system settings kernel set -s="tty2Port" -v=<%=comport%>
esxcli system settings kernel set -s="debugLogToSerial" -v=<%=debugLogToSerial%>

# disable firewall
esxcli network firewall set --default-action false --enabled no

Expand Down
93 changes: 93 additions & 0 deletions data/views/redfish-1.0/redfish.1.0.0.computersystem.1.1.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"@odata.context" : "<%= basepath %>/$metadata#Systems/Members/$entity",
"@odata.id": "<%= url %>",
"@odata.type": "#ComputerSystem.1.0.0.ComputerSystem",
"Oem" : {},
"Id": "<%= identifier %>",
"Description": "",
"Name": "Computer System",
"SystemType": "<%= systemType %>",
"AssetTag": "<%= ohai.data.dmi.chassis.asset_tag %>",
"Manufacturer": "<%= ohai.data.dmi.system.Manufacturer %>",
"Model": "<%= ohai.data.dmi.system.product_name %>",
"SKU": "<%= ohai.data.dmi.system.sku_number %>",
"SerialNumber": "<%= ohai.data.dmi.system.serial_number %>",
"PartNumber": "",
"UUID": "<%= ohai.data.dmi.system.uuid.toLowerCase() %>",
"HostName": "",
"IndicatorLED": "<%= chassisData.uid %>",
"PowerState": "<%= chassisData.power==='Unknown' ? 'On' : chassisData.power %>",
"Boot": {},
"BiosVersion": "<%= ohai.data.dmi.bios.version.trim() %> <%= ohai.data.dmi.bios.bios_revision.trim() %> <%= ohai.data.dmi.bios.release_date.trim() %>",
"ProcessorSummary": {
"Count": <%= ohai.data.cpu.real %>,
"Model": "<%= ohai.data.dmi.processor.version %>",
"Status": {}
},
"MemorySummary": {
<% var memsize = 0; %>
<% dmi.data['Memory Device'].forEach(function(dev) { %>
<% var size = dev.Size.split(' ')[0]; %>
<% var units = dev.Size.split(' ')[1]; %>
<% size = isNaN(size) ? 0 : size; %>
<% size = (units === 'GB') ? size * 1024 : size; %>
<% memsize = memsize + parseInt(size); %>
<% }); %>
<% memsize = memsize / 1024; %>
"TotalSystemMemoryGiB": <%= memsize %>,
"Status": {}
},
"Actions": {
"Oem": {
"RackHD": {
"#RackHD.BootImage": {
"target": "<%=basepath%>/Systems/<%=identifier%>/Actions/RackHD.BootImage"
}
}
},
"#ComputerSystem.Reset": {
"target": "<%=basepath%>/Systems/<%=identifier%>/Actions/ComputerSystem.Reset"
}
},
"Status": {},
"Processors": {
"@odata.id": "<%= basepath %>/Systems/<%= identifier %>/Processors"
},
"EthernetInterfaces": {
"@odata.id": "<%= basepath %>/Systems/<%= identifier %>/EthernetInterfaces"
},
"SimpleStorage": {
"@odata.id": "<%= basepath %>/Systems/<%= identifier %>/SimpleStorage"
},
"LogServices": {
"@odata.id": "<%= basepath %>/Systems/<%= identifier %>/LogServices"
},
"SecureBoot": {
"@odata.id": "<%= basepath %>/Systems/<%= identifier %>/SecureBoot"
},
"Links": {
"Oem": {},
"[email protected]": <%= obm.length %>,
"ManagedBy": [
<% obm.forEach(function(obm, i, arr) { %>
{
"@odata.id": "<%= basepath %>/Managers/<%= obm %>"
}
<%= ( arr.length > 0 && i < arr.length-1 ) ? ',': '' %>
<% }); %>
],
"[email protected]": 0,
"PoweredBy": [],
"[email protected]": 0,
"CooledBy": [],
"[email protected]": <%= chassis.length %>,
"Chassis": [
<% chassis.forEach(function(chassis, i, arr) { %>
{
"@odata.id": "<%= basepath %>/Chassis/<%= chassis %>"
}
<%= ( arr.length > 0 && i < arr.length-1 ) ? ',': '' %>
<% }); %>
]
}
}
8 changes: 8 additions & 0 deletions data/views/redfish-1.0/redfish.1.0.0.secureboot.1.0.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@odata.context": "<%= basepath %>/$metadata#Systems/Links/Members/<%= identifier %>/SecureBoot",
"@odata.id": "<%= url %>",
"@odata.type": "#SecureBoot.1.0.1.SecureBoot",
"SecureBootCurrentBoot": "<%= SecureBoot%>",
"Id": "<%= identifier %>",
"Name": "Secure Boot Current Status"
}
5 changes: 3 additions & 2 deletions debianstatic/on-http/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on-http (2.4.0) UNRELEASED; urgency=low
on-http (2.5.0) UNRELEASED; urgency=low

* Initial release
* release 1.0.0
Expand All @@ -10,5 +10,6 @@ on-http (2.4.0) UNRELEASED; urgency=low
* release 2.2.0
* release 2.3.0
* release 2.4.0
* release 2.5.0

-- rackhd <[email protected]> Fri, 05 May 2017 21:03:07 -0400
-- rackhd <[email protected]> Fri, 12 May 2017 21:03:37 -0400
1 change: 1 addition & 0 deletions lib/api/2.0/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var configPatch = controller(function(req) {

module.exports = {
configGet: configGet,
configPut: configPatch,
configPatch: configPatch
};

3 changes: 1 addition & 2 deletions lib/api/2.0/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ var nodesGetWorkflowById = controller(function(req) {
} else {
newQuery = req.query;
}

return nodes.getNodeWorkflowById(req.swagger.params.identifier.value);
return nodes.getNodeWorkflowById(req.swagger.params.identifier.value, newQuery);
});

var nodesPostWorkflowById = controller({success: 201}, function(req) {
Expand Down
74 changes: 72 additions & 2 deletions lib/api/redfish-1.0/systems.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var nodeApi = injector.get('Http.Services.Api.Nodes');
var controller = injector.get('Http.Services.Swagger').controller;
var Errors = injector.get('Errors');
var moment = require('moment');
var racadm = injector.get('JobUtils.RacadmTool');

var dataFactory = function(identifier, dataName) {
switch(dataName) {
Expand Down Expand Up @@ -186,6 +187,16 @@ var selTranslator = function(selArray, identifier) {
});
};

var getObmSettings = function(nodeId){
return waterline.obms.findByNode(nodeId, 'ipmi-obm-service', true)
.then(function (obmSettings) {
return obmSettings.config;
})
.catch(function(err) {
return (err);
});
};

/**
* Generate a list of systems managed by RackHD
* @param {Object} req
Expand Down Expand Up @@ -239,7 +250,7 @@ var getSystem = controller(function(req, res) {
return obms;
})
}).then(function(data) {
return redfish.render('redfish.2016.3.computersystem.1.3.0.json',
return redfish.render('wsman.1.0.0.computersystem.1.0.0.json',
'ComputerSystem.v1_3_0.json#/definitions/ComputerSystem',
_.merge(options, data));
}).catch(function(error) {
Expand Down Expand Up @@ -1234,6 +1245,63 @@ var addHotspare = controller(function(req,res) {
});
});

var getSecureBoot = controller(function(req, res) {
var identifier = req.swagger.params.identifier.value;
var options = redfish.makeOptions(req, res, identifier);

return getObmSettings(identifier)
.then(function(obmSettings) {
return racadm.runCommand (
obmSettings.host,
obmSettings.user,
obmSettings.password,
'get bios.SysSecurity.SecureBoot'
);
})
.then(function(secureBoot) {
var secureBootSetting = _.words(secureBoot, /SecureBoot=[a-zA-Z]*/);
var statusArray = secureBootSetting[0].split('=');
options.SecureBoot = (statusArray[1]);
return redfish.render('redfish.1.0.0.secureboot.1.0.1.json',
'SecureBoot.v1_0_1.json#/definitions/SecureBoot',
options);
})
.catch(function(error) {
return redfish.handleError(error, res);
});
});

/**
* Set UEFI Secure Boot status for a system
* @param {Object} req
* @param {Object} res
*/
var setSecureBoot = controller(function(req, res) {
var identifier = req.swagger.params.identifier.value;
var command;
if (req.body.SecureBootEnable) {
command = "Enabled";
} else {
command = "Disabled";
}
return getObmSettings(identifier)
.then(function(obmSettings) {
return racadm.runCommand (
obmSettings.host,
obmSettings.user,
obmSettings.password,
'set bios.SysSecurity.SecureBoot ' + command
);
})
.then(function() {
res.status(202).json({"Message": "Successfully Completed Request"});
})
.catch(function(error) {
return redfish.handleError(error, res);
});
});


module.exports = {
listSystems: listSystems,
getSystem: getSystem,
Expand All @@ -1256,5 +1324,7 @@ module.exports = {
doBootImage: doBootImage,
deleteVolume: deleteVolume,
addVolume: addVolume,
addHotspare: addHotspare
addHotspare: addHotspare,
getSecureBoot: getSecureBoot,
setSecureBoot: setSecureBoot
};
5 changes: 4 additions & 1 deletion lib/fittings/rackhd_validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ module.exports = function create(fittingDef) {
var suffix = null;
var service = null;
if (schemaName === 'obm') {
suffix = '.json#/definitions/Obm';
if (context.request.method === "PATCH")
suffix = '.json#/definitions/ObmPatch';
else
suffix = '.json#/definitions/Obm';
service = context.request.body.service;
if (service) {
schemaName = service + suffix;
Expand Down
20 changes: 18 additions & 2 deletions lib/services/http-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ di.annotate(httpServiceFactory,
'_',
'Auth.Services',
di.Injector,
'uuid'
'uuid',
'Constants'
)
);

Expand Down Expand Up @@ -91,7 +92,8 @@ function httpServiceFactory(
_,
authService,
injector,
uuid
uuid,
constants
) {
var logger = Logger.initialize(httpServiceFactory);

Expand Down Expand Up @@ -373,6 +375,20 @@ function httpServiceFactory(
' - ' + req.originalUrl,
data
);
if(res.statusCode > 299 ){
if(configuration.get("minLogLevel") > constants.Logging.Levels.debug){

logger.error(
'http: ' + req.method +
' ' + res.statusCode +
' ' + ms.toFixed(3) +
' - ' + res.locals.uuid +
' - ' + req.originalUrl,
data
);
}
logger.error('http: ' + JSON.stringify(res.body));
}

eventsProtocol.publishHttpResponse(
res.locals.identifier || 'external',
Expand Down
4 changes: 2 additions & 2 deletions lib/services/nodes-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ function nodeApiServiceFactory(
}
};

NodeApiService.prototype.getNodeWorkflowById = function (id) {
NodeApiService.prototype.getNodeWorkflowById = function (id, query) {
return waterline.nodes.needByIdentifier(id)
.then(function () {
return workflowApiService.getWorkflowsByNodeId(id);
return workflowApiService.getWorkflowsByNodeId(id, query);
});
};

Expand Down
5 changes: 3 additions & 2 deletions lib/services/notification-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function NotificationApiServiceFactory(
function extractBmcInfo(amqpMessage, bmcCatalog){
amqpMessage.typeId = bmcCatalog.node;
amqpMessage.data.nodeId = bmcCatalog.node;
amqpMessage.data.macAddress = bmcCatalog.data["MAC Address"];
amqpMessage.data.sourceMacAddress = bmcCatalog.data["MAC Address"];

return amqpMessage;
}
Expand All @@ -252,7 +252,8 @@ function NotificationApiServiceFactory(
amqpMessage.data.ServiceTag = null;
amqpMessage.data.SN = null;

return waterline.catalogs.findMostRecent({source: "ipmi-fru"})
return waterline.catalogs.findMostRecent({"node": amqpMessage.data.nodeId,
source: "ipmi-fru"})
.then(function(catalogIpmiFru){
if(catalogIpmiFru !== undefined && catalogIpmiFru.data.hasOwnProperty("Builtin FRU Device (ID 0)")){// jshint ignore:line
var deviceInfoCatalog = catalogIpmiFru.data["Builtin FRU Device (ID 0)"];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "on-http",
"version": "2.4.0",
"version": "2.5.0",
"description": "OnRack Http Server",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions spec/lib/api/2.0/nodes-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ describe('2.0 Http.Api.Nodes', function () {

var obm = {
service: 'ipmi-obm-service',
nodeId: '123',
config: {
host: '1.2.3.4',
user: 'myuser',
Expand Down
16 changes: 12 additions & 4 deletions spec/lib/api/2.0/obms-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ describe('Http.Api.Obms', function () {
.expect(function (res) {
expect(res.body).to.have.property('title', 'ipmi-obm-service');
expect(res.body).to.have.deep.property(
'definitions.Obm.properties.service').that.is.an('object');
'definitions.ObmBase.properties.service').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.Obm.properties.config').that.is.an('object');
'definitions.ObmBase.properties.config').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.ObmPatch').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.Obm').that.is.an('object');
});
});

Expand All @@ -124,9 +128,13 @@ describe('Http.Api.Obms', function () {
.expect(function (res) {
expect(res.body).to.have.property('title', 'panduit-obm-service');
expect(res.body).to.have.deep.property(
'definitions.Obm.properties.service').that.is.an('object');
'definitions.ObmBase.properties.service').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.ObmBase.properties.config').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.ObmPatch').that.is.an('object');
expect(res.body).to.have.deep.property(
'definitions.Obm.properties.config').that.is.an('object');
'definitions.Obm').that.is.an('object');
});

});
Expand Down
Loading

0 comments on commit 7936fed

Please sign in to comment.