networking_generic_switch.netconf_models package

Subpackages

Submodules

networking_generic_switch.netconf_models.constants module

class networking_generic_switch.netconf_models.constants.NetconfEditConfigOperation(*values)

Bases: Enum

RFC 6241 - <edit-config> operation attribute

The “operation” attribute has one of the following values:
merge: The configuration data identified by the element

containing this attribute is merged with the configuration at the corresponding level in the configuration datastore identified by the <target> parameter. This is the default behavior.

replace: The configuration data identified by the element

containing this attribute replaces any related configuration in the configuration datastore identified by the <target> parameter. If no such configuration data exists in the configuration datastore, it is created. Unlike a <copy-config> operation, which replaces the entire target configuration, only the configuration actually present in the <config> parameter is affected.

create: The configuration data identified by the element

containing this attribute is added to the configuration if and only if the configuration data does not already exist in the configuration datastore. If the configuration data exists, an <rpc-error> element is returned with an <error-tag> value of “data-exists”.

delete: The configuration data identified by the element

containing this attribute is deleted from the configuration if and only if the configuration data currently exists in the configuration datastore. If the configuration data does not exist, an <rpc-error> element is returned with an <error-tag> value of “data-missing”.

remove: The configuration data identified by the element

containing this attribute is deleted from the configuration if the configuration data currently exists in the configuration datastore. If the configuration data does not exist, the “remove” operation is silently ignored by the server.

CREATE = 'create'
DELETE = 'delete'
MERGE = 'merge'
REMOVE = 'remove'
REPLACE = 'replace'

networking_generic_switch.netconf_models.utils module

networking_generic_switch.netconf_models.utils.config_to_restconf_json(config)

Serialize model objects to RESTCONF JSON (RFC 7951).

Returns a dict suitable for passing to requests.patch(json=…).

networking_generic_switch.netconf_models.utils.config_to_xml(config)
networking_generic_switch.netconf_models.utils.restconf_resource_path(*segments, base_path='/restconf/data')

Build a RESTCONF URL path from model path segments.

Composes segments from model to_restconf_path() calls into a full RESTCONF data-resource URL path (RFC 8040 Section 3.5.3).

Parameters:
  • segments – One or more RESTCONF path segments.

  • base_path – RESTCONF base path (default /restconf/data).

Returns:

Full RESTCONF URL path string.

networking_generic_switch.netconf_models.utils.txt_subelement(parent, tag, text, *args, **kwargs)

Module contents