/**
*
*/
package com.lgnortel.r4.r4equipment.management.olt.qos.oper;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.lgnortel.lib.logger.LoggerUtil;
import com.lgnortel.netconf.DOM4Confspec;
import com.lgnortel.netconf.NetconfElementModel;
import com.lgnortel.netconf.wdmpon.InterfaceQosQueue;
import com.lgnortel.netconf.wdmpon.InterfaceQosQueueEthernet;
import com.lgnortel.netconf.wdmpon.Msp;
import com.lgnortel.netconf.wdmpon.Oper;
import com.lgnortel.r4.r4equipment.common.ManagementTableIF;
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: InterfaceEthernetStatusModel<br>
* Description: <br>
* Copyright: Copyright(c) 2009 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author Sungill, Kim
* @version 0.1
* @created 2009. 8. 27.
* @modified 2009. 8. 27.
* @product EFA R4.0 EMS
* @sw_block
*/
public class OperInterfaceQosQueueEthernetModel implements ManagementTableIF {
// Log4J
Logger logger = LoggerUtil.getInstance().getLogger(this.getClass().getName());
// table name
public static final String TABLE_NAME = "Oper Interface QOS Queue Ethernet";
// Syntax information
String sMaxOccurs = null;
// Column Definition
// private String COLUMN_NAME_INTERFACE = "interface"; // key
private String COLUMN_NAME_FC = "fc"; // key
private String COLUMN_NAME_FC_WEIGHT = "fc-*weight";
private String COLUMN_NAME_FC_QUEUE_LIMIT = "fc-queue-*limit";
private String COLUMN_NAME_FC_QUEUE_LENGTH = "fc-queue-*length";
private String COLUMN_NAME_WFQ_TRANSMIT_FRAME = "wfq-transmit-*frame";
private String COLUMN_NAME_WFQ_DISCARD_FRAME = "wfq-discard-*frame";
private String COLUMN_NAME_FC_MIN_RATE = "fc-min-*rate";
private String COLUMN_NAME_FC_MAX_RATE = "fc-max-*rate";
private String COLUMN_NAME_SCHED_NAME = "sched-*name";
private String COLUMN_NAME_SCHED_MAX_SPEED = "sched-*max-speed";
private String COLUMN_NAME_STORM_NAME = "storm-*name";
private String COLUMN_NAME_STORM_CIR = "storm-*cir";
private String COLUMN_NAME_STORM_CBS = "storm-*cbs";
/**
* Return table schema information
*/
public List<NetconfElementModel> getTableSchema() {
Vector<NetconfElementModel> columnInfo = new Vector<NetconfElementModel>();
// 1. Locate "msp/oper/interface-qos-queue/Ethernet" Node in the DOM tree of wdmpon.cs
DOM4Confspec dom4Confspec = DOM4Confspec.getInstance();
String[] fdn = {"msp", "oper", "interface-qos-queue", "Ethernet"};
org.w3c.dom.Node node = dom4Confspec.findNode(fdn);
if (node == null) {
logger.warning("wdmpon.cs parsing error!");
return null;
}
// 2. Extract leaf nodes' attribute information with 'type' attribute
columnInfo = dom4Confspec.getComponentSchema(node.getChildNodes());
// change column name and width
for (NetconfElementModel oneNem : columnInfo) {
if (oneNem.getElementName().equals(COLUMN_NAME_FC)) {
oneNem.setColWidth(50);
} else if (oneNem.getElementName().equals("fc-weight")) {
oneNem.setElementName(COLUMN_NAME_FC_WEIGHT);
oneNem.setColWidth(50);
} else if (oneNem.getElementName().equals("fc-queue-limit")) {
oneNem.setElementName(COLUMN_NAME_FC_QUEUE_LIMIT);
oneNem.setColWidth(60);
} else if (oneNem.getElementName().equals("fc-queue-length")) {
oneNem.setElementName(COLUMN_NAME_FC_QUEUE_LENGTH);
oneNem.setColWidth(60);
} else if (oneNem.getElementName().equals("wfq-transmit-frame")) {
oneNem.setElementName(COLUMN_NAME_WFQ_TRANSMIT_FRAME);
oneNem.setColWidth(80);
} else if (oneNem.getElementName().equals("wfq-discard-frame")) {
oneNem.setElementName(COLUMN_NAME_WFQ_DISCARD_FRAME);
oneNem.setColWidth(80);
} else if (oneNem.getElementName().equals("fc-min-rate")) {
oneNem.setElementName(COLUMN_NAME_FC_MIN_RATE);
oneNem.setColWidth(60);
} else if (oneNem.getElementName().equals("fc-max-rate")) {
oneNem.setElementName(COLUMN_NAME_FC_MAX_RATE);
oneNem.setColWidth(60);
} else if (oneNem.getElementName().equals("sched-name")) {
oneNem.setElementName(COLUMN_NAME_SCHED_NAME);
oneNem.setColWidth(50);
} else if (oneNem.getElementName().equals("sched-max-speed")) {
oneNem.setElementName(COLUMN_NAME_SCHED_MAX_SPEED);
oneNem.setColWidth(70);
} else if (oneNem.getElementName().equals("storm-name")) {
oneNem.setElementName(COLUMN_NAME_STORM_NAME);
oneNem.setColWidth(50);
} else if (oneNem.getElementName().equals("storm-cir")) {
oneNem.setElementName(COLUMN_NAME_STORM_CIR);
oneNem.setColWidth(50);
} else if (oneNem.getElementName().equals("storm-cbs")) {
oneNem.setElementName(COLUMN_NAME_STORM_CBS);
oneNem.setColWidth(50);
}
}
return columnInfo;
}
/**
* Return maxOccurs value of msp/oper/interface-qos-queue Component
*/
public int getMaxOccurs() {
return 0;
}
/**
* Convert Element into the form that can be used in Table Model
* ==========================================================================================================================================================================================================
* interface fc fc-weight fc-queue-limit fc-queue-length wfq-transmit-frame wfq-discard-frame fc-min-rate fc-max-rate sched-name sched-max-speed storm-name storm-cir storm-bcs
* xs:string xs:string xs:int xs:int xs:int xs:int xs:int xs:int xs:int xs:string xs:int xs:string xs:int xs:int
* ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
* 1/1/1 fc1 1 1 1 1 1 1 1 sched1 1 name1 1 1
* 1/1/2 fc2 2 2 2 2 2 2 2 sched2 2 name2 2 2
* 1/1/3 fc3 3 3 3 3 3 3 3 sched3 3 name3 3 3
* ==========================================================================================================================================================================================================
*/
public Vector<Vector<Object>> makeTableInformation(Element element, Map<String, Object> keys) {
logger.info("makeTableInformation()..");
// return value
Vector<Vector<Object>> tblInfo = new Vector<Vector<Object>>();
try {
// Locate msp/oper MO
Msp msp = (Msp) element;
Oper oper = msp.oper;
if (oper == null) {
logger.info("No msp/oper status..");
return tblInfo;
}
InterfaceQosQueue ifQosQueue = oper.interfaceQosQueue;
if (ifQosQueue == null) {
logger.info("No msp/oper/interface-qos-queue status..");
return tblInfo;
}
// Retrieve children MO list
ElementChildrenIterator ethernetIt = ifQosQueue.ethernetIterator();
while (ethernetIt.hasNext()) {
// msp/oper/interface-qos-queue MO
InterfaceQosQueueEthernet ethernet = (InterfaceQosQueueEthernet) ethernetIt.next();
// extract attribute value
Object ifName = R4Util.validateNullValue(ethernet.getJinterfaceValue());
Object fc = R4Util.validateNullValue(ethernet.getFcValue());
Object fcWeight = R4Util.validateNullValue(ethernet.getFcWeightValue());
Object fcQueueLimit = R4Util.validateNullValue(ethernet.getFcQueueLimitValue());
Object fcQueueLength = R4Util.validateNullValue(ethernet.getFcQueueLengthValue());
Object wfqTransmitFrame = R4Util.validateNullValue(ethernet.getWfqTransmitFrameValue());
Object wfqDiscardFrame = R4Util.validateNullValue(ethernet.getWfqDiscardFrameValue());
Object fcMinRate = R4Util.validateNullValue(ethernet.getFcMinRateValue());
Object fcMaxRate = R4Util.validateNullValue(ethernet.getFcMaxRateValue());
Object schedName = R4Util.validateNullValue(ethernet.getSchedNameValue());
Object schedMaxSpeed = R4Util.validateNullValue(ethernet.getSchedMaxSpeedValue());
Object stormName = R4Util.validateNullValue(ethernet.getStormNameValue());
Object stormCir = R4Util.validateNullValue(ethernet.getStormCirValue());
Object stormCbs = R4Util.validateNullValue(ethernet.getStormCbsValue());
// Make a row
Vector<Object> tblRow = new Vector<Object>();
tblRow.addElement(ifName);
tblRow.addElement(fc);
tblRow.addElement(fcWeight);
tblRow.addElement(fcQueueLimit);
tblRow.addElement(fcQueueLength);
tblRow.addElement(wfqTransmitFrame);
tblRow.addElement(wfqDiscardFrame);
tblRow.addElement(fcMinRate);
tblRow.addElement(fcMaxRate);
tblRow.addElement(schedName);
tblRow.addElement(schedMaxSpeed);
tblRow.addElement(stormName);
tblRow.addElement(stormCir);
tblRow.addElement(stormCbs);
// add a row into the table
tblInfo.addElement(tblRow);
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Exception in makeTableInformation()", e);
}
// return table information
return tblInfo;
}
}
|