jnpr.junos.cfg.resource.Resource(junos, namevar=None, **kvargs)[source]¶Bases: object
D¶returns the Device object bound to this resource/manager
M¶returns the :Resource: manager associated to this resource
P¶returns the parent of the associated Junos object
PROPERTIES = ['_exists', '_active']¶R¶returns the Device RPC meta object
__init__(junos, namevar=None, **kvargs)[source]¶Resource or Resource-Manager constructor. All managed resources and resource-managers inherit from this class.
If not None, identifies a specific resource by ‘name’. The format of the name is resource dependent. Most resources take a single string name, while others use tuples for compound names. refer to each resource for the ‘namevar’ definition
If namevar is None, then the instance is a Resource-Manager (RM). The RM is then used to select specific resources by name using the __getitem__ overload.
activate()[source]¶activate resource in Junos config the same as the Junos config-mode “activate” command
active¶is this resource configuration active on the Junos device?
| RuntimeError: | if invoked on a manager object |
|---|
catalog¶returns a dictionary of resources
deactivate()[source]¶activate resource in Junos config the same as the Junos config-mode “deactivate” command
delete()[source]¶remove configuration from Junos device the same as the Junos config-mode “delete” command
exists¶does this resource configuration exist on the Junos device?
| RuntimError: | if invoked on a manager |
|---|
is_mgr¶is this a resource manager?
is_new¶is this a new resource? that is, it does not exist on the Junos device when it was initally retrieved
| RuntimeError: | if invoked on a manager |
|---|
list¶returns a list of named resources
manages¶a resource may contain sub-managers for hierarchical oriented resources. this method will return a list of manager names attached to this resource, or :None: if there are not any
name¶the name of the resource
| RuntimeError: | if invoked on a manager |
|---|
propcopy(p_name)[source]¶proptery from :has: to :should:
performs a ‘deepcopy’ of the property; used to make changes to list, dict type properties
rename(new_name)[source]¶rename resource in Junos configuration the same as the Junos config-mode “rename” command
reorder(**kvargs)[source]¶move the configuration within the Junos hierarcy the same as the Junos config-mode “insert” command
| Kvargs: | after=”<name>” before=”<name>” |
|---|
write(**kvargs)[source]¶write resource configuration stored in :should: back to device
xml¶for debugging the resource XML configuration that was read from the Junos device
jnpr.junos.cfg.user.User(junos, namevar=None, **kvargs)[source]¶Bases: jnpr.junos.cfg.resource.Resource
[edit system login user <name>]
MANAGES = {'sshkey': <class 'jnpr.junos.cfg.user_ssh_key.UserSSHKey'>}¶PROPERTIES = ['uid', 'fullname', 'userclass', 'password', '$password', '$sshkeys']¶jnpr.junos.cfg.user_ssh_key.UserSSHKey(junos, namevar=None, **kvargs)[source]¶Bases: jnpr.junos.cfg.resource.Resource
[edit system login user <name> authentication <key-type> <key-value> ]
PROPERTIES = []¶load_key(path=None, key_value=None)[source]¶Adds a new ssh-key to the user authentication. You can provide either the path to the ssh-key file, or the contents of they key (useful for loading the same key on many devices)
| Path: | (optional) path to public ssh-key file on the local server, |
|---|---|
| Key_value: | (optional) the contents of the ssh public key |