public class CiscoApicRestCollector extends Collector
collectorDescription, collectorName, collectorPort, dataStore, propsFileName, running| Constructor and Description |
|---|
CiscoApicRestCollector(java.lang.String collectorName,
java.lang.String collectorDescription)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
collectData(int dataSourceId,
java.lang.String address,
java.lang.String mask)
This method is responsible for ensuring that data is updated as appropriate, that is, the Collector should check
the EMS for new data and update any internal stores as appropriate.
|
protected void |
doFullDiscovery(java.lang.String nodeId)
Performs a Full Discovery operation
|
protected void |
doPartialDiscovery(int dataSource,
java.lang.String nodeId)
This method performs Partial Discovery by invoking doFullDiscovery(int)
method and supplying a node id as parameter.
|
protected java.util.ArrayList<Node> |
getAllRestClass(java.lang.String workingDirectory,
java.lang.String topSystemFileName,
java.lang.String nodeId,
java.lang.Boolean partial)
Generate XML or JSON file from REST command output
|
protected java.lang.String |
getTopSystemCmdRest(WebSocketTransport webSocketTransport,
java.lang.String restMethod,
java.lang.String command)
Sending REST 'topSystem' Class to get all available list of nodes Output
from REST command is in xml based format
|
protected static java.lang.Boolean |
individualPerNodeRestCmd(WebSocketTransport webSocketTransport,
java.lang.String restCommand,
java.lang.String absoluteFilePath)
Prepare REST command per individual nodes to pass to getIndividualCmdRest
method
|
protected void |
initDataStore()
Initialises data source as specified in the properties file
|
protected boolean |
initialise()
Initialise collector with data gather from properties file
|
protected boolean |
isGetEntities() |
protected boolean |
isGetLayer1Connections() |
protected boolean |
isGetLayer2Connections() |
protected boolean |
isGetLayer3Connections() |
static void |
main(java.lang.String[] args)
Runs the Cisco APIC SDN collector
|
java.util.List<NetworkDevice> |
parseNetworkDeviceData(java.util.ArrayList<Node> nodeList) |
protected java.util.ArrayList<lldpAdjEp> |
processPhysicalInventoryData(java.util.ArrayList<Node> processNodeList,
CiscoApicXMLJSONParser XMLJSONParser)
Process data for Physical Inventory
|
protected void |
processTopologyData(java.util.ArrayList<Node> processNodeList,
java.util.ArrayList<lldpAdjEp> lldpAdjEplist)
Process data for Topology
|
protected void |
purgeDirectory(java.io.File file)
Delete files from 'data' directory before any new full discovery
|
protected boolean |
setConnectionParameters(WebSocketTransport webSocketTransport,
java.lang.String remoteUsername,
java.lang.String remotePassword,
java.lang.String remoteHost,
java.lang.Integer remotePort,
java.lang.String remotekeyStoreFileName,
java.lang.String remotekeyStorePassword,
java.lang.String remoteHTTPversion,
java.lang.String remoteResponseTimeout,
java.lang.Integer remoteRefreshInterval,
java.lang.Boolean remoteEnableSSL,
java.lang.String pathToKeyStoreFile,
java.lang.String TLSVersion,
int maxBufferSize)
Setting up websocket connection parameters for REST
|
protected void |
setGetEntities(java.lang.String getEntitiesFlag) |
protected void |
setGetLayer1Connections(java.lang.String getLayer1Connections) |
protected void |
setGetLayer2Connections(java.lang.String getLayer2Connections) |
protected void |
setGetLayer3Connections(java.lang.String getLayer3Connections) |
static void |
setPropsFile(java.util.Properties propsFile) |
protected java.lang.String |
testRegex(java.lang.String input,
java.lang.String patterns)
Test the regex from supplied Distinguish Name (DN) to check pattern
|
java.lang.String |
UpdateData(int dataSourceId,
int requestType,
java.lang.String address,
java.lang.String mask)
UpdateData invokes the collectData method which is responsible for
ensuring that data is updated as appropriate, that is, the Collector
should check the EMS for new data and update any internal stores as
appropriate.
|
GetAfData, GetAmfData, GetAssociatedAddresses, GetAssociatedAddresses, GetAusfData, getCommandLineArgument, GetConnections, GetConnections, GetDeviceInfo, GetDeviceInfo, GetDeviceInfo, GetDeviceList, GetEirData, GetENodeBData, GetEntities, GetEntities, GetGNodeBData, GetHssData, GetInfo, GetInventory, GetInventory, GetLayer1Connections, GetLayer1Connections, GetLayer2Connections, GetLayer2Connections, GetLayer2Vpns, GetLayer2Vpns, GetLayer3Connections, GetLayer3Connections, GetLayer3Vpns, GetLayer3Vpns, GetMmeData, GetMplsInterfaces, GetMplsInterfaces, GetNefData, GetNrfData, GetNssfData, GetPcfData, GetPcrfData, GetPgwData, getPortNumberArgument, getPropertiesFileNameArgument, getPropertyValue, GetRanData, GetSAEGatewayData, GetSgwData, GetSmfData, GetUdmData, GetUpfData, initialiseDataStore, isRunning, loadPropertiesFile, setDataStore, setRunning, shutdown, startup, startuppublic CiscoApicRestCollector(java.lang.String collectorName,
java.lang.String collectorDescription)
collectorName - The name of the collectorcollectorDescription - A description of the collectorpublic static void main(java.lang.String[] args)
args - Command line arguments, e.g.
-propsFile <props file name>protected void initDataStore()
protected void collectData(int dataSourceId,
java.lang.String address,
java.lang.String mask)
CollectorThis method is responsible for ensuring that data is updated as appropriate, that is, the Collector should check the EMS for new data and update any internal stores as appropriate.
collectData in class CollectordataSourceId - Holds the ID of the data source which should be updatedaddress - If mask is not defined then it holds the address (IP or native id) of the device to refresh, or else it holds the subnet to
refresh.mask - Holds the subnet mask, or is not definedpublic java.lang.String UpdateData(int dataSourceId,
int requestType,
java.lang.String address,
java.lang.String mask)
UpdateData invokes the collectData method which is responsible for ensuring that data is updated as appropriate, that is, the Collector should check the EMS for new data and update any internal stores as appropriate.
If the Collector does not need to update its data then it does not need to perform any work other than returning the response message "<updateResponse></updateResponse>".
Note: Is it the Collector's responsibility to determine which devices the supplied IP relates to; the IP is NOT guaranteed to be the device id.
UpdateData in class CollectordataSourceId - Holds the ID of the data source which should be updatedrequestType - The type of requestaddress - If mask is not defined then it holds the IP of the device to
refresh, or else it holds the subnet to refreshmask - Holds the subnet mask, or is not defined<updateResponse></updateResponse>protected void doPartialDiscovery(int dataSource,
java.lang.String nodeId)
throws java.io.IOException
dataSource - The DataSource Id that is specified in the properties fileaddress - IP address of the target device of the partial discoveryjava.io.IOException - , TolAttributeException, TolCommunicationExceptionprotected void doFullDiscovery(java.lang.String nodeId)
throws java.io.IOException
nodeId - Node Id for Partial Discovery operation. When a non-zero value
is supplied, Partial Discovery is performed, else Full
Discovery is performed insteadjava.io.IOException - ,TolAttributeException,TolCommunicationExceptionprotected java.util.ArrayList<lldpAdjEp> processPhysicalInventoryData(java.util.ArrayList<Node> processNodeList, CiscoApicXMLJSONParser XMLJSONParser) throws java.io.IOException
processNodeList - List of nodesXMLJSONParser - XMLJSONParser Class that handle parser operationjava.io.IOExceptionprotected void processTopologyData(java.util.ArrayList<Node> processNodeList, java.util.ArrayList<lldpAdjEp> lldpAdjEplist) throws java.io.IOException
processNodeList - List of nodeslldpAdjEplist - LLDP Neighbor list of nodesjava.io.IOExceptionprotected boolean initialise()
protected boolean isGetEntities()
protected void setGetEntities(java.lang.String getEntitiesFlag)
getEntities - the getEntities to setprotected boolean isGetLayer1Connections()
protected void setGetLayer1Connections(java.lang.String getLayer1Connections)
getLayer1Connections - the getLayer1Connections to setprotected boolean isGetLayer2Connections()
protected void setGetLayer2Connections(java.lang.String getLayer2Connections)
getLayer2Connections - the getLayer2Connections to setprotected boolean isGetLayer3Connections()
protected void setGetLayer3Connections(java.lang.String getLayer3Connections)
getLayer3Connections - the getLayer3Connections to setprotected boolean setConnectionParameters(WebSocketTransport webSocketTransport, java.lang.String remoteUsername, java.lang.String remotePassword, java.lang.String remoteHost, java.lang.Integer remotePort, java.lang.String remotekeyStoreFileName, java.lang.String remotekeyStorePassword, java.lang.String remoteHTTPversion, java.lang.String remoteResponseTimeout, java.lang.Integer remoteRefreshInterval, java.lang.Boolean remoteEnableSSL, java.lang.String pathToKeyStoreFile, java.lang.String TLSVersion, int maxBufferSize)
webSocketTransport - webSocketTransport classremoteUsername - Cisco APIC usernameremotePassword - Cisco APIC passwordremoteHost - Cisco APIC ip addressremotePort - Cisco APIC portremotekeyStoreFileName - Cisco APIC usernameremotekeyStorePassword - keyStorePasswordremoteHTTPversion - HTTP versionremoteResponseTimeout - Response Timeout in secondssetRefreshInterval - Refresh Interval in secondsprotected java.lang.String getTopSystemCmdRest(WebSocketTransport webSocketTransport, java.lang.String restMethod, java.lang.String command)
webSocketTransport - webSocketTransport classrestMethod - REST method GET or PUTcommand - REST commandprotected static java.lang.Boolean individualPerNodeRestCmd(WebSocketTransport webSocketTransport, java.lang.String restCommand, java.lang.String absoluteFilePath)
webSocketTransport - webSocketTransport classrestCommand - REST commandabsoluteFilePath - Absolute path of the file created from this methodprotected java.lang.String testRegex(java.lang.String input,
java.lang.String patterns)
input - Distinguish Name (DN) data as inputpatterns - Patterns that need to be applied to DNprotected void purgeDirectory(java.io.File file)
file - Directoryprotected java.util.ArrayList<Node> getAllRestClass(java.lang.String workingDirectory, java.lang.String topSystemFileName, java.lang.String nodeId, java.lang.Boolean partial)
workingDirectory - Directory where 'topSystem' class is kepttopSystemFileName - Filename of 'topSystem' classnodeId - Node Idpartial - Full or Partial discoverypublic java.util.List<NetworkDevice> parseNetworkDeviceData(java.util.ArrayList<Node> nodeList)
nodeList - public static void setPropsFile(java.util.Properties propsFile)