Skip to content

Commit

Permalink
Start using hostboot attribute_types.xml and attribute_types_hb.xml
Browse files Browse the repository at this point in the history
directly in build
  • Loading branch information
nkskjames committed Oct 25, 2015
1 parent 2595b33 commit 79107c6
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 17,389 deletions.
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.source=1.7
5 changes: 3 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<project>
<property name="one-jar.dist.dir" value="c:/one-jar-ant"/>
<property name="plugin.dir" value="C:\eclipse\plugins"/>
<property name="hbxml.dir" value="C:\Users\IBM_ADMIN\git\hostboot\src\usr\targeting\common\xmltohb"/>
<import file="${one-jar.dist.dir}/one-jar-ant-task.xml" optional="true" />
<path id="classpath">
<fileset dir="lib" includes="**/*.jar"/>
Expand Down Expand Up @@ -68,8 +69,8 @@
</lib>
</one-jar>
<zip destfile="build/serverwiz2_lib.zip">
<zipfileset dir="xml/" includes="attribute_types.xml" fullpath="xml/attribute_types.xml"/>
<zipfileset dir="xml/" includes="attribute_types_hb.xml" fullpath="xml/attribute_types_hb.xml"/>
<zipfileset dir="${hbxml.dir}/" includes="attribute_types.xml" fullpath="xml/attribute_types.xml"/>
<zipfileset dir="${hbxml.dir}/" includes="attribute_types_hb.xml" fullpath="xml/attribute_types_hb.xml"/>
<zipfileset dir="xml/" includes="attribute_types_mrw.xml" fullpath="xml/attribute_types_mrw.xml"/>
<zipfileset dir="xml/" includes="target_types_mrw.xml" fullpath="xml/target_types_mrw.xml"/>
<zipfileset dir="xml/" includes="target_instances_v3.xml" fullpath="xml/target_instances_v3.xml"/>
Expand Down
20 changes: 0 additions & 20 deletions src/com/ibm/ServerWizard2/MainDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,26 +425,6 @@ public void widgetSelected(SelectionEvent e) {
btnSaveAs.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
btnSaveAs.setEnabled(true);

Button btnImportSDR = createButton(parent, IDialogConstants.NO_ID, "Import SDR", false);
btnImportSDR.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Button b = (Button) e.getSource();
FileDialog fdlg = new FileDialog(b.getShell(), SWT.OPEN);
String ext[] = { "*.xml" };
fdlg.setFilterExtensions(ext);
String filename = fdlg.open();
if (filename == null) {
return;
}
controller.importSDR(filename);
setDirtyState(true);
}
});

btnImportSDR.setFont(SWTResourceManager.getFont("Arial", 9, SWT.NORMAL));
btnImportSDR.setEnabled(true);

btnRunChecks = createButton(parent, IDialogConstants.NO_ID, "Run Checks", false);
btnRunChecks.addSelectionListener(new SelectionAdapter() {
@Override
Expand Down
104 changes: 0 additions & 104 deletions src/com/ibm/ServerWizard2/SystemModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,110 +75,6 @@ public Vector<Target> getTargetList() {
public Collection<Target> getTargetInstances() {
return targetInstances.values();
}
public void updateIpmiTarget(Target target,int l_entityInst,HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,
String path) throws Exception {
for (String child : target.getAllChildren()) {
int entityInst=l_entityInst;
Target childTarget = this.getTarget(child);
if (childTarget.getAttribute("MRW_TYPE").equals("IPMI_SENSOR") ||
childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
if (!childTarget.getAttribute("IPMI_INSTANCE").isEmpty()) {
entityInst=Integer.decode(childTarget.getAttribute("IPMI_INSTANCE"));
}
if (childTarget.getAttribute("MRW_TYPE").equals("APSS_SENSOR")) {
String id=childTarget.getAttribute("ADC_CHANNEL_ASSIGNMENT");
if (!id.isEmpty()) {
entityInst=Integer.decode(id)+1;
}
}
String instPath=path+"/"+childTarget.getName();
String entityIdStr = childTarget.getAttribute("IPMI_ENTITY_ID");
String sensorTypeStr = childTarget.getAttribute("IPMI_SENSOR_TYPE");
int entityId = Integer.decode(entityIdStr);
int sensorType = Integer.decode(sensorTypeStr);
HashMap<Integer,Vector<SdrRecord>> sdrMap= sdrLookup.get(entityId);
if (sdrMap!=null) {
Vector<SdrRecord> sdrs = sdrMap.get(entityInst);
if (sdrs!=null) {
for (SdrRecord sdr:sdrs ) {
if (sdr.getSensorType()==sensorType) {
String msg = "MATCH: "+childTarget.getName()+"; "+sdr.toString();
this.logData=this.logData+msg+"\n";
this.setGlobalSetting(instPath, "IPMI_SENSOR_ID", String.format("0x%02X", sdr.getSensorId()));
}
}
} else {
if (entityInst!=-1) {
String msg = ">> WARNING: "+childTarget.getName()+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
this.logData=this.logData+msg+"\n";
this.setGlobalSetting(instPath, "IPMI_SENSOR_ID", "");
}
}
}
}
}
}
public void importSdr2(Target target, HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,HashMap<String,Integer>instCheck,String path) throws Exception {
if (target==null) {
for (Target t : this.rootTargets) {
this.importSdr2(t,sdrLookup,instCheck,"/");
}
} else {
String instPath = path+target.getName();
String type = target.getAttribute("TYPE");
if (type.equals("APSS")) {
String msg="\n========================================================\n";
msg=msg+"IPMI TARGET: "+instPath+" (APSS)";
this.logData=this.logData+msg+"\n";
this.updateIpmiTarget(target,-1,sdrLookup,instPath);
} else {
if (target.isAttribute("FRU_NAME")) {
Integer entityInst = instCheck.get(type);
if (entityInst == null) {
entityInst=-1;
}
entityInst++;
instCheck.put(type,entityInst);
this.setGlobalSetting(instPath, "IPMI_INSTANCE", entityInst.toString());
if (this.getGlobalSetting(instPath, "FRU_NAME").value.isEmpty()) {
this.setGlobalSetting(instPath,"FRU_NAME", type+entityInst);
}
String msg="\n========================================================\n";
msg=msg+"IPMI TARGET: "+instPath+"; IPMI_INSTANCE="+entityInst+"; FRU_NAME="+this.getGlobalSetting(instPath, "FRU_NAME").value;
this.logData=this.logData+msg+"\n";
this.updateIpmiTarget(target,entityInst,sdrLookup,instPath);
}
}
/*
HashMap<String,Field> inst = this.globalSettings.get(instPath);
int entityInst=0;
if (inst!=null) {
Field instStr=inst.get("IPMI_INSTANCE");
if (instStr!=null && instStr.value!=null) {
if (!instStr.value.isEmpty()) {
entityInst = Integer.parseInt(instStr.value);
//String key = target.getName()+":"+entityInst;
Boolean = instCheck.get(target.getAttribute("TYPE"));
if (instFound!=null) {
throw new Exception("Duplicate instance id for instance type: \n"+instPath+
"\n. Make sure each instance has a unique IPMI_INSTANCE attribute.");
} else {
instCheck.put(key,true);
}
this.updateIpmiTarget(target,entityInst,sdrLookup,instPath);
}
}
} else if(target.getAttribute("TYPE").equals("APSS")) {
this.updateIpmiTarget(target,-1,sdrLookup,instPath);
}*/

path=path+target.getName()+"/";
for (String child : target.getChildren()) {
Target childTarget = this.getTarget(child);
this.importSdr2(childTarget, sdrLookup,instCheck,path);
}
}
}

public Vector<Target> getConnectionCapableTargets() {
Vector<Target> cards = new Vector<Target>();
Expand Down
49 changes: 0 additions & 49 deletions src/com/ibm/ServerWizard2/TargetWizardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,55 +60,6 @@ public void initModel() throws Exception {
//model.addTarget(null, sys);
}

public void importSDR(String filename) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

Vector<SdrRecord> sdrs = new Vector<SdrRecord>();
HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>> sdrLookup = new HashMap<Integer,HashMap<Integer,Vector<SdrRecord>>>();

try {
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new XmlHandler());

Document document = builder.parse(filename);

NodeList deviceList = document
.getElementsByTagName("device");

model.logData="Importing SDR's...\n";
for (int i = 0; i < deviceList.getLength(); ++i) {
Element deviceElement = (Element) deviceList.item(i);
SdrRecord s = new SdrRecord();
s.readXML(deviceElement);

HashMap<Integer,Vector<SdrRecord>> idLookup = sdrLookup.get(s.getEntityId());
if (idLookup==null) {
idLookup = new HashMap<Integer,Vector<SdrRecord>>();
sdrLookup.put(s.getEntityId(), idLookup);
}
Vector<SdrRecord> sdrRecords = idLookup.get(s.getEntityInstance());
if (sdrRecords==null) {
sdrRecords = new Vector<SdrRecord>();
idLookup.put(s.getEntityInstance(), sdrRecords);
}
sdrRecords.add(s);
sdrs.add(s);
model.logData=model.logData+s.toString()+"\n";
}
HashMap<String,Integer> instCheck = new HashMap<String,Integer>();
model.logData=model.logData+"Matching SDR's to targets...\n";
model.importSdr2(null,sdrLookup,instCheck,"");
LogViewerDialog dlg = new LogViewerDialog(null);
ServerWizard2.LOGGER.info(model.logData);
dlg.setData(model.logData);
dlg.open();
} catch (Exception e) {
MessageDialog.openError(null, "SDR Import Error", e.getMessage());
ServerWizard2.LOGGER.info(model.logData);
e.printStackTrace();
}
}

public Target getTargetModel(String type) {
return model.getTargetModel(type);
}
Expand Down
Loading

0 comments on commit 79107c6

Please sign in to comment.