summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjames <njames@us.ibm.com>2015-02-21 18:50:27 -0600
committernjames <njames@us.ibm.com>2015-02-21 18:50:27 -0600
commit921c53141afa0bac37f0bed3ac3d67f0802ac0db (patch)
tree16205616ac685de3653d81bd6e5cac972494ee80
parent8e69f0bdd5a87377f98fbc897561751af9684ca2 (diff)
downloadserverwiz-921c53141afa0bac37f0bed3ac3d67f0802ac0db.tar.gz
serverwiz-921c53141afa0bac37f0bed3ac3d67f0802ac0db.zip
auto assigns ipmi instance number and fru name
-rw-r--r--build/serverwiz2_linux64.jarbin3182902 -> 3183049 bytes
-rw-r--r--build/serverwiz2_win32.jarbin3192702 -> 3192837 bytes
-rw-r--r--build/serverwiz2_win64.jarbin3970663 -> 3970775 bytes
-rw-r--r--scripts/Targets.pm2
-rw-r--r--scripts/processMrw.pl4
-rw-r--r--src/com/ibm/ServerWizard2/SystemModel.java52
-rw-r--r--src/com/ibm/ServerWizard2/Target.java7
-rw-r--r--src/com/ibm/ServerWizard2/TargetWizardController.java15
-rw-r--r--xml/attribute_types_mrw.xml2
-rw-r--r--xml/target_types_mrw.xml14
10 files changed, 67 insertions, 29 deletions
diff --git a/build/serverwiz2_linux64.jar b/build/serverwiz2_linux64.jar
index b18a607..cf1436d 100644
--- a/build/serverwiz2_linux64.jar
+++ b/build/serverwiz2_linux64.jar
Binary files differ
diff --git a/build/serverwiz2_win32.jar b/build/serverwiz2_win32.jar
index 0fc9319..9a5d005 100644
--- a/build/serverwiz2_win32.jar
+++ b/build/serverwiz2_win32.jar
Binary files differ
diff --git a/build/serverwiz2_win64.jar b/build/serverwiz2_win64.jar
index 54530dc..b152f7e 100644
--- a/build/serverwiz2_win64.jar
+++ b/build/serverwiz2_win64.jar
Binary files differ
diff --git a/scripts/Targets.pm b/scripts/Targets.pm
index 4df2f4c..29f688d 100644
--- a/scripts/Targets.pm
+++ b/scripts/Targets.pm
@@ -196,7 +196,7 @@ sub printAttribute
$filter{ENTITY_INSTANCE} = 1;
$filter{MBA_NUM} = 1;
$filter{IPMI_INSTANCE} = 1;
- $filter{IPMI_NAME} = 1;
+ $filter{FRU_NAME} = 1;
$filter{INSTANCE_ID} = 1;
#$filter{ADC_CHANNEL_SENSOR_NUMBERS} = 1;
$filter{IO_CONFIG_SELECT} = 1;
diff --git a/scripts/processMrw.pl b/scripts/processMrw.pl
index 071506e..59a1eff 100644
--- a/scripts/processMrw.pl
+++ b/scripts/processMrw.pl
@@ -193,9 +193,9 @@ sub processIpmiSensors {
my $instance=$targetObj->getAttribute($target,"IPMI_INSTANCE");
my $name="";
- if (!$targetObj->isBadAttribute($target,"IPMI_NAME"))
+ if (!$targetObj->isBadAttribute($target,"FRU_NAME"))
{
- $name=$targetObj->getAttribute($target,"IPMI_NAME");
+ $name=$targetObj->getAttribute($target,"FRU_NAME");
}
my $fru_id="N/A";
if (!$targetObj->isBadAttribute($target,"FRU_ID"))
diff --git a/src/com/ibm/ServerWizard2/SystemModel.java b/src/com/ibm/ServerWizard2/SystemModel.java
index 5d4d64e..d4c6cf4 100644
--- a/src/com/ibm/ServerWizard2/SystemModel.java
+++ b/src/com/ibm/ServerWizard2/SystemModel.java
@@ -103,16 +103,14 @@ public class SystemModel {
if (sdrs!=null) {
for (SdrRecord sdr:sdrs ) {
if (sdr.getSensorType()==sensorType) {
- String msg = "IMPORT MATCH: "+instPath+"; "+sdr.toString();
- ServerWizard2.LOGGER.info(msg);
+ 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 (childTarget.getAttribute("MRW_TYPE").equals("IPMI_SENSOR")) {
- String msg = ">>IMPORT WARNING: "+instPath+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
- ServerWizard2.LOGGER.warning(msg);
+ String msg = ">> WARNING: "+childTarget.getName()+"; Entity ID: "+entityId+"; Entity Inst: "+entityInst+" not found in SDR";
this.logData=this.logData+msg+"\n";
}
}
@@ -120,13 +118,38 @@ public class SystemModel {
}
}
}
- public void importSdr2(Target target, HashMap<Integer, HashMap<Integer, Vector<SdrRecord>>> sdrLookup,HashMap<String,Boolean>instCheck,String path) throws Exception {
+ 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) {
@@ -134,8 +157,8 @@ public class SystemModel {
if (instStr!=null && instStr.value!=null) {
if (!instStr.value.isEmpty()) {
entityInst = Integer.parseInt(instStr.value);
- String key = target.getName()+":"+entityInst;
- Boolean instFound = instCheck.get(key);
+ //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.");
@@ -147,7 +170,8 @@ public class SystemModel {
}
} 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);
@@ -349,6 +373,18 @@ public class SystemModel {
return f;
}
+ public Boolean isGlobalSetting(String path, String attribute) {
+ HashMap<String, Field> s = globalSettings.get(path);
+ if (s == null) {
+ return false;
+ }
+ Field f=s.get(attribute);
+ if (f==null) {
+ return false;
+ }
+ return true;
+ }
+
public Field getGlobalSetting(String path, String attribute) {
HashMap<String, Field> s = globalSettings.get(path);
if (s == null) {
diff --git a/src/com/ibm/ServerWizard2/Target.java b/src/com/ibm/ServerWizard2/Target.java
index bd17995..0d41e4e 100644
--- a/src/com/ibm/ServerWizard2/Target.java
+++ b/src/com/ibm/ServerWizard2/Target.java
@@ -186,7 +186,12 @@ public class Target implements Comparable<Target>, java.io.Serializable {
}
return attributes.get(attribute).getValue().getValue();
}
-
+ public boolean isAttribute(String attribute) {
+ if (attributes.get(attribute) == null) {
+ return false;
+ }
+ return true;
+ }
public void copyAttributesFromParent(Target s) {
for (Map.Entry<String, Attribute> entry : s.getAttributes().entrySet()) {
String key = entry.getKey();
diff --git a/src/com/ibm/ServerWizard2/TargetWizardController.java b/src/com/ibm/ServerWizard2/TargetWizardController.java
index 3695265..78afa9c 100644
--- a/src/com/ibm/ServerWizard2/TargetWizardController.java
+++ b/src/com/ibm/ServerWizard2/TargetWizardController.java
@@ -83,6 +83,7 @@ public class TargetWizardController implements PropertyChangeListener {
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();
@@ -100,22 +101,18 @@ public class TargetWizardController implements PropertyChangeListener {
}
sdrRecords.add(s);
sdrs.add(s);
- ServerWizard2.LOGGER.info(s.toString());
+ model.logData=model.logData+s.toString()+"\n";
}
- } catch (Exception e) {
- MessageDialog.openError(null, "SDR Import Error", e.getMessage());
- e.printStackTrace();
- }
- try {
- HashMap<String,Boolean> instCheck = new HashMap<String,Boolean>();
- model.logData="";
+ 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) {
- ServerWizard2.LOGGER.severe(e.getMessage());
MessageDialog.openError(null, "SDR Import Error", e.getMessage());
+ ServerWizard2.LOGGER.info(model.logData);
e.printStackTrace();
}
}
diff --git a/xml/attribute_types_mrw.xml b/xml/attribute_types_mrw.xml
index 52ef512..66f40df 100644
--- a/xml/attribute_types_mrw.xml
+++ b/xml/attribute_types_mrw.xml
@@ -1351,7 +1351,7 @@
<global />
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
<description>Maps to IPMI Sensor name</description>
<simpleType>
<string></string>
diff --git a/xml/target_types_mrw.xml b/xml/target_types_mrw.xml
index 98feb4d..0bb9dc0 100644
--- a/xml/target_types_mrw.xml
+++ b/xml/target_types_mrw.xml
@@ -15,7 +15,7 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
<attribute>
<id>FRU_ID</id>
@@ -511,14 +511,14 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
<attribute>
<id>FRU_ID</id>
<default></default>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
<default></default>
</attribute>
</targetType>
@@ -779,7 +779,7 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
<attribute>
<id>FRU_ID</id>
@@ -1117,7 +1117,7 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
</targetType>
@@ -1454,7 +1454,7 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
</targetType>
@@ -1520,7 +1520,7 @@
<id>IPMI_INSTANCE</id>
</attribute>
<attribute>
- <id>IPMI_NAME</id>
+ <id>FRU_NAME</id>
</attribute>
<attribute>
<id>FRU_ID</id>
OpenPOWER on IntegriCloud