Aruba & ProVision-based
1753629 Members
5711 Online
108797 Solutions
New Discussion

Automating VLAN port assignment via SNMP or PEXPECT?

 
TonyStocker
Occasional Contributor

Automating VLAN port assignment via SNMP or PEXPECT?

 

I have a ProCurve switch (8212) with nine modules (all 24-port 1 Gb/s RJ45) (Software revesion: K.15.06.0017, ROM version K.15.29) which supports several clusters.  We would like to automate the assignment of ports to VLAN's without requiring a human to manually login and assign ports.  This primarily occurs when we want to assign host duties to a different node using high-availability software.

 

I have tried to use Expect/Pexpect to interact with the switch, but based on the log output from Pexpect it appears that something that can be done manually, only generates scores of control characters which Pexpect can't deal with - since it doesn't match the human readable output when done manually.

 

The other option I can see is perhaps using 'snmpset' to assign the correct port to the correct VLAN.  But I can't find any information on this - only tangentally related questions from others.

 

So how can I programatically (as opposed to manually logging into the switch) assign, for example, Port A23 to VLAN 301?

3 REPLIES 3
paulgear
Esteemed Contributor

Re: Automating VLAN port assignment via SNMP or PEXPECT?

Hi Tony,

If you use RANCID (http://www.shrubbery.net/rancid/) and set your switch type correctly, you should be able to use an hlogin script for such tasks.

I created some scripts to do this from flat text files that i could probably dig up if you need some pointers.
Regards,
Paul
TonyStocker
Occasional Contributor

Re: Automating VLAN port assignment via SNMP or PEXPECT?

Paul,

 

I'd be interested in any sample scripts that you have that show doing something similar to what I'm trying to do, i.e. change VLAN port assignments.

 

I looked at RANCID but it appeared to mainly be used for gathering information from a switch, not setting information on it. If I can't find a way to do this with SNMP or pexpect, I may have no choice but to try that route and, after spending a lot of time learning a whole new package & syntax, hope that it works for this issue.

 

I'm still surprised/perplexed that the HP switches produce non-standard responses such that pexpect scripts won't work with them.

 

I'd also still like any information anyone could give me on how to do what I want using SNMP with the switch since this would obviate the need to install a separate software package (i.e. RANCID) solely for the purposes of accessing a single switch, given that we already have SNMP and pexpect on the system.

 

Tony

paulgear
Esteemed Contributor

Re: Automating VLAN port assignment via SNMP or PEXPECT?

Hi Tony,

 

Here's the code: https://github.com/paulgear/procurve-rancid  (Insert standard disclaimers here.)

 

I haven't seen a lot of environments which used SNMP writes to do similar things.  I'm sure many things are possible to do that way, but i'll have to leave that to others with more SNMP expertise.

Regards,
Paul