Workloads & VENs

Workloads and VENs

Workloads

class illumio.workloads.Workload[source]

Represents a workload in the PCE.

See https://docs.illumio.com/core/21.5/Content/Guides/security-policy/workloads/_ch-workloads.htm

Usage:
>>> import illumio
>>> pce = illumio.PolicyComputeEngine('pce.company.com', port=443, org_id=1)
>>> pce.set_credentials('api_key', 'api_secret')
>>> role_label = pce.labels.create({'key': 'role', 'value': 'R-Web'})
>>> app_label = pce.labels.create({'key': 'app', 'value': 'A-App'})
>>> env_label = pce.labels.create({'key': 'env', 'value': 'E-Dev'})
>>> loc_label = pce.labels.create({'key': 'loc', 'value': 'L-NYC'})
>>> workload = illumio.Workload(
...     name='Web 01',
...     hostname='web01.lab.company.com',
...     public_ip='10.8.17.229',
...     labels=[role_label, app_label, env_label, loc_label],
...     interfaces=[
...         illumio.Interface(
...             name='lo0',
...             address='127.0.0.1',
...             link_state='up'
...         )
...     ],
...     enforcement_mode=illumio.EnforcementMode.SELECTIVE,
...     online=True
... )
>>> workload = pce.workloads.create(workload)
>>> workload
Workload(
    href='/orgs/1/workloads/572eb23e-a891-42b5-b488-cd9ffe3622f5',
    name='Web 01',
    hostname='web01.lab.company.com',
    public_ip='10.8.17.229',
    labels=[
        Reference(href='/orgs/1/labels/11'),
        ...
    ],
    interfaces=[
        Interface(
            name='lo0',
            address='127.0.0.1',
            link_state='up'
        )
    ],
    enforcement_mode='selective',
    online=True,
    ...
)

VENs

class illumio.workloads.VEN[source]

Represents a Virtual Enforcement Node object in the PCE.

The VEN object represents the agent on a workload that has been paired with the PCE.

NOTE: VENs are read-only via the PCE API.

See https://docs.illumio.com/core/21.5/Content/Guides/rest-api/workloads/ven-operations.htm

Usage:
>>> import illumio
>>> pce = illumio.PolicyComputeEngine('pce.company.com', port=443, org_id=1)
>>> pce.set_credentials('api_key', 'api_secret')
>>> vens = pce.vens.get()
>>> vens
[
    VEN(
        href="/orgs/1/vens/5fe88f13-d22c-427e-be47-b9c3369e1e32",
        hostname="web01.lab.company.com",
        status="active",
        os_id="centos-x86_64-8.0",
        os_detail="5.18.11-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 12 22:52:35 UTC 2022 (CentOS Linux release 8.5.2111)",
        os_platform="linux",
        version="21.2.5-8017",
        activation_type="pairing_key",
        labels=[
            Reference(href="/orgs/1/labels/14"),
            ...
        ],
        interfaces=[
            Interface(
                href="/orgs/1/workloads/5fe88f13-d22c-427e-be47-b9c3369e1e32/interfaces/eth0",
                name="eth0",
                address="10.88.0.3",
                cidr_block=16,
                default_gateway_address="10.88.0.1",
                network=Reference(
                    href="/orgs/1/networks/40995e57-5e83-4fc5-9492-5b0e6df32a68"
                ),
                network_detection_mode="single_private_brn",
                loopback=False,
            ),
            ...
        ],
        workloads=[
            Reference(href="/orgs/1/workloads/5fe88f13-d22c-427e-be47-b9c3369e1e32")
        ],
        last_heartbeat_at="2022-08-01T17:14:08.830Z",
        last_goodbye_at=None,
        unpair_allowed=True,
        conditions=[
            VENCondition(
                first_reported_timestamp="2022-08-01T17:31:40.669Z",
                latest_event=Event(
                    href="/orgs/1/events/0d2cec5f-5025-4e62-b867-b6e607397105",
                    notification_type="agent.missed_heartbeats",
                    severity="warning",
                    info={
                        ...
                    },
                    timestamp="2022-08-01T17:31:40.669Z",
                ),
            ),
            ...
        ],
    ),
    ...
]

Pairing Profiles

class illumio.workloads.PairingProfile[source]

Represents a pairing profile in the PCE.

Pairing profiles are used to configure VEN defaults and generate keys for VEN pairing on workloads that will be managed by the PCE.

See https://docs.illumio.com/asp/20.1/Content/Guides/rest-api/workloads/pairing-profiles-and-pairing-keys.htm

Usage:
>>> import illumio
>>> pce = illumio.PolicyComputeEngine('pce.company.com', port=443, org_id=1)
>>> pce.set_credentials('api_key', 'api_secret')
>>> pairing_profile = illumio.PairingProfile(
...     name='PP-DATABASE-VENS',
...     enabled=True,
...     enforcement_mode='visibility_only',
...     visibility_level='flows_summary'
... )
>>> pairing_profile = pce.pairing_profiles.create(pairing_profile)
>>> pairing_profile
PairingProfile(
    href='/orgs/1/pairing_profiles/19',
    name='PP-DATABASE-VENS',
    enabled=True,
    enforcement_mode='visibility_only',
    visibility_level='flows_summary',
    ...
)