📄 ifmib.java
字号:
// Scalar Objects
server.register(this.ifNumber, context);
server.register(this.ifTableLastChange, context);
server.register(this.ifStackLastChange, context);
server.register(this.ifEntry, context);
server.register(this.ifXEntry, context);
server.register(this.ifStackEntry, context);
server.register(this.ifTestEntry, context);
server.register(this.ifRcvAddressEntry, context);
//--AgentGen BEGIN=_registerMOs
//--AgentGen END
}
public void unregisterMOs(MOServer server, OctetString context) {
// Scalar Objects
server.unregister(this.ifNumber, context);
server.unregister(this.ifTableLastChange, context);
server.unregister(this.ifStackLastChange, context);
server.unregister(this.ifEntry, context);
server.unregister(this.ifXEntry, context);
server.unregister(this.ifStackEntry, context);
server.unregister(this.ifTestEntry, context);
server.unregister(this.ifRcvAddressEntry, context);
//--AgentGen BEGIN=_unregisterMOs
//--AgentGen END
}
// Notifications
public void linkDown(NotificationOriginator notificationOriginator,
OctetString context, VariableBinding[] vbs) {
if (vbs.length < 3) {
throw new IllegalArgumentException("Too few notification objects: "+
vbs.length+"<3");
}
if (!(vbs[0].getOid().startsWith(oidTrapVarIfIndex))) {
throw new IllegalArgumentException("Variable 0 has wrong OID: "+vbs[0].getOid()+
" does not start with "+oidTrapVarIfIndex);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[0].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 0 specified: "+
ifEntry.getIndexPart(vbs[0].getOid()));
}
if (!(vbs[1].getOid().startsWith(oidTrapVarIfAdminStatus))) {
throw new IllegalArgumentException("Variable 1 has wrong OID: "+vbs[1].getOid()+
" does not start with "+oidTrapVarIfAdminStatus);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[1].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 1 specified: "+
ifEntry.getIndexPart(vbs[1].getOid()));
}
if (!(vbs[2].getOid().startsWith(oidTrapVarIfOperStatus))) {
throw new IllegalArgumentException("Variable 2 has wrong OID: "+vbs[2].getOid()+
" does not start with "+oidTrapVarIfOperStatus);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[2].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 2 specified: "+
ifEntry.getIndexPart(vbs[2].getOid()));
}
notificationOriginator.notify(context, oidLinkDown, vbs);
}
public void linkUp(NotificationOriginator notificationOriginator,
OctetString context, VariableBinding[] vbs) {
if (vbs.length < 3) {
throw new IllegalArgumentException("Too few notification objects: "+
vbs.length+"<3");
}
if (!(vbs[0].getOid().startsWith(oidTrapVarIfIndex))) {
throw new IllegalArgumentException("Variable 0 has wrong OID: "+vbs[0].getOid()+
" does not start with "+oidTrapVarIfIndex);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[0].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 0 specified: "+
ifEntry.getIndexPart(vbs[0].getOid()));
}
if (!(vbs[1].getOid().startsWith(oidTrapVarIfAdminStatus))) {
throw new IllegalArgumentException("Variable 1 has wrong OID: "+vbs[1].getOid()+
" does not start with "+oidTrapVarIfAdminStatus);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[1].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 1 specified: "+
ifEntry.getIndexPart(vbs[1].getOid()));
}
if (!(vbs[2].getOid().startsWith(oidTrapVarIfOperStatus))) {
throw new IllegalArgumentException("Variable 2 has wrong OID: "+vbs[2].getOid()+
" does not start with "+oidTrapVarIfOperStatus);
}
if (!ifEntryIndex.isValidIndex(ifEntry.getIndexPart(vbs[2].getOid()))) {
throw new IllegalArgumentException("Illegal index for variable 2 specified: "+
ifEntry.getIndexPart(vbs[2].getOid()));
}
notificationOriginator.notify(context, oidLinkUp, vbs);
}
// Scalars
// Value Validators
/**
* The <code>IfAdminStatusValidator</code> implements the value
* validation for <code>IfAdminStatus</code>.
*/
static class IfAdminStatusValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifAdminStatus::validate
//--AgentGen END
}
}
/**
* The <code>IfLinkUpDownTrapEnableValidator</code> implements the value
* validation for <code>IfLinkUpDownTrapEnable</code>.
*/
static class IfLinkUpDownTrapEnableValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifLinkUpDownTrapEnable::validate
//--AgentGen END
}
}
/**
* The <code>IfPromiscuousModeValidator</code> implements the value
* validation for <code>IfPromiscuousMode</code>.
*/
static class IfPromiscuousModeValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifPromiscuousMode::validate
//--AgentGen END
}
}
/**
* The <code>IfAliasValidator</code> implements the value
* validation for <code>IfAlias</code>.
*/
static class IfAliasValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 0) && (os.length() <= 64)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=ifAlias::validate
//--AgentGen END
}
}
/**
* The <code>IfStackStatusValidator</code> implements the value
* validation for <code>IfStackStatus</code>.
*/
static class IfStackStatusValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifStackStatus::validate
//--AgentGen END
}
}
/**
* The <code>IfTestIdValidator</code> implements the value
* validation for <code>IfTestId</code>.
*/
static class IfTestIdValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
long v = ((Integer32)newValue).getValue();
if (!(((v >= 0L) && (v <= 2147483647L)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_VALUE);
return;
}
//--AgentGen BEGIN=ifTestId::validate
//--AgentGen END
}
}
/**
* The <code>IfTestStatusValidator</code> implements the value
* validation for <code>IfTestStatus</code>.
*/
static class IfTestStatusValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifTestStatus::validate
//--AgentGen END
}
}
/**
* The <code>IfTestTypeValidator</code> implements the value
* validation for <code>IfTestType</code>.
*/
static class IfTestTypeValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifTestType::validate
//--AgentGen END
}
}
/**
* The <code>IfTestOwnerValidator</code> implements the value
* validation for <code>IfTestOwner</code>.
*/
static class IfTestOwnerValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 0) && (os.length() <= 255)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=ifTestOwner::validate
//--AgentGen END
}
}
/**
* The <code>IfRcvAddressStatusValidator</code> implements the value
* validation for <code>IfRcvAddressStatus</code>.
*/
static class IfRcvAddressStatusValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifRcvAddressStatus::validate
//--AgentGen END
}
}
/**
* The <code>IfRcvAddressTypeValidator</code> implements the value
* validation for <code>IfRcvAddressType</code>.
*/
static class IfRcvAddressTypeValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
//--AgentGen BEGIN=ifRcvAddressType::validate
//--AgentGen END
}
}
// Rows and Factories
public class IfEntryRow extends DefaultMOMutableRow2PC {
public IfEntryRow(OID index, Variable[] values) {
super(index, values);
}
public Integer32 getIfIndex() {
return (Integer32) getValue(idxIfIndex);
}
public void setIfIndex(Integer32 newValue) {
setValue(idxIfIndex, newValue);
}
public OctetString getIfDescr() {
return (OctetString) getValue(idxIfDescr);
}
public void setIfDescr(OctetString newValue) {
setValue(idxIfDescr, newValue);
}
public Integer32 getIfType() {
return (Integer32) getValue(idxIfType);
}
public void setIfType(Integer32 newValue) {
setValue(idxIfType, newValue);
}
public Integer32 getIfMtu() {
return (Integer32) getValue(idxIfMtu);
}
public void setIfMtu(Integer32 newValue) {
setValue(idxIfMtu, newValue);
}
public Gauge32 getIfSpeed() {
return (Gauge32) getValue(idxIfSpeed);
}
public void setIfSpeed(Gauge32 newValue) {
setValue(idxIfSpeed, newValue);
}
public OctetString getIfPhysAddress() {
return (OctetString) getValue(idxIfPhysAddress);
}
public void setIfPhysAddress(OctetString newValue) {
setValue(idxIfPhysAddress, newValue);
}
public Integer32 getIfAdminStatus() {
return (Integer32) getValue(idxIfAdminStatus);
}
public void setIfAdminStatus(Integer32 newValue) {
setValue(idxIfAdminStatus, newValue);
}
public Integer32 getIfOperStatus() {
return (Integer32) getValue(idxIfOperStatus);
}
public void setIfOperStatus(Integer32 newValue) {
setValue(idxIfOperStatus, newValue);
}
public TimeTicks getIfLastChange() {
return (TimeTicks) getValue(idxIfLastChange);
}
public void setIfLastChange(TimeTicks newValue) {
setValue(idxIfLastChange, newValue);
}
public Counter32 getIfInOctets() {
return (Counter32) getValue(idxIfInOctets);
}
public void setIfInOctets(Counter32 newValue) {
setValue(idxIfInOctets, newValue);
}
public Counter32 getIfInUcastPkts() {
return (Counter32) getValue(idxIfInUcastPkts);
}
public void setIfInUcastPkts(Counter32 newValue) {
setValue(idxIfInUcastPkts, newValue);
}
public Counter32 getIfInNUcastPkts() {
return (Counter32) getValue(idxIfInNUcastPkts);
}
public void setIfInNUcastPkts(Counter32 newValue) {
setValue(idxIfInNUcastPkts, newValue);
}
public Counter32 getIfInDiscards() {
return (Counter32) getValue(idxIfInDiscards);
}
public void setIfInDiscards(Counter32 newValue) {
setValue(idxIfInDiscards, newValue);
}
public Counter32 getIfInErrors() {
return (Counter32) getValue(idxIfInErrors);
}
public void setIfInErrors(Counter32 newValue) {
setValue(idxIfInErrors, newValue);
}
public Counter32 getIfInUnknownProtos() {
return (Counter32) getValue(idxIfInUnknownProtos);
}
public void setIfInUnknownProtos(Counter32 newValue) {
setValue(idxIfInUnknownProtos, newValue);
}
public Counter32 getIfOutOctets() {
return (Counter32) getValue(idxIfOutOctets);
}
public void setIfOutOctets(Counter32 newValue) {
setValue(idxIfOutOctets, newValue);
}
public Counter32 getIfOutUcastPkts() {
return (Counter32) getValue(idxIfOutUcastPkts);
}
public void setIfOutUcastPkts(Counter32 newValue) {
setValue(idxIfOutUcastPkts, newValue);
}
public Counter32 getIfOutNUcastPkts() {
return (Counter32) getValue(idxIfOutNUcastPkts);
}
public void setIfOutNUcastPkts(Counter32 newValue) {
setValue(idxIfOutNUcastPkts, newValue);
}
public Counter32 getIfOutDiscards() {
return (Counter32) getValue(idxIfOutDiscards);
}
public void setIfOutDiscards(Counter32 newValue) {
setValue(idxIfOutDiscards, newValue);
}
public Counter32 getIfOutErrors() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -