ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Scripting changing VLANs on Managed Switches through SSH

    Scheduled Pinned Locked Moved IT Discussion
    8 Posts 2 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • FiyaFlyF
      FiyaFly
      last edited by FiyaFly

      I'm looking to script changing a port's vlan on a managed switch through SSH. We have over 500 switches and these VLANs change. A lot. Basically I'm expecting to have to put together tables of these switches, what brand they are, what VLANs they use, and what to do. What scripting language would you guys recommend? I need something that can read information from external tables and run some commands through SSH, put simply.

      1 Reply Last reply Reply Quote 1
      • scottalanmillerS
        scottalanmiller
        last edited by

        From a really high level... anything will do this. So your choices are pretty broad. Even BASH can pull this off, but would suck so don't use that. PowerShell will obviously do it, too.

        But if this were my project I would probably limit myself to Python or Ruby. If you already know one or the other, use that. If not, I'd pick Python because it is the most broadly known and one of its key advantages is how simple it tends to be to be maintained and read by multiple people. Especially if you are in administration, not software engineering.

        Perl, PHP and lots of other languages will work fine, too. But without any other factors, Python would be where I would look first.

        1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller
          last edited by

          For this you might just want to use CSV which makes things easy enough that you can edit the data files by hand. No need for a database. If you feel that a database is necessary (why?) then BDB or SQLite are likely what you want.

          1 Reply Last reply Reply Quote 0
          • FiyaFlyF
            FiyaFly
            last edited by

            I do not see a database as necessary. At this point most of the idea is conceptual. Just looking to gain some direction. I am already familiar with Python and that was what I was thinking from the start, I just wasn't certain it would fully handle it. I know there's a module for python to access SSH but I haven't played with it.

            The only argument I might see for a database is the massive amount of data that would need to be stored and referenced. The second part of this project may come into documenting changes automatically, but that's an entirely different project at this point.

            scottalanmillerS 2 Replies Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller @FiyaFly
              last edited by

              @FiyaFly said in Scripting changing VLANs on Managed Switches through SSH:

              The only argument I might see for a database is the massive amount of data that would need to be stored and referenced. The second part of this project may come into documenting changes automatically, but that's an entirely different project at this point.

              Does the amount of data really make a difference? A CSV is a database, too. It's the type of data, not the amount, that determines the usefulness of database types.

              1 Reply Last reply Reply Quote 1
              • scottalanmillerS
                scottalanmiller @FiyaFly
                last edited by

                @FiyaFly said in Scripting changing VLANs on Managed Switches through SSH:

                I do not see a database as necessary. At this point most of the idea is conceptual. Just looking to gain some direction. I am already familiar with Python and that was what I was thinking from the start, I just wasn't certain it would fully handle it. I know there's a module for python to access SSH but I haven't played with it.

                Python is a full language, it can do anything except make a pure operating system that runs on bare metal as it cannot be compiled which is necessary only in that one use case. As long as you are not writing your own OS (or are willing to make an OS with a thin Python layer to bootstrap Python) you can use Python no matter what you are doing.

                1 Reply Last reply Reply Quote 0
                • FiyaFlyF
                  FiyaFly
                  last edited by

                  Can you think of an easy way to get the information from the switches as to current configuration in an automated manner to create and update the tables accordingly? SNMP is an option but I'd have to think on the best way to output and parse the information.

                  scottalanmillerS 1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @FiyaFly
                    last edited by

                    @FiyaFly said in Scripting changing VLANs on Managed Switches through SSH:

                    Can you think of an easy way to get the information from the switches as to current configuration in an automated manner to create and update the tables accordingly? SNMP is an option but I'd have to think on the best way to output and parse the information.

                    SNMP should be available via a pre-parsed module in Python, I would assume. Not something that I have written myself (obviously not the module, but I've not written something that uses the module) but I would be pretty surprised if this didn't already exist in such a way that you just have to query the resulting array rather than needing to parse a text dump.

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • First post
                      Last post