| 264 | === The battle continues (8/22) === |
| 265 | The NEC MIB manual revealed that while traditionally read-write, dot1q family of OIDs are made non-writable for the IP8800. |
| 266 | * NEC's big refrence guide of MIBs (in Japanese) : http://www.nec.co.jp/ip88n/s36_sw/html/mibref/index.html |
| 267 | * 2.13.5 - qBridgeMIB (VLANs) |
| 268 | So instead, using Telnet to change values in a gorier way |
| 269 | * Ruby Telnet : http://www.ruby-doc.org/stdlib/libdoc/net/telnet/rdoc/index.html |
| 270 | The following code bit creates a ruby telnet object, which essentially logs in and reconfigures port vlan assignments (I am particularily impressed/irked by the way I can now recall commands without even sitting in front of the CLI) |
| 271 | |
| 272 | {{{ |
| 273 | def set_port_vlan(port, vlan) |
| 274 | #sets port VLAN. For NEC switches whose port-vlans can't be set using dot1qPvid SNMP value. |
| 275 | sw = Net::Telnet::new("Host" => "172.16.100.10","Timeout"=> 10,"Prompt" => /[$%#>] \z/n) |
| 276 | sw.login("operator") |
| 277 | sw.cmd("enable") |
| 278 | sw.cmd("configure") { |c| print c } |
| 279 | sw.cmd("interface gigabitethernet"+" "+"#{port}") { |c| print c } |
| 280 | puts "changing port vlan value" |
| 281 | sw.cmd("switchport access vlan"+" "+"#{vlan}") { |c| print c } |
| 282 | #sleep(1) |
| 283 | sw.cmd("save") |
| 284 | sw.cmd("exit") {|c| print c} |
| 285 | sw.cmd("exit") {|c| print c} |
| 286 | sw.cmd("exit") {|c| print c} |
| 287 | end |
| 288 | }}} |
| 289 | |