This repository has been archived by the owner on May 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
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 #23 from napalm-automation/develop
Release beta 0.0.3
- Loading branch information
Showing
44 changed files
with
4,302 additions
and
39 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
Empty file.
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,18 @@ | ||
import netaddr | ||
|
||
|
||
def filters(): | ||
return { | ||
"netmask_to_cidr": netmask_to_cidr, | ||
"cidr_to_netmask": cidr_to_netmask, | ||
} | ||
|
||
|
||
def netmask_to_cidr(value): | ||
""" Converts a network mask to it's CIDR value. """ | ||
return netaddr.IPAddress(value).netmask_bits() | ||
|
||
|
||
def cidr_to_netmask(value): | ||
""" Converts a CIDR prefix-length to a network mask. """ | ||
return netaddr.IPNetwork("1.1.1.1/{}".format(value)).netmask |
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
9 changes: 9 additions & 0 deletions
9
napalm_yang/mappings/ios/parsers/config/napalm-if-ip/secondary.yaml
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,9 @@ | ||
--- | ||
metadata: | ||
prefix: "napalm-ip" | ||
parser: TextParser | ||
|
||
secondary: | ||
_parse: | ||
mode: value | ||
value: "{{ extra_vars.secondary != None }}" |
82 changes: 82 additions & 0 deletions
82
napalm_yang/mappings/ios/parsers/config/openconfig-if-ip/ipv4.yaml
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,82 @@ | ||
--- | ||
metadata: | ||
parser: TextParser | ||
|
||
ipv4: | ||
_parse: unnecessary | ||
config: | ||
_parse: unnecessary | ||
enabled: | ||
_parse: # TODO look at this one, I think this is different depending on IOS version | ||
mode: is_absent | ||
regexp: "(?P<value>^\\W*switchport$)" | ||
from: "{{ bookmarks['parent'] }}" | ||
mtu: | ||
_parse: not_implemented | ||
addresses: | ||
_parse: unnecessary | ||
address: | ||
_parse: | ||
mode: block | ||
regexp: "(?P<block>ip address (?P<key>(?P<ip>.*)) (?P<prefix>([0-255]|\\.)*)(?P<secondary> secondary)*)$" | ||
from: "{{ bookmarks['parent'] }}" | ||
ip: | ||
_parse: unnecessary | ||
config: | ||
_parse: unnecessary | ||
ip: | ||
_parse: | ||
mode: value | ||
value: "{{ extra_vars.ip }}" | ||
prefix_length: | ||
_parse: | ||
mode: value | ||
value: "{{ extra_vars.prefix|netmask_to_cidr }}" | ||
vrrp: | ||
_parse: not_implemented | ||
vrrp_group: | ||
_parse: not_implemented | ||
virtual_router_id: | ||
_parse: not_implemented | ||
config: | ||
_parse: not_implemented | ||
virtual_address: | ||
_parse: not_implemented | ||
priority: | ||
_parse: not_implemented | ||
preempt: | ||
_parse: not_implemented | ||
advertisement_interval: | ||
_parse: not_implemented | ||
virtual_router_id: | ||
_parse: not_implemented | ||
preempt_delay: | ||
_parse: not_implemented | ||
accept_mode: | ||
_parse: not_implemented | ||
unnumbered: | ||
_parse: not_implemented | ||
config: | ||
_parse: not_implemented | ||
enabled: | ||
_parse: not_implemented | ||
interface_ref: | ||
_parse: not_implemented | ||
config: | ||
_parse: not_implemented | ||
interface: | ||
_parse: not_implemented | ||
subinterface: | ||
_parse: not_implemented | ||
neighbors: | ||
_parse: not_implemented | ||
neighbor: | ||
_parse: not_implemented | ||
ip: | ||
_parse: not_implemented | ||
config: | ||
_parse: not_implemented | ||
ip: | ||
_parse: not_implemented | ||
link_layer_address: | ||
_parse: not_implemented |
82 changes: 82 additions & 0 deletions
82
napalm_yang/mappings/ios/parsers/config/openconfig-interfaces/interfaces.yaml
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,82 @@ | ||
--- | ||
metadata: | ||
parser: TextParser | ||
execute: | ||
- method: cli | ||
args: | ||
commands: ["show running-config all"] | ||
interfaces: | ||
_parse: unnecessary | ||
interface: | ||
_parse: | ||
mode: block | ||
regexp: "(?P<block>interface (?P<key>(\\w|-)*\\d+)\n(?:.|\n)*?^!$)" | ||
from: "{{ bookmarks.interfaces }}" | ||
name: | ||
_parse: unnecessary | ||
hold_time: | ||
_parse: not_implemented | ||
config: | ||
_parse: not_implemented | ||
down: | ||
_parse: not_implemented | ||
up: | ||
_parse: not_implemented | ||
config: | ||
_parse: unnecessary | ||
name: | ||
_parse: unnecessary | ||
type: | ||
_parse: | ||
mode: map | ||
regexp: "(?P<value>(\\w|-)*)\\d+" | ||
from: "{{ interface_key }}" | ||
map: | ||
GigabitEthernet: ethernetCsmacd | ||
Management: ethernetCsmacd | ||
Loopback: softwareLoopback | ||
Port-Channel: ieee8023adLag | ||
Port-channel: ieee8023adLag | ||
Vlan: l3ipvlan | ||
enabled: | ||
_parse: | ||
mode: is_present | ||
regexp: "(?P<value>no shutdown)" | ||
from: "{{ bookmarks.interface[interface_key] }}" | ||
description: | ||
_parse: | ||
mode: search | ||
regexp: "description (?P<value>.*)" | ||
from: "{{ bookmarks.interface[interface_key] }}" | ||
mtu: | ||
_parse: | ||
mode: search | ||
regexp: "mtu (?P<value>[0-9]+)" | ||
from: "{{ bookmarks.interface[interface_key] }}" | ||
subinterfaces: | ||
_parse: unnecessary | ||
subinterface: | ||
_parse: | ||
mode: block | ||
regexp: "(?P<block>interface {{interface_key}}\\.(?P<key>\\d+)\\n(?:.|\\n)*?^!$)" | ||
from: "{{ bookmarks.interfaces }}" | ||
index: | ||
_parse: unnecessary | ||
config: | ||
_parse: unnecessary | ||
index: | ||
_parse: unnecessary | ||
name: | ||
_parse: | ||
mode: value | ||
value: "{{ interface_key }}.{{ subinterface_key}}" | ||
enabled: | ||
_parse: | ||
mode: is_present | ||
regexp: "(?P<value>no shutdown)" | ||
from: "{{ bookmarks.subinterface[subinterface_key] }}" | ||
description: | ||
_parse: | ||
mode: search | ||
regexp: "description (?P<value>.*)" | ||
from: "{{ bookmarks.subinterface[subinterface_key] }}" |
13 changes: 13 additions & 0 deletions
13
napalm_yang/mappings/ios/parsers/config/openconfig-vlan/routed-vlan.yaml
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,13 @@ | ||
--- | ||
metadata: | ||
prefix: "oc-vlan" | ||
parser: TextParser | ||
|
||
routed-vlan: | ||
_parse: unnecessary | ||
config: | ||
_parse: unnecessary | ||
enabled: | ||
_parse: unnecessary | ||
vlan: | ||
_parse: unnecessary |
14 changes: 14 additions & 0 deletions
14
napalm_yang/mappings/ios/parsers/config/openconfig-vlan/vlan.yaml
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,14 @@ | ||
--- | ||
metadata: | ||
prefix: "oc-vlan" | ||
parser: TextParser | ||
|
||
vlan: | ||
_parse: unnecessary | ||
config: | ||
_parse: unnecessary | ||
vlan_id: | ||
_parse: | ||
mode: search | ||
regexp: "^\\W*encapsulation dot1q (?P<value>[0-9]+)" | ||
from: "{{ bookmarks['parent'] }}" |
80 changes: 80 additions & 0 deletions
80
napalm_yang/mappings/ios/translators/openconfig-if-ip/ipv4.yaml
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,80 @@ | ||
--- | ||
metadata: | ||
translator: TextTranslator | ||
|
||
ipv4: | ||
_translation: unnecessary | ||
config: | ||
_translation: unnecessary | ||
enabled: | ||
_translation: # TODO look at this one, I think this is different depending on IOS version | ||
- mode: element | ||
value: " no switchport\n" | ||
negate: " switchport\n" | ||
in: "interface.{{ interface_key }}" | ||
when: "{{ model and interface_key[0:4] not in ['Mana', 'Loop'] }}" | ||
mtu: | ||
_translation: not_implemented | ||
addresses: | ||
_translation: unnecessary | ||
address: | ||
_translation: | ||
mode: default_only | ||
negate: " default ip address {{ model.config.ip }} {{ model.config.prefix_length|cidr_to_netmask }}{{ ' secondary' if model.config.secondary else '' }}\n" | ||
ip: | ||
_translation: unnecessary | ||
config: | ||
_translation: unnecessary | ||
ip: | ||
_translation: unnecessary | ||
prefix_length: | ||
_translation: | ||
- mode: element | ||
value: " ip address {{ model._parent.ip }} {{ model|cidr_to_netmask }}{{ ' secondary' if model._parent.secondary else '' }}\n" | ||
vrrp: | ||
_translation: not_implemented | ||
vrrp_group: | ||
_translation: not_implemented | ||
virtual_router_id: | ||
config: | ||
virtual_address: | ||
_translation: not_implemented | ||
priority: | ||
_translation: not_implemented | ||
preempt: | ||
_translation: not_implemented | ||
advertisement_interval: | ||
_translation: not_implemented | ||
virtual_router_id: | ||
_translation: not_implemented | ||
preempt_delay: | ||
_translation: not_implemented | ||
accept_mode: | ||
_translation: not_implemented | ||
unnumbered: | ||
_translation: not_implemented | ||
config: | ||
_translation: not_implemented | ||
enabled: | ||
_translation: not_implemented | ||
interface_ref: | ||
_translation: not_implemented | ||
config: | ||
_translation: not_implemented | ||
interface: | ||
_translation: not_implemented | ||
subinterface: | ||
_translation: not_implemented | ||
neighbors: | ||
_translation: not_implemented | ||
neighbor: | ||
_translation: not_implemented | ||
ip: | ||
_translation: not_implemented | ||
config: | ||
_translation: not_implemented | ||
ip: | ||
_translation: not_implemented | ||
link_layer_address: | ||
_translation: not_implemented | ||
|
Oops, something went wrong.