Collection Jobs

This section contains the following topics:

About Collection Jobs

Crosswork Data Gateway pulls functional images from the Controller. Each functional image represents a collection profile. These collection profiles describe what task the Controller is expected to perform.

You can collect more than one type of data at a time by using separate collection profiles.

Each collection job you create executes the collection requests and receives the collection data in their respective protocol/transport. The collected raw data from the devices and then fed to either Kafka or gRPC server.


Note

Crosswork Data Gateway is read only to the network. The devices must be configured for the correct data metrics in advance of the Crosswork Data Gateway collecting them.


Cisco Crosswork Data Gateway lets you create three types of collection jobs:

CLI Collection Job

Enables CLI-based data collection (such as device configuration) from the network devices. The CLI collector uses XDE/PAL to collect device data for a given CLI. Only show commands are supported for this type of collection job.

SNMP Collection Job

Enables SNMP-based data collection based on the OIDs supported on the devices.

Supported SNMP versions include SNMPv1, SNMPv2c, and SNMPv3 for data polling and traps.

MDT Collection Job

Collects model driven telemetry data streamed from the device to the Crosswork Data Gateway.

Collection Job Payload Model

A collection job describes the following:

  • Data to be collected

  • Devices from which collection is desired and credentials to authenticate

  • Collection intervals (a periodic interval no greater than 30 days or immediately on demand)

A single collection job can contain either CLI commands, SNMP MIB requests, or MDT subscriptions. Crosswork Data Gateway routes the request to the appropriate collector to fetch the requested data.

A collection job has three main parts:


//          Device Groups(s) -- identifies the different device groups from which data is 
//                              to be collected and their authentication credentials.
//          Source(s)    -- identifies the different sensors and their collection details 
//                              like sensor path , devices, etc
//          Sink(s)      -- identifies the different output destination the final CDG data 
//                          is sent to
//
//

A typical collection request contains at least the following information:

  • Collection Job ID

  • Method of collection

  • Device Groups

  • Sensor Path (CLI, SNMP, or MDT)

  • Cadence or Collection Interval

  • Output Target

Shown below is a sample collection job payload:

{
    "collection-job-id": "<sample-collection-job>",
   "collectorType": "CLI",
   "deviceGroups": [
      {
         "id": "deviceGroup1",
          "devices": [
            {
               "name": "vm1-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm2-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm3-xrv9000",
               "host": "<device_IP_address>"    
        }   
      ],
         "deviceParams": [
            {
               "key": "software",
               "value": "IOS"    
        },
            {
               "key": "transport",
               "value": "SSH2"    
        },
            {
               "key": "port",
               "value": "22"    
        },
            {
               "key": "username",
               "value": "admin"    
        },
            {
               "key": "password",
               "value": "<password>"    
        },
            {
               "key": "vendor",
               "value": "cisco"    
        }   
      ]  
    },
      {
         "id": "deviceGroup2",
           "devices": [
            {
               "name": "vm1-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm2-xrv9000",
               "host": "<device_IP_address>"    
        }   
      ],
          "deviceParams": [
            {
               "key": "software",
               "value": "IOS"    
        },
            {
               "key": "transport",
               "value": "SSH2"    
        },
            {
               "key": "port",
               "value": "22"    
        },
            {
               "key": "username",
               "value": "admin"    
        },
            {
               "key": "password",
               "value": "<password>"    
        },
            {
               "key": "vendor",
               "value": "cisco"    
        }   
      ]  
    } 
  ],
   "sources": [
      {
         "name": "source1",
         "deviceGroupIds": [
            "deviceGroup1",
            "deviceGroup2"   
      ],
         "sensorConfigs": [
            {
               "sensorConfigId": "sensor-id-1",
               "path": "show interfaces",
               "cadence": 90,
        }  
      ]  
    } 
  ],
 "sinks": [
      {
         "name": "sink2",
         "parentIds": [
            "source1"   
      ],
         "outputTarget": {
            "messageBusTarget": {
               "brokerAddresses": [
                  {
                     "host": "kafka-operational",
                     "port": 9092      
            }     
          ],
               "username": "kafka-admin",
               "password": "password",
               "destinationTopic": "externalOutputTopic",
               "certificateKey": "BasicOne"    
        }   
      }  
    } ,
{
      "name": "sink2",
      "parentIds": [
        "source"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }

  ],
   "secretKey": "skey"

The following table explains the fields of the above payload:

Field

Type

(M)andatory or (O)ptional

Description

collection-job-id

string

M

String for unique identification of the collection job.

collectorType

string

M

Acceptable values are MDT, CLI or SNMP to indicate the type of job.

deviceGroups

json array

M

An array of information on device details. Each device group contains the details of one device type.

deviceGroups[x] > id

string

M

String for the unique identification of the device group.

deviceGroups[x] > devices

json array

M

An array of device names and IP addresses.

deviceGroups[x] > devices[y] > name

string

M

Name of the device.

deviceGroups[x] > devices[y] > host

string

M

IP address of the device.

deviceGroups[x] > devicesParams

json array

M

An array of information on devices' authentication credentials.

deviceGroups[x] > devicesParams[y] > key

string

M

Key required for device authentication.

deviceGroups[x] > devicesParams[y] > value

string

M

Value for the key to authenticate the device.

sources

json array

M

An array of information on source details that can have multiple source info(JSON objects).

sources[x] > name

string

M

A name for the source.

sources[x] > deviceGroupIds

json array

M

An array containing names of the device groups from which data has to be collected.

sources[x] > sensorConfigs

json array

M

An array of Sensor Configs (JSON Obects). Each Sensor Config (JSON object) element contains config details of one collection.

At least one sensor config per collection job is a must.

Note 

For a registered application, each source of sensor config should have a unique string name.

sources[x] > sensorConfigs[y] > sensorConfigId

string

M

Unique ID of the sensor config.

sources[x] > sensorConfigs[y] > path

string

M

Mandatory path of sensor config containing the CLI command in case of CLI collector OR SNMP OID in case of SNMP collector OR YANG PATH in case of MDT collection. In case of MDT collection, path may also contain *:* indicating to send all sensors output for this collection job.

sources[x] > sensorConfigs[y] > cadence

int

O

Optional cadence value of this sensor config in seconds. If not passed the sensor config collection is done once.

sinks

json array

M

This contains an array of destination sink information(JSON objects).

This can provide details on one more sinks of same/different types. Currently supported sink types are Kafka and gRPC.

sink[x] > name

string

M

A unique name for the sink.

sink[x] > parentIds

string array

M

An array of parent IDs from which the sink should get its input.

sink[x] > outputTarget

json object

M

A JSON object that holds the final transport information. It can hold one or more type of target information. Currently supported target types are kafka and gRPC

sercretKey

string

O

A key that is needed for validating the collection job.

Sink with Kafka output target

sinks[x] > outputTarget > messageBusTarget

json object

M

This contains connection

information of the target Kafka server.

sinks[x] > outputTarget > messageBusTarget > brokerAddresses

json object

M

Array containing host+port information.

sinks[x] > outputTarget > messageBusTarget > brokerAddresses > host

string

M

An IP address or reachable name of the Kafka server.

sinks[x] > outputTarget > messageBusTarget > brokerAddresses > port

int

M

Port number based on transport protocol to be used to connect to the Kafka server.

sinks[x] > outputTarget > messageBusTarget > username

string

M

Credential username to connect to the Kafka server.

Note 

Username and password are not supported in Crosswork Data Gateway 1.0. Any value passed is ignored.

sinks[x] > outputTarget > messageBusTarget > password

string

M

Credential password to connect to the Kafka server.

Note 

Username and password are not supported in Crosswork Data Gateway 1.0. Any value passed is ignored.

sinks[x] > outputTarget > messageBusTarget > destinationTopic

string

M

Name of the destination Kafka topic.

sinks[x] > outputTarget > messageBusTarget > certificateKey

bytes

M

Certificate Blob to connect to the Kafka server.

Sink with gRPC output target

sink[x] > outputTarget > grpctarget

json object

M

This contains connection information of the target gRPC.

sink[x] > outputTarget > grpctarget > grpcaddress

json object

M

Array containing host+port information.

sink[x] > outputTarget > grpctarget > grpcaddress > host

string

M

An IP address or reachable name of the gRPC server.

sink[x] > outputTarget > grpctarget > grpcaddress > port

string

M

Port number based on transport protocol to be used to connect to the gRPC server.

sink[x] > outputTarget > grpctarget > username

string

M

Credential userid to connect to the gRPC server.

Note 

Username and password are not supported in Crosswork Data Gateway 1.0. Any value passed is ignored.

sink[x] > outputTarget > grpctarget > password

string

M

Credential password to connect to the gRPC server.

Note 

Username and password are not supported in Crosswork Data Gateway 1.0. Any value passed is ignored.

sink[x] > outputTarget > grpctarget > certificateKey

bytes

M

Certificate Blob to connect to the gRPC server.

Add/Delete Collection Jobs

You can refer the Sample Collection Jobs Payloads to create collection jobs. Once the collection job is created, it must be added to the collection profile i.e., functional image of the respective collector.

The collection job is picked up by the Crosswork Data Gateway for execution when the Image Manager syncs with the Controller and retrieves the latest boot-config and docker-compose.


Note

  • Crosswork Data Gateway is read only to the network. The devices must be configured for the correct data metrics in advance of the Crosswork Data Gateway collecting them.

  • The name of the collection job json file must be supplied (without extension ".json") as the value of the attribute collectionJobId in the collection payload i.e., in the content of the file. Crosswork Data Gateway throws an error if the value of collectionJobId does not match the name of the file.


Upon successful creation of collection job, if the output server is up, running, and accessible, Crosswork Data Gateway starts sending data to it. In this scenario, status for per device per sensor config is shown as ACTIVE in the collector logs.

However, if output server is inaccessible, Crosswork Data Gateway fails to send data to it.

On receiving error while sending data to external sink (gRPC or Kafka):

  1. Sink is set to ERROR state and all the collection job(s) related to that sink are stopped for further collection.

  2. A notification is sent that Sink is in ERROR state.

  3. Reconnect sink flow periodically sends the last collection data to the sink until the sink resumes or the collection job(s) are deleted.

  4. During this time, a warn message is logged for any inflight collection data (or) data received from device for Traps or MDT.

  5. Once sink resumes, a notification is sent to inform that Sink is ACTIVE.

  6. All the collection job(s) of the sink that were stopped are resumed and data is dispatched.

To delete a collection job, simply remove it from the collection profile.

Upon job deletion, the collector will send one alert to the Controller for that job once all the devices per sensor path execution has stopped.

Best Practices and Limitations for Creating Collection Jobs

Cisco recommends that following best practices be followed while creating collection job payloads:

Limitation

Best Practices

Scale

Maximum size of sensor path collected data is 10 MB.

Crosswork Data Gateway collector data at the same time from N devices cannot exceed 6 GB.

  1. Any collected sensor path's data size should not be > 10 MB when target server is Kafka, otherwise you will get the following error message:

    RecordTooLargeException: The message is xxxxxxxx bytes when serialized which is larger than the maximum request size you have configured with the max.request.size configuration.

  2. If external target server is Kafka, then the following should be configured in Kafka's server properties:

    • message.max.bytes=10485760

    • replica.fetch.max.bytes=10485760

    • max.request.size=10485760

    • fetch.messsage.max.bytes=10485760

  3. Crosswork Data Gateway collector data at the same time from N devices with M sensor path per device and with P average size of collected data per sensor path cannot exceed 6 GB i.e.,

    (N = # of devices) x (M = # of sensor path) x (P= Average Message size per sensor path) < 6GB

Log Purge Policy

When total log file size for a collector reaches 2 GB, Crosswork Data Gateway starts cleaning up by removing the old log files.

If you would like to save the old log files, save it to any other remote server before the total log file size reaches 2 GB per collector. This can be done by running show-tech from Crosswork Data Gateway Main Menu > Troubleshooting.

Sample Collection Jobs Payloads

This section contains sample collection job payloads for the following collection profiles:

CLI Collection Job

Crosswork Data Gateway supports CLI-based data collection from the network devices. It uses XDE/PAL to collect device data for a given CLI. Only show commands are supported for this type of collection job.


Note

  • While creating a CLI collection job, you must validate it for any errors. Crosswork Data Gateway does not validate collection jobs. Hence, even though a collection job is invalid, its staus is still shown as Active.

  • Device should not have any banner configuration for CLI collection to work properly. Please refer to device documentation on how to turn this off.

  • The value of Cadence is in seconds. It should be set either to 0 to indicate the sensor configured to be collected only once.

    OR

    It should be >= 60 (i.e. at least 1 minute) up to 2764800 seconds ( i.e. at most 32 days) max, indicating how frequently configured sensor data should be collected.

  • When collection from a device is skipped due to previous execution still in progress, Crosswork Data Gateway raises a warning log. No alert is generated for this scenario.


Following are some CLI collection job examples:

API URL

{contextPath}/v1/collect-jobs/{jobId}

Note 

This API resides on the Controller.

HTTP Method

GET

Response Status Code

200 OK

CLI sample payload with Kafka output target

{
    "collection-job-id": "<unique_collection_job_name>",
   "collectorType": "CLI",
   "deviceGroups": [
      {
         "id": "deviceGroup1",
          "devices": [
            {
               "name": "vm1-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm2-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm3-xrv9000",
               "host": "<device_IP_address>"    
        }   
      ],
         "deviceParams": [
            {
               "key": "software",
               "value": "IOS"    
        },
            {
               "key": "transport",
               "value": "SSH2"    
        },
            {
               "key": "port",
               "value": "22"    
        },
            {
               "key": "username",
               "value": "admin"    
        },
            {
               "key": "password",
               "value": "<password>"    
        },
            {
               "key": "vendor",
               "value": "cisco"    
        }   
      ]  
    },
      {
         "id": "deviceGroup2",
           "devices": [
            {
               "name": "vm1-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm2-xrv9000",
               "host": "<device_IP_address>"    
        }   
      ],
          "deviceParams": [
            {
               "key": "software",
               "value": "IOS"    
        },
            {
               "key": "transport",
               "value": "SSH2"    
        },
            {
               "key": "port",
               "value": "22"    
        },
            {
               "key": "username",
               "value": "admin"    
        },
            {
               "key": "password",
               "value": "<password>"    
        },
            {
               "key": "vendor",
               "value": "cisco"    
        }   
      ]  
    } 
  ],
   "sources": [
      {
         "name": "source1",
         "deviceGroupIds": [
            "deviceGroup1",
            "deviceGroup2"   
      ],
         "sensorConfigs": [
            {
               "sensorConfigId": "sensor-id-1",
               "path": "show interfaces",
               "cadence": 90,
        }  
      ]  
    } 
  ],
   "sinks": [
      {
         "name": "sink2",
         "parentIds": [
            "source"   
      ],
         "outputTarget": {
            "messageBusTarget": {
               "brokerAddresses": [
                  {
                     "host": "kafka-operational",
                     "port": 9092      
            }     
          ],
               "username": "kafka-admin",
               "password": "<password>",
               "destinationTopic": "externalOutputTopic",
               "certificateKey": "BasicOne"    
        }   
      }  
    } 
  ],
   "secretKey": "skey"
}

Sink with gRPC output target

"sinks": [
    {
      "name": "sink2",
      "parentIds": [
        "source"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }
  ]

Sink with Kafka output target

Sample payload for CLI with custom device package.

Create a custom package and mention the function and package in the sensorPathParams in the sensorConfigs.

In this case, path is not considered.

Note 

The custom device package can be imported into the container using Import Device Pack Tar File option from the Main Menu of Crosswork Data Gateway. See Deploy a Custom Device Package.

{
  "collection-job-id": "<unique_collection_job_name>",
  "collectorType": "CLI",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm1-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm3-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "software",
          "value": "IOS"
        },
        {
          "key": "transport",
          "value": "SSH2"
        },
        {
          "key": "port",
          "value": "22"
        },
        {
          "key": "username",
          "value": "admin"
        },
        {
          "key": "password",
          "value": "<password>"
        },
        {
          "key": "vendor",
          "value": "cisco"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "source1",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "sensorConfigId": "sensor-id-1",
          "path": "*",
          "cadence": 60,
          "sensorPathParams": [
            {
              "key": "function",
              "value": "show_running_config"
            },
            {
              "key": "package",
              "value": "show_running_config"
            }
          ]
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "sink2",
      "parentIds": [
        "source"
      ],
      "outputTarget": {
        "messageBusTarget": {
          "brokerAddresses": [
            {
              "host": "kafka-operational",
              "port": 9092
            }
          ],
          "username": "kafka-admin",
          "password": "password",
          "destinationTopic": "externalOutputTopic",
          "certificateKey": "BasicOne"
        }
      }
    }
  ],
  "secretKey": "skey"
}

gRPC Output Target

Sample payload for CLI with custom device package.

{
  "collection-job-id": "<unique_collection_job_name>",
  "collectorType": "CLI",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm1-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm3-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "software",
          "value": "IOS"
        },
        {
          "key": "transport",
          "value": "SSH2"
        },
        {
          "key": "port",
          "value": "22"
        },
        {
          "key": "username",
          "value": "admin"
        },
        {
          "key": "password",
          "value": "<password>"
        },
        {
          "key": "vendor",
          "value": "cisco"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "source1",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "sensorConfigId": "sensor-id-1",
          "path": "*",
          "cadence": 60,
          "sensorPathParams": [
            {
              "key": "function",
              "value": "show_running_config"
            },
            {
              "key": "package",
              "value": "show_running_config"
            }
          ]
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "sink2",
      "parentIds": [
        "source"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }
  ],
  "secretKey": "skey"
}

SNMP Collection Jobs

Crosswork Data Gateway supports SNMP-based data collection based on the OIDs supported on the devices.

The SNMP collector makes a poll request to the Controller to get its configuration profile (a list of MIB objects to collect and a list of devices to fetch from). It determines the corresponding OIDs by looking up the pre-packaged list of MIB modules or the custom list of MIB modules.

Once the OIDs are resolved, they are provided as input to the SNMP collectors.

The customization of the output can be achieved by generating a device package for the same. The device packages can be downloaded to the Crosswork Data Gateway VM using Import MIB Pack Tar File option from the Main Menu of Crosswork Data Gateway. See Deploy a Custom MIB.

The following SNMP versions are supported:

  • SNMPv1

  • SNMPv2c

  • SNMPv3

The table below lists supported privacy protocols and the value that needs to be given in the collection payload for SNMP and SNMP Trap collection jobs:

Protocol

SNMP Collection Payload

SNMP Trap Collection Payload

aes

AES

N/A

des56

DES

DES

3des

3DES

3DES

aes 128

AES128

AES128

aes 192

AES192 or CiscoAES192(Cisco specific)

AES192 or CiscoAES192(Cisco specific)

aes 256

AES256 or CiscoAES256(Cisco specific)

AES256 or CiscoAES256(Cisco specific)


Note

  • While creating an SNMP collection job, you must validate it for any errors. Crosswork Data Gateway does not validate collection jobs. Hence, even though a collection job is invalid, its status is still shown as Active.

  • The value of Cadence is in seconds. It should be set either to 0 to indicate the sensor configured to be collected only once.

    OR

    It should be >= 60 (i.e. at least 1 minute) up to 2764800 seconds ( i.e. at most 32 days) max, indicating how frequently configured sensor data should be collected.

  • When collection from a device is skipped due to previous execution still in progress, Crosswork Data Gateway raises a warning log. No alert is generated for this scenario.

  • For SNMP v1/v2c, if the device details (such as host or community string) are incorrect in the payload, Crosswork Data Gateway ignores the traps received from the device and logs the following WARN message:

    23:38:50.566 [Trap.0] WARN c.c.d.s.t.receiver.
    SnmpTrapReceiver - Ignoring trap received. No collection 
    -job found for device: <ip>, securityName: <communitystring>, 
    version: <version>

    In case of SNMP v3, if the device details (such as auth, priv, and security name details) are incorrect in the payload, Crosswork Data Gateway filters it out and hence, does not receive the trap. Thus, no WARN message is logged.


Sample Configurations on Device:


Note

Device configuration is customer's responsability as Crosswork Data Gateway does not perform any devcie configuration activity.


Version

Configuration

V1

snmp-server group group1 v1

snmp-server user user1 group1 v1

snmp-server host <host_ip> traps <community_string> udp-port 1062

For example,

snmp-server host 172.29.194.78 traps test udp-port 1062

Note 

Version 1 is the default version used by the device.

V2c

snmp-server group group1 v2c

snmp-server user user1 group1 v2c

snmp-server host 172.29.194.142 traps version 2c v2test udp-port 1062

V3

snmp-server group group1 v3 auth notify user1 read user1 write user1

snmp-server view user1 1.3 included

snmp-server user user1 group1 v3 auth md5 <password> priv aes 128 <password>

snmp-server host 172.23.92.193 traps version 3 priv user1 udp-port 1062

The SNMP Collector supports the following operations:

  • SCALAR

  • TABLE

  • MIB_WALK

  • TRAP

  • DEVICE_PACKAGE

These operations are defined in the sensor config (see payload example below).


Note

There is an optional deviceParams attribute snmpRequestTimeoutMillis (not shown in the sample payloads) that should be used if the device response time is very high. It’s not recommended to use snmpRequestTimeoutMillis unless you are absolutely certain that your device response time is very high.

The value for snmpRequestTimeoutMillis should be specified in milliseconds:

Default value is 1500 milliseconds

Minimum value is 1500 milliseconds

However, there is no limitation on the maximum value of this attribute.


SNMP Collection Job

The following table shows different types of SNMP collection jobs:

API URL

{contextPath}/v1/collect-jobs/{jobId}

HTTP Method

GET

Response Status Code

200 OK

SNMP payload example with Kafka as output target

{
   "collection-job-id": "<unique_collection_job_name>",
   "collectorType": "SNMP",
   "deviceGroups": [
      {
         "id": "deviceGroup1",
      "devices": [
            {
               "name": "vm1-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm2-xrv9000",
               "host": "<device_IP_address>"    
        },
            {
               "name": "vm3-xrv9000",
               "host": "<device_IP_address>"    
        }   
      ] ,

      "deviceParams": [
        {
           "key": "snmpVersion",
           "value": "V3"    
        },
        {
           "key": "snmpSecurityName",
           "value": "xrvr-usr"    
        },
        {
           "key": "snmpAuthProtocol",
           "value": "MD5"    
        },
        {
           "key": "snmpAuthPassphrase",
           "value": "<password>"    
        },
        {
           "key": "snmpPrivProtocol",
           "value": "AES128"    
        },
        {
           "key": "snmpPrivPassphrase",
           "value": "<password>"    
        },
        {
           "key": "snmpCommunityString",
           "value": "xrvr-usr"    
        }   
        ] 
      } 
  ],
     
   "sources": [
      {
         "name": "<unique_source_name>",
         "deviceGroupIds": [
            "deviceGroup1"   
      ],
         "sensorConfigs": [
            {
               "sensorConfigId": "sensor-id-1",
               "path": "1.3.6.1.2.1.1.3.0",
               "operation": "SCALAR",
               "cadence": 60,
               "startTime": 90,
               "collectCount": 10    
        },
            {
               "sensorConfigId": "sensor-id-2",
               "path": "IF-MIB",
               "operation": "MIB_WALK",
               "cadence": 90,
               "startTime": 90,
               "collectCount": 10    
        },
            {
               "sensorConfigId": "sensor-id-3",
               "path": "ifStackTable",
               "operation": "TABLE",
               "cadence": 120,
               "sensorPathParams": [
                  {
                     "key": "MIB",
                     "value": "IF-MIB"      
            }     
          ]    
        }   
      ]  
    } 
  ],
   "sinks": [
      {
         "name": "<unique_sink_name>",
         "parentIds": [
            "<unique_source_name>"   
      ],
         "outputTarget": {
            "messageBusTarget": {
               "brokerAddresses": [
                  {
                     "host": "kafka-operational",
                     "port": 9092      
            }     
          ],
               "username": "kafka-admin",
               "password": "<password>",
               "destinationTopic": "externalOutputTopic",
               "certificateKey": "BasicOne"    
        }   
      }  
    } 
  ],
   "secretKey": "skey"
}

SNMP payload example with gRPC as output target


   "sinks": [
      {
         "name": "<unique_sink_name>",
         "parentIds": [
            "<unique_source_name>"   
      ],
         "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    } 
  ],
   "secretKey": "skey"
}

Kafka Output Target

(Custom MIB package)

Note 

The custom MIB package can be imported into the container using Import MIB Pack Tar File option from the Main Menu of Crosswork Data Gateway. See Deploy a Custom MIB.

{
    "collection-job-id": "<unique_collection_job_name>",
    "collectorType": "SNMP",
    "deviceGroups": [{
        "id": "deviceGroup1",
        "devices": [{
                "name": "vm1-xrv9000",
                "host": "<device_IP_address>"
            },
            {
                "name": "vm2-xrv9000",
                "host": "<device_IP_address>"
            },
            {
                "name": "vm3-xrv9000",
                "host": "<device_IP_address>"
            }
        ]
    }],
    "deviceParams": [{
            "key": "snmpVersion",
            "value": "V3"
        },
        {
            "key": "snmpSecurityName",
            "value": "xrvr-usr"
        },
        {
            "key": "snmpAuthProtocol",
            "value": "MD5"
        },
        {
            "key": "snmpAuthPassphrase",
            "value": "<password>"
        },
        {
            "key": "snmpPrivProtocol",
            "value": "AES128"
        },
        {
            "key": "snmpPrivPassphrase",
            "value": "<password>"
        },
        {
            "key": "snmpCommunityString",
            "value": "xrvr-usr"
        }
    ],
    "sources": [{
        "name": "<unique_source_name>",
        "deviceGroupIds": [
            "deviceGroup1"
        ],
        "sensorConfigs": [{
            "sensorConfigId": "sensor-id-1",
            "path": "*",
            "operation": "DEVICE_PACKAGE",
            "cadence": 120,
            "sensorPathParams": [{
                    "key": "package",
                    "value": "getIfNumbersnmp"
                },
                {
                    "key": "function",
                    "value": "SnmpActionIfMib"
                }
            ]
        }]
    }],
    "sinks": [{
        "name": "<unique_sink_name>",
        "parentIds": [
            "<unique_source_name>"
        ],
        "outputTarget": {
            "messageBusTarget": {
                "brokerAddresses": [{
                    "host": "kafka-operational",
                    "port": 9092
                }],
                "username": "kafka-admin",
                "password": "<password>",
                "destinationTopic": "externalOutputTopic",
                "certificateKey": "BasicOne"
            }
        }
    }],
    "secretKey": "skey"
}

gRPC Output Target

(with custom MIB)

{
    "collection-job-id": "<unique_collection_job_name>",
    "collectorType": "SNMP",
    "deviceGroups": [{
        "id": "deviceGroup1",
        "devices": [{
                "name": "vm1-xrv9000",
                "host": "<device_IP_address>"
            },
            {
                "name": "vm2-xrv9000",
                "host": "<device_IP_address>"
            },
            {
                "name": "vm3-xrv9000",
                "host": "<device_IP_address>"
            }
        ]
    }],
    "deviceParams": [{
            "key": "snmpVersion",
            "value": "V3"
        },
        {
            "key": "snmpSecurityName",
            "value": "xrvr-usr"
        },
        {
            "key": "snmpAuthProtocol",
            "value": "MD5"
        },
        {
            "key": "snmpAuthPassphrase",
            "value": "<password>"
        },
        {
            "key": "snmpPrivProtocol",
            "value": "AES128"
        },
        {
            "key": "snmpPrivPassphrase",
            "value": "<password>"
        },
        {
            "key": "snmpCommunityString",
            "value": "xrvr-usr"
        }
    ],
    "sources": [{
        "name": "<unique_source_name>",
        "deviceGroupIds": [
            "deviceGroup1"
        ],
        "sensorConfigs": [{
            "sensorConfigId": "sensor-id-1",
            "path": "*",
            "operation": "DEVICE_PACKAGE",
            "cadence": 120,
            "sensorPathParams": [{
                    "key": "package",
                    "value": "getIfNumbersnmp"
                },
                {
                    "key": "function",
                    "value": "SnmpActionIfMib"
                }
            ]
        }]
    }],
    "sinks": [{
        "name": "<unique_sink_name>",
        "parentIds": [
            "<unique_source_name>"
        ],
       "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }],
    "secretKey": "skey"
}

SNMP Traps Collection Job

SNMP traps are handled in a similar manner. Trap listeners listen on a port and then dispatch data to recipients (based on their topic of interest).


Note

  • Device should have been pre-configured by the traps.

  • Crosswork Data Gateway listens on UDP port 1062 for Traps.

  • Collection jobn gets stuck in Accepted state when wrong authentication credentials are passed for SNMP Traps.


On receiving a trap, Crosswork Data Gateway does the following validations:

  1. Check if any collection job is created for the device.

  2. Checks the trap version and community string.

  3. For SNMP v3, validates for user auth and priv protocol and credentials.

The following table shows different types of SNMP Trap collection jobs:

API URL

{contextPath}/v1/collect-jobs/{jobId}

HTTP Method

GET

Response Status Code

200 OK

SNMP TRAP with Kafka output target

{
  "collection-job-id": "<unique_collection_job_name>",
  "collectorType": "SNMP",
  "deviceGroups": [
    {
      "id": "deviceGroup1",

  "devices": [
        {
          "name": "vm1-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        },
        {
          "name": "vm3-xrv9000",
          "host": "<device_IP_address>"
        }
      ]
    }
  ],
      "deviceParams": [
        {
          "key": "snmpVersion",
          "value": "V3"
        },
        {
          "key": "snmpSecurityName",
          "value": "xrvr-usr"
        },
        {
          "key": "snmpAuthProtocol",
          "value": "MD5"
        },
        {
          "key": "snmpAuthPassphrase",
          "value": "<password>"
        },
        {
          "key": "snmpPrivProtocol",
          "value": "AES128"
        },
        {
          "key": "snmpPrivPassphrase",
          "value": "<password>"
        },
        {
          "key": "snmpEngineId",
          "value": "00000009030052540020fd32"
        },
        {
          "key": "snmpCommunityString",
          "value": "xrvr-usr"
        }
      ]
  "sources": [
    {
      "name": "<unique_source_name>",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
         "sensorConfigId": "sensor-id-1",

         "operation": "TRAP",

          "path": "*"
        },
        {
          "sensorConfigId": "sensor-id-2",

          "operation": "TRAP",
          "path": "*"
        }
      ]
    }
  ],
  "sinks": [
    {
      "id": "<unique_sink_name>",
      "name": "sink2",
      "parentIds": [
        "<unique_source_name>"
      ],
      "outputTarget": {
        "messageBusTarget": {
          "brokerAddresses": [
            {
              "host": "kafka-operational",
              "port": 9092
            }
          ],
          "username": "kafka-admin",
          "password": "<password>",
          "destinationTopic": "externalOutputTopic",
          "certificateKey": "BasicOne"
        }
      }
    }
  ],
  "secretKey": "skey"
}

SNMP TRAP with gRPC output target

{
  "collection-job-id": "collect-job1",
  "collectorType": "SNMP",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm1-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "snmpVersion",
          "value": "V2"
        },
        {
          "key": "snmpCommunityString",
          "value": "xrvr-usr"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "source1",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "path": "*",
          "operation": "TRAP"
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "sink-grpc",
      "parentIds": [
        "source1"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }
  ],
  "secretKey": "skey"
}

MDT Collection Job

Crosswork Data Gateway supports data collection from network devices using Model-driven Telemetry (MDT) to consume telemetry streams directly from devices.


Note

It is suggested that the Controller application can integrate with a provisioning entity to provision the telemetry subscription request on the device. Crosswork Data Gateway is not responsible to provision the MDT on the device. It is customer's responsibility to to perform any device configuration required on the device using some other provisioning tool.


It supports data collection for the following transport modes:

Source Fields Interpretation for MDT

Field

Description

sensorConfigs->path

Subscription ID for MDT subscriptions on the device.

deviceSet->Name

Field to match with node_id from collected MDT Header data.

deviceSet->transport

MDT collection method:

  • GRPC_DAILIN

  • GRPC_DAILOUT

  • TCP_DAILOUT

deviceSet->deviceAddress->host

Host to connect for GRPC_DAILIN

deviceSet->deviceAddress->port

Port to be used for GRPC_DAILIN only

deviceSet->deviceAddress->username

deviceSet->deviceAddress->password

Credentials for GRPC_DAILIN only. This can be any user who has access to subscribed configs.


Note

Any other fields, if populated, would be ignored by MDT collector.


MDT gRPC Dial-in Mode

{
  "collectionJobId": "Mdt_Grpc_DialIn_OneSource_OneSink_OneDevice_OneConfig_Kafka",
  "collectorType": "MDT",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "transport",
          "value": "GRPC_DIALIN"
        },
        {
          "key": "username",
          "value": "admin"
        },
        {
          "key": "password",
          "value": "<password>"
        },
        {
          "key": "port",
          "value": "17777"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "mdt-grpc-dial-in-source",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "sensorConfigId": "5b8d749a-74f2-420a-beea-c0e19a6b7a63",
          "path": "GrpcDialInSub1"
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "kafka-sink",
      "parentIds": [
        "mdt-grpc-dial-in-source"
      ],
      "outputTarget": {
        "messageBusTarget": {
          "brokerAddresses": [
            {
              "host": "<kafka_server_IP_address>",
              "port": 9092
            }
          ],
          "destinationTopic": "mdt-grpc-dialin-collection-topic"
        }
      }
    }
  ],
  "secretKey": "skey"
}

Sink with gRPC Output Target

"sinks": [
    {
      "name": "sink-grpc",
      "parentIds": [
        "source1"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<device_IP_address>"
          }
        }
      }
    }
  ]

MDT gRPC Dial-out Mode

{
  "collection-job-id": "Mdt_Grpc_DialOut_OneSource_OneSink_OneDevice_OneConfig",
  "collectorType": "MDT",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "transport",
          "value": "GRPC_DIALOUT"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "mdt-grpc-dial-out-source",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "sensorConfigId": "5b8d749a-74f2-420a-beea-c0e19a6b7a63",
          "path": "Sub1"
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "kafka-sink",
      "parentIds": [
        "mdt-grpc-dial-out-source"
      ],
      "outputTarget": {
        "messageBusTarget": {
          "brokerAddresses": [
            {
              "host": "<kafka_server_IP_address>",
              "port": 9092
            }
          ],
          "destinationTopic": "mdt-collection-topic"
        }
      }
    }
  ],
  "secretKey": "skey"
}

Sink with gRPC Output Target

"sinks": [
    {
      "name": "sink-grpc",
      "parentIds": [
        "source1"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<gRPC_server_IP_address>"
          }
        }
      }
    }
  ]

MDT TCP Dial-out Mode

{
  "collectionJobId": "Mdt_Tcp_DialOut_OneSource_OneSink_OneDevice_OneConfig_kafka",
  "collectorType": "MDT",
  "deviceGroups": [
    {
      "id": "deviceGroup1",
      "devices": [
        {
          "name": "vm2-xrv9000",
          "host": "<device_IP_address>"
        }
      ],
      "deviceParams": [
        {
          "key": "transport",
          "value": "TCP_DIALOUT"
        }
      ]
    }
  ],
  "sources": [
    {
      "name": "mdt-tcp-dial-out-source",
      "deviceGroupIds": [
        "deviceGroup1"
      ],
      "sensorConfigs": [
        {
          "sensorConfigId": "5b8d749a-74f2-420a-beea-c0e19a6b7a63",
          "path": "TcpSub1"
        }
      ]
    }
  ],
  "sinks": [
    {
      "name": "kafka-sink",
      "parentIds": [
        "mdt-tcp-dial-out-source"
      ],
      "outputTarget": {
        "messageBusTarget": {
          "brokerAddresses": [
            {
              "host": "<gRPC_server_IP_address>",
              "port": 9092
            }
          ],
          "destinationTopic": "mdt-tcp-dialout-collection-topic"
        }
      }
    }
  ],
  "secretKey": "skey"
}

Sink with gRPC Output Target

"sinks": [
    {
      "name": "sink-grpc",
      "parentIds": [
        "source1"
      ],
      "outputTarget": {
        "grpcTarget": {
          "password": "<password>",
          "username": "admin",
          "certificateKey": "some certificate",
          "grpcAddress": {
            "port": 60061,
            "host": "<device_IP_address>"
          }
        }
      }
    }
  ]