netlab.api

Netlab SDK api methods

class netlab.api.ClassApiMixin(*args, **kwargs)

Methods for working with classes.

async class_add(*, cls_name, com_id, cls_change_ex=True, cls_def_pw_account=None, cls_def_pw_console=None, cls_def_pw_enable=None, cls_email_logs=ClassEmailLogs.NO, cls_end_date=None, cls_lab_limit=ClassLabLimit.ENFORCE, cls_max_slots_per_res=None, cls_min_hours_btw_res=None, cls_no_delete=False, cls_retain_ilt=False, cls_retain_period=None, cls_retain_st=True, cls_self_sched=True, cls_start_date=None, cls_team_sched=False, **kwargs)

This method allows you to add a class to the NETLAB+ system.

Parameters:
  • cls_name (str) – Class name.

  • com_id (int) – Community ID.

  • cls_change_ex (bool) – Allow student to change exercise.

  • cls_def_pw_account (str | None) – Class default account password.

  • cls_def_pw_console (str | None) – Class default console password.

  • cls_def_pw_enable (str | None) – Class default enable password.

  • cls_email_logs (ClassEmailLogs) – Email reservation logs for real equipment pods.

  • cls_end_date (date | None) – Class end date.

  • cls_lab_limit (ClassLabLimit) – Class lab time limit.

  • cls_max_slots_per_res (int | None) – Maximum number of slots per reservation.

  • cls_min_hours_btw_res (int | None) – Minimum hours between reservations.

  • cls_no_delete (bool) – Prevent from deletion.

  • cls_retain_ilt (bool) – Retain instructor led logs.

  • cls_retain_period (date | None) – The number of days to retain logs for.

  • cls_retain_st (bool) – Retain student logs.

  • cls_self_sched (bool) – Allow students to self schedule.

  • cls_start_date (date | None) – Class start date.

  • cls_team_sched (bool) – Allow teams to schedule.

Returns:

On success, returns the cls_id of the newly created class.

Return type:

int

async class_content_add(*, cls_id, con_id, **kwargs)

This method allows you to add content to a class.

Parameters:
  • cls_id (int) – Class identifier.

  • con_id (str) – Content identifier.

async class_content_availability(*, cls_id, **kwargs)

This method provides a list of available class content.

Parameters:

cls_id (int) – Unnique class identifier.

Returns:

On success, returns a list of objects with the requested properties:

Return type:

List[Dict[str, Any]]

Properties

con_access

Content is Globally accessible or Private.

con_aid

Content author ID.

con_author

Content author name.

con_build

Build number.

con_copyright

Content copyright.

con_desc

Content description.

con_gid

Unique content identifier.

con_global

Is content globally accessible or not.

con_id

Unique content identifier.

con_managed

Is the content managed or not.

con_name

Name of content.

con_notes

Content notes.

con_org

Content organization.

con_origin

Source of the content.

con_pt_ids

Comma separated list of required Pod Types.

con_url

Content URL.

async class_content_list(*, cls_id, properties='all', **kwargs)

This method provides a list of content associated with a class.

Parameters:
  • cls_id (int) – Unique class identifier.

  • properties (Literal['all'] | ~typing.List[str]) – Array of properties to retrieve.

Returns:

On success, returns a list of objects with the requested properties:

Return type:

List[Dict[str, Any]]

Properties

con_access

Content is Globally accessible or Private.

con_aid

Content author ID.

con_author

Content author name.

con_build

Build number.

con_copyright

Content copyright.

con_desc

Content description.

con_gid

Unique content identifier.

con_global

Is content globally accessible or not.

con_id

Unique content identifier.

con_managed

Is the content managed or not.

con_name

Name of content.

con_notes

Content notes.

con_org

Content organization.

con_origin

Source of the content.

con_pt_ids

Comma separated list of required Pod Types.

con_url

Content URL.

async class_content_remove(*, cls_id, con_id, **kwargs)

This method removes content from a class.

Parameters:
  • cls_id (int) – Class identifier.

  • con_id (str) – Content identifier.

async class_get(*, cls_id, properties='default', **kwargs)

This method allows you to retrieve a single class and properties.

Parameters:
  • cls_id (int) – Class ID.

  • properties (List[str] | Literal['default', 'all']) – List of properties to retrieve. Defaults to “all”.

Returns:

On success, returns an object with the requested properties:

Return type:

Dict[str, Any]

Properties

cls_change_ex

Allow student to change exercise.

cls_def_pw_account

Class default account password.

cls_def_pw_console

Class default console password.

cls_def_pw_enable

Class default enable password.

cls_email_logs

Email reservation logs for real equipment pods. netlab.enums.ClassEmailLogs

cls_end_date

Class end date.

cls_id

Unique class identifier.

cls_lab_limit

Lab limit settings. netlab.enums.ClassLabLimit

cls_max_slots_per_res

Maximum number of slots per reservation.

cls_min_hours_btw_res

Minimum number of hours between reservations.

cls_name

Unique class name per community.

cls_no_delete

Prevent from deletion.

cls_retain_ilt

Retain instructor led logs.

cls_retain_period

Number of days to retain class logs.

cls_retain_st

Retain student logs.

cls_self_sched

Allow students to self schedule.

cls_start_date

Class start date.

cls_team_sched

Allow teams to schedule.

cls_uuid

Class UUID.

com_id

Unique community identifier.

enrollment

Count of those enrolled.

leads

List of leads and properties sorted by acc_sort_name.

async class_list(*, com_id=None, member=False, properties='default', **kwargs)

This method allows you to retrieve a list of classes and their properties.

Parameters:
  • com_id (int | None) – Community ID.

  • member (bool) – If true, get list of classes the caller is in.

  • properties (List[str] | Literal['default', 'all']) – List of properties to retrieve. See Properties section for list of available properties.

Returns:

On success, returns an object with the requested properties:

Return type:

List[Dict[str, Any]]

Properties

cls_change_ex

Allow student to change exercise.

cls_def_pw_account

Class default account password.

cls_def_pw_console

Class default console password.

cls_def_pw_enable

Class default enable password.

cls_email_logs

Email reservation logs for real equipment pods. netlab.enums.ClassEmailLogs

cls_end_date

Class end date.

cls_id

Unique class identifier.

cls_lab_limit

Lab limit settings. netlab.enums.ClassLabLimit

cls_max_slots_per_res

Maximum number of slots per reservation.

cls_min_hours_btw_res

Minimum number of hours between reservations.

cls_name

Unique class name per community.

cls_no_delete

Prevent from deletion.

cls_retain_ilt

Retain instructor led logs.

cls_retain_period

Number of days to retain class logs.

cls_retain_st

Retain student logs.

cls_self_sched

Allow students to self schedule.

cls_start_date

Class start date.

cls_team_sched

Allow teams to schedule.

cls_uuid

Class UUID.

com_id

Unique community identifier.

enrollment

Count of those enrolled.

leads

List of leads and properties sorted by acc_sort_name.

async class_remove(*, cls_id, delete_students=False, **kwargs)

This method removes a class from the NETLAB+ system.

Parameters:
  • cls_id (int) – Local system class.

  • delete_students (bool) – False Do not delete student accounts. True Delete student accounts that are exclusively in this class. Student accounts that are members of multiple classes are not deleted.

async class_roster_add(*, acc_id, cls_id, lead=False, ros_team=None, **kwargs)

This method allows you to add a member to a class roster.

Parameters:
  • acc_id (str) – Unique account identifier.

  • cls_id (str) – Unique class identifier.

  • lead (bool) – Add as lead.

  • ros_team (str | None) – Assign user to a team. Single character, A-Z.

async class_roster_get(*, cls_id, acc_id, **kwargs)

This method returns class roster information for a single user.

Parameters:
  • cls_id (int) – Local system class identifier.

  • acc_id (int | None) – Returns roster information for the user specified by acount ID acc_id. If acc_id is not provided, roster information related to the requester is returned.

Returns:

On success, returns an object with the requested properties:

Return type:

Dict[str, Any]

Properties

acc_display_name

Account name people will see this name in discussions, messages and comments.

acc_email

Account email.

acc_id

Local system account identifier.

acc_full_name

Account full name.

acc_last_login

Timestamp of last account login.

acc_logins

Number of times a user has logged in.

acc_sort_name

Account name as it appears in sorted lists.

acc_time_last_access

Timestamp of last access.

acc_type

Account type.

acc_user_id

Account user identifier.

cls_id

Unique class identifier.

lead

User is a lead instructor.

ros_team

Team identifier [A-Z] or None if user is not assigned to a team.

async class_roster_list(*, cls_id, leads=False, **kwargs)

This method lists users in the class roster.

Parameters:
  • cls_id (int) – Local system class.

  • leads (bool) – None Return all users in the roster (leads and learners). True Return lead instructors only. False Return learners only.

Returns:

On success, returns an object with the requested properties:

Properties

acc_display_name

Account name people will see this name in discussions, messages and comments.

acc_email

Account email.

acc_id

Local system account identifier.

acc_full_name

Account full name.

acc_last_login

Timestamp of last account login. Possibly None.

acc_logins

Number of times a user has logged in.

acc_sort_name

Account name as it appears in sorted lists.

acc_time_last_access

Timestamp of last access. Possibly None.

acc_type

Account type. netlab.enums.AccountType

acc_user_id

Account user identifier.

cls_id

Unique class identifier.

lead

If user is a lead instructor.

ros_team

Assignment of user to a team (designated by team letter). None if user is not assigned to a team.

async class_roster_remove(*, acc_id, cls_id, **kwargs)

This method removes a user from the class roster.

Parameters:
  • acc_id (int) – Account identifier of user to be removed.

  • cls_id (str) – Unique class identifier.

async class_roster_team_update(*, cls_id, ros_team=None, roster_acc_id, **kwargs)

This method will create and update teams (groups of students) for a given class roster.

Parameters:
  • cls_id (int) – Local system class identifier.

  • ros_team (str | None) – A single uppercase letter [A,Z] as the designation of the team to add the student(s) to. If this value is None, the student(s) are assigned to no team (unassigned).

  • roster_acc_id (List[int]) – A list of account IDs to assign to the specified team.

async class_update(*, cls_id, cls_change_ex=None, cls_def_pw_account=None, cls_def_pw_console=None, cls_def_pw_enable=None, cls_email_logs=None, cls_end_date=None, cls_lab_limit=None, cls_max_slots_per_res=None, cls_min_hours_btw_res=None, cls_name=None, cls_no_delete=None, cls_retain_ilt=None, cls_retain_period=None, cls_retain_st=None, cls_self_sched=None, cls_start_date=None, cls_team_sched=None, cls_ext_slots_per_res=None, **kwargs)

This method allows you to update a class and its properties.

Parameters:
  • cls_id (int) – Unique class identifier.

  • cls_change_ex (bool | None) – Allow student to change exercise.

  • cls_def_pw_account (str | None) – Class default account password.

  • cls_def_pw_console (str | None) – Class default console password.

  • cls_def_pw_enable (str | None) – Class default enable password.

  • cls_email_logs (ClassEmailLogs | None) – Email reservation logs for real equipment pods.

  • cls_end_date (date | None) – Class end date.

  • cls_lab_limit (ClassLabLimit | None) – Class lab time limit.

  • cls_max_slots_per_res (int | None) – Maximum number of slots per reservation.

  • cls_min_hours_btw_res (int | None) – Minimum hours between reservations.

  • cls_name (str | None) – Class name.

  • cls_no_delete (bool | None) – Prevent from deletion.

  • cls_retain_ilt (bool | None) – Retain instructor led logs.

  • cls_retain_period (int | None) – The number of days to retain logs for.

  • cls_retain_st (bool | None) – Retain student logs.

  • cls_self_sched (bool | None) – Allow students to self schedule.

  • cls_start_date (date | None) – Class start date.

  • cls_team_sched (bool | None) – Allow teams to schedule.

  • cls_ext_slots_per_res (int | ClassExtensionSlots | None) – Allow extensions to reservations for students and teams. Instructors are not restricted to this limit.

class netlab.api.LabApiMixin(*args, **kwargs)

Methods for working with labs.

async lab_exercise_list(*, properties=None, sort_property='ex_id', con_id=None, **kwargs)

This method allows you to retrieve a list of lab exercises installed on the system.

Parameters:
  • con_id (str | None) – If specified, only return exercises within for the lab designed with identifier of con_id.

  • sort_property (Literal['ex_id', 'ex_index', 'ex_name', 'ex_con_id']) – Property to sort results by.

  • properties (List[str] | None) – List of properties to retrieve. See Properties section for list of available properties.

Returns:

On success, returns an object with the requested properties:

Return type:

List[Dict[str, Any]]

Properties

ex_id

Lab exercise identifier.

ex_con_id

Lab design identifier.

ex_index

Exercise index number in lab design.

ex_name

Exercise name.

ex_content_url

Lab document relative URL.

ex_minutes

Exercise minimum time in minutes.

ex_topology_image

Lab topology image relative URL.

ex_im_id

Internal image map identifier for clickable hotspots.

ex_vlan_map

Alternate VLAN map for real equipment pods, overrides pod design.

ex_pt_id

Exercise pod type identifier.

ex_tabs

Exercise tabs enabled.

ex_actions

Exercise actions enabled.

ex_fs_id

Root node of folder containing configuration files for this exercise.

ex_content_no_preview

If true, user cannot preview this exercise.

ex_ilt_no_select

If true, exercise is disabled in ILT.

cls_ids

Array of class identifiers using this content.

hotspots

Array of image_map objects (for clickable hotspots).

class netlab.api.PodApiMixin(*args, **kwargs)
async pod_acl_add(*, com_id, pod_id, acc_id=None, cls_id=None, team=None, **kwargs)

This method allows you to add access controls to a pod on the NETLAB+ system.

Parameters:
  • com_id (int) – Community identifier.

  • pod_id (int) – Pod identifier.

  • acc_id (int | None) – Account identifier.

  • cls_id (int | None) – Class identifier.

  • team (str | None) – Team assignment.

Returns:

Pod access control list UUID.

Return type:

UUID

async pod_acl_admin_add(*, acc_id, pod_id, **kwargs)

This method allows you add additional pod access control administrators.

Parameters:
  • acc_id (int) – Account identifier.

  • pod_id (int) – Pod identifier.

async pod_acl_admin_auth(*, acc_id, pod_id, **kwargs)

This method returns true if a specified instructor account is authorized to manage POD ACLs on a specified pod.

Parameters:
  • acc_id (int) – Account identifier.

  • pod_id (int) – Pod identifier.

Returns:

acc_id is authorized for pod_id.

Return type:

bool

async pod_acl_admin_list(*, pod_id, **kwargs)

This method allows you to retrieve a list of pod access controls per pod.

Parameters:

pod_id (int) – Pod identifier.

Returns:

Pod access control list.

Return type:

List[Dict[str, Any]]

async pod_acl_admin_pods(*, acc_id, **kwargs)

This method allows you to retrieve a list of pods a user has access to.

Parameters:

acc_id (int) – Account identifier.

async pod_acl_admin_remove(*, acc_id, pod_id, **kwargs)

This method allows you to remove authorization for an account.

Parameters:
  • acc_id (int) – Account identifier.

  • pod_id (int) – Pod identifier.

async pod_acl_challenge(*, com_id, pod_id, acc_id=None, cls_id=None, team=None, **kwargs)

This method allows you to test against a pod access control list.

Parameters:
  • com_id (int) – Community identifier.

  • pod_id (int) – Pod identifier.

  • acc_id (int) – Account identifier.

  • cls_id (int) – Class identifier.

  • team (str) – Team assignment.

Returns:

If matching rule found, pod access control list UUID.

Return type:

UUID

async pod_acl_get(*, pacl_uuid, **kwargs)

This method allows you to retrieve a pod access control list.

Parameters:

pacl_uuid (UUID) – Pod access control list UUID.

Returns:

Pod access control list.

Return type:

List[Dict[str, Any]]

async pod_acl_list(*, pod_id, **kwargs)

This method allows you to retrieve a list of pod access controls per pod.

Parameters:

pod_id (int) – Pod identifier.

Returns:

Pod access control list.

Return type:

List[Dict[str, Any]]

async pod_acl_remove(*, pacl_uuid, **kwargs)

This method allows you to remove a pod access control list.

Parameters:

pacl_uuid (UUID) – Pod access control list UUID.

async pod_add(*, pod_id, pt_id, devices=None, pod_acl_enabled=False, pod_adv_settings=None, pod_auto_net_enabled=True, pod_auto_net_host_setup=True, pod_auto_net_host_teardown=True, pod_cat=PodCategory.PERSISTENT_VM, pod_desc=None, pod_name=None, **kwargs)

This method allows you to add a pod to the NETLAB+ system. Pods created will be OFFLINE after added.

Parameters:
  • pod_id (int) – Unique pod identifier.

  • pt_id (str) – Pod type identifier.

  • devices (List[Dict[str, Any]] | None) – Array of devices associated with this pod. This is for real equipment pods only.

  • pod_acl_enabled (bool) – Pod access control list enabled.

  • pod_adv_settings (str | None) – Advanced settings for pod configuration.

  • pod_auto_net_enabled (bool) – Auto-networking enabled.

  • pod_auto_net_host_setup (bool) – Auto-networking host setup enabled.

  • pod_auto_net_host_teardown (bool) – Auto-networking host teardown enabled.

  • pod_cat (PodCategory) – Pod category type.

  • pod_desc (str | None) – Pod description.

  • pod_name (str | None) – Pod name.

async pod_clone_task(*, source_pod_id, clone_pod_id, clone_pod_name, pc_clone_specs=None, severity_level=HDRSeverity.WARN, **kwargs)

Clone a pod.

Parameters:
  • source_pod_id (int) – Source pod unique identifier.

  • clone_pod_id (int) – Cloned pod unique identifier

  • clone_pod_name (str) – Cloned unique pod name.

  • pc_clone_specs (List[PCCloneSpec] | PCCloneSpec | None) – Array of PC clone specifications. Any unpassed params will be taken from the existing pods. If a dict is passed, the params will be used on every pod.

  • severity_level (HDRSeverity) – Display detailed events for the task only at this severity level or higher.

Returns:

HDR result

Return type:

HDRResult

pc_clone_specs

The format requires a list of dictionaries. One dictionary per each PC in the pod, e.g. [{pc.clone.spec.1}, {pc.clone.spec.2}]. See PCCloneSpec the expected value type and a key description.

Example:

pc_clone_specs = [{
        "clone_role":"NORMAL",
        "clone_type":"LINKED",
        "source_snapshot":"GOLDEN_MASTER",
        "pc_type":"AVMI",
        "clone_vh_id":1,
        "clone_name":"Test_Linux_Install_pod04_CentOS Server",
        "clone_storage_alloc":"ONDEMAND",
        "clone_datastore":"local",
        "clone_snapshot":"GOLDEN_MASTER"
    }, {
        "clone_role":"NORMAL",
        "clone_type":"LINKED",
        "source_snapshot":"GOLDEN_MASTER",
        "pc_type":"AVMI",
        "clone_vh_id":1,
        "clone_name":"Test_Linux_Install_pod04_Ubuntu Workstation",
        "clone_storage_alloc":"ONDEMAND",
        "clone_datastore":"local",
        "clone_snapshot":"GOLDEN_MASTER"
    }]
async pod_get(*, pod_id, properties='default', **kwargs)
Parameters:
  • pod_id (int) – Unique pod identifier.

  • properties (List[str] | Literal['default', 'all']) – Properties consist of any combination of properties listed below under Properties. You may also use “all” to include all properties, or “default” for a smaller subset of properties.

Returns:

Returns a dictionary object containing the following properties:

Return type:

Dict[str, Any]

Properties

def_im_name

Default image name.

def_topology_image

Default topology image URL.

def_vlan_map

Default VLAN mapping.

device_count

Count of devices in pod type.

devices

List of devices in pod type.

pod_acl_enabled

Pod access control list enabled.

pod_admin_state

Administrative pod states.

pod_adv_settings

A list of all advanced settings.

pod_auto_net_enabled

Automatic VM networking enabled.

pod_auto_net_host_setup

Automatic Host networking setup enabled.

pod_auto_net_host_teardown

Automatic Host networking teardown enabled.

pod_cat

Pod category type. netlab.enums.PodCategory

pod_csw_base_vlan

Pod control switch base VLAN.

pod_csw_id

Pod control switch id.

pod_current_state

Pod current state status.

pod_desc

Pod description.

pod_id

Unique pod identifier.

pod_managed

Pod is managed.

pod_name

Pod name.

pod_origin

Pod origin.

pod_res_id

Current pod reservation identifier.

pod_task_id

Current pod task identifier.

pod_task_info

Current pod task information.

pod_task_type

Current pod task type.

pod_uuid

Globally unique pod identifier.

pt_actions

Pod type actions enabled.

pt_adv_settings

Long string of advanced settings.

pt_apc_port_count

Switched outlet port count requirement.

pt_apdid

Author identifier for pod design.

pt_as_port_count

Access server port count requirement.

pt_author

Pod design author.

pt_build

Pod build number.

pt_copyright

Pod design copyright.

pt_csw_port_count

Control switch port count requirement.

pt_desc

Pod type description.

pt_gpdid

Global unique identifier.

pt_id

Pod type identifier.

pt_name

Pod type name.

pt_notes

Pod type notes.

pt_org

Pod design organization.

pt_origin

Pod type origin.

pt_pod_max

Max pod count of this type.

pt_removable

Pod type is removable.

pt_tabs

Pod type tabs enabled.

pt_url

Pod design support URL.

pt_vlan_pool

Pod type vlan pool.

remote_pc

List of remote PCs in pod type with their expanded properties. See Remote PC table below.

remote_pc_count

Count of remote PCs in pod type.

reservations

The number of reservations scheduled or in progress for this pod.

sched_image

Scheduler image URL.

vm_alloc

VM resource allocation properties. netlab.datatypes.VMAlloc Added in 18.5.0.

async pod_list(*, pod_cat=None, **kwargs)

List pods on the system.

Parameters:

pod_cat (PodCategory | None) – Pod category type.

Returns:

Returns a list of dictionary objects containing the following properties:

Return type:

List[Dict[str, Any]]

Properties

def_topology_image

Default topology image URL.

pod_acl_enabled

Pod access control lists enabled for this pod.

pod_admin_state

Pod administrative state. netlab.enums.PodAdminState

pod_cat

Pod category. netlab.enums.PodCategory

pod_current_state

Pod current state. netlab.enums.PodCurrentState

pod_desc

Pod description.

pod_dyn_vlan

Pod is using dynamic vlans.

pod_id

Unique pod identifier.

pod_managed

Pod is managed (currently always True).

pod_name

Pod name.

pod_uuid

Pod name.

pod_res_id

Current pod reservation identifier.

pt_apdid

Author identifier for pod design.

pt_desc

Pod type description.

pt_gpdid

Global unique identifier.

pt_id

Pod type identifier.

pt_name

Pod type name.

sched_image

Scheduler image URL.

async pod_list_used_ids(**kwargs)

List the used pod_id’s on the system.

Returns:

Returns a list of pod_ids

Return type:

List[int]

async pod_pc_get(*, pod_id=None, pl_index=None, pc_id=None, **kwargs)

Get information regarding a pod pc.

Parameters:
  • pod_id (int | None) – Pod ID

  • pl_index (int | None) – PC Pod index

  • pc_id (int | None) – unique pc identifier

Returns:

On success, returns the following properties:

Return type:

Dict[str, Any]

Properties

pc_icon

Icon identifier. netlab.enums.PCIcon

pc_id

Unique pc identifier.

pc_label

PC label.

pc_online

PC online.

pc_origin

PC origin.

pc_os_id

PC operating system identifier.

pc_os_name

NETLAB+ operating system name.

pc_pod_id

pod_id pc is associated to.

pc_pod_index

Index of pods.

pc_revert_to_scrub

Revert pc during scrub.

pc_type

PC type. netlab.enums.PCType

pc_vnc_ip_addr

IP Address of vnc (ESXi host) server.

pc_vnc_port

Port number VNC is running on.

pc_vnc_use_copy_rect

Always Allow VNC to use copy rect encoding.

pl_icon

Pod design PC icon identifier. netlab.enums.PLIcon

pl_index

PC pod index.

pl_label

Remote pc label.

pt_id

Pod type identifier.

vdc_id

Agent hostname/IP address.

vdc_name

VM Datacenter name.

vh_bios_date

Timestamp of BIOS creation date.

vh_bios_version

BIOS version installed.

vh_com_path

Virtual host communication path. netlab.enums.VirtualHostComPath

vh_cpu_cores

Total count of CPU cores on virtual host.

vh_cpu_mhz

Speed in MHz of CPU.

vh_cpu_model

CPU model identification.

vh_cpu_threads

Number of threads CPUs can handle.

vh_cpu_threads

Number of threads CPUs can handle.

vh_date_modified

Timestamp of virtual host information has been modified.

vh_date_tested

Timestamp of virtual host test communication.

vh_id

Virtual host identifier.

vh_inside_ipv4_addr

Inside interface ipv4 address.

vh_inside_vswitch_0

Virtual host inside vSwitch.

vh_last_test_status

Status of last virtual host test communication.

vh_memory_mb

Total RAM in MB of virtual host.

vh_name

Virtual host hostname.

vh_online

Virtual host is online.

vh_os_build

Operating system build number.

vh_os_description

Operating system description.

vh_os_name

Operating system name.

vh_os_type

Operating system type.

vh_os_vendor

Operating system vendor.

vh_os_version

Operating system version.

vh_outside_ipv4_addr

Outside interface ipv4 address.

vh_pra_enabled

Proactive resource awareness is enabled.

vh_pra_max_cpu

Max number of CPUs for PRA.

vh_pra_max_mem_mb

Max amount of RAM in MB for PRA.

vh_pra_max_vm

Max amount of virtual machines for PRA.

vh_sys_model

System model.

vh_sys_service_tag

System service tag.

vh_sys_vendor

System vendor.

vh_uuid

Virtual host unique global identifier.

vhg_id

Virtual host group identifier.

vm_alloc_cpu_n

Total amount of allocated CPUs.

vm_alloc_mem_mb

Total amount of allocated RAM.

vm_auto_display

Virtual machine auto display port configuration.

vm_auto_network

Virtual machine auto networking.

vm_auto_settings

Virtual machine auto settings.

vm_child_count

Total count of children VMs.

vm_comments

Virtual machine comments from VMX.

vm_date_added

Timestamp of virtual machine added to NETLAB+ inventory.

vm_id

Virtual machine identifier.

vm_name

Virtual machine name.

vm_netlab_os_id

NETLAB+ match to vm_vendor_os_id.

vm_parent_id

Virtual machine parent identifier, if VM is a link clone.

vm_parent_snapname

Virtual machine parent snapshot name, if VM is a link clone.

vm_path

Virtual machine path on datastore.

vm_power_state

Virtual machine power state.

vm_role

Virtual machine role in NETLAB+ inventory. netlab.enums.VirtualMachineRole

vm_runtime_vh_id

Unique identifier of runtime virtual host.

vm_sanity_checks

Sanity checks.

vm_shutdown_pref

Shutdown preference.

vm_snapshot

This is what the VM reverts to when the pod is reset. You can take multiple snapshots with the same name, without having to update this field. Update this field with a call to pod_pc_update()

vm_uuid

Virtual machine unique identifier.

vm_vendor_os_id

Vendor operating system identifier.

vm_vendor_os_name

Vendor operating system name.

async pod_pc_update(*, pc_id, pc_type=None, pc_os_id=None, pc_online=None, vm_shutdown_pref=None, vm_id=None, vm_snapshot=None, vm_auto_display=None, vm_auto_network=None, vm_auto_settings=None, vm_sanity_checks=None, **kwargs)

Update information regarding a pod pc.

Parameters:
  • pc_id (int) – unique pc identifier

  • pc_type (Literal['ABSENT', 'AVMI'] | None) – PC type (ABSENT, AVMI)

  • pc_os_id (str | None) – PC operating system identifier

  • pc_online (bool | None) – PC online

  • vm_shutdown_pref (str | None) – Shutdown preference

  • vm_id (int | None) – Virtual machine identifier

  • vm_snapshot (str | None) – This is what the VM reverts to when the pod is reset. You can take multiple snapshots with the same name, without having to update this field.

  • vm_auto_display (bool | None) – Virtual machine auto display port configuration

  • vm_auto_network (bool | None) – Virtual machine auto networking

  • vm_auto_settings (bool | None) – Virtual machine auto settings

  • vm_sanity_checks (bool | None) – Virtual machine sanity checks

async pod_remove_task(*, pod_id, remove_vms=RemoveVMS.NONE, severity_level=HDRSeverity.WARN, **kwargs)
Parameters:
  • pod_id (int) – Pod unique identifier.

  • remove_vms (RemoveVMS) – Specifies the method for removing the virtual machines.

  • severity_level (HDRSeverity) – Display detailed events for the task only at this severity level or higher.

Returns:

HDR result

Return type:

HDRResult

async pod_state_change(*, pod_id, state, **kwargs)

Sets pod state to either ONLINE, OFFLINE or RESUME.

Parameters:
  • pod_id (int) – Pod ID

  • state (PodState) – PC Pod State

async pod_types_get(*, pt_id, properties='default', **kwargs)

Returns the build, id and name of installed pods on queried system.

Parameters:
  • pt_id (str) – Pod Type ID is a alpha/num hash with prefix.

  • properties (List[str] | Literal['default'] | ~typing.Literal['all']) – Properties consist of any combination of properties listed below under Properties. You may also use “all” to include all properties, or “default” for a smaller subset of properties.

Returns:

Returns all or selected properties from the list initially passed for return.

Return type:

Dict[str, Any]

Properties

pt_id

Pod type identifier.

pt_name

Account email.

pt_build

Account Family(Last) name.

pt_gpdid

Global unique identifer.

pt_apdid

Author identifier for pod design.

pt_desc

Pod type description.

pt_index

Pod type index.

pt_type

Pod type id

sched_image

Location of scheduler image.

def_topology_image

Default topology image URL.

def_im_name

Default image map name.

def_vlan_map

Default VLAN map.

pt_tabs

Pod type tabs.

pt_actions

Pod type actions.

pt_origin

Pod type origin.

pt_vlan_pool

Pod type vlan pool.

pt_pod_max

Max amount of pod types allowed on system.

pt_notes

Pod type notes.

pt_csw_port_count

Number of consecutive ports on control switch required by pod type.

pt_as_port_count

Number of access server ports required by pod type.

pt_apc_port_count

Number of switched outlet ports required by pod type.

pt_build

Pod type build number.

pt_author

Pod type author.

pt_org

Pod type organization.

pt_copyright

Pod type copyright.

pt_url

Pod type URL address.

pt_removable

Allows pod type to be uninstalled.

pt_ae_pod

Pod type is for NETLAB+ AE.

pt_adv_settings

Pod type advanced settings.

hotspots

Returns array of hotspot information for pt_id.

  • im_coords

  • im_dev_class

  • im_dev_name

  • im_group

  • im_name

  • im_shape

remote_pc_layout

Returns array of remote PC layout information for pt_id.

  • pl_access_types

  • pl_def_access_message

  • pl_def_offline_message

  • pl_icon

  • pl_index

  • pl_label

  • pl_os_types

  • pl_pt_id

  • pl_reboot_to_scrub

  • pl_required

remote_pc_count

Get a count of the remote PCs per pod type.

device_layout

Returns array of device layout information for pt_id.

  • dl_pt_id

  • dl_index

  • dl_name

  • dl_class

  • dl_auto

  • dl_managed

  • dl_so_base_ix

  • dl_as_base_ix

  • dl_cs_base_ix

  • dl_eth_recv_port

  • dl_eth_req

  • dl_ser_req

  • dl_ae_ifx

device_count

Get count of the devices for pod type.

pod_cat_values

Returns array of pod categories (PodCategory).

cables

Returns list of cable connections for pod type.

  • ca_pt_id

  • ca_from_type

  • ca_from_index

  • ca_from_port

  • ca_seq

  • ca_cable

  • ca_to_dev

  • ca_to_port

async pod_types_list(*, properties='default', **kwargs)

Obtain a list of pod types.

Parameters:

properties (List[str] | Literal['default', 'all']) – Properties consist of any combination of properties listed below under Properties. You may also use “all” to include all properties, or “default” for a smaller subset of properties.

Returns:

On success, returns [rt_id, pt_build, pt_name] by default, or the following properties if requested.

Return type:

List[Dict[str, Any]]

Properties

pt_id

Pod type identifier.

pt_name

Account email.

pt_build

Account Family(Last) name.

pt_gpdid

Global unique identifer.

pt_apdid

Short unique identifier.???

pt_desc

Pod type description.

pt_index

Pod type index.

pt_type

???

sched_image

Location of scheduler image.

def_topology_image

Location of the default topology image.

def_im_name

Default image map name.

def_vlan_map

Default VLAN map.

pt_tabs

Pod type tabs.

pt_actions

Pod type actions.

pt_origin

Pod type origin.

pt_vlan_pool

Pod type vlan pool.

pt_pod_max

Max amount of pod types allowed on system.

pt_notes

Pod type notes.

pt_csw_port_count

Number of consecutive ports on control switch required by pod type.

pt_as_port_count

Number of access server ports required by pod type.

pt_apc_port_count

Number of switched outlet ports required by pod type.

pt_build

Pod type build number.

pt_author

Pod type author.

pt_org

Pod type organization.

pt_copyright

Pod type copyright.

pt_url

Pod type URL address.

pt_removable

Allows pod type to be uninstalled.

pt_ae_pod

Is pod type for NETLAB+ AE???.

pt_adv_settings

Pod type advanced settings.

remote_pc_count

Get count of the remote PCs per pod type.

device_count

Get count of the devices per pod type.

async pod_update(*, pod_id, pod_name=None, pod_desc=None, pod_auto_net_enabled=None, pod_auto_net_host_setup=None, pod_auto_net_host_teardown=None, pod_adv_settings=None, pod_acl_enabled=None, **kwargs)

This method allows you to update a pod on the NETLAB+ system.

Parameters:
  • pod_id (int) – Unique pod identifier.

  • pod_name (str) – Pod name.

  • pod_desc (str) – Pod description.

  • pod_auto_net_enabled (bool) – Auto-networking enabled.

  • pod_auto_net_host_setup (bool) – Auto-networking host setup enabled.

  • pod_auto_net_host_teardown (bool) – Auto-networking host teardown enabled.

  • pod_adv_settings (str) – Advanced settings for pod configuration.

  • pod_acl_enabled (bool) – Pod access control list enabled.

class netlab.api.ReservationApiMixin(*args, **kwargs)
async reservation_cancel(*, res_id, **kwargs)

Cancel a reservation in NETLAB+ prior to reservation being started.

NOTE - if you wish to end a reservation that is already started use reservation_post.

Parameters:

res_id (int) – Reservation unique identifier.

async reservation_extend(*, res_id, **kwargs)

Request a 30 minute lab reservation extension.

Parameters:

res_id (int) – Reservation identifier.

Returns:

Returns an object with the following properties:

Return type:

dict

Properties

status

Status code.

reason

Textual message that is suitable for display (English).

Status Codes

OK

The reservation was extended.

CLASS_LIMIT_EXCEEDED

Reservation cannot be extended because of cls_ext_slots_per_res setting limit.

COMMUNITY_LIMIT_EXCEEDED

Reservation cannot be extended because of com_ext_slots_per_res setting limit.

TIME_SLOT_UNAVAILABLE

The next time slot is occupied by another reservation.

POD_ACTIVE_MAX

Maximum number of pods in use.

RESERVATION_ALREADY_COMPLETED

The reservation has already completed and cannot be extended.

E_ACCESS_DENIED

Student/learner cannot extend ILT reservation.

STATE_NOT_ACTIVE_LAB

Reservation is not in the active lab state.

TOO_EARLY

Cannot extend before T-00:15:59 minutes/seconds.

TOO_LATE

Cannot extend after T-00:00:10 seconds.

Restrictions For All Users

  • An extension cannot be made before T-00:15:59 from the reservation post time. This is about 26 minutes from the blocked end time and 16 minutes of the usable time remaining.

  • The next 30 minute time slot must not be already scheduled by another reservation.

  • The extension cannot exceed maximum pods in use limit and/or proactive resource awareness settings.

Restrictions for Students and Teams

  • The number of extensions that a student or team can request are limited by community and class settings.

  • For backward setting compatibility, communities and classes do not allow extensions to be made by students or teams by default.

    • The administrator must specifically allow extensions for students and teams per community via the com_ext_slots_per_res setting.

    • The instructor must specifically allow extensions for students and teams per class via the cls_ext_slots_per_res setting.

    • The number of extensions that a student or team can request in a single reservation will be the more restrictive of the two settings.

  • A student (or instructor learner) may not extend an ILT reservation. Only a lead instructor can do that.

async reservation_get(*, res_id, **kwargs)

Get parameters of a reservation.

Parameters:

res_id (int) – Reservation identifier.

Returns:

On success, returns an object with the following properties:

Return type:

dict

Properties

acc_com_id

Community identifier.

acc_full_name

Account display name.

acc_id

Account identifier.

cls_div_id

Community identifier.

cls_id

Class identifier.

cls_name

Class name.

ex_id

Lab exercise identifier.

ex_name

Lab exercise name.

pod_desc

Pod description.

pod_id

Unique pod identifier.

pod_name

Pod name.

pt_desc

Pod type description.

pt_id

Pod type identifier.

pt_name

Account email.

res_acc_id

Account ID.

res_active_time

Active reservation timestamp.

res_asm_data

???

res_attend_time

Time reservation was attended.

res_cls_id

Class identifier.

res_com_id

Community identifier.

res_config

Initial configuration.

res_done

Reservation is done.

res_end

Timestamp scheduled end of reservation.

res_ex_id

Reservation lab exercise identifier.

res_flags

???

res_id

Reservation identifier.

res_init_fail

Count of failures during initialization.

res_is_active

Reservation is active.

res_minutes

Count of minutes for reservation.

res_pod_id

Reservation pod identifier.

res_post_time

Timestamp of actual end of reservation.

res_preload_time

Timestamp UTC lab will preload.

res_pt_id

Reservation pod type identifier.

res_remaining_dhms

Days, hours, min, sec remaining if pod is in ACTIVE_LOAD or ACTIVE_INIT state.

res_remaining_sec

Seconds remaining if pod is in ACTIVE_LOAD or ACTIVE_LAB state.

res_start

Timestamp to start reservation.

res_team

Reservation team setting.

res_type

Reservation type. netlab.enums.ReservationType

res_uuid

Reservation unique identifier.

sched_image

Location of the scheduler image.

async reservation_make(*, type, pod_id, cls_id, end_time, start_time=None, acc_id=None, reserver_id=None, tz_id=None, tz_olson=None, team=None, pt_id=None, ex_id, init_config=InitConfig.NONE, **kwargs)
Parameters:
  • type (ReservationType) – Type of reservation.

  • pod_id (int) – Pod identifier.

  • cls_id (int) – Class identifier.

  • end_time (datetime) – Local time end of reservation. This must be on a half hour slot boundary.

  • start_time (datetime | None) – Local time start of reservation. If not specified it will use the current datetime.

  • tz_id (int | None) – Timezone identifier.

  • tz_olson (str | None) – IANA timezone name. If not specified, the timezone of the user identified by acc_id will be used.

  • team (str | None) – Team identifier.

  • pt_id (int | None) – Pod type identifier.

  • ex_id (str) – Exercise identifier (required).

  • acc_id (int | None) – Account identifier for the reservation. Defaults to reserver_id.

  • init_config (InitConfig) – Initial configuration.

  • reserver_id (int | None) – Reserver identifier. Defaults to the request user. An admin can use a reserver_id to make reservations for others.

Returns:

On success, returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

res_id

Reservation identifier.

res_start_utc

Reservation start in UTC.

res_end_utc

Reservation end in UTC.

res_minutes

Reservation time in minutes

async reservation_plan(*, acc_id=None, cls_id=None, date, ex_id=None, pod_id=None, reserver_id=None, team=None, type, tz_id=None, tz_olsen=None, **kwargs)

Used to provide information on all pods available for a proposed date.

Parameters:
  • acc_id (int | None) – Account identifier.

  • cls_id (int | None) – Class identifier.

  • date (date) – Date.

  • ex_id (int | None) – Exercise identifier.

  • pod_id (int | None) – Pod identifier.

  • reserver_id (int | None) – Reserver identifier.

  • team (int | None) – Team identifier.

  • type (ReservationType) – Type of reservation.

  • tz_id (int | None) – Timezone identifier.

Returns:

On success, returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

clock_pref

User clock preference.

show_date

Proposed date.

min_date

cls_id start date or SystemMinDate.

max_date

cls_id end date or SystemMaxDate.

time_now

Current time.

time_format

User preferred time format.

first_weekday

User preferred first day of the week.

serial

Incremented number when there is a scheduler transaction.

slot_minutes

Number of minutes in reservation slot.

time_slots

Array of available time slots.

pods

Array of pods available.

async reservation_post(*, res_id, **kwargs)

Ends a reservation that has already started.

Parameters:

res_id (int) – Reservation identifier.

async reservation_query(*, active: bool | None = None, min_time: datetime | None = None, max_time: datetime | None = None, cls_id: int | None = None, pod_id: int | None = None) List[Dict[str, Any]]
async reservation_query(*, active: bool | None = None, scope: ReservationScope = enums.ReservationScope.ALL, min_time: datetime | None = None, max_time: datetime | None = None, com_id: int | None = None, pod_id: int | None = None) List[Dict[str, Any]]

Return a list of reservations filtered on criteria. Take note of the acceptable overrides.

Parameters:
  • scope – Reservation scope.

  • active – Filter active reservations.

  • cls_id – Class identifier.

  • com_id – Community identifier.

  • max_time – Maximum time range.

  • min_time – Minimum time range.

  • pod_id – Pod identifier.

Returns:

On success, returns an object with the following properties:

Properties

acc_com_id

Community identifier.

acc_full_name

Account display name.

acc_id

Account identifier.

cls_div_id

Community identifier.

cls_id

Class identifier.

cls_name

Class name.

ex_id

Lab exercise identifier.

ex_name

Lab exercise name.

pod_desc

Pod description.

pod_id

Unique pod identifier.

pod_name

Pod name.

pt_desc

Pod type description.

pt_id

Pod type identifier.

pt_name

Account email.

res_acc_id

Account identifier.

res_active_time

Active reservation timestamp.

res_attend_time

Time reservation was attended.

res_cls_id

Class identifier.

res_com_id

Community identifier.

res_config

Initial configuration.

res_done

Reservation is done.

res_end

Timestamp scheduled end of reservation.

res_ex_id

Reservation lab exercise identifier.

res_flags

Reservation hex code for pod state.

res_id

Reservation identifier.

res_init_fail

Count of failures during initialization.

res_is_active

Reservation is active.

res_minutes

Count of minutes for reservation.

res_pod_id

Reservation pod identifier.

res_post_time

Timestamp of actual end of reservation.

res_pt_id

Reservation pod type identifier.

res_start

Timestamp to start reservation.

res_team

Reservation team setting.

res_type

Type of reservation. netlab.enums.ReservationType

res_uuid

Reservation unique identifier.

sched_image

Location of the scheduler image.

async reservation_summary(**kwargs)

This method allows you to retrieve a summary of all reservations.

Returns:

On success, returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

active_reservations

Count of active reservations.

completed_reservations

Count of completed reservations.

future_reservations

Count of future reservations.

pods_in_use

Count of pods in use.

total_reservations

Count of total reservations.

async reservation_time_delta(*, end, start=None, tz_id=None, tz_olson=None, **kwargs)

This method returns time between two timestamps with optional timezone offset.

Parameters:
  • end (datetime.datetime) – End time. This must be on a half hour increment.

  • start (datetime.datetime) – Start time. Defaults to now if not specified.

  • tz_id (int) – Timezone identifier.

  • tz_olson (str) – Timezone olson.

Returns:

On success, returns an object with the following properties:

Return type:

dict

Properties

days

Number of days to increase/decrease.

hours

Number of hours to increase/decrease.

minutes

Number of minutes to increase/decrease.

months

Number of months to increase/decrease.

async reservation_time_now(*, tz_id=None, tz_olson=None, **kwargs)

This method returns the current NETLAB time.

Parameters:
  • tz_id (int | None) – Timezone identifier.

  • tz_olson (str | None) –

Returns:

On success, returns an object with the following properties:

Return type:

dict

Properties

local

Local date time.

local_am_pm

AM/PM indicator.

local_day

Local day of the month.

local_day_of_week

Local day of the week.

local_hmap

Local time and am/pm.

local_hms

Local time.

local_hour_12

Local 12 Hour time.

local_hour_24

Local 24 Hour time.

local_minute

Local minute time.

local_second

Local second time.

local_year

Local year.

local_ymd

Local YYYY-MM-DD.

tz_id

Timezone identifier.

tz_is_dst

Timezone is in Daylight Savings Time.

tz_name

Name of the timezone.

tz_olson

Timezone olson.

utc

Coordinated Universal Time.

async reservation_time_offset(*, time=None, op=None, tz_id_in=None, tz_olson_in=None, tz_id_out=None, tz_olson_out=None, slot_roundup=False, years=None, months=None, weeks=None, days=None, hours=None, minutes=None, seconds=None, **kwargs)

This method returns the current time with a timezone offset.

Parameters:
  • time (datetime) – Time input.

  • op (str) – Operator. “+” rounds up. “-” rounds down.

  • tz_id_in (int) – Timezone identifier input.

  • tz_olson_in (str) – Timezone olson input.

  • tz_id_out (int) – Timezone identifier output.

  • tz_olson_out (str) – Timezone olson output.

  • slot_roundup (bool) – Round up to nearest slot. i.e. 30 min interval. Defaults to False.

  • years (int) – Number of years to increase/decrease.

  • months (int) – Number of months to increase/decrease.

  • weeks (int) – Number of weeks to increase/decrease.

  • days (int) – Number of days to increase/decrease.

  • hours (int) – Number of hours to increase/decrease.

  • minutes (int) – Number of minutes to increase/decrease.

  • seconds (int) – Number of seconds to increase/decrease.

Returns:

On success, returns an object with the following properties:

Return type:

dict

Properties

days

int

hours

int

minutes

int

months

int

time_in_local

datetime

time_in_utc

datetime

time_out_local

datetime

time_out_utc

datetime

tz_id_in

int

tz_id_out

int

tz_olson_in

str

tz_olson_out

str

static reservation_timeslot_adjuster(*, user_time, round_low=False)

Round a datetime to the nearest half hour, which is required for some times in netlab.

Parameters:
  • user_time (datetime) – Must be a datetime object. Adjusted for fulfilling time slot if not already time slot acceptable.

  • round_low (bool) – True: rounds time in minutes down to the low timeslot. False: rounds time up to next timeslot.

Returns:

Datetime rounded to half hour.

Return type:

datetime

class netlab.api.SystemApiMixin(*args, **kwargs)
system_perf_query(*, start_time, end_time=None, metrics=None, sources=None, **kwargs)

This method is used to query system performance metrics.

Parameters:
  • start_time (datetime) – If specified, only return metrics recorded on or after start time.

  • end_time (datetime | None) – If specified, only return metrics recorded on or before end time.

  • metrics (List[str] | None) – If specified, only returns metrics from this list.

  • sources (List[str] | None) – If specified, only returns metrics originating from sources in this list. Valid sources include mbusd, podspd, sysspd, respd, userspd, vmspd, histpd, filespd.

Returns:

A list of dicts with the following properties.

Return type:

List[Dict[str, Any]]

Properties

sp_time

The date/time the metric was recorded.

sp_metric

The metric identifier.

sp_source

The module/program that produced the metric.

sp_value

The numeric value of the metric.

async system_status_get(**kwargs)

This method allows you to query NETLAB+ system information.

Returns:

Returns a system status object with the following properties:

Return type:

SystemStatusGetResult

Properties

cpu_n

Number of CPUs detected by the virtual appliance.

uptime_sec

System uptime in seconds.

hostname

NETLAB+ domain name

sys_lic_exp_date

License expiration date

sys_lic_op_state

License operation stsate

sys_logins_enabled

User logins status

sys_maint_ends

Mainenance end date

sys_mode

System mode

sys_name

System name

sys_product_id

Product identifier

sys_sdn_release_date

Software distribution date

sys_sdn_release_type

Software distribution release type

sys_sdn_version

Software distribution version

sys_serial

System serial number

system_time_timezone_get(*, tz_id, **kwargs)

Match a netlab timezone id to the timezone iana.

Returns:

Returns an object that represents a timezone.

Return type:

Dict[str, Any]

Properties

tz_id

The id of timezone (specific to netlab).

tz_iana

The iana identifier of the timezone.

tz_name

The name of the timezone.

tz_sort

The sort order of the timezone.

system_time_timezone_list(**kwargs)

Match a netlab timezone id to the timezone iana.

Returns:

Returns an object that represents a timezone.

Return type:

dict

Properties

tz_id

The id of timezone (specific to netlab).

tz_iana

The iana identifier of the timezone.

tz_name

The name of the timezone.

tz_sort

The sort order of the timezone.

system_usage_cpu(**kwargs)

This method allows you to query NETLAB+ CPU usage.

Returns:

Returns an object with N+1 properties, where N is the number of CPUs. The CPUs are listed from 0 to N-1 and also includes all . They each contain an object with the following properties:

Return type:

dict

Properties

gnice_pct

The percentage of time spent by the CPU or CPUs to run a niced guest.

guest_pct

The percentage of time spent by the CPU or CPUs to run a virtual processor.

idle_pct

The percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.

iowait_pct

The percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.

irq_pct

The percentage of time spent by the CPU or CPUs to service hardware interrupts.

nice_pct

The percentage of CPU utilization that occurred while executing at the user level with nice priority.

soft_pct

The percentage of time spent by the CPU or CPUs to service software interrupts.

steal_pct

The percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.

sys_pct

The percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this does not include time spent servicing hardware and software interrupts.

usr_pct

The percentage of CPU utilization that occurred while executing at the user level (application).

system_usage_disk(**kwargs)

This method allows you to query NETLAB+ disk usage.

Returns:

Returns an object with two properties, data and programs . They each contain an object with the following properties:

Return type:

Dict[str, Any]

Properties

avail_b

Available disk space in bytes.

total_b

Total disk space in bytes.

used_b

Used disk space in bytes.

used_pct

Disk space used as a percentage of the whole.

system_usage_memory(**kwargs)

This method allows you to query NETLAB+ memory usage.

Returns:

Returns an object with a single property, ram. It contains an object with the following properties:

Return type:

Dict[str, Any]

Properties

free_b

Free memory in bytes.

total_b

Total memory in bytes.

used_b

Used memory in bytes.

class netlab.api.UserApiMixin(*args, **kwargs)
async user_account_add(*, com_id, acc_user_id, acc_password, acc_full_name, acc_type=AccountType.STUDENT, acc_privs=None, acc_display_name=None, acc_sort_name=None, acc_email=None, acc_can_login=True, acc_pw_change=True, cls_id=None, tz_id=11, date_format=DateFormat.ISO, time_format=TimeFormat.HOUR24, first_weekday=0, page_length=25, **kwargs)

Add a user account on the NETLAB system. For accepted values see the properties documentation for user_account_get().

Parameters:
  • com_id (int) – Community ID.

  • acc_user_id (str) – User Account ID.

  • acc_password (str) – Unencrypted account password.

  • acc_full_name (str) – Account full name.

  • acc_type (AccountType) – Account type.

  • acc_can_login (bool) – User can login. Defaults to True.

  • acc_pw_change (bool) – Upon first login, force user to change password. Defaults to True.

  • acc_privs (List[str | AccountPrivileges] | None) – Supplemental account privileges for instructors in list or tuple format.

  • acc_display_name (str | None) – Account name, people will see this name in discussions, messages, and comments.

  • acc_sort_name (str | None) – Account name as it appears in sorted lists.

  • acc_email (str | None) – Account email address.

  • cls_id (int | None) – Class ID. (If you want to add user directly to a class during account creation.)

  • tz_id (int) – Timezone identifier. Defaults to 11.

  • date_format (DateFormat) – Date format preference.

  • time_format (TimeFormat) – Time format preference.

  • first_weekday (int) – First day of week preference.

  • page_length (int) – The number of items to display in paginated lists.

Returns:

On success, returns acc_id.

Return type:

int

async user_account_get(*, acc_id, properties='default', **kwargs)

Retrieves a user account on the NETLAB system.

Parameters:
  • acc_id (int) – User Account ID.

  • properties (List[str] | Literal['default', 'all']) – Properties consist of any combination of properties listed below under Properties. You may also use “all” to include all properties, or “default” for a smaller subset of properties.

Returns:

Account data for the requested acc_id with the requested properties.

Return type:

Dict[str, Any]

Properties

acc_can_login

User allowed to login.

acc_display_name

Account name people will see this name in discussions, messages and comments.

acc_email

Account email.

acc_fs_id

Filesystem identifier of the account root folder.

acc_full_name

Account full name.

acc_id

Account identifier.

acc_last_ip

Last IP address of user.

acc_last_login

Datetime of last account login.

acc_last_ua

User agent string of the browser when logging in from the UI.

acc_logins

Number of account logins.

acc_privs

Supplemental account privileges for instructors only. AccountPrivileges

acc_pw_change

Force user to change password.

acc_session_time_started

Datetime of session start time.

acc_sort_name

Account name as it appears in sorted lists.

acc_sys

Mark as system account.

acc_time_created

Datetime account was created.

acc_time_last_access

Datetime of last access.

acc_type

Account type. AccountType

acc_user_id

Unique system-wide login identifier.

acc_uuid

Globally unique account ID.

com_full_name

Community name.

com_id

Unique community identifier.

tz_iana

Timezone IANA database identifier.

tz_id

Time zone identifier.

tz_name

Time zone name.

acc_nlx_terms

Lab designer terms and conditions acknowleged.

acc_npd_terms

Pod designer terms and conditions acknowleged.

acc_pw_console

Instructor’s lab device console password.

acc_pw_enable

Instructor’s lab device enable password.

accman_list_com_id

Persist account manager community selection in list view (admin and syswide).

date_format

Date format preference. netlab.enums.DateFormat

time_format

Time format preference. netlab.enums.TimeFormat

first_weekday

First day of week preference. An integer from 0 - 6 mapping to Sunday - Saturday.

page_length

The number of items to display in paginated lists. Possible values are 10, 25, 50, 100. A value of -1 will disable pagination and return all items.

async user_account_list(*, com_id=None, acc_type=None, properties='default', **kwargs)

Query a list of the user accounts in the NETLAB system. The list method is only restricted by community id and account types. The properties only identify those properties or fields that will be returned via the underlying query.

Parameters:
  • com_id (int | None) – Community ID

  • acc_type (AccountType | None) – User account type.

  • properties (List[str] | Literal['default', 'all']) – Properties consist of any combination of properties listed below under Properties. You may also use “all” to include all properties, or “default” for a smaller subset of properties.

Returns:

A list of dictionaries (a set of records) where the dictionaries contain requested properties per user.

Return type:

List[Dict[str, Any]]

Properties

acc_can_login

User allowed to login.

acc_display_name

Account name people will see this name in discussions, messages and comments.

acc_email

Account email.

acc_fs_id

Filesystem identifier of the account root folder.

acc_full_name

Account full name.

acc_id

Account identifier.

acc_last_ip

Last IP address of user.

acc_last_login

Datetime of last account login.

acc_last_ua

User agent string of the browser when logging in from the UI.

acc_logins

Number of account logins.

acc_privs

Supplemental account privileges for instructors only. netlab.enums.AccountPrivileges

acc_pw_change

Force user to change password.

acc_session_time_started

Datetime of session start time.

acc_sort_name

Account name as it appears in sorted lists.

acc_sys

Mark as system account.

acc_time_created

Datetime account was created.

acc_time_last_access

Datetime of last access.

acc_type

Account type. netlab.enums.AccountType

acc_user_id

Unique system-wide login identifier.

acc_uuid

Globally unique account ID.

com_id

Unique community identifier.

tz_id

Time zone identifier.

async user_account_password_set(*, acc_id, new_password, force_reset=False, **kwargs)

Sets the user account password.

Parameters:
  • acc_id (int) – Account ID.

  • new_password (str) – New account password.

  • force_reset (bool) – Force user to reset password.

async user_account_remove(*, acc_id, **kwargs)

Removes the specified user account.

Parameters:

acc_id (int) – User Account ID

This method queries and/or retrieves user accounts. Also see user_account_search_iter().

Filters and returns paged results of user accounts. Any property from user_account_list() can be filtered upon. Multiple filter will be combined using AND. Returns zero or more user accounts that match filter query.

Parameters:
  • properties (List[str]) – Properties consist of any combination of properties listed below under Properties.

  • order (str or list) – List of properties to sort by in order of preference.

  • filter – Search criteria. See below for how to use filters.

  • limit (int) – Page size or maximum number of records returned. This method can return a maximum of 500 use account records. Call the method multiple times with successive page numbers to return all data.

  • page (int | None) – Starting page number (pages start at one). When page is None, returns only info like ‘total_records’ with no accounts. A page that goes pass all records will return no accounts.

  • offset (int | None) – Starting record number. If page and offset are both None, no records are returned; only meta data about total users and pages are returned.

Returns:

A list of user accounts that match filter.

Return type:

Dict[str, Any]

Examples

Collect the account id and account user id with acc_id that is 100031.

Client().user_account_search(properties=[‘acc_id’, ‘acc_user_id’], page=1, filter={‘acc_id’: 100031})

Collect first page of accounts, ordered by acc_id.

Client().user_account_search(properties=[‘acc_id’, ‘acc_user_id’], page=1, order=’acc_id’)

Return how many users can login.

Client().user_account_search(filter={‘acc_can_login’: True})[‘total_records’]

Properties

The following properties may be used in this method. The text in bold indicates the contexts in which the property may be used (see contexts below). The text following the | character describes the property.

Properties in communities and timezones must be fully qualified (i.e. timezones.tz_name). Properties starting with accounts my be specified without namespace (i.e. acc_full_name or accounts.acc_full_name may be used).

accounts.acc_can_login

SELECT, FILTER, ORDER | Logins enabled flag.

accounts.acc_display_name

SELECT, FILTER, ORDER | User display name.

accounts.acc_email

SELECT, FILTER, ORDER | Email address (RFC 2822).

accounts.acc_full_name

SELECT, FILTER, ORDER | User full name.

accounts.acc_id

SELECT, FILTER, ORDER | Local account identifier on system.

accounts.acc_last_ip

SELECT, FILTER, ORDER | Last IP address of user.

accounts.acc_last_login

SELECT, FILTER, ORDER | Timestamp of last account login.

accounts.acc_last_ua

SELECT, FILTER, ORDER | Last user agent string.

accounts.acc_logins

SELECT, FILTER | Number of times user has logged in.

accounts.acc_privs

SELECT, FILTER | Account privileges.

accounts.acc_pw_change

SELECT, FILTER | Password change pending on next login.

accounts.acc_session_time_started

SELECT, FILTER, ORDER | Timestamp of session start time.

accounts.acc_sort_name

SELECT, FILTER, ORDER | User’s sortable display name.

accounts.acc_sys

SELECT, FILTER, ORDER | System account flag.

accounts.acc_time_created

SELECT, FILTER, ORDER | Time account was created.

accounts.acc_time_last_access

SELECT, FILTER, ORDER | Time acocunts was last accessed.

accounts.acc_type

SELECT, FILTER, ORDER | Account type.

accounts.acc_user_id

SELECT, FILTER, ORDER | Local user ID on system.

accounts.acc_uuid

SELECT, FILTER | Globally unique account identifier.

accounts.com_id

SELECT, FILTER, ORDER | Local community identifier on system.

accounts.tz_id

SELECT, FILTER, ORDER | Timezone identifier.

communities.com_enabled

SELECT, FILTER, ORDER | Community enabled flag.

communities.com_full_name

SELECT, FILTER, ORDER | Community name.

communities.com_id

SELECT, FILTER, ORDER | Local community identifier on system.

communities.com_max_slots_per_res

SELECT, FILTER, ORDER | Community maximum slots per reservation.

communities.com_min_hours_btw_res

SELECT, FILTER, ORDER | Community minimum hours between reservations.

communities.com_mynetlab_news

SELECT, FILTER | Community MyNetlab page news markdown.

communities.com_mynetlab_welcome

SELECT, FILTER | Community MyNetlab page welcome markdown.

communities.com_tz_id

SELECT, FILTER, ORDER | Timezone identifier.

communities.com_uuid

SELECT, FILTER | Globally unique community identifier.

timezones.tz_iana

SELECT, FILTER, ORDER | Timezone IANA identifier.

timezones.tz_id

SELECT, FILTER, ORDER | Timezone identifier.

timezones.tz_name

SELECT, FILTER, ORDER | Timezone name.

timezones.tz_sort

SELECT, FILTER, ORDER | Timezone sort order.

user_account_search_iter(*, properties=['acc_id'], order=None, filter=None, limit=100)

This method queries and/or retrieves user accounts.

Gets all users from server and then performs filtering locally. Any property from user_account_list() can be filtered upon. Multiple filter will be combined using AND. Returns zero or more user accounts that match filter query.

Parameters:
  • properties (List[str]) – Properties consist of any combination of properties listed below under Properties.

  • order (str | List[str] | None) – Sort order.

  • filter (Any) – Search criteria. See below for how to use filters.

  • limit (int) – Page size collected in a single request from the server. This can be used to tune performace over large record sets. Maximum 500.

Returns:

A series of user accounts that match filter. This method returns an iterator, which can be used in for loops like a list. See [the offical Python documenation](https://docs.python.org/3.6/library/stdtypes.html#iterator-types) for more infomation.

Return type:

AsyncGenerator[Dict[str, Any], None]

Examples

Collect the account id and account user id with acc_id that is 100031.

Client().user_account_search_iter(properties=[‘acc_id’, ‘acc_user_id’], filter={‘acc_id’: 100031})

Collect first page of accounts, ordered by acc_id.

Client().user_account_search_iter(properties=[‘acc_id’, ‘acc_user_id’], order=’acc_id’)

Return how many users can login.

Client().user_account_search_iter(properties=[‘acc_id’], filter={‘acc_can_login’: True,

‘communities.com_id’: 1})

Properties

The following properties may be used in this method. The text in bold indicates the contexts in which the property may be used (see contexts below). The text following the | character describes the property.

Properties in communities and timezones must be fully qualified (i.e. timezones.tz_name). Properties starting with accounts my be specified without namespace (i.e. acc_full_name or accounts.acc_full_name may be used).

accounts.acc_can_login

SELECT, FILTER, ORDER | Logins enabled flag.

accounts.acc_display_name

SELECT, FILTER, ORDER | User display name.

accounts.acc_email

SELECT, FILTER, ORDER | Email address (RFC 2822).

accounts.acc_full_name

SELECT, FILTER, ORDER | User full name.

accounts.acc_id

SELECT, FILTER, ORDER | Local account identifier on system.

accounts.acc_last_ip

SELECT, FILTER, ORDER | Last IP address of user.

accounts.acc_last_login

SELECT, FILTER, ORDER | Timestamp of last account login.

accounts.acc_last_ua

SELECT, FILTER, ORDER | Last user agent string.

accounts.acc_logins

SELECT, FILTER | Number of times user has logged in.

accounts.acc_privs

SELECT, FILTER | Account privileges.

accounts.acc_pw_change

SELECT, FILTER | Password change pending on next login.

accounts.acc_session_time_started

SELECT, FILTER, ORDER | Timestamp of session start time.

accounts.acc_sort_name

SELECT, FILTER, ORDER | User’s sortable display name.

accounts.acc_sys

SELECT, FILTER, ORDER | System account flag.

accounts.acc_time_created

SELECT, FILTER, ORDER | Time account was created.

accounts.acc_time_last_access

SELECT, FILTER, ORDER | Time acocunts was last accessed.

accounts.acc_type

SELECT, FILTER, ORDER | Account type.

accounts.acc_user_id

SELECT, FILTER, ORDER | Local user ID on system.

accounts.acc_uuid

SELECT, FILTER | Globally unique account identifier.

accounts.com_id

SELECT, FILTER, ORDER | Local community identifier on system.

accounts.tz_id

SELECT, FILTER, ORDER | Timezone identifier.

communities.com_enabled

SELECT, FILTER, ORDER | Community enabled flag.

communities.com_full_name

SELECT, FILTER, ORDER | Community name.

communities.com_id

SELECT, FILTER, ORDER | Local community identifier on system.

communities.com_max_slots_per_res

SELECT, FILTER, ORDER | Community maximum slots per reservation.

communities.com_min_hours_btw_res

SELECT, FILTER, ORDER | Community minimum hours between reservations.

communities.com_mynetlab_news

SELECT, FILTER | Community MyNetlab page news markdown.

communities.com_mynetlab_welcome

SELECT, FILTER | Community MyNetlab page welcome markdown.

communities.com_tz_id

SELECT, FILTER, ORDER | Timezone identifier.

communities.com_uuid

SELECT, FILTER | Globally unique community identifier.

timezones.tz_iana

SELECT, FILTER, ORDER | Timezone IANA identifier.

timezones.tz_id

SELECT, FILTER, ORDER | Timezone identifier.

timezones.tz_name

SELECT, FILTER, ORDER | Timezone name.

timezones.tz_sort

SELECT, FILTER, ORDER | Timezone sort order.

async user_account_update(*, acc_id, acc_user_id=None, acc_type=None, acc_can_login=None, acc_pw_change=None, acc_password=None, acc_privs=None, acc_full_name=None, acc_display_name=None, acc_sort_name=None, acc_email=None, tz_id=None, date_format=None, time_format=None, first_weekday=None, page_length=None, **kwargs)

Update the user account. For accepted values see the properties documentation for user_account_get().

Parameters:
  • acc_id (int) – Account ID

  • acc_user_id (str) – Unique system-wide login identifier.

  • acc_type (enums.AccountType) – Account type.

  • acc_can_login (bool) – User allowed to login.

  • acc_pw_change (bool) – Force user to change password.

  • acc_password (str) – Account password

  • acc_privs (list[enums.AccountPrivileges]) – Supplemental account privileges for instructors in list or tuple format.

  • acc_full_name (str) – Account full name.

  • acc_display_name (str) – Account name people will see this name in discussions, messages and comments.

  • acc_sort_name (str) – Account name as it appears in sorted lists.

  • acc_email (str) – Account e-mail address.

  • tz_id (int) – Timezone identifier.

  • date_format (DateFormat) – Date format preference.

  • time_format (TimeFormat) – Time format preference.

  • first_weekday (int) – First day of week preference.

  • page_length (int) – The number of items to display in paginated lists.

async user_community_add(*, com_full_name, com_id, com_enabled=True, com_max_slots_per_res=None, com_min_hours_btw_res=None, com_mynetlab_news=None, com_mynetlab_welcome=None, **kwargs)

This method allows you to add a community to the NETLAB+ system.

Parameters:
  • com_full_name (str) – Community full name.

  • com_id (int) – Community identifier.

  • com_enabled (bool) – Is community enabled.

  • com_max_slots_per_res (int | None) – Max amount of slots per reservation.

  • com_min_hours_btw_res (int | None) – Minimum hours between reservations.

  • com_mynetlab_news (str | None) – Community MyNETLAB+ news entry.

  • com_mynetlab_welcome (str | None) – Community MyNETLAB+ welcome message.

Returns:

Community ID of the newly created community.

Return type:

int

async user_community_find(*, com_full_name, **kwargs)

This method allows you to find a community based on com_full_name.

Parameters:

com_full_name (str) – Community full name.

Returns:

The Community ID on success.

Return type:

int | None

async user_community_get(*, com_id, properties='default', **kwargs)

This method allows you to retrieve a community and its properties.

Parameters:
  • com_id (int) – Community ID.

  • properties (list[str] or 'all') – Properties to return. Accepts string or list. See below for all available properties. You may also use “all” to include all properties.

Returns:

An object with the properties requested:

Return type:

dict

Properties

com_alt_banner

Alternate community banner.

com_alt_banner_height

Alternate banner height.

com_alt_banner_width

Alternate banner width.

com_enabled

Is community enabled.

com_full_name

Community full name.

com_id

Community identifier.

com_max_slots_per_res

Max amount of slots per reservation.

com_min_hours_btw_res

Minimum hours between reservations.

com_mynetlab_news

Community MyNETLAB+ news entry.

com_mynetlab_welcome

Community MyNETLAB+ welcome message.

async user_community_list(*, properties='default', sort_property='com_id', **kwargs)

Retrieve a list of communities.

Parameters:
  • properties (list[str] or 'all' or 'default') – Properties to return. Accepts string or list. See below for all available properties. You may also use “all” to include all properties.

  • sort_property (str) – Property to sort list by. Only com_id (default) and com_full_name are valid options.

Returns:

A list of objects with the properties requested:

Return type:

list[dict]

Properties

com_alt_banner

Alternate community banner.

com_alt_banner_height

Alternate banner height.

com_alt_banner_width

Alternate banner width.

com_enabled

Is community enabled.

com_full_name

Community full name.

com_id

Community identifier.

com_max_slots_per_res

Max amount of slots per reservation.

com_min_hours_btw_res

Minimum hours between reservations.

com_mynetlab_news

Community MyNETLAB+ news entry.

com_mynetlab_welcome

Community MyNETLAB+ welcome message.

async user_community_remove(*, com_id, **kwargs)

This method allows you to remove a community.

Parameters:

com_id (int) – Community identifier.

async user_community_update(*, com_id, com_full_name=None, com_enabled=None, com_mynetlab_welcome=None, com_mynetlab_news=None, com_min_hours_btw_res=None, com_max_slots_per_res=None, com_ext_slots_per_res=None, **kwargs)

Update a community.

Parameters:
  • com_id (int) – Community ID.

  • com_full_name (str) – Community full name.

  • com_enabled (bool) – Is community enabled.

  • com_mynetlab_welcome (str) – Community MyNETLAB+ welcome message.

  • com_mynetlab_news (str) – Community MyNETLAB+ news entry.

  • com_min_hours_btw_res (int) – Minimum hours between reservations.

  • com_max_slots_per_res (int) – Max amount of slots per reservation.

  • com_ext_slots_per_res (int or enums.CommunityExtensionSlots) – Allow extensions to reservations for students and teams. Instructors are not restricted to this limit.

async user_logins_system_get(**kwargs)

This method allows you to query the User Logins status and number of active logins.

Returns:

A dictionary with the following properties:

Return type:

dict

active

Number of active users logged in.

enabled

User logins status.

async user_logins_system_set(*, enabled, logout=False, **kwargs)

This method allows you to enable and disable user logins.

Parameters:
  • enabled (bool) – Enable or disable user logins.

  • logout (bool) – Logout users that are already logged in.

Returns:

A dictionary with the following properties:

Return type:

dict

changed

Whether user login status was changed.

logouts

Number of users logged out.

user_session_keepalive(*, acc_id, **kwargs)

This method performs a keepalive on a logged in user’s session and restarts their session timeout. The last access for the session is set to the current time.

Parameters:

acc_id (int) – Local account identifier.

Returns:

A dictionary with the following properties:

Return type:

dict

acc_session_time_started

Session start time, or None if the administrator specifies an acc_id that is not logged in.

acc_time_last_access

Updated last access time, or None if the administrator specifies an acc_id that is not logged in.

class netlab.api.VmApiMixin(*args, **kwargs)
async vm_clone_task(*, parent_vm_id, parent_snapname, clone_role, clone_type, clone_name, clone_datastore=None, clone_storage_alloc=CloneStorageAllocation.ONDEMAND, clone_vh_id=None, clone_vhg_id=None, clone_comments=None, copy_bios_uuid=False, **kwargs)

Method to call a task to clone a virtual machine.

Parameters:
  • parent_vm_id (int) – Parent virtual machine identifier.

  • parent_snapname (str) – Parent snapshot name.

  • clone_role (VirtualMachineRole) – Cloned virtual machine role.

  • clone_type (CloneType) – Cloned virtual machine type.

  • clone_name (str) – Cloned virtual machine name.

  • clone_datastore (str | None) – Datastore cloned virtual machine will reside on.

  • clone_storage_alloc (CloneStorageAllocation) – Cloned virtual machine storage allocation.

  • clone_vh_id (int | None) – The virtual host the cloned virtual machine will reside on.

  • clone_vhg_id (int | None) – The virtual host group identifier. NOT SUPPORTED!

  • clone_comments (str | None) – Comments for the cloned virtual machine.

Returns:

Created task id

Return type:

int

async vm_datacenter_find(*, vdc_name, **kwargs)

This method allows you to find a datacenter’s vdc_id by the datacenter name.

Parameters:

vdc_name (str) – VM Datacenter name.

Returns:

On success, returns vdc_id. If there is no VDC matching, returns None.

Return type:

int | None

async vm_datacenter_get(*, vdc_id, **kwargs)

This method allows you to retrieve a datacenter’s information by vdc_id.

Parameters:

vdc_id (int) – VM Datacenter identifier.

Returns:

On success, returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

vdc_agent_hostname

Agent hostname/IP address.

vdc_agent_password

Agent password.

vdc_agent_username

Agent username.

vdc_date_added

Timestamp of when VDC was added to NETLAB+.

vdc_date_tested

Timestamp of when VDC was last tested.

vdc_last_test_status

Status of last VDC test.

vdc_id

VM Datacenter identifier.

vdc_name

VM Datacenter name.

vdt_type

VM Datacenter type.

vdt_name

VM Datacenter type name.

async vm_datacenter_list(**kwargs)

This method allows you to retrieve all datacenters’ information.

Returns:

A list of objects with the following properties:

Return type:

List[Dict[str, Any]]

Properties

vdc_agent_hostname

Agent hostname/IP address.

vdc_agent_password

Agent password.

vdc_agent_username

Agent username.

vdc_date_added

Timestamp of when VDC was added to NETLAB+.

vdc_date_tested

Timestamp of when VDC was last tested.

vdc_last_test_status

Status of last VDC test.

vdc_id

VM Datacenter identifier.

vdc_name

VM Datacenter name.

vdt_type

VM Datacenter type.

vdt_name

VM Datacenter type name.

async vm_datacenter_test(*, vdc_id, **kwargs)

This method allows you to call a task to test communication to datacenter.

Parameters:

vdc_id (int) – VM Datacenter identifier.

Returns:

On success returns ‘PASSED’, otherwise returns ‘FAILED’.

Return type:

Literal[‘PASSED’, ‘FAILED’]

async vm_host_find(*, vh_name, **kwargs)

This method allows you to find a virtual host’s vh_id by the virtual host name.

Parameters:

vh_name (str) – Virtual Host name.

Returns:

On success, returns vh_id. If there is no matching Virtual Host, returns None.

Return type:

int | None

async vm_host_get(*, vh_id, **kwargs)

This method allows you to retrieve a virtual host information.

Parameters:

vh_id (int) – Virtual host identifier.

Returns:

On success, returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

vdc_id

Agent hostname/IP address.

vdc_name

VM Datacenter name.

vdt_type

VM Datacenter type.

vdt_name

VM Datacenter type name.

vh_bios_date

Timestamp of BIOS creation date.

vh_bios_version

BIOS version installed.

vh_com_path

Virtual host communication path.

vh_cpu_cores

Total count of CPU cores on virtual host.

vh_cpu_count

Total count of physical CPUs on virtual host.

vh_cpu_mhz

Speed in MHz of CPU.

vh_cpu_model

CPU model identification.

vh_cpu_threads

Number of threads CPUs can handle.

vh_date_added

Timestamp of virtual host added to NETLAB+.

vh_date_modified

Timestamp of virtual host information has been modified.

vh_date_tested

Timestamp of virtual host test communication.

vh_id

Virtual host identifier.

vh_inside_ipv4_addr

Inside interface ipv4 address.

vh_inside_vswitch_0

Virtual host inside vSwitch.

vh_last_test_status

Status of last virtual host test communication.

vh_memory_mb

Total RAM in MB of virtual host.

vh_name

Virtual host hostname.

vh_online

Virtual host is online.

vh_os_build

Operating system build number.

vh_os_description

Operating system description.

vh_os_name

Operating system name.

vh_os_type

Operating system type.

vh_os_vendor

Operating system vender.

vh_os_version

Operating system version.

vh_outside_ipv4_addr

Outside interface ipv4 address.

vh_pra_enabled

Proactive resource awareness is enabled.

vh_pra_max_cpu

Max number of CPUs for PRA.

vh_pra_max_mem_mb

Max amount of RAM in MB for PRA.

vh_pra_max_vm

Max amount of virtual machines for PRA.

vh_sys_model

System model.

vh_sys_service_tag

System service tag.

vh_sys_vendor

System vendor.

vh_uuid

Virtual host unique global identifier.

async vm_host_list(*, vdc_id=None, **kwargs)

This method allows you to retrieve a list of virtual hosts information.

Parameters:

vdc_id (str | None) – VM Datacenter identifier. If not specified, will return from all datacenters.

Returns:

Returns a list of objects with the following properties:

Return type:

List[Dict[str, Any]]

Properties

vdc_id

Agent hostname/IP address.

vdc_name

VM Datacenter name.

vdt_type

VM Datacenter type.

vdt_name

VM Datacenter type name.

vh_bios_date

Timestamp of BIOS creation date.

vh_bios_version

BIOS version installed.

vh_com_path

Virtual host communication path.

vh_cpu_cores

Total count of CPU cores on virtual host.

vh_cpu_count

Total count of physical CPUs on virtual host.

vh_cpu_mhz

Speed in MHz of CPU.

vh_cpu_model

CPU model identification.

vh_cpu_threads

Number of threads CPUs can handle.

vh_date_added

Timestamp of virtual host added to NETLAB+.

vh_date_modified

Timestamp of virtual host information has been modified.

vh_date_tested

Timestamp of virtual host test communication.

vh_id

Virtual host identifier.

vh_inside_ipv4_addr

Inside interface ipv4 address.

vh_inside_vswitch_0

Virtual host inside vSwitch.

vh_last_test_status

Status of last virtual host test communication.

vh_memory_mb

Total RAM in MB of virtual host.

vh_name

Virtual host hostname.

vh_online

Virtual host is online.

vh_os_build

Operating system build number.

vh_os_description

Operating system description.

vh_os_name

Operating system name.

vh_os_type

Operating system type.

vh_os_vendor

Operating system vender.

vh_os_version

Operating system version.

vh_outside_ipv4_addr

Outside interface ipv4 address.

vh_pra_enabled

Proactive resource awareness is enabled.

vh_pra_max_cpu

Max number of CPUs for PRA.

vh_pra_max_mem_mb

Max amount of RAM in MB for PRA.

vh_pra_max_vm

Max amount of virtual machines for PRA.

vh_sys_model

System model.

vh_sys_service_tag

System service tag.

vh_sys_vendor

System vendor.

vh_uuid

Virtual host unique global identifier.

async vm_host_perf_realtime_list(*, vh_id=None, **kwargs)

This method returns real-time virtual machine host performance data for one or more hosts.

Params vh_id:

NETLAB+ host identifier of hosts to return. If omitted or empty, all hosts are returned.

Returns:

A dictionary with the following properties.

Return type:

List[Dict[str, Any]]

Recommended Usage

  1. Obtain a list of hosts systems from vm.host.list.

  2. Call this method to obtain real-time performance data for one or more hosts. You may optionally specify which hosts to return by passing an array or CSV list of host IDs; long running applications that specify vh_id should always be prepared to handle this exception in case a host host is deleted.

  3. Real-time data is available every 20 seconds with observations for T+00, T+20, and T+40 seconds of every minute. For optimal results, call this method at T+05, T+25, and T+45 seconds; calling system should have accurate system clock (i.e. NTP). To avoid unnecessary overhead on the NETLAB+ server API, calls to this method should be at least 20 seconds apart.

Properties

vh_id

The NETLAB+ host identifier of the associated host.

data_available

real-time performance properties are available for this host.

vhp_time

The ending date and time (UTC) of the performance interval (UTC).

age_sec

The age of the data in second from time of call. If greater than 60, data will be considered too stale to be real-time, and data_available will be 0. If None, no data was available for host, data_available will be 0 and vhp_time will be None.

async vm_inventory_add(*, vdc_id, vm_uuid, vm_name, vm_path=None, vm_alloc_mem_mb, vm_alloc_cpu_n, vhg_id=None, vh_id=None, vm_role=VirtualMachineRole.NORMAL, vm_comments=None, vm_vendor_os_id=None, vm_vendor_os_name=None, vm_netlab_os_id=None, vm_parent_id=None, vm_parent_snapname=None, **kwargs)

``vm_inventory_add`` is deprecated, please use ``vm_inventory_import_task`` instead

Add virtual machines to NETLAB+ inventory.

Parameters:
  • vdc_id (int) – VM Datacenter identifier.

  • vhg_id (int) – Virtual host group identifier.

  • vh_id (int) – Virtual host identifier.

  • vm_uuid (str) – Virtual machine unique identifier.

  • vm_name (str) – Virtual machine name.

  • vm_path (str) – Virtual machine path on datastore.

  • vm_role (netlab.enums.VirtualMachineRole) – Virtual machine role in NETLAB+ inventory.

  • vm_alloc_mem_mb (int) – Total amount of allocated RAM.

  • vm_alloc_cpu_n (int) – Total amount of allocated CPUs.

  • vm_comments (str) – Virtual machine comments from VMX.

  • vm_vendor_os_id (str) – Vendor operating system identifier.

  • vm_vendor_os_name (str) – Vendor operating system name.

  • vm_netlab_os_id (str) – NETLAB+ match to vm_vendor_os_id.

  • vm_parent_id (int) – Virtual machine parent identifier, if VM is a link clone.

  • vm_parent_snapname (str) – Virtual machine parent snapname, if VM is a link clone.

Returns:

Returns a list of object with the following properties:

Return type:

list[dict]

properties

vm_id

Virtual machine identifier.

async vm_inventory_get(*, vm_id, **kwargs)

This method allows you to retrieve one or more virtual machines from NETLAB+ inventory.

Parameters:

vm_id (int) – Virtual machine identifier.

Returns:

Returns an object with the following properties:

Return type:

Dict[str, Any]

Properties

pc_id

Remote pc identifier.

pc_label

Remote pc label.

pc_os_id

NETLAB+ operating system identifier.

pc_os_name

NETLAB+ operating system name.

pc_pod_id

If attached to a pod, pod identifier.

pc_vm_id

Virtual machine identifier.

pod_name

Pod name.

vdc_id

Virtual datacenter identifier.

vdc_name

Virtual datacenter name.

vh_id

Virtual host identifier.

vh_name

Virtual host name.

vhg_id

Virtual host group identifier.

vhg_name

Virtual host group name.

vm_alloc_cpu_n

Total amount of allocated CPUs.

vm_alloc_mem_mb

Total amount of allocated RAM.

vm_child_count

Total count of children VMs.

vm_comments

Virtual machine comments from VMX.

vm_date_added

Timestamp of virtual machine added to NETLAB+ inventory.

vm_id

Virtual machine identifier.

vm_name

Virtual machine name.

vm_netlab_os_id

NETLAB+ match to vm_vendor_os_id.

vm_parent_id

Virtual machine parent identifier, if VM is a link clone.

vm_parent_name

Virtual machine parent name.

vm_parent_role

Parent virtual machine role.

vm_parent_snapname

Virtual machine parent snapname, if VM is a link clone.

vm_path

Virtual machine path on datastore.

vm_power_state

Virtual machine power state.

vm_role

Virtual machine role in NETLAB+ inventory.

vm_snapshot

This is what the VM reverts to when the pod is reset. You can take multiple snapshots with the same name, without having to update this field. Update this field with a call to pod_pc_update()

vm_uuid

Virtual machine unique identifier.

vm_vendor_os_id

Vendor operating system identifier.

vm_vendor_os_name

Vendor operating system name.

async vm_inventory_import_task(*, vdc_id, vm_property_list, **kwargs)

Method to call a task to import virtual machine into NETLAB+ inventory.

Parameters:
  • vdc_id (int) – Virtual datacenter identifier.

  • vm_property_list (list) – Virtual machine property list of the following properties:

properties

vm_uuid

Virtual machine unique identifier.

vhg_id

Virtual host group identifier.

vh_id

Virtual host identifier.

vm_name

Virtual machine name.

vm_role

Virtual machine role in NETLAB+ inventory. netlab.enums.VirtualMachineRole

vm_alloc_mem_mb

Total amount of allocated RAM.

vm_alloc_cpu_n

Total amount of allocated CPUs.

vm_comments

Virtual machine comments from VMX.

vm_vendor_os_id

Vendor operating system identifier.

vm_vendor_os_name

Vendor operating system name.

vm_netlab_os_id

NETLAB+ match to vm_vendor_os_id.

Returns:

List of results

Return type:

List[Dict[str, Any]]

return properties

status

‘OK’ or error.

vm_id

Virtual machine identifier.

async vm_inventory_list(*, vdc_id=None, roles=None, attached=None, **kwargs)

This method allows you to list the virtual machines from NETLAB+ inventory.

Parameters:
  • vdc_id (int | None) – VM Datacenter identifier.

  • roles (List[str] | None) – Filter by specified roles.

  • attached (bool | None) – List virtual machines attached to a pod.

Returns:

Returns an object with the following properties:

Return type:

List[Dict[str, Any]]

Properties

pc_id

Remote pc identifier.

pc_label

Remote pc label.

pc_os_id

NETLAB+ operating system identifier.

pc_os_name

NETLAB+ operating system name.

pc_pod_id

If attached to a pod, pod identifier.

pc_vm_id

Virtual machine identifier.

pod_name

Pod name.

vdc_id

Virtual datacenter identifier.

vdc_name

Virtual datacenter name.

vh_id

Virtual host identifier.

vh_name

Virtual host name.

vhg_id

Virtual host group identifier.

vhg_name

Virtual host group name.

vm_alloc_cpu_n

Total amount of allocated CPUs.

vm_alloc_mem_mb

Total amount of allocated RAM.

vm_child_count

Total count of children VMs.

vm_comments

Virtual machine comments from VMX.

vm_date_added

Timestamp of virtual machine added to NETLAB+ inventory.

vm_id

Virtual machine identifier.

vm_name

Virtual machine name.

vm_netlab_os_id

NETLAB+ match to vm_vendor_os_id.

vm_parent_id

Virtual machine parent identifier, if VM is a link clone.

vm_parent_name

Virtual machine parent name.

vm_parent_role

Parent virtual machine role.

vm_parent_snapname

Virtual machine parent snapname, if VM is a link clone.

vm_path

Virtual machine path on datastore.

vm_power_state

Virtual machine power state.

vm_role

Virtual machine role in NETLAB+ inventory.

vm_snapshot

This is what the VM reverts to when the pod is reset. You can take multiple snapshots with the same name, without having to update this field. Update this field with a call to pod_pc_update()

vm_uuid

Virtual machine unique identifier.

vm_vendor_os_id

Vendor operating system identifier.

vm_vendor_os_name

Vendor operating system name.

async vm_inventory_remove_datacenter_task(*, vm_id, **kwargs)

Remove virtual machine from NETLAB+ inventory and datacenter. Does NOT remove VM from disk.

Parameters:

vm_id (int) – Virtual machine identifier.

async vm_inventory_remove_disk_task(*, vm_id, **kwargs)

Remove virtual machine from NETLAB+ inventory, datacenter, and disk.

WARNING: this method permanantly deletes the virtual machine files from disk. This operation cannot be undone.

Parameters:

vm_id (int) – Virtual machine identifier.

async vm_inventory_remove_local(*, vm_id, **kwargs)

Remove virtual machine from NETLAB+ inventory only. Does NOT remove VM from datacenter or disk.

Parameters:

vm_id – Virtual machine identifier.

vm_license_list(*, vdc_id=None, vh_id=None, vl_server=None, vl_key=None, vl_type=None, **kwargs)

This method returns a list of cached VMware vCenter and server licenses.

This license cache is populated by any of the following events: - every 12 hours per scheduled task - when datacenters are added or removed - when virtual machine host servers are added or removed - by calling API method VmApiMixin.vm_license_update_task()

The cache updates each time licenses are scanned. If a vCenter server for a datacenter is unreachable during the scan, the licenses managed by that vCenter will be missing from the cache until the vCenter can be reached on a subsequent scan.

Parameters:
  • vdc_id (int | None) – return licenses for datacenter identified by vdc_id in NETLAB+

  • vh_id (int | None) – return license for vm host identified by vh_id in NETLAB+

  • vl_server (int | None) – return license with hostname or IP address matching vl_server in vCenter

  • vl_key (int | None) – return license with key matching vl_key in vCenter

  • vl_type (VirtualMachineLicenseType | None) – License type.

Returns:

A list of dictionaries with the following properties.

Return type:

List[Dict[str, Any]]

Properties

vdc_id

NETLAB+ datacenter identifier associated with license.

vh_id

If not None, the NETLAB+ vm host identifier associated with license.

vl_type

License type. netlab.enums.VirtualMachineLicenseType

vl_server

Hostname or IP address of the server as registered in vCenter.

vl_product

Licensed product name.

vl_key

Licnese key.

vl_units

Number of units licensed (i.e. processors) depending on server type.

vl_expiration

The expiration date and time of the license (UTC) or None if no expiration.

vl_last_udpate

The date and time this license was last queried and cached.

vm_license_update_task(**kwargs)

This method scans each vCenter server in all NETLAB+ datacenters and returns the VMware license status of VMware vCenter and VMware host servers.

  • The license information is cached for quick retreival using subsequent calls to VmApiMixin.vm_license_list().

  • It is usually not necessary to call vm.liense.update.task directly. It is automatically run:
    • every 12 hours per scheduled task

    • when datacenters are added or removed

    • when virtual machine host servers are added or removed

  • The license cache is cleared updated each time vm.license.udpate.task is run.
    • If a vCenter server for a datacenter is unreachable during the scan, the licenses managed by that vCenter will be missing from the cache until the vCenter can be reached on a subsequent scan.

  • This task ignores licenses that are not associated with NETLAB+ servers.

Returns:

A dictionary with the following properties.

Return type:

Dict[str, Any]

Properties

servers_tried

The number of vCenter servers that contact was attempted.

servers_reporting

The number of vCenter servers that responded with license information.

license_count

The number of licenses that were found and cached.

licenses

Information about each licence (see below).

earliest_expiration

The earliest license expiration at time of call. Can be None.

License Properties

vdc_id

NETLAB+ datacenter identifier associated with license.

vh_id

If not None, the NETLAB+ vm host identifier associated with license.

vl_type

License type. netlab.enums.VirtualMachineLicenseType

vl_server

Hostname or IP address of the server as registered in vCenter.

vl_product

Licensed product name.

vl_key

Licnese key.

vl_units

Number of units licensed (i.e. processors) depending on server type.

vl_expiration

The expiration date and time of the license (UTC) or None if no expiration.

vl_last_udpate

The date and time this license was last queried and cached.

async vm_snapshot_add(*, vm_id=None, pc_id=None, snapshot_name, dump_memory=False, sync=False, description=None, **kwargs)

Method to call a task to add snapshot to virtual machine.

Parameters:
  • vm_id (int | None) – Virtual datacenter identifier.

  • pc_id (int | None) – Remote pc identifier.

  • snapshot_name (str) – Name of snapshot to take.

  • dump_memory (bool) – Dump memory files.

  • sync (bool) – Sync files.

  • description (str | None) – Snapshot description.

async vm_snapshot_edit(*, vm_id=None, pc_id=None, snapshot_id=None, new_snapshot_name=None, new_snapshot_description=None, **kwargs)

Method to call a task to edit a snapshot.

Parameters:
  • vm_id (int | None) – Virtual datacenter identifier.

  • pc_id (int | None) – Remote pc identifier.

  • snapshot_id (int | None) – Snapshot identifier.

  • new_snapshot_name (str | None) – New name of snapshot to take.

  • new_snapshot_description (str | None) – New description of snapshot.

async vm_snapshot_get_list(*, pc_id: int) Dict[str, Any]
async vm_snapshot_get_list(*, vm_id: int) Dict[str, Any]

Method to call a task to retrieve a list of snapshots.

Parameters:
  • vm_id – Virtual datacenter identifier.

  • pc_id – Remote pc identifier.

Returns:

Returns a dict with the following properties:

Properties

current_snapshot

The current snapshot. See Snapshot properties for more info.

snapshot_list

A list of all snapshots. See Snapshot properties for more info.

Snapshot properties

power_state

The state of the snapshot. PowerState

name

The snapshot name.

description

The snapshot description.

parent_id

The id of the snapshot parent.

id

The snapshot id.

mo_ref

The unique identifier of the managed object in vSphere.

async vm_snapshot_get_tree(*, pc_id: int) Dict[str, Any]
async vm_snapshot_get_tree(*, vm_id: int) Dict[str, Any]

Method to call a task to retrieve snapshot tree.

Parameters:
  • vm_id – Virtual datacenter identifier.

  • pc_id – Remote pc identifier.

Returns:

Returns a dict with the following properties:

Properties

current_snapshot

The current snapshot. See Snapshot properties for more info.

snapshot_list

A list of all snapshots. See Snapshot properties for more info.

Snapshot properties

power_state

The state of the snapshot. PowerState

name

The snapshot name.

description

The snapshot description.

id

The snapshot id.

mo_ref

The unique identifier of the managed object in vSphere.

async vm_snapshot_remove(*, vm_id=None, pc_id=None, snapshot_name=None, snapshot_id=None, remove_children=None, remove_all_snapshots=None, **kwargs)

Method to call a task to remove snapshot from virtual machine.

Parameters:
  • vm_id (int | None) – Virtual datacenter identifier.

  • pc_id (int | None) – Remote pc identifier.

  • snapshot_name (str | None) – Name of snapshot to take.

  • snapshot_id (int | None) – Snapshot identifier.

  • remove_children (bool | None) – Remove children snapshots.

  • remove_all_snapshots (bool | None) – Remove all snapshots of virtual machine.

async vm_snapshot_revert(*, vm_id=None, pc_id=None, snapshot_name=None, snapshot_id=None, **kwargs)

Method to call a task to revert to snapshot from virtual machine.

Parameters:
  • vm_id (int | None) – Virtual datacenter identifier.

  • pc_id (int | None) – Remote pc identifier.

  • snapshot_name (str | None) – Name of snapshot to take.

  • snapshot_id (int | None) – Snapshot identifier.