ntc_rosetta leverages yangify to implement a set of "drivers" that can:
pip install ntc-rosetta
git clone https://github.com/networktocode/ntc-rosetta.git
)cd ntc-rosetta
)pip install poetry
poetry install
Clone the repository:
$ git clone https://github.com/networktocode/ntc-rosetta.git
Change directory into ntc-rosetta
:
$ cd ntc-rosetta
Build the containers:
$ make build_test_containers
Start a container so you can run the Jupyter notebooks:
$ make jupyter
Launch a browser and navigate to the following URL:
http://127.0.0.1:8888/tree/docs/tutorials
The same notebooks can be viewed without being interactive in the NTC Rosetta Read the Docs.
>>> from ntc_rosetta import get_driver
>>>
>>> ios = get_driver("ios", "openconfig")
>>> ios_driver = ios()
>>> with open("data/ios/config.txt", "r") as f:
>>> config = f.read()
>>> print(config)
interface FastEthernet1
description This is Fa1
shutdown
exit
!
vlan 10
name prod
no shutdown
exit
!
vlan 20
name dev
shutdown
exit
!
>>> parsed = ios_driver.parse(native={"dev_conf": config})
>>> import json
>>> print(json.dumps(parsed.raw_value(), indent=4))
{
"openconfig-interfaces:interfaces": {
"interface": [
{
"name": "FastEthernet1",
"config": {
"name": "FastEthernet1",
"type": "iana-if-type:ethernetCsmacd",
"description": "This is Fa1",
"enabled": false
},
"subinterfaces": {
"subinterface": [
{
"index": 1,
"config": {
"index": 1,
"description": "This is Fa1.1"
}
},
{
"index": 2,
"config": {
"index": 2,
"description": "This is Fa1.2"
}
}
]
}
},
]
},
"openconfig-network-instance:network-instances": {
"network-instance": [
{
"name": "default",
"config": {
"name": "default"
},
"vlans": {
"vlan": [
{
"vlan-id": 10,
"config": {
"vlan-id": 10,
"name": "prod",
"status": "ACTIVE"
}
},
{
"vlan-id": 20,
"config": {
"vlan-id": 20,
"name": "dev",
"status": "SUSPENDED"
}
}
]
}
}
]
}
}
>>> from ntc_rosetta import get_driver
>>>
>>> ios = get_driver("ios", "openconfig")
>>> ios_processor = ios()
>>> data = {
>>> "openconfig-interfaces:interfaces": {
>>> "interface": [
>>> {
>>> "name": "FastEthernet1",
>>> "config": {
>>> "name": "FastEthernet1",
>>> "type": "iana-if-type:ethernetCsmacd",
>>> "description": "This is Fa1",
>>> "enabled": False
>>> },
>>> "subinterfaces": {
>>> "subinterface": [
>>> {
>>> "index": 1,
>>> "config": {
>>> "index": 1,
>>> "description": "This is Fa1.1"
>>> }
>>> },
>>> {
>>> "index": 2,
>>> "config": {
>>> "index": 2,
>>> "description": "This is Fa1.2"
>>> }
>>> }
>>> ]
>>> }
>>> },
>>> ]
>>> },
>>> "openconfig-network-instance:network-instances": {
>>> "network-instance": [
>>> {
>>> "name": "default",
>>> "config": {
>>> "name": "default"
>>> },
>>> "vlans": {
>>> "vlan": [
>>> {
>>> "vlan-id": 10,
>>> "config": {
>>> "vlan-id": 10,
>>> "name": "prod",
>>> "status": "ACTIVE"
>>> }
>>> },
>>> {
>>> "vlan-id": 20,
>>> "config": {
>>> "vlan-id": 20,
>>> "name": "dev",
>>> "status": "SUSPENDED"
>>> }
>>> }
>>> ]
>>> }
>>> }
>>> ]
>>> }
>>> }
>>> native = ios_processor.translate(candidate=data)
>>> print(native)
interface FastEthernet1
description This is Fa1
shutdown
exit
!
interface FastEthernet1.1
description This is Fa1.1
exit
!
interface FastEthernet1.2
description This is Fa1.2
exit
!
interface FastEthernet3
description This is Fa3
no shutdown
switchport mode access
switchport access vlan 10
exit
!
interface FastEthernet4
shutdown
switchport mode trunk
switchport trunk allowed vlan 10,20
exit
!
vlan 10
name prod
no shutdown
exit
!
vlan 20
name dev
shutdown
exit
!
Bumps mistune from 0.8.4 to 2.0.3.
Sourced from mistune's releases.
Version 2.0.2
Fix
escape_url
via lepture/mistune#295Version 2.0.1
Fix XSS for image link syntax.
Version 2.0.0
First release of Mistune v2.
Version 2.0.0 RC1
In this release, we have a Security Fix for harmful links.
Version 2.0.0 Alpha 1
This is the first release of v2. An alpha version for users to have a preview of the new mistune.
Sourced from mistune's changelog.
Changelog
Here is the full history of mistune v2.
Version 2.0.4
Released on Jul 15, 2022
- Fix
url
plugin in<a>
tag- Fix
*
formattingVersion 2.0.3
Released on Jun 27, 2022
- Fix
table
plugin- Security fix for CVE-2022-34749
Version 2.0.2
Released on Jan 14, 2022
Fix
escape_url
Version 2.0.1
Released on Dec 30, 2021
XSS fix for image link syntax.
Version 2.0.0
Released on Dec 5, 2021
This is the first non-alpha release of mistune v2.
Version 2.0.0rc1
Released on Feb 16, 2021
Version 2.0.0a6
</tr></table>
... (truncated)
3f422f1
Version bump 2.0.3a6d4321
Fix asteris emphasis regex CVE-2022-347495638e46
Merge pull request #307 from jieter/patch-10eba471
Fix typo in guide.rst61e9337
Fix table plugin76dec68
Add documentation for renderer heading when TOC enabled799cd11
Version bump 2.0.2babb0cf
Merge pull request #295 from dairiki/bug.escape_urlfc2cd53
Make mistune.util.escape_url less aggressive3e8d352
Version bump 2.0.1Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
I would like to update the openconfig models to reflect the latest in https://github.com/openconfig/public.git
In order to make this work I need to generate an updated file containing JSON-encoded data model specification in the YANG library format.
How can I generate a version of openconfig.json which reflects updated model data? https://github.com/networktocode/ntc-rosetta/blob/develop/ntc_rosetta/yang/openconfig.json
Thank you
Bumps notebook from 6.0.3 to 6.4.10.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps ipython from 7.12.0 to 7.16.3.
d43c7c7
release 7.16.35fa1e40
Merge pull request from GHSA-pq7m-3gw7-gq5x8df8971
back to dev9f477b7
release 7.16.2138f266
bring back release helper from master branch5aa3634
Merge pull request #13341 from meeseeksmachine/auto-backport-of-pr-13335-on-7...bcae8e0
Backport PR #13335: What's new 7.16.28fcdcd3
Pin Jedi to <0.17.2.2486838
release 7.16.120bdc6f
fix conda buildDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps lxml from 4.5.0 to 4.6.5.
Sourced from lxml's changelog.
4.6.5 (2021-12-12)
Bugs fixed
A vulnerability (GHSL-2021-1038) in the HTML cleaner allowed sneaking script content through SVG images.
A vulnerability (GHSL-2021-1037) in the HTML cleaner allowed sneaking script content through CSS imports and other crafted constructs.
4.6.4 (2021-11-01)
Features added
GH#317: A new property
system_url
was added to DTD entities. Patch by Thirdegree.GH#314: The
STATIC_*
variables insetup.py
can now be passed via env vars. Patch by Isaac Jurado.4.6.3 (2021-03-21)
Bugs fixed
- A vulnerability (CVE-2021-28957) was discovered in the HTML Cleaner by Kevin Chung, which allowed JavaScript to pass through. The cleaner now removes the HTML5
formaction
attribute.4.6.2 (2020-11-26)
Bugs fixed
- A vulnerability (CVE-2020-27783) was discovered in the HTML Cleaner by Yaniv Nizry, which allowed JavaScript to pass through. The cleaner now removes more sneaky "style" content.
4.6.1 (2020-10-18)
... (truncated)
a9611ba
Fix a test in Py2.a3eacbc
Prepare release of 4.6.5.b7ea687
Update changelog.69a7473
Cleaner: cover some more cases where scripts could sneak through in specially...54d2985
Fix condition in test decorator.4b220b5
Use the non-depcrecated TextTestResult instead of _TextTestResult (GH-333)d85c6de
Exclude a test when using the macOS system libraries because it fails with li...cd4bec9
Add macOS-M1 as wheel build platform.fd0d471
Install automake and libtool in macOS build to be able to install the latest ...f233023
Cleaner: Remove SVG image data URLs since they can embed script content.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Review for PyPI token fix. Ran test locally with Mikhail and verified push to PyPI is working
Thanks to:
First version