Skip to content

Commit 486b820

Browse files
authored
Merge pull request CiscoDevNet#2 from WendellOdom/master
Fixed compatibility issue for CSR upgrade
2 parents 5b07db4 + 0a50a2e commit 486b820

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

NC-get-config/NC-get-config.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525
# SUCH DAMAGE.
2626
#
27-
# This script retrieves entire configuration from a network element via NETCONF
27+
# This script retrieves entire configuration from a network element via NETCONF
2828
# prints it out in a "pretty" XML tree.
2929

3030
import sys
@@ -44,14 +44,20 @@
4444
parser.add_argument('--port', type=int, default=830,
4545
help="Specify this if you want a non-default port")
4646
args = parser.parse_args()
47-
47+
4848
m = manager.connect(host=args.host,
4949
port=args.port,
5050
username=args.username,
5151
password=args.password,
5252
device_params={'name':"csr"})
53-
# Pretty print the XML reply
54-
xmlDom = xml.dom.minidom.parseString( str( m.get_config(source='running')))
55-
print xmlDom.toprettyxml( indent = " " )
5653

54+
hostname_filter = '''
55+
<filter>
56+
<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
57+
</native>
58+
</filter>
59+
'''
5760

61+
# Pretty print the XML reply
62+
xmlDom = xml.dom.minidom.parseString( str( m.get_config('running', hostname_filter)))
63+
print(xmlDom.toprettyxml( indent = " " ))

0 commit comments

Comments
 (0)