1. Cannot iterate over interfaces on a network in FABlib v1.9.0

Cannot iterate over interfaces on a network in FABlib v1.9.0

Home Forums FABRIC General Questions and Discussion Cannot iterate over interfaces on a network in FABlib v1.9.0

Tagged: , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8783
    Peter Willis
    Participant

      The following code and FabLib calls worked in v1.8.0:

      
      for network in slice.get_networks():
      print("NETWORK:")
      print(f"\t{network}")
      for intf in network.get_interfaces():
      print("INTERFACES:")
      print(f"\t{intf}")
      

      But, when running in v1.9.0, intf is always a blank list. If you grab the interfaces directly (get_interfaces()), it works fine. I haven’t dug into the source code on GitHub yet, but I figured I’d ask first to see if I’m working with deprecated functions or something like that.

      • This topic was modified 2 days, 18 hours ago by Peter Willis.
      #8785
      Komal Thareja
      Moderator

        Hi Peter,

        Possibly a bug, however, I tried doing this with my existing slice and it seems to work.

        Is there a specific sequence in which you are running this code? Just trying to reproduce this on my end.

        Code Snippet of my trials:

        
        from fabrictestbed_extensions.fablib.fablib import FablibManager as fablib_manager
        from ipaddress import ip_address, IPv4Address, IPv6Address, IPv4Network, IPv6Network
        fablib = fablib_manager()
        slice = fablib.get_slice(slice_name)
        for nw in slice.get_networks():
        print(nw)
        for ifc in slice.get_interfaces():
        print(ifc)
        

        Thanks,

        Komal

         

        P.S: we did roll out some improvements w.r.t to how often the interfaces are updated to limit the number of ssh connections.

        #8787
        Peter Willis
        Participant

          In my case, it’s specifically when iterating over the interfaces on a given network, so slice.get_interfaces() works fine, but nw.get_interfaces() and using that to iterate over the interfaces of nw would not work.

          #8788
          Nirmala Shenoy
          Participant

            hello Komal,

            we are configuring IP addresses in an OSPF network. so the link that is common to a pair of nodes is given the same network address.

            I tried the script with f

            for ifc in slice.get_interfaces():

            the addressing assignment is going wrong.

            can you please suggest how we can fix this?

             

            thanks

             

            #8789
            Komal Thareja
            Participant

              Hi Nirmala,

              Could you please try using the fablib from this branch: https://github.com/fabric-testbed/fabrictestbed-extensions/tree/rel1.9.1 ?

              nw.get_interfaces() should work now.

              I plan to push this main branch Monday. I’ll keep you posted.

              Please let me know if this resolves the issue.

              Thanks,

              Komal

              1 user thanked author for this post.
              #8790
              Peter Willis
              Participant

                I gave it a try and then went back to 1.9.0 to double-check. It is working as intended in 1.9.1. Thank you!

                #8791
                Nirmala Shenoy
                Participant

                  thanks a lot Komal. peter checked it and looks like it worked. I will be trying it now .

                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.