Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions object_groups/ietf/bgp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ietf_bgp:
# BGP
- BGP4-MIB::bgp
- BGP4-MIB::bgpPeerEntry
- BGP4-MIB::bgp4PathAttrEntry
28 changes: 28 additions & 0 deletions object_groups/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ all:
- ADSL-LINE-MIB::adslAturChanPerfDataEntry
- BGP4-MIB::bgp
- BGP4-MIB::bgpPeerEntry
- BGP4-MIB::bgp4PathAttrEntry
- BRIDGE-MIB::dot1dBase
- BRIDGE-MIB::dot1dBasePortEntry
- BRIDGE-MIB::dot1dStp
Expand Down Expand Up @@ -342,6 +343,33 @@ all:
- ANDOVER-CONTROLS-MIB::accSystem

# APC
- CPDU-MIB::cPDU
- CPDU-MIB::pduNamePlateEntry
- CPDU-MIB::pduUnitConfigEntry
- CPDU-MIB::pduUnitPropertiesEntry
- CPDU-MIB::pduUnitStatusEntry
- CPDU-MIB::pduUnitPsEntry
- CPDU-MIB::pduInputPhaseConfigEntry
- CPDU-MIB::pduInputPhasePropertiesEntry
- CPDU-MIB::pduInputPhaseStatusEntry
- CPDU-MIB::pduCircuitBreakerConfigEntry
- CPDU-MIB::pduCircuitBreakerPropertiesEntry
- CPDU-MIB::pduCircuitBreakerStatusEntry
- CPDU-MIB::pduOutletSwitchedConfigEntry
- CPDU-MIB::pduOutletSwitchedPropertiesEntry
- CPDU-MIB::pduOutletSwitchedStatusEntry
- CPDU-MIB::pduOutletSwitchedControlEntry
- CPDU-MIB::pduOutletMeteredConfigEntry
- CPDU-MIB::pduOutletMeteredPropertiesEntry
- CPDU-MIB::pduOutletMeteredStatusEntry
- CPDU-MIB::pduExternalSensorNamePlateEntry
- CPDU-MIB::pduExternalSensorConfigEntry
- CPDU-MIB::pduExternalSensorStatusEntry
- CPDU-MIB::pduUnitSmartCabinetEntry
- CPDU-MIB::pduUnitSmartCabinetControl
- CPDU-MIB::pduUnitSmartCabinetLockStateEntry
- CPDU-MIB::pduEhandleEntry
- CPDU-MIB::pduEhandleControlEntry
- PowerNet-MIB::upsBasicBattery
- PowerNet-MIB::upsAdvBattery
- PowerNet-MIB::upsAdvBatteryActualVoltageEntry
Expand Down
2 changes: 1 addition & 1 deletion objects/cumulus/CUMULUS-BGPUN-MIB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ CUMULUS-BGPUN-MIB::bgp4PathAttrEntry:
oid: .1.3.6.1.4.1.40310.4.5.1.1
name: bgp.path_attr.peer.ip.addr
syntax: IpAddressNoSuffix
discovery_attribute: bgp4PathAttrIpAddrPrefixLen
discovery_attribute: bgp4PathAttrOrigin
attributes:
bgp4PathAttrOrigin:
oid: .1.3.6.1.4.1.40310.4.5.1.4
Expand Down
4 changes: 2 additions & 2 deletions objects/cumulus/CUMULUS-BGPVRF-MIB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CUMULUS-BGPVRF-MIB::bgpPeerEntry:
oid: .1.3.6.1.4.1.40310.7.3.1.1.27
name: cumulus.bgpPeerIfindex
syntax: IntegerAsID
discovery_attribute: bgpPeerIdType
discovery_attribute: bgpPeerIdentifier
attributes:
bgpPeerIdentifier:
oid: .1.3.6.1.4.1.40310.7.3.1.1.1
Expand Down Expand Up @@ -146,7 +146,7 @@ CUMULUS-BGPVRF-MIB::bgp4PathAttrEntry:
oid: .1.3.6.1.4.1.40310.7.5.1.1
name: bgp.path_attr.peer.ip.addr
syntax: IpAddressNoSuffix
discovery_attribute: bgp4PathAttrIpAddrPrefixLen
discovery_attribute: bgp4PathAttrOrigin
attributes:
bgp4PathAttrOrigin:
oid: .1.3.6.1.4.1.40310.7.5.1.4
Expand Down
2 changes: 1 addition & 1 deletion objects/ietf/BGP4-MIB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ BGP4-MIB::bgp4PathAttrEntry:
oid: .1.3.6.1.2.1.15.6.1.1
name: bgp.path_attr.peer.ip.addr
syntax: IpAddressNoSuffix
discovery_attribute: bgp4PathAttrIpAddrPrefixLen
discovery_attribute: bgp4PathAttrOrigin
attributes:
bgp4PathAttrOrigin:
oid: .1.3.6.1.2.1.15.6.1.4
Expand Down
2 changes: 1 addition & 1 deletion objects/juniper/BGP4-V2-MIB-JUNIPER.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BGP4-V2-MIB-JUNIPER::jnxBgpM2BaseScalars:
mib: BGP4-V2-MIB-JUNIPER
object: jnxBgpM2BaseScalars
discovery_attribute: jnxBgpM2AsSize
discovery_attribute: jnxBgpM2LocalAs
attributes:
jnxBgpM2LocalAs:
oid: .1.3.6.1.4.1.2636.5.1.1.1.5
Expand Down
1 change: 1 addition & 0 deletions pkg/def/definitions.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package def provides the definitions that are to be validated.
package def

import (
Expand Down
11 changes: 10 additions & 1 deletion pkg/def/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ type Object struct {
}

func (o Object) Validate() error {
return validate(o, "schemas/object.json")
if err := validate(o, "schemas/object.json"); err != nil {
return err
}
// Validate discovery_attribute exists in attributes
if o.DiscoveryAttribute != "" {
if _, ok := o.Attributes[o.DiscoveryAttribute]; !ok {
return fmt.Errorf("discovery_attribute %q not found in attributes", o.DiscoveryAttribute)
}
}
return nil
}

func (o Object) Kind() string {
Expand Down