-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from h4ndzdatm0ld/release/v2.1.0
Release/v2.1.0
- Loading branch information
Showing
50 changed files
with
1,456 additions
and
578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ name: "Documentation" | |
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "develop" | ||
|
||
jobs: | ||
documentation: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Netconf Connection Plugin.""" | ||
|
||
from nornir_netconf.plugins.connections.netconf import CONNECTION_NAME, Netconf | ||
|
||
__all__ = ("Netconf", "CONNECTION_NAME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Netconf Connection Plugin.""" | ||
|
||
from typing import Any, Dict, Optional | ||
|
||
from ncclient import manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""General Helpers.""" | ||
|
||
import logging | ||
import os.path | ||
from pathlib import Path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Data Models.""" | ||
|
||
from dataclasses import dataclass, field | ||
from typing import List, Optional | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Helper to extract info from RPC reply.""" | ||
|
||
from typing import List | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
nornir_netconf/plugins/tasks/capabilities/netconf_capabilities.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""NETCONF commit.""" | ||
|
||
from typing import Optional | ||
|
||
from ncclient.manager import Manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""NETCONF edit config.""" | ||
|
||
from typing import Optional | ||
|
||
from ncclient.manager import Manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""NETCONF validate config.""" | ||
|
||
from typing import Optional | ||
|
||
from ncclient.manager import Manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""NETCONF lock.""" | ||
|
||
from typing import Optional | ||
|
||
from ncclient.manager import Manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""NETCONF get config.""" | ||
|
||
from typing import Any, Dict, Optional | ||
|
||
from nornir.core.task import Result, Task | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""NETCONF rpc generic call.""" | ||
|
||
import re | ||
from typing import Optional | ||
|
||
from ncclient import xml_ | ||
from ncclient.manager import Manager | ||
from nornir.core.task import Result, Task | ||
|
||
from nornir_netconf.plugins.connections import CONNECTION_NAME | ||
from nornir_netconf.plugins.helpers import RpcResult | ||
|
||
|
||
def netconf_rpc( | ||
task: Task, | ||
payload: str, | ||
manager: Optional[Manager] = None, | ||
) -> Result: | ||
"""This method is a "bare-bones" rpc call which does not apply any | ||
formatting/standardization beyond the outer most rpc tag. | ||
Arguments: | ||
payload (str): Payload snippet to apply | ||
manager (Manager): NETCONF Manager | ||
Examples: | ||
Simple example:: | ||
> desired_payload='<save-config xmlns="http://cisco.com/yang/cisco-ia"/>' | ||
> nr.run(task= netconf_rpc, payload=desired_payload) | ||
Returns: | ||
Result object with the following attributes set:: | ||
* result (RpcResult): Rpc and Manager | ||
""" | ||
if not manager: | ||
manager = task.host.get_connection(CONNECTION_NAME, task.nornir.config) | ||
|
||
# convert payload to element, set namespace (if not set) and send RPC | ||
data = xml_.to_ele(payload) | ||
if not re.match(r"{.*}.*", xml_.parse_root(payload)[0]): | ||
data.set("xmlns", xml_.BASE_NS_1_0) | ||
|
||
result = manager.rpc(data) | ||
|
||
result = RpcResult(rpc=result, manager=manager) | ||
return Result(host=task.host, result=result) |
Oops, something went wrong.