dzs adapter¶
Inmanta module to manage DZS OLT devices.
Environment variables¶
Env variable name |
Description |
|---|---|
INMANTA_DZS_SESSION_IDLE_TIMEOUT |
Number of seconds an idle ssh session to a device is kept open before being closed (default: |
INMANTA_DZS_INVENTORY_TIMEOUT |
Number of seconds to wait for the |
INMANTA_DZS_INVENTORY_CACHE_TIME |
Number of seconds an ssh session reuses an |
Session idle timeout¶
The handlers share one ssh session per agent, which they cache and close once it was idle for
INMANTA_DZS_SESSION_IDLE_TIMEOUT seconds. The driver closes the session when a command fails, as the device
may still be busy with it, which fails the rest of the resource action. Before each resource action, the
handler opens a new session if the cached one was closed, by the driver or by the device, resolving the
username and password references again. The driver doesn’t keep the password in memory once the session
is open.
Two other timeouts close an idle session:
The device terminates an ssh session after 15 minutes of inactivity by default (“Connection terminated due to inactivity”). This timeout can be read and changed on its cli with the
timeoutcommand (in minutes, for all cli sessions).The executor of an agent is stopped once it was idle for the executor retention time of the orchestrator (
executor-retention-timein the[agent]section of its config, orINMANTA_AGENT_EXECUTOR_RETENTION_TIME, 60 seconds by default), which closes its session too.
To keep the sessions open longer, raise INMANTA_DZS_SESSION_IDLE_TIMEOUT below the timeout of the device,
and the executor retention time slightly above it. To help with this:
The agent logs a warning when
INMANTA_DZS_SESSION_IDLE_TIMEOUTis longer than the executor retention time.Each time it opens a session, the driver reads the timeout of the device, and logs a warning when the device drops idle sessions before the agent closes them, or an info when the agent could keep them open longer. Reading it is skipped when the user isn’t allowed to run
timeout.
Onu inventory cache¶
onu inventory is slow (several seconds for an olt port, up to minutes for a whole olt), and all the onus of an
olt port look for themselves in the same inventory. The ssh session of an agent keeps each inventory it read
for INMANTA_DZS_INVENTORY_CACHE_TIME seconds, for the onus registered with their serial number and for the
discoveries, and forgets them when it registers, clears or deletes an onu.
During that time, the agent doesn’t see an onu registered, cleared or deleted by another session (another
agent, an operator), nor a change of the facts of an onu (model, software versions, measurements). An ont
detected by the olt is not affected: it is listed by onu show until it is registered, never by the
inventory. The onus registered with a regid always read the inventory.
Devices and agents¶
A dzs::Device is identified by its name, which is also the name of the agent managing its resources:
the id of every resource is scoped to the name of its device. The device is reached on host (the name
when null) and port (22 by default). Several devices can reach the same olt, with the same host and
port and different names, to split its resources over several agents.
The credentials of a dzs::Device (username/password) can be set directly, or resolved on the agent
at deploy time with a reference, e.g. from an environment variable (std::create_environment_reference).
The agent only resolves such a reference when it opens a new ssh session to the device.
A discovery resource runs on the agent of its device, sharing its ssh session with the other resources
of the device, and reports the resources it discovers on that agent. To run it on its own agent, give it
a device reaching the same olt under another name, and set its target_agent_name to the name of the
device managing the resources, so that the discovered resources get the ids of their managed counterparts.
Usage example¶
This example configures an onu, its rules and the bridge of one of its ports.
import dzs
device = dzs::Device(
name="olt1",
host="0.0.0.0",
username=std::create_environment_reference("DZS_USERNAME"),
password=std::create_environment_reference("DZS_PASSWORD"),
strict_key=false,
)
onu = dzs::Onu(
device=device,
slot=2,
olt=12,
me_profile="zhone-2424",
serial_number="00112233",
)
ingress_rule = dzs::Rule(
device=device,
group_index=590,
member_index=1,
access_type="PPPoE",
name="subscriber-1",
)
# An existing rule, shared by all the bridges
egress_rule = dzs::Rule(
device=device,
group_index=1,
member_index=1,
)
bridge = dzs::OnuPortBridge(
device=device,
onu=onu,
ingress_packet_rule=ingress_rule,
egress_packet_rule=egress_rule,
vlan=100,
slan=0,
eth_port=1,
gtp=1,
encapsulation="tagged",
rg_bridged=false,
uni_vlan_priority_tagged=false,
)
dzs::Onu requires either regid or serial_number to be set (not both), to identify the onu on the
olt. The full model definition, with a description of every entity and attribute, is documented in
model/_init.cf and picked up by the generated module documentation, the same way as for other
Inmanta modules (e.g. netbox).