本文整理汇总了Java中org.opennms.rancid.RancidNode.setStateUp方法的典型用法代码示例。如果您正苦于以下问题:Java RancidNode.setStateUp方法的具体用法?Java RancidNode.setStateUp怎么用?Java RancidNode.setStateUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.rancid.RancidNode
的用法示例。
在下文中一共展示了RancidNode.setStateUp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSuitableRancidNode
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
private RancidNode getSuitableRancidNode(OnmsNode node) {
//The group should be the foreign source of the node
String group = node.getForeignSource();
if (group == null) return null;
RancidNode r_node = new RancidNode(group, node.getLabel());
String ipaddress = m_onmsNodeIpMap.get(node.getId());
if (m_rancidAdapterConfig.useCategories(ipaddress)) {
log().debug("getSuitableRancidNode: Using Categories to get Rancid devicetype for node: " + node.getLabel());
r_node.setDeviceType(getTypeFromCategories(node));
} else {
log().debug("getSuitableRancidNode: Using Sysoid to get Rancid devicetype for node: " + node.getLabel());
r_node.setDeviceType(getTypeFromSysObjectId(node.getSysObjectId()));
}
r_node.setStateUp(false);
r_node.setComment(RANCID_COMMENT);
r_node.setAuth(getSuitableRancidNodeAuthentication(node));
return r_node;
}
示例2: switchStatus
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
/**
* <p>switchStatus</p>
*
* @param groupName a {@link java.lang.String} object.
* @param deviceName a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean switchStatus(String groupName, String deviceName){
log().debug("InventoryService switchStatus " + groupName+"/"+deviceName);
try {
RancidNode rn = RWSClientApi.getRWSRancidNodeTLO(m_cp, groupName, deviceName);
if (rn.isStateUp()){
log().debug("InventoryService switchStatus :down");
rn.setStateUp(false);
}else {
log().debug("InventoryService switchStatus :up");
rn.setStateUp(true);
}
RWSClientApi.updateRWSRancidNode(m_cp, rn);
}
catch (Throwable e){
log().debug("switchStatus has given exception on node " + groupName+"/"+deviceName + " "+ e.getMessage() );
return false;
}
return true;
}
示例3: updateNodeOnRouterDb
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
/**
* <p>updateNodeOnRouterDb</p>
*
* @param groupName a {@link java.lang.String} object.
* @param deviceName a {@link java.lang.String} object.
* @param deviceType a {@link java.lang.String} object.
* @param status a {@link java.lang.String} object.
* @param comment a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean updateNodeOnRouterDb(String groupName, String deviceName, String deviceType, String status, String comment ){
log().debug("InventoryService updateNodeOnRouterDb: " + groupName+"->"+deviceName+":"+ deviceType+":"+ status + ":" + comment);
try {
RancidNode rn = RWSClientApi.getRWSRancidNodeTLO(m_cp, groupName, deviceName);
rn.setDeviceType(deviceType);
if (comment != null) rn.setComment(comment);
if ("up".equalsIgnoreCase(status)) {
rn.setStateUp(true);
} else if ("down".equalsIgnoreCase(status)) {
rn.setStateUp(false);
}
RWSClientApi.updateRWSRancidNode(m_cp, rn);
}
catch (Throwable e){
log().debug("updateNodeOnRouterDb has given exception on node " + groupName+"/"+deviceName + " "+ e.getMessage() );
return false;
}
return true;
}
示例4: createNodeOnRouterDb
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
/**
* <p>createNodeOnRouterDb</p>
*
* @param groupName a {@link java.lang.String} object.
* @param deviceName a {@link java.lang.String} object.
* @param deviceType a {@link java.lang.String} object.
* @param status a {@link java.lang.String} object.
* @param comment a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean createNodeOnRouterDb(String groupName, String deviceName, String deviceType, String status,String comment ){
log().debug("InventoryService createNodeOnRouterDb: " + groupName+"->"+deviceName+":"+ deviceType+":"+ status + ":" + comment);
try {
RancidNode rn = new RancidNode(groupName,deviceName);
rn.setDeviceType(deviceType);
if (comment != null) rn.setComment(comment);
if ("up".equalsIgnoreCase(status)) {
rn.setStateUp(true);
} else if ("down".equalsIgnoreCase(status)) {
rn.setStateUp(false);
}
RWSClientApi.createRWSRancidNode(m_cp, rn);
}
catch (Throwable e){
log().debug("createNodeOnRouterDb has given exception on node " + groupName+"/"+deviceName + " "+ e.getMessage() );
return false;
}
return true;
}
示例5: updateGroupConfiguration
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
private void updateGroupConfiguration(String group) {
Iterator<Integer> ite = m_onmsNodeRancidNodeMap.keySet().iterator();
while (ite.hasNext()) {
Integer nodeId = ite.next();
RancidNode rnode = m_onmsNodeRancidNodeMap.get(nodeId);
if (group.equals(rnode.getGroup())) {
boolean stateUp = rnode.isStateUp();
rnode.setStateUp(false);
updateConfiguration(nodeId.intValue(), rnode, m_cp, true);
rnode.setStateUp(stateUp);
}
}
}
示例6: updateRancidNodeState
import org.opennms.rancid.RancidNode; //导入方法依赖的package包/类
private void updateRancidNodeState(int nodeid, boolean up) {
RancidNode rnode = m_onmsNodeRancidNodeMap.get(Integer.valueOf(nodeid));
rnode.setStateUp(up);
m_onmsNodeRancidNodeMap.put(nodeid, rnode);
}