package com.lgnortel.r4.r4equipment.management.olt.facility;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.w3c.dom.NamedNodeMap;
import com.lgnortel.lib.logger.LoggerUtil;
import com.lgnortel.netconf.DOM4Confspec;
import com.lgnortel.netconf.NetconfElementModel;
import com.lgnortel.netconf.wdmpon.Fan;
import com.lgnortel.netconf.wdmpon.Msp;
import com.lgnortel.netconf.wdmpon.Oper;
import com.lgnortel.r4.r4equipment.common.ManagementComplexModelIF;
import com.lgnortel.r4.util.R4Constants;
import com.lgnortel.r4.util.R4Util;
import com.tailf.inm.Element;
import com.tailf.inm.ElementChildrenIterator;
/**
* Copyright (c) 2009 LG-Nortel, Inc. All Rights Reserved.
*
* CONFIDENTIALITY AND LIMITED USE: This software, including any software of <br>
* third parties embodied herein, contains code, information, data and concepts <br>
* which are confidential and/or proprietary to LG-Nortel and such third <br>
* parties. This software is licensed for use solely in accordance with the <br>
* terms and conditions of the applicable license agreement with LG-Nortel or <br>
* its authorized distributor, and not for any other use or purpose. No <br>
* redistribution of this software by any party is permitted. <br>
*
* Title: IgmpsGroupStatusModel<br>
* Description: This is a class that GUI uses. And this is a class to set information of ONT port using Netconf interface and get it. <br>
* Copyright: Copyright(c) 2009 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author Moongye, Oh
* @version 0.1
* @created 2009. 7. 1.
* @modified 2009. 7. 1.
* @product EFA R4.0 EMS
* @sw_block
*/
public class OperFan implements ManagementComplexModelIF {
// Log4J
Logger logger = LoggerUtil.getInstance().getLogger(this.getClass().getName());
// table name
public static final String TABLE_NAME = "Show Fan Tray";
// Syntax information
String sMaxOccurs = null;
/**
* Constructor
*/
public OperFan() {}
/**
* Reference : <elem[DOM tree node name] K[DOM tree attribute name]="K1"[DOM tree attribute value]...>
*
* @return table schema information
*/
public List<NetconfElementModel> getTableSchema() {
logger.info("getTableSchema()..");
Vector<NetconfElementModel> columnInfo = new Vector<NetconfElementModel>();
DOM4Confspec dom4Confspec = DOM4Confspec.getInstance();
String[] fFdn = {"msp", "oper", "fan"};
org.w3c.dom.Node fNode = dom4Confspec.findNode(fFdn);
if (fNode == null) {
logger.warning("wdmpon.cs parsing error!");
return null;
}
NamedNodeMap nnm = fNode.getAttributes();
org.w3c.dom.Node fmNode = nnm.getNamedItem("maxOccurs");
if (fmNode != null) {
sMaxOccurs = fmNode.getNodeValue();
logger.info("sMaxOccurs: " + sMaxOccurs);
}
columnInfo = dom4Confspec.getComponentSchema(fNode.getChildNodes(), null, null);
return columnInfo;
}
/**
* Get maxOccurs value for GUI table
*
* @return maxOccurs value
*/
public int getMaxOccurs() {
int maxOccurs = 1;
if (sMaxOccurs != null) {
if (sMaxOccurs.equals(R4Constants.MAX_OCCURS_VALUE_UNBOUNDED)) {
maxOccurs = Integer.MAX_VALUE;
} else {
maxOccurs = Integer.parseInt(sMaxOccurs);
}
}
return maxOccurs;
}
/**
* Make Filter from Msp MO
*
* @return filter
*/
public Element getFilter() {
Msp filter = new Msp();
try {
filter.addOper().addFan();
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception ", e);
}
return filter;
}
/**
* Convert Element into the form that can be used in Table Model
*
* @param element: data to be filtered by GET request
* @param keys: key to get a data among element argument
*
* @return table information for inquery
*/
public Vector<Vector<Object>> makeTableInformation(Element element, Map<String, Object> keys) {
logger.info("makeTableInformation()...");
Vector<Vector<Object>> tblInfo = new Vector<Vector<Object>>();
try {
Msp msp = (Msp) element;
logger.fine(msp.toXMLString());
Oper oper = msp.oper;
if (oper == null) {
logger.info("No oper configuration..");
return tblInfo;
}
ElementChildrenIterator fanIt = oper.fanIterator();
while(fanIt.hasNext()) {
Fan fan = (Fan) fanIt.next();
Object fan_num = fan.getFanNumValue();
Object fan_out = R4Util.validateNullValue(fan.getFanOutValue());
Object fan_fail = R4Util.validateNullValue(fan.getFanFailValue());
Vector<Object> tblRow = new Vector<Object>();
tblRow.addElement(fan_num);
tblRow.addElement(fan_out);
tblRow.addElement(fan_fail);
tblInfo.addElement(tblRow);
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception ", e);
}
return tblInfo;
}
/**
* Construct MO tree & request 'NETCONF-AUDIT' command
*
* @param msp: msp to include data of other tables
* @param rows: data to be existed in the table of GUI interface
*
* @return Msp MO tree for set command
*/
public Msp addTableInfoToMsp(Msp msp, List<Map<String, Object>> rows, Map<String, Object> keys) {
logger.info("IgmpsGroupStatusModel addTableInfoToMsp(): only view..");
return msp;
}
}
|