public class DataSource
extends java.lang.Object
A class to represent a collector data source. A data source is a container of
collected devices from a given EMS or other source. A DataStore
typically contains one data source, but can contain any number.
A data source contains a number of Element
s which hold collected
network data or information for a specific network device or logical entity.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
dataSourceDescription
The description for the data source
|
protected int |
dataSourceId
The ID of the data source
|
protected java.lang.String |
emsHost
The host of the source EMS
|
protected java.lang.String |
emsIdentifier
The identifier of the source EMS
|
protected java.lang.String |
emsName
The name of the source EMS
|
protected java.lang.String |
emsRole
The role of the EMS (e.g.
|
protected java.lang.String |
emsStatus
The status of the EMS (e.g.
|
protected java.lang.String |
emsVersion
The version of the source EMS
|
protected java.util.Map<java.lang.String,java.lang.Object> |
extraInfo
A map to hold additional informational data to be included in XML-RPC
calls under the
extraInfo tag. |
protected java.util.Map<java.lang.String,Element> |
networkElements
A map of all device data from this data source
|
Constructor and Description |
---|
DataSource(int id,
java.lang.String description)
Create a new empty data source
|
DataSource(int id,
java.lang.String description,
java.util.Map<java.lang.String,Element> data)
Create a new data source using pre-existing device data
|
Modifier and Type | Method and Description |
---|---|
void |
addAssociatedAddress(java.lang.String deviceId,
java.lang.String interfaceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Associate an address with a given device.
|
void |
addConnection(java.lang.String deviceId,
java.lang.String topologyType,
java.util.Map<java.lang.String,java.lang.Object> connectionData)
Add a connection within a given topology for a given device.
|
Element |
addDeviceData(java.lang.String deviceId,
Element deviceData)
Add device data for a given device or other logical element.
|
void |
addEntity(java.lang.String deviceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Add entity data to the device.
|
void |
addExtraInfo(java.util.Map<java.lang.String,java.lang.Object> extraInfoData)
Add extra info into the extraInfo field
|
void |
addGeographicLocation(java.lang.String elementId,
java.util.Map<java.lang.String,java.lang.Object> data)
Adds geographical data to a given element.
|
void |
addInterface(java.lang.String deviceId,
java.lang.String interfaceKey,
java.util.Map<java.lang.String,java.lang.Object> data)
Add interface data to a given device.
|
void |
addL2Vpn(java.lang.String deviceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Add layer 2 VPN data to a device.
|
void |
addL3Vpn(java.lang.String deviceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Add layer 3 VPN data to a device.
|
void |
addL3VpnInterface(java.lang.String deviceId,
java.lang.String interfaceKey,
java.lang.String vpnName,
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 deviceId,
java.lang.String vpnName,
java.lang.String routeTarget,
int routeTargetType)
Adds VPN route target data for a given layer 3 VPN
|
void |
addLsp(java.lang.String deviceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Add LSP data to a given device.
|
void |
addMplsInterface(java.lang.String deviceId,
java.util.Map<java.lang.String,java.lang.Object> data)
Add MPLS interface data to a given device.
|
java.lang.String |
getDataSourceDescription()
Get the description for this data source
|
int |
getDataSourceId()
Get the ID of the data source
|
Element |
getElement(java.lang.String elementId)
Get the element identified by the given element ID.
|
java.lang.String |
getEmsHost()
Get the host of the source EMS
|
java.lang.String |
getEmsIdentifier()
Get the identifier for the EMS
|
java.lang.String |
getEmsName()
Get the name of the source EMS
|
java.lang.String |
getEmsRole()
Get the role of the EMS (e.g.
|
java.lang.String |
getEmsStatus()
Get the status of the EMS (e.g.
|
java.lang.String |
getEmsVersion()
Get the version of the EMS
|
java.util.Map<java.lang.String,java.lang.Object> |
getExtraInfo()
Get the extra information for this data source
|
java.util.Map<java.lang.String,java.lang.Object> |
getGeographicLocation(java.lang.String elementId)
Return the geographic data for a given element as a single map as
required for the
addGeographicLocation(String, Map) method |
NetworkDevice |
getNetworkDevice(java.lang.String deviceId)
Get the Network Device identified by the device id.
|
NetworkDevice |
getNetworkDevice(java.lang.String deviceId,
boolean createIfNotFound)
Get the Network Device identified by the device id.
|
java.util.Map<java.lang.String,Element> |
getNetworkDevices()
Get a map of all devices for which data is stored.
|
void |
removeAllDeviceData()
Delete/remove all device data from the data store
|
void |
removeDeviceData(java.lang.String deviceId)
Delete/remove all data associated with a given device
|
void |
removeDeviceEntity(java.lang.String deviceId)
Remove entity data to the device.
|
void |
removeDeviceInterface(java.lang.String deviceId)
Remove interface data to the device.
|
void |
removeDeviceLayer2Connection(java.lang.String deviceId)
Remove layer 2 connection data to the device.
|
void |
removeDeviceLayer2Vpn(java.lang.String deviceId)
Remove layer 2 VPN data to the device.
|
void |
removeDeviceLayer3Vpn(java.lang.String deviceId)
Remove layer 3 VPN data to the device.
|
void |
removeDeviceMpls(java.lang.String deviceId)
Remove MPLS data to the device.
|
void |
setDataSourceDescription(java.lang.String dataSourceDescription)
Change the description for this data source
|
void |
setDataSourceId(int dataSourceId)
Set the id for this data source
|
void |
setEmsHost(java.lang.String emsHost)
Set the host of the source EMS
|
void |
setEmsIdentifier(java.lang.String emsIdentifier)
Set the identifier for the EMS
|
void |
setEmsName(java.lang.String emsName)
Set the name of the source EMS
|
void |
setEmsPropertiesFromFile(java.util.Properties propsFile)
A common routine for all collector to set DataSource attributes values
from a given properties file.
|
void |
setEmsRole(java.lang.String emsRole)
Set the role of the EMS (e.g.
|
void |
setEmsStatus(java.lang.String emsStatus)
Set the status of the EMS (e.g.
|
void |
setEmsVersion(java.lang.String emsVersion)
Set the version of the EMS
|
java.lang.String |
toXMLString()
Generate an XML representation of the data source
|
protected java.lang.String dataSourceDescription
protected int dataSourceId
protected java.lang.String emsHost
protected java.lang.String emsName
protected java.lang.String emsVersion
protected java.lang.String emsIdentifier
protected java.lang.String emsRole
protected java.lang.String emsStatus
protected java.util.Map<java.lang.String,java.lang.Object> extraInfo
extraInfo
tag. No data validation is performed on
this data.protected java.util.Map<java.lang.String,Element> networkElements
public DataSource(int id, java.lang.String description)
id
- The ID of the data sourcedescription
- The description for the data sourcepublic DataSource(int id, java.lang.String description, java.util.Map<java.lang.String,Element> data)
id
- The ID of the data sourcedescription
- The description for the data sourcedata
- Device data for the data sourcepublic void addAssociatedAddress(java.lang.String deviceId, java.lang.String interfaceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateAddressData(Map)
deviceId
- The ID of the deviceinterfaceId
- The ID of the interface on the device with which the address
is associateddata
- The address data: IfIndex, IfOperStatus, IpAddressCollectorValidationUtils.validateAddressData(Map)
public void addConnection(java.lang.String deviceId, java.lang.String topologyType, java.util.Map<java.lang.String,java.lang.Object> connectionData)
CollectorValidationUtils.validateConnectionData(Map)
deviceId
- The ID of the devicetopologyType
- The type of connection, for example Layer1, Layer2 or
MicrowaveconnectionData
- Link data: SourceName SourceInterfaceId DestinationName
DestinationInterfaceIdCollectorValidationUtils.validateConnectionData(Map)
public Element addDeviceData(java.lang.String deviceId, Element deviceData)
deviceId
- The ID of the devicedeviceData
- An object containing the device data to merge with the
existing device data (if it already exists)CollectorValidationUtils.validateDeviceData(NetworkDevice)
public void addEntity(java.lang.String deviceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateEntityData(Map)
deviceId
- The ID of the devicedata
- Entity data: EntPhysicalIndex EntPhysClass EntPhysName
EntPhysDescr EntContainedIn ParentRelPos EntPhysAlias
EntVendorType EntParent EntPhysType EntHwRevision
EntSwRevision EntFwRevision EntSerialNumber
IfIndex InterfaceIdCollectorValidationUtils.validateEntityData(Map)
public void removeDeviceEntity(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void removeDeviceInterface(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void removeDeviceMpls(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void removeDeviceLayer2Vpn(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void removeDeviceLayer3Vpn(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void removeDeviceLayer2Connection(java.lang.String deviceId)
deviceId
- The ID of the devicepublic void addExtraInfo(java.util.Map<java.lang.String,java.lang.Object> extraInfoData)
extraInfoData
- The data for the extra informationpublic void addGeographicLocation(java.lang.String elementId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateGeographicData(Map)
elementId
- The ID of the elementdata
- The geographic location data. Valid fields are:
CollectorValidationUtils.validateGeographicData(Map)
public void addInterface(java.lang.String deviceId, java.lang.String interfaceKey, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateInterfaceData(Map)
deviceId
- The ID of the deviceinterfaceKey
- 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 addL2Vpn(java.lang.String deviceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateL2VPNData(Map)
deviceId
- The ID of the devicedata
- The VPN data: VPNName VCID VCType IfIndex LocalLabel PeerIp
PeerIfIndex PeerLabel VPNType StatusCollectorValidationUtils.validateL2VPNData(Map)
public void addL3Vpn(java.lang.String deviceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateL3VPNData(Map)
deviceId
- The ID of the devicedata
- The VPN data: VPNName VRFName RD Status Description ImportRTs
(see addL3VpnRouteTarget(java.lang.String, java.lang.String, java.lang.String, int)
) ExportRTs (see
addL3VpnRouteTarget(java.lang.String, java.lang.String, java.lang.String, int)
) Interfaces (see
addL3VpnInterface(java.lang.String, java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)
)CollectorValidationUtils.validateL3VPNData(Map)
public void addL3VpnInterface(java.lang.String deviceId, java.lang.String interfaceKey, java.lang.String vpnName, java.util.Map<java.lang.String,java.lang.Object> interfaceData) throws CollectorException
CollectorValidationUtils.validateL3VPNInterfaceData(Map)
deviceId
- The ID of the deviceinterfaceKey
- The key of the interfacevpnName
- The name of the CPNinterfaceData
- 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 deviceId, java.lang.String vpnName, java.lang.String routeTarget, int routeTargetType) throws CollectorException
deviceId
- The ID of the devicevpnName
- 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 addLsp(java.lang.String deviceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateLSPData(Map)
deviceId
- The ID of the devicedata
- The LSP data: SourceName DestName NumHops LspName HopNumber
DeviceNameCollectorValidationUtils.validateLSPData(Map)
public void addMplsInterface(java.lang.String deviceId, java.util.Map<java.lang.String,java.lang.Object> data)
CollectorValidationUtils.validateMPLSData(Map)
deviceId
- The ID of the devicedata
- The MPLS interface data: ifIndex (future fields may include
statistics etc..)CollectorValidationUtils.validateMPLSData(Map)
public java.lang.String getDataSourceDescription()
public int getDataSourceId()
public Element getElement(java.lang.String elementId)
NetworkDevice
, for fetching elements
that are known devices see getNetworkDevice(String)
.elementId
- The ID of the elementpublic java.lang.String getEmsHost()
public java.lang.String getEmsIdentifier()
public java.lang.String getEmsName()
public java.lang.String getEmsRole()
public java.lang.String getEmsStatus()
public java.lang.String getEmsVersion()
public java.util.Map<java.lang.String,java.lang.Object> getExtraInfo()
public java.util.Map<java.lang.String,java.lang.Object> getGeographicLocation(java.lang.String elementId)
addGeographicLocation(String, Map)
methodelementId
- The ID of the element for which to get the geographic locationCollectorValidationUtils.validateGeographicData(Map)
public NetworkDevice getNetworkDevice(java.lang.String deviceId)
NetworkDevice
(e.g. there is no element by that
name or the element is a LogicalElement
), then a null value will
be returned.deviceId
- The ID of the network devicepublic NetworkDevice getNetworkDevice(java.lang.String deviceId, boolean createIfNotFound)
NetworkDevice
(e.g. there is
no element by that name or the element is a LogicalElement
), then
a null value will be returned.deviceId
- The ID of the network devicecreateIfNotFound
- If specified will create a device if one is not foundpublic java.util.Map<java.lang.String,Element> getNetworkDevices()
public void removeAllDeviceData()
public void removeDeviceData(java.lang.String deviceId)
deviceId
- The ID of the device to removepublic void setDataSourceDescription(java.lang.String dataSourceDescription)
dataSourceDescription
- The new description for this data sourcepublic void setDataSourceId(int dataSourceId)
dataSourceId
- the new id for this data sourcepublic void setEmsHost(java.lang.String emsHost)
emsHost
- the host of the source EMS to setpublic void setEmsIdentifier(java.lang.String emsIdentifier)
emsIdentifier
- the identifier for the EMS to setpublic void setEmsName(java.lang.String emsName)
emsName
- the name of the source EMS to setpublic void setEmsRole(java.lang.String emsRole)
emsRole
- the role of the EMS to setpublic void setEmsStatus(java.lang.String emsStatus)
emsStatus
- the status of the EMS to setpublic void setEmsVersion(java.lang.String emsVersion)
emsVersion
- the version of the EMS to setpublic void setEmsPropertiesFromFile(java.util.Properties propsFile)
propsFile
- Collector properties filepublic java.lang.String toXMLString()