public class NetworkDevice extends Element
Class representing a network device to be used as an in memory data store for the collector framework. This class holds collected network data for a given network device, which is commonly an entity like a network chassis.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
addressSpace
A string representing the address space of the device
|
protected java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> |
associatedAddresses
A map of all associated address data, hashed by the address' associated interface
|
protected java.lang.String |
baseName
The base name for the device
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
configuredAddresses
A map for looking up a given network address.
|
protected java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> |
connectivity
A map of all topology connections for this device.
|
protected java.lang.String |
deviceId
The unique identifier for this device
|
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
entityList
A map of eneity data for this device
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
interfaces
A map of interface data for this device, indexed by interface ID.
|
protected int |
ipForwarding
An integer representing whether IP forwarding is enabled on the device.
|
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
layer2Vpns
A list of layer 2 virtual private networks for this device
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
layer3Vpns
A map of layer 3 virtual private networks for this device, indexed by VPN name
|
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
lspList
A list of layer switch paths for this device
|
protected java.lang.String |
managedElementId
An optional custom ID field to be used when an ID is required in addition to the standard 'native' id
|
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
mplsInterfaces
A list of MPLS interfaces for this device
|
protected int |
protocol
An integer that represents the address protocol.
|
protected java.lang.String |
sysDescr
The system description (sysDescr attribute) for this device
|
protected java.lang.String |
sysName
The system name (sysName attribute) for this device
|
protected java.lang.String |
sysObjectId
The sysObjectId attribute for this device
|
protected java.lang.String |
uniqueAddress
The unique address for this device.
|
customData, extraInfo| Constructor and Description |
|---|
NetworkDevice(java.lang.String deviceId,
java.lang.String uniqueAddress)
Create a new network device with a given Device ID to store data from a collector
|
NetworkDevice(java.lang.String deviceId,
java.lang.String uniqueAddress,
java.lang.String baseName,
java.lang.String sysObjectId)
Constructor that takes all required attributes for a device
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAssociatedAddress(java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> addressData)
Add an associated address for a device.
|
void |
addConfiguredAddress(java.lang.String address,
int ifOperStatus)
Add an address to a map to indicate that the given address is associated with this device, for the purposes of a
quick lookup
|
void |
addConnection(java.lang.String topologyType,
java.util.Map<java.lang.String,java.lang.Object> connectionData)
Add a connection within a given topology for this device.
|
void |
addInterface(java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> data)
Add interface data to the device.
|
void |
addL3Vpn(java.lang.String vpnName,
java.util.Map<java.lang.String,java.lang.Object> data)
Add layer 3 VPN data to a device.
|
void |
addL3VpnInterface(java.lang.String vpnName,
java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> interfaceData)
Add VPN interface data for a given layer 3 VPN.
|
void |
addL3VpnRouteTarget(java.lang.String vpnName,
java.lang.String routeTarget,
int routeTargetType)
Adds VPN route target data for a given VPN
|
void |
associate(Associatable a)
This method does not provide any functionality for a standard
NetworkDevice as there are currently no
automatic associations that can be inferred from two devices. |
java.lang.String |
getAddressSpace()
Get the address space for this device
|
java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> |
getAssociatedAddresses()
Returns a map of all associated addresses for the device by interface
|
java.lang.String |
getBaseName()
Get the base name for this device
|
java.util.Map<java.lang.String,java.lang.Integer> |
getConfiguredAddresses()
Returns a map of all addresses for the device for quick lookup of addresses - see
hasAddress(java.lang.String) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getConnections(java.lang.String topologyType)
Get a list of all connections for a specified topology type
|
java.lang.String |
getDeviceId()
Get the ID of the device (see also
getId()) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getEntityList()
Get a list of all entities for the device
|
java.lang.String |
getId()
Get the ID of the device (see also
getDeviceId()) |
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
getInterfaces()
Get all the interfaces defined for this device
|
int |
getIpForwarding()
Get the ipForwarding value for this device
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getLayer2Vpns()
Get a list of all layer 2 VPNs
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> |
getLayer3Vpns()
Get a list of all layer 3 VPNs
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getLspList()
Get a list of all LSPs
|
java.lang.String |
getManagedElementId()
Get the managed element ID for this device
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getMplsInterfaces()
Get a list of all MPLS interfaces
|
java.lang.String |
getName()
Get the name of this device.
|
int |
getProtocol()
Get the protocol for this device.
|
java.lang.String |
getSysDescr()
Get the system description for this device
|
java.lang.String |
getSysName()
Get the system name for this device
|
java.lang.String |
getSysObjectId()
Get the system object ID for this device
|
java.lang.String |
getUniqueAddress()
Get the unique address for this device
|
java.lang.String |
getUniqueID()
Get the management IP of this device (this is an alias for
getUniqueAddress() |
boolean |
hasAddress(java.lang.String address)
Check whether a device has a given address configured for it
|
boolean |
isInSubnet(java.lang.String subnetAddress,
java.lang.String subnetMask)
Checks whether the device is in a given subnet.
|
boolean |
merge(Element elementData)
Merge the data from a given network device object with this one
|
void |
resolveDeviceAddresses()
Builds the associated address list based on the existing interface data.
|
void |
setAddressSpace(java.lang.String addressSpace)
Set the address space for this deivce
|
void |
setBaseName(java.lang.String baseName)
Set the base name for this device
|
void |
setDeviceId(java.lang.String deviceId)
Set the Device ID
|
void |
setIpForwarding(int ipForwarding)
Set the ipForwarding attribute for this device
|
void |
setManagedElementId(java.lang.String managedElementId)
Set the managed element ID for this device
|
void |
setManagementIpAddress(java.lang.String managementIpAddress)
If a device has an IP, assign a management IP address
|
void |
setProtocol(int protocol)
Set the textual description of the protocol
|
void |
setSysDescr(java.lang.String sysDescr)
Set the sysDescr attribute for the device
|
void |
setSysName(java.lang.String sysName)
Set the sysName attribute for the device
|
void |
setSysObjectId(java.lang.String sysObjectId)
Set the sysObjectId attribute for the device
|
void |
setUniqueName(java.lang.String uniqueName)
For non-IP devices, a unique name must be provided instead of an IP address.
|
java.lang.String |
toDeviceInfoXMLString()
Generate an XML representation of the network device information
|
java.lang.String |
toInventoryXMLString()
Generate an XML representation of the network device inventory
|
java.lang.String |
toMPLSInterfaceXMLString()
Generate an XML representation of the MPLS interface data for the device
|
java.lang.String |
toXMLString()
Generate an XML representation of the network device
|
addCustomData, addExtraInfo, getCustomData, getExtraInfoprotected java.lang.String addressSpace
protected java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> associatedAddresses
protected java.lang.String baseName
protected java.util.Map<java.lang.String,java.lang.Integer> configuredAddresses
protected java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> connectivity
protected java.lang.String deviceId
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> entityList
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> interfaces
protected int ipForwarding
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> layer2Vpns
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> layer3Vpns
protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> lspList
protected java.lang.String managedElementId
deviceIdprotected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> mplsInterfaces
protected int protocol
protected java.lang.String sysDescr
protected java.lang.String sysName
protected java.lang.String sysObjectId
protected java.lang.String uniqueAddress
baseName)public NetworkDevice(java.lang.String deviceId,
java.lang.String uniqueAddress)
deviceId - The ID of the deviceuniqueAddress - The management IP of the device or if there's no IP address, another unique namepublic NetworkDevice(java.lang.String deviceId,
java.lang.String uniqueAddress,
java.lang.String baseName,
java.lang.String sysObjectId)
deviceId - The ID of the deviceuniqueAddress - The management IP of the device or if there's no IP address, another unique namebaseName - The name of the devicesysObjectId - The system object ID of the devicepublic void addAssociatedAddress(java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> addressData)
CollectorValidationUtils.validateAddressData(Map)interfaceKey - The interface to add the address toaddressData - The address data: IfIndex, IfOperStatus, IpAddressCollectorValidationUtils.validateAddressData(Map)public void addConfiguredAddress(java.lang.String address,
int ifOperStatus)
address - ifOperStatus - public void addConnection(java.lang.String topologyType,
java.util.Map<java.lang.String,java.lang.Object> connectionData)
CollectorValidationUtils.validateConnectionData(Map)topologyType - The type of connection, for example Layer1, Layer2 or MicrowaveconnectionData - Link data: SourceName SourceInterfaceId DestinationName DestinationInterfaceIdCollectorValidationUtils.validateConnectionData(Map)public void addInterface(java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateInterfaceData(Map)interfaceKey - The key of the interface to add data todata - Interface data: Port Card IfIndex InterfaceId IfDescr IfName IfType IsConnected PhysAddress IpAddress
Subnet SubnetMask NetMaskCollectorValidationUtils.validateInterfaceData(Map)public void addL3Vpn(java.lang.String vpnName,
java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateL3VPNData(Map)vpnName - The name of the VPNdata - The VPN data: VPNName VRFName RD Status Description ImportRTs (see addL3VpnRouteTarget(java.lang.String, java.lang.String, int))
ExportRTs (see addL3VpnRouteTarget(java.lang.String, java.lang.String, int)) Interfaces (see addL3VpnInterface(java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>))CollectorValidationUtils.validateL3VPNData(Map)public void addL3VpnInterface(java.lang.String vpnName,
java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> interfaceData)
throws CollectorException
CollectorValidationUtils.validateL3VPNInterfaceData(Map)vpnName - The name of the CPNinterfaceKey - The key of the interfaceinterfaceData - The interface data: IfIndex InterfaceId CEAddress ProtocolCollectorException - if the L3 VPN for which the data is being added, cannot be found in the data storeCollectorValidationUtils.validateL3VPNInterfaceData(Map)public void addL3VpnRouteTarget(java.lang.String vpnName,
java.lang.String routeTarget,
int routeTargetType)
throws CollectorException
vpnName - The name of the VPNrouteTarget - The route targetrouteTargetType - The route target type (import/export/both)CollectorException - if the L3 VPN for which the data is being added, cannot be found in the data storeCollectorValidationUtils.validateL3VPNRTData(String, int)public void associate(Associatable a)
NetworkDevice as there are currently no
automatic associations that can be inferred from two devices.a - The object to associate with this object.public java.lang.String getAddressSpace()
public java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>> getAssociatedAddresses()
public java.lang.String getBaseName()
public java.util.Map<java.lang.String,java.lang.Integer> getConfiguredAddresses()
hasAddress(java.lang.String)public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getConnections(java.lang.String topologyType)
topologyType - The type of topology connections to get (e.g. Layer1, Layer2)public java.lang.String getDeviceId()
getId())public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getEntityList()
public java.lang.String getId()
getDeviceId())public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getInterfaces()
public int getIpForwarding()
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getLayer2Vpns()
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getLayer3Vpns()
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getLspList()
public java.lang.String getManagedElementId()
managedElementIdpublic java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getMplsInterfaces()
public java.lang.String getName()
getBaseName(), but if can be
overriden if required.public int getProtocol()
public java.lang.String getSysDescr()
public java.lang.String getSysName()
public java.lang.String getSysObjectId()
public java.lang.String getUniqueAddress()
public java.lang.String getUniqueID()
getUniqueAddress()public boolean hasAddress(java.lang.String address)
address - The addresspublic boolean isInSubnet(java.lang.String subnetAddress,
java.lang.String subnetMask)
subnetAddress - The address of the subnetsubnetMask - The subnet maskpublic boolean merge(Element elementData)
public void resolveDeviceAddresses()
public void setAddressSpace(java.lang.String addressSpace)
addressSpace - The address space for this devicepublic void setBaseName(java.lang.String baseName)
baseName - The base name for this devicepublic void setDeviceId(java.lang.String deviceId)
deviceId - The ID of the device to setpublic void setIpForwarding(int ipForwarding)
ipForwarding - The integer value for ipForwardingpublic void setManagedElementId(java.lang.String managedElementId)
managedElementId - the managed elementId to set for this devicemanagedElementIdpublic void setManagementIpAddress(java.lang.String managementIpAddress)
managementIpAddress - The main management IP address to be used to identify the devicepublic void setProtocol(int protocol)
protocol - The protocol valuepublic void setSysDescr(java.lang.String sysDescr)
sysDescr - The system description for this devicepublic void setSysName(java.lang.String sysName)
sysName - The system name for this devicepublic void setSysObjectId(java.lang.String sysObjectId)
sysObjectId - The system object ID for this devicepublic void setUniqueName(java.lang.String uniqueName)
uniqueName - A unique name to identify the devicepublic java.lang.String toDeviceInfoXMLString()
<deviceInfo>
<sysObjectId>1.3.6.1.4.1.0.1.94</sysObjectId>
<descr>Vendor Device Description (sysDescr)</descr>
<name>10.1.254.1</name>
</deviceInfo>
public java.lang.String toInventoryXMLString()
<deviceInventory>
<deviceId>10.1.254.1</deviceId>
<interfaceList>
<interface>
<ifPhysAddress>00:99:00:E5:C4:06</ifPhysAddress>
<ifDescr>FastEthernet0/1.10</ifDescr>
<ifOperStatus>1</ifOperStatus>
<ifIndex>19</ifIndex>
<interfaceId>MyUniqueInterfaceIdFor19</interfaceId>
<ifType>135</ifType>
<ipAddress></ipAddress>
<ifName>Fa0/1.10</ifName>
</interface>
.. other interfaces ..
</interfaceList>
</deviceInventory>
public java.lang.String toMPLSInterfaceXMLString()
<mplsInterfaceData>
<deviceId>10.1.1.1</deviceId>
<interfaceList>
<interface>
<ifIndex>1</ifIndex>
</interface>
</interfaceList>
</mplsInterfaceData>
public java.lang.String toXMLString()
toXMLString in class Element
<device>
<id>10.1.230.3</id>
<ip>10.1.230.3</ip>
<addressSpace></addressSpace>
<medId>optionalCustomId</meId>
</device>