diff options
author | njames <nkskjames@gmail.com> | 2015-10-24 22:56:52 -0500 |
---|---|---|
committer | njames <nkskjames@gmail.com> | 2015-10-24 22:56:52 -0500 |
commit | 79107c6705ca38f2448acd8c91d235dcea25fa79 (patch) | |
tree | fde6670aa0306956282d618d77365c5e9ff0928d /src | |
parent | 2595b33cb7da037622b2f873bc80f56309319912 (diff) | |
download | serverwiz-79107c6705ca38f2448acd8c91d235dcea25fa79.tar.gz serverwiz-79107c6705ca38f2448acd8c91d235dcea25fa79.zip |
Start using hostboot attribute_types.xml and attribute_types_hb.xml
directly in build
Diffstat (limited to 'src')
-rw-r--r-- | src/com/ibm/ServerWizard2/MainDialog.java | 20 | ||||
-rw-r--r-- | src/com/ibm/ServerWizard2/SystemModel.java | 104 | ||||
-rw-r--r-- | src/com/ibm/ServerWizard2/TargetWizardController.java | 49 |
3 files changed, 0 insertions, 173 deletions
diff --git a/src/com/ibm/ServerWizard2/MainDialog.java b/src/com/ibm/ServerWizard2/MainDialog.java index a68ccf1..08c287d 100644 --- a/src/com/ibm/ServerWizard2/MainDialog.java +++ b/src/com/ibm/ServerWizard2/MainDialog.java @@ -425,26 +425,6 @@ public class MainDialog extends Dialog { 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 diff --git a/src/com/ibm/ServerWizard2/SystemModel.java b/src/com/ibm/ServerWizard2/SystemModel.java index f6bf50a..4e801cc 100644 --- a/src/com/ibm/ServerWizard2/SystemModel.java +++ b/src/com/ibm/ServerWizard2/SystemModel.java @@ -75,110 +75,6 @@ public class SystemModel { 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>(); diff --git a/src/com/ibm/ServerWizard2/TargetWizardController.java b/src/com/ibm/ServerWizard2/TargetWizardController.java index e55e9ba..0a6f0a1 100644 --- a/src/com/ibm/ServerWizard2/TargetWizardController.java +++ b/src/com/ibm/ServerWizard2/TargetWizardController.java @@ -60,55 +60,6 @@ public class TargetWizardController implements PropertyChangeListener { //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); } |