Network Discovery

class NetworkDiscovery(api)

Bases: FeatureBase

blackout_schedule(job, sunday=None, monday=None, tuesday=None, wednesday=None, thursday=None, friday=None, saturday=None)

Times of the week to restrict a discovery job from processing.

Parameters
  • job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

  • sunday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Sunday.

  • monday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Monday.

  • tuesday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Tuesday.

  • wednesday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Wednesday.

  • thursday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Thursday.

  • friday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Friday.

  • saturday (List[Union[str, int]]) – List of hours without leading zeros to restrict processing on Saturday.

cancel(job)

Cancels a currently running job.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

create(name, hosts, default_certificate_location, attributes=None, automatically_import=False, blackout=None, contacts=None, days_of_week=None, days_of_month=None, days_of_year=None, description=None, exclusion_locations=None, hour=None, placement_rules=None, ports=None, priority=None, reschedule=True, resolve_host=True, utc='1', get_if_already_exists=True)
Parameters
  • name (str) – Name of the discovery job.

  • hosts (List[str]) – A list of hosts. If specific hosts should scan different ports, then specify by appending the port to the IP address or hostname (i.e. 192.168.0.10:80). If no port is specified, then the ports parameter will be appended to those hosts.

  • default_certificate_location (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the folder to place results not matching a placement rule.

  • attributes (dict) – Additional attributes.

  • automatically_import (bool) – If True, the job will terminate by placing the certificate objects, device objects, and application objects according to the placement rules.

  • blackout (Dict[str, List]) – Period of time that TPP will not perform discovery operations. The format of this value should be as follows: [{<day>:[<hour>, <hour>, …]}, {…}] where day is the zero-based index day of the week (i.e. Sunday = ‘0’, etc.) and hour is the 24-hour hour of the day (i.e. 1, 2, 3, …, 23). For example:

  • contacts (List[Union[ident.Identity, str]]) – List of Identity Object or Prefixed Name as contacts.

  • days_of_week (List[str]) – Zero-based index value of the days of the week to run the job.

  • days_of_month (List[str]) – Day value(s) of the month to run the job.

  • days_of_year (List[str]) – Days of the year to run the job in the format “MM/DD” where leading zeros can be ignored (i.e. 1/23, 10/3).

  • description (str) – Description of the job.

  • exclusion_locations (Union[config.Object, str]) – List of Config Object or Distinguished Name (DN) of exclusion folders.

  • hour (int) – 24-hour UTC hour format of the day (i.e. 20 = 8 PM UTC).

  • placement_rules (List[Union[config.Object, str]]) – List of Config Object or Distinguished Name (DN) for the placement rules. The order of the list matters as the rules are prioritized accordingly.

  • ports (List[Union[str, int]]) – List of ports to scan.

  • priority (int) – Priority of the job.

  • reschedule (bool) – When True, the job will run again on the next scheduled interval.

  • resolve_host (bool) – Resolve the hostname when True.

  • utc (str) – UTC offset.

  • get_if_already_exists (bool) – If the objects already exists, just return it as is.

Returns

Config Object of the discovery job.

delete(job)

Deletes the discovery job.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

get(name, raise_error_if_not_exists=True)
Parameters
  • name (str) – Name of the discovery job.

  • raise_error_if_not_exists (bool) – Raise an exception if the discovery job does not exist.

Returns

Config Object of the discovery job.

get_all_jobs()
Returns

List of Config Object of all network discovery jobs.

is_in_progress(job)
Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

Returns

True if the job is in progress or False if it is not.

Return type

bool

pause(job)

Pauses a currently running job.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

place_results(job)

Warning

This functionality has been deprecated in TPP 21.1 and will have no effect from this version forward.

Places the results of the discovery job according to the placement rules.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

resume(job)

Resumes a currently paused job.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

run_now(job, timeout=60)

Runs a job despite any scheduling. This does not return until the job is processing, or has a Processing Attribute.

Parameters
schedule(job, hour, days_of_week=None, days_of_month=None, days_of_year=None)

Schedules an existing job.

Parameters
  • job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

  • hour (Union[str, int]) – 24-hour UTC hour format (i.e. 20 = 8PM UTC).

  • days_of_week (List[Union[str, int]]) – Zero-based index of the days of the week (i.e. Sunday = ‘0’).

  • days_of_month (List[Union[str, int]]) – Days of the month without leading zeros.

  • days_of_year (List[str]) – Days of the year in “MM/DD” format without leading zeros (i.e. 1/23, 10/3).

unschedule(job)

Removes a schedule from a job. This does not delete the job.

Parameters

job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

wait_for_job_to_finish(job, check_interval=5, timeout=300)

Waits for the Status attribute to have a value other than Pending Execution and Running on the discovery job. An error is raised if the timeout is exceeded.

Parameters
  • job (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the discovery job.

  • check_interval (int) – Poll interval in seconds to validate that the job finished.

  • timeout (int) – Timeout in seconds to wait for the job to finish.