-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for nested XML configuration #3
Open
benmcbenben
wants to merge
8
commits into
networktocode:develop
Choose a base branch
from
benmcbenben:patch-2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f6c32b2
Add support for nested XML configuration
benmcbenben 47e3d64
Update __init__.py
benmcbenben ad624d8
finalise working fix
benmcbenben dc44b89
copy -> deepcopy
benmcbenben 1a8f41d
* Run black across parsers/openconfig/junos/__init__.py to make black…
bd4cc5f
Restore a commented out line
benmcbenben ad93d4e
Merge from develop branch
benmcbenben 4196c4e
Merge branch 'develop' into patch-2
benmcbenben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
33 changes: 33 additions & 0 deletions
33
tests/models/openconfig/data/openconfig-interfaces/parse/junos/config/dev_conf_fails_1
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,33 @@ | ||
<rpc-reply> | ||
<configuration> | ||
<interfaces> | ||
<interface> | ||
<name>xe-0/0/0</name> | ||
<unit> | ||
<name>0</name> | ||
<description>this is interface xe-0/0/0</description> | ||
</unit> | ||
<disable/> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/1</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
<unit> | ||
<name>10</name> | ||
<description>this is interface xe-0/0/1.10</description> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/3</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
</interface> | ||
</interfaces> | ||
</configuration> | ||
<cli> | ||
<banner></banner> | ||
</cli> | ||
</rpc-reply> |
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
tests/models/openconfig/data/openconfig-interfaces/parse/junos/config/dev_conf_passes_2
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,33 @@ | ||
<rpc-reply> | ||
<configuration> | ||
<interfaces> | ||
<interface> | ||
<name>xe-0/0/0</name> | ||
<unit> | ||
<name>0</name> | ||
<description>this is interface xe-0/0/0</description> | ||
</unit> | ||
<disable/> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/1</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
<unit> | ||
<name>10</name> | ||
<description>this is interface xe-0/0/1.10</description> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/3</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
</interface> | ||
</interfaces> | ||
</configuration> | ||
<cli> | ||
<banner></banner> | ||
</cli> | ||
</rpc-reply> |
33 changes: 33 additions & 0 deletions
33
...s/openconfig/data/openconfig-interfaces/parse/junos/config/dev_conf_raises_AttributeError
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,33 @@ | ||
<rpc-reply> | ||
<bad_config_tag> | ||
<interfaces> | ||
<interface> | ||
<name>xe-0/0/0</name> | ||
<unit> | ||
<name>0</name> | ||
<description>this is interface xe-0/0/0</description> | ||
</unit> | ||
<disable/> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/1</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
<unit> | ||
<name>10</name> | ||
<description>this is interface xe-0/0/1.10</description> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/3</name> | ||
<unit> | ||
<name>0</name> | ||
</unit> | ||
</interface> | ||
</interfaces> | ||
</bad_config_tag> | ||
<cli> | ||
<banner></banner> | ||
</cli> | ||
</rpc-reply> |
61 changes: 61 additions & 0 deletions
61
tests/models/openconfig/data/openconfig-interfaces/parse/junos/config/result_fails_1.json
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,61 @@ | ||
{ | ||
"openconfig-interfaces:interfaces": { | ||
"interface": [ | ||
{ | ||
"name": "xe-0/0/0", | ||
"config": { | ||
"name": "xe-0/0/0", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": false | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0, | ||
"description": "this is interface xe-0/0/0" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "xe-0/0/1", | ||
"config": { | ||
"name": "xe-0/0/1", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": true | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "xe-0/0/3", | ||
"config": { | ||
"name": "xe-0/0/3", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": true | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
File renamed without changes.
68 changes: 68 additions & 0 deletions
68
tests/models/openconfig/data/openconfig-interfaces/parse/junos/config/result_passes_2.json
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,68 @@ | ||
{ | ||
"openconfig-interfaces:interfaces": { | ||
"interface": [ | ||
{ | ||
"name": "xe-0/0/0", | ||
"config": { | ||
"name": "xe-0/0/0", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": false | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0, | ||
"description": "this is interface xe-0/0/0" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "xe-0/0/1", | ||
"config": { | ||
"name": "xe-0/0/1", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": true | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0 | ||
} | ||
}, | ||
{ | ||
"index": 10, | ||
"config": { | ||
"index": 10, | ||
"description": "this is interface xe-0/0/1.10" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"name": "xe-0/0/3", | ||
"config": { | ||
"name": "xe-0/0/3", | ||
"type": "iana-if-type:ethernetCsmacd", | ||
"enabled": true | ||
}, | ||
"subinterfaces": { | ||
"subinterface": [ | ||
{ | ||
"index": 0, | ||
"config": { | ||
"index": 0 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...penconfig/data/openconfig-interfaces/parse/junos/config/result_raises_AttributeError.json
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 @@ | ||
{} |
53 changes: 0 additions & 53 deletions
53
tests/models/openconfig/data/openconfig-vlan/parse/junos/config/dev_conf
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
tests/models/openconfig/data/openconfig-vlan/parse/junos/config/dev_conf_fails_1
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,58 @@ | ||
<rpc-reply> | ||
<configuration> | ||
<interfaces> | ||
<interface> | ||
<name>xe-0/0/0</name> | ||
<unit> | ||
<name>0</name> | ||
<description>this is interface xe-0/0/0</description> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/1</name> | ||
<unit> | ||
<name>0</name> | ||
<family> | ||
<ethernet-switching> | ||
<interface-mode>access</interface-mode> | ||
<vlan> | ||
<members>10</members> | ||
</vlan> | ||
</ethernet-switching> | ||
</family> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>xe-0/0/3</name> | ||
<unit> | ||
<name>0</name> | ||
<family> | ||
<ethernet-switching> | ||
<interface-mode>trunk</interface-mode> | ||
<vlan> | ||
<members>10</members> | ||
<members>20</members> | ||
</vlan> | ||
</ethernet-switching> | ||
</family> | ||
</unit> | ||
</interface> | ||
</interfaces> | ||
<vlans> | ||
<vlan> | ||
<name>default</name> | ||
<vlan-id>1</vlan-id> | ||
</vlan> | ||
<vlan> | ||
<name>prod</name> | ||
<vlan-id>20</vlan-id> | ||
</vlan> | ||
<vlan inactive="inactive"> | ||
<vlan-id>10</vlan-id> | ||
</vlan> | ||
</vlans> | ||
</configuration> | ||
<cli> | ||
<banner></banner> | ||
</cli> | ||
</rpc-reply> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We made changes to the testing so if you could rebase off the
develop
branch and change the testing for these change to match the new way, that would be great.I think we should also start creating our own exceptions for parsing errors rather than use built-in errors. Such as
ntc_rosetta.exceptions.ConfigurationParsingError
, but this needs more discussion.