Skip to content

Commit

Permalink
Merge pull request #1307 from neelimapp/test-data
Browse files Browse the repository at this point in the history
Add support for sanitized arg in get_config
  • Loading branch information
ktbyers committed Apr 8, 2021
2 parents fa62ff0 + 54ffd21 commit d4a2530
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 1 deletion.
2 changes: 1 addition & 1 deletion napalm/base/constants.py
Expand Up @@ -83,7 +83,7 @@
r"^(snmp-server user \S+( \S+)? auth md5) \S+ (priv) \S+ (localizedkey( engineID \S+)?)\s*$": r"\1 <removed> \3 <removed> \4\5", # noqa
r"^(username .+ (password|secret) \d) .+$": r"\1 <removed>",
r"^(enable (password|secret)( level \d+)? \d) .+$": r"\1 <removed>",
r"^(\s+(?:password|secret)) (?:\d )?\S+$": r"\1 <removed>",
r"^(\s+(?:password|secret)) (?:\d{1,2} )?\S+$": r"\1 <removed>",
r"^(.*wpa-psk ascii \d) (\S+)$": r"\1 <removed>",
r"^(.*key 7) (\d.+)$": r"\1 <removed>",
r"^(tacacs-server (.+ )?key) .+$": r"\1 <removed>",
Expand Down
4 changes: 4 additions & 0 deletions napalm/iosxr_netconf/iosxr_netconf.py
Expand Up @@ -3156,4 +3156,8 @@ def get_config(self, retrieve="all", full=False, sanitized=False):
pretty_print=True,
encoding="unicode",
)
if sanitized and encoding == "cli":
return napalm.base.helpers.sanitize_configs(
config, C.CISCO_SANITIZE_FILTERS
)
return config
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<rpc-reply message-id="urn:uuid:de925fb1-e3d1-40d1-837c-c618bb62c1eb" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data/>
</rpc-reply>
@@ -0,0 +1,185 @@
<?xml version="1.0"?>
<rpc-reply message-id="urn:uuid:de925fb1-e3d1-40d1-837c-c618bb62c1eb" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data>
<cli xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-cli-cfg">
!! IOS XR Configuration 6.7.1
!! Last configuration change at Thu Oct 8 06:29:40 2020 by admin
!
hostname asr9000-h07-2
service timestamps log datetime msec
service timestamps debug datetime msec
username admin
group root-system
group cisco-support
secret 5 $1$DPTg$5iBzqAsx43/5XfWPUulnr/
!
line default
exec-timeout 0 0
!
call-home
service active
contact smart-licensing
profile CiscoTAC-1
active
destination transport-method http
!
!
netconf-yang agent
ssh
!
interface Loopback0
ipv4 address 172.16.255.101 255.255.255.255
ipv6 address 2001:db8::ff:101/128
!
interface MgmtEth0/RSP0/CPU0/0
ipv4 address 172.30.2.11 255.255.255.0
!
interface MgmtEth0/RSP0/CPU0/1
shutdown
!
interface MgmtEth0/RSP1/CPU0/0
shutdown
!
interface MgmtEth0/RSP1/CPU0/1
shutdown
!
interface GigabitEthernet0/0/0/0
description CONNECTS TO LER2 (g0/0/0/1)
ipv4 address 172.16.0.3 255.255.255.254
ipv6 address 2001:db8::3/127
shutdown
!
interface GigabitEthernet0/0/0/1
description CONNECTS TO LER1 (g0/0/0/0)
ipv4 address 172.16.0.4 255.255.255.254
ipv6 address 2001:db8::4/127
shutdown
!
interface GigabitEthernet0/0/0/2
shutdown
!
interface GigabitEthernet0/0/0/3
shutdown
!
interface GigabitEthernet0/0/0/4
shutdown
!
interface GigabitEthernet0/0/0/5
shutdown
!
interface GigabitEthernet0/0/0/6
shutdown
!
interface GigabitEthernet0/0/0/7
shutdown
!
interface GigabitEthernet0/0/0/8
shutdown
!
interface GigabitEthernet0/0/0/9
shutdown
!
interface GigabitEthernet0/0/0/10
shutdown
!
interface GigabitEthernet0/0/0/11
shutdown
!
interface GigabitEthernet0/0/0/12
shutdown
!
interface GigabitEthernet0/0/0/13
shutdown
!
interface GigabitEthernet0/0/0/14
shutdown
!
interface GigabitEthernet0/0/0/15
shutdown
!
interface GigabitEthernet0/0/0/16
shutdown
!
interface GigabitEthernet0/0/0/17
shutdown
!
interface GigabitEthernet0/0/0/18
shutdown
!
interface GigabitEthernet0/0/0/19
shutdown
!
interface TenGigE0/0/1/0
shutdown
!
interface TenGigE0/0/1/1
shutdown
!
interface TenGigE0/0/1/2
shutdown
!
interface TenGigE0/0/1/3
shutdown
!
interface PTP0/RSP0/CPU0/0
shutdown
!
router static
address-family ipv4 unicast
0.0.0.0/0 172.30.2.1
!
!
router isis DEFAULT
is-type level-2-only
net 49.0001.0000.00ff.0101.00
address-family ipv4 unicast
metric-style wide
mpls traffic-eng level-2-only
mpls traffic-eng router-id Loopback0
!
address-family ipv6 unicast
metric-style wide
!
interface Loopback0
passive
address-family ipv4 unicast
!
address-family ipv6 unicast
!
!
interface GigabitEthernet0/0/0/0
point-to-point
address-family ipv4 unicast
!
address-family ipv6 unicast
!
!
interface GigabitEthernet0/0/0/1
point-to-point
address-family ipv4 unicast
!
address-family ipv6 unicast
!
!
!
rsvp
interface GigabitEthernet0/0/0/0
bandwidth percentage 100
!
interface GigabitEthernet0/0/0/1
bandwidth percentage 100
!
!
mpls traffic-eng
interface GigabitEthernet0/0/0/0
!
interface GigabitEthernet0/0/0/1
!
!
ssh server v2
ssh server netconf vrf default
end

</cli>
</data>
</rpc-reply>
@@ -0,0 +1,5 @@
{
"candidate": "",
"running": "!! IOS XR Configuration 6.7.1\n!! Last configuration change at Thu Oct 8 06:29:40 2020 by admin\n!\nhostname asr9000-h07-2\nservice timestamps log datetime msec\nservice timestamps debug datetime msec\nusername admin\n group root-system\n group cisco-support\n secret <removed>\n!\nline default\n exec-timeout 0 0\n!\ncall-home\n service active\n contact smart-licensing\n profile CiscoTAC-1\n active\n destination transport-method http\n !\n!\nnetconf-yang agent\n ssh\n!\ninterface Loopback0\n ipv4 address 172.16.255.101 255.255.255.255\n ipv6 address 2001:db8::ff:101/128\n!\ninterface MgmtEth0/RSP0/CPU0/0\n ipv4 address 172.30.2.11 255.255.255.0\n!\ninterface MgmtEth0/RSP0/CPU0/1\n shutdown\n!\ninterface MgmtEth0/RSP1/CPU0/0\n shutdown\n!\ninterface MgmtEth0/RSP1/CPU0/1\n shutdown\n!\ninterface GigabitEthernet0/0/0/0\n description CONNECTS TO LER2 (g0/0/0/1)\n ipv4 address 172.16.0.3 255.255.255.254\n ipv6 address 2001:db8::3/127\n shutdown\n!\ninterface GigabitEthernet0/0/0/1\n description CONNECTS TO LER1 (g0/0/0/0)\n ipv4 address 172.16.0.4 255.255.255.254\n ipv6 address 2001:db8::4/127\n shutdown\n!\ninterface GigabitEthernet0/0/0/2\n shutdown\n!\ninterface GigabitEthernet0/0/0/3\n shutdown\n!\ninterface GigabitEthernet0/0/0/4\n shutdown\n!\ninterface GigabitEthernet0/0/0/5\n shutdown\n!\ninterface GigabitEthernet0/0/0/6\n shutdown\n!\ninterface GigabitEthernet0/0/0/7\n shutdown\n!\ninterface GigabitEthernet0/0/0/8\n shutdown\n!\ninterface GigabitEthernet0/0/0/9\n shutdown\n!\ninterface GigabitEthernet0/0/0/10\n shutdown\n!\ninterface GigabitEthernet0/0/0/11\n shutdown\n!\ninterface GigabitEthernet0/0/0/12\n shutdown\n!\ninterface GigabitEthernet0/0/0/13\n shutdown\n!\ninterface GigabitEthernet0/0/0/14\n shutdown\n!\ninterface GigabitEthernet0/0/0/15\n shutdown\n!\ninterface GigabitEthernet0/0/0/16\n shutdown\n!\ninterface GigabitEthernet0/0/0/17\n shutdown\n!\ninterface GigabitEthernet0/0/0/18\n shutdown\n!\ninterface GigabitEthernet0/0/0/19\n shutdown\n!\ninterface TenGigE0/0/1/0\n shutdown\n!\ninterface TenGigE0/0/1/1\n shutdown\n!\ninterface TenGigE0/0/1/2\n shutdown\n!\ninterface TenGigE0/0/1/3\n shutdown\n!\ninterface PTP0/RSP0/CPU0/0\n shutdown\n!\nrouter static\n address-family ipv4 unicast\n 0.0.0.0/0 172.30.2.1\n !\n!\nrouter isis DEFAULT\n is-type level-2-only\n net 49.0001.0000.00ff.0101.00\n address-family ipv4 unicast\n metric-style wide\n mpls traffic-eng level-2-only\n mpls traffic-eng router-id Loopback0\n !\n address-family ipv6 unicast\n metric-style wide\n !\n interface Loopback0\n passive\n address-family ipv4 unicast\n !\n address-family ipv6 unicast\n !\n !\n interface GigabitEthernet0/0/0/0\n point-to-point\n address-family ipv4 unicast\n !\n address-family ipv6 unicast\n !\n !\n interface GigabitEthernet0/0/0/1\n point-to-point\n address-family ipv4 unicast\n !\n address-family ipv6 unicast\n !\n !\n!\nrsvp\n interface GigabitEthernet0/0/0/0\n bandwidth percentage 100\n !\n interface GigabitEthernet0/0/0/1\n bandwidth percentage 100\n !\n!\nmpls traffic-eng\n interface GigabitEthernet0/0/0/0\n !\n interface GigabitEthernet0/0/0/1\n !\n!\nssh server v2\nssh server netconf vrf default\nend",
"startup": ""
}
@@ -0,0 +1 @@
6.7.1

0 comments on commit d4a2530

Please sign in to comment.