Skip to content
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

interface(loopback): add check for same ipv4_address_secondary #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alagoutte
Copy link

When using the following code and repeat twice, the second time (like for ansible with idempotent) you get an 500 error

Ran into exception: 'GENERIC OPERATION ERROR: Internal service error.\n: Code: 500'. Closing session.

import urllib3
from pyaoscx.session import Session
from pyaoscx.pyaoscx_factory import PyaoscxFactory
from pyaoscx.vlan import Vlan
from pyaoscx.interface import Interface
from pyaoscx.device import Device

version = "10.09"
switch_ip = "10.200.11.147"

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
s = Session(switch_ip, version)
s.open("admin", "MyPassword")

try:
    device = Device(s)
    
    ipv4 = ["10.23.23.1/24", "10.123.23.1/24"]

    #print("ipv4 {0}".format(ipv4))
    loopback_interface = device.interface("loopback23")
    loopback_interface.configure_loopback(
                ipv4=ipv4,
                vrf = None
    )
except Exception as error:
    print("Ran into exception: {0}. Closing session.".format(error))

finally:
    s.close()

add simple check for don't append with same ip the ipv4_secondary attribut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant