cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
514
Views
1
Helpful
5
Replies

BGP aggregate-address command throws error on ASR 9k

while running 'aggregate-address x.x.0.0/17 summary-only' command on ASR 9k router from python code as part BGP routing protocol. It's throwing response 'aggregate-address x.x.0$' and the BGP configuration is not done successfully.

Can you share inputs to resolve the issue.

Thanks.

5 Replies 5

M02@rt37
VIP
VIP

Hello @Krishna Reddy Malem,

Could you share please your python code as concerned this command ?

Thanks.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Please find the python code snippet concerned.

import netmiko
from jinj2 import Template

try:
  device = ConnectHandler(device_type='cisco_ios', ip='x.x.x.x', username='xxxxx', password='xxxxx')

path = "./test.txt"

with open(path) as file:
        template = Template(file.read(), keep_trailing_newline=True)  

 

with device as conn:        
        config_set = commands.split('\n')
        output = conn.send_config_set(config_set)   

Thanks for looking into my issue. I have shared the sample python script to execute the command. Could you please check and help us to resolve the issue. Let me know if you need any additional information, currently we are not able to move a head on BGP configuration. 

You python snippet looks like it could work fine depending on the contents of test.txt. Could you post the contents of that file?

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

Hello @Krishna Reddy Malem,

The error message "aggregate-address x.x.0$" suggests that there might be an issue with how the command is being interpreted. The '$' character is indicative of an incomplete command.

In your code, you are splitting the commands by '\n' (newline), which is a common way to separate commands. Make sure there are no extra characters or typos that might be causing issues with the splitting.

Also, ensure that the template is rendering correctly with the actual values for 'x.x.0.0/17'. You should verify that the template is correctly substituting the IP prefix.

Proposal:

import netmiko

try:
device = netmiko.ConnectHandler(device_type='cisco_xr', ip='x.x.x.x', username='xxxxx', password='xxxxx')

path = "./test.txt"

with open(path) as file:
config_set = file.read().splitlines()

with device as conn:
output = conn.send_config_set(config_set)

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.
Review Cisco Networking for a $25 gift card