Hello again,
I found a MIB Companion guide for a 3Com 4500G switch that apparently covered the MIBs in question and it solved my problem! It told me that there were a few conditionals on writing to the OIDs I was trying to write to. For the big hex string, they come in a group of four: hwifHybridUnTaggedVlanListLow hwifHybridUnTaggedVlanListHigh hwifHybridTaggedVlanListLow hwifHybridTaggedVlanListHigh
And they all need to be set with the same snmpset command. That is only to change VLAN on hybrid (or trunk ports), there is another hex string per VLAN that is which ports that the VLAN is on, it only allows you to change it on untagged ports set to access mode.
So, to change a port from an access port to a trunk port, you need to modify multiple variables. First, you need to set the: A3COM-HUAWEI-LswINF-MIB::hwifVLANType.28 = hybrid (3) After which you need to know the IDs of all VLANs. Then you need to set the four big hex strings in one set with each bit corresponding to the VLAN in question. I've also figured out how to create and remove VLANs, which for once seemed rather straight forward.
How much of this functionality is possible to control with PortAdmin right now? :)
// MVH Mikael K.
************************************ Webhallen Sverige AB Svetsarvägen 10B 171 41 Solna Tel: 08 - 673 60 00 Fax: 08 - 650 00 30 Sida: www.webhallen.com Mail: mikael@webhallen.com ************************************
On 09/08/2011 06:01 PM, Mikael Knutsson wrote:
Thanks. I took a look at the code and tried playing around a little with the OIDs that you are using for VLANs on standard boxes, I'm still getting inconsistentValue errors though, like this:
mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch1.3.6.1.2.1.17.7.1.4.5.1.1.28 u 2 Error in packet. Reason: inconsistentValue (The set value is illegal or unsupported in some way) Failed object: .1.3.6.1.2.1.17.7.1.4.5.1.1.28 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch1.3.6.1.2.1.17.7.1.4.5.1.1.28 i 2 Error in packet. Reason: wrongType (The set datatype does not match the data type the agent expects) Failed object: .1.3.6.1.2.1.17.7.1.4.5.1.1.28 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch1.3.6.1.2.1.17.7.1.4.5.1.1.28 x "02" Error in packet. Reason: wrongType (The set datatype does not match the data type the agent expects) Failed object: .1.3.6.1.2.1.17.7.1.4.5.1.1.28
I tried hex string just to see if I still got wrongType. The OIDs I've found on the switch are very.. obscure, it would seem. They look like this:
A3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 = Hex-STRING: 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
And when I try setting them, I'm getting this:
mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch A3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 x "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" Error in packet. Reason: inconsistentValue (The set value is illegal or unsupported in some way) Failed object: .1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitchA3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 x "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" Error in packet. Reason: inconsistentValue (The set value is illegal or unsupported in some way) Failed object: .1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitchA3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 x "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" A3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24: Value out of range (Bad string length :: {(0..256)}) mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitchA3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 i 0 A3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24: Bad variable type (Type of attribute is OCTET STRING, not INTEGER) mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitchA3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 u 0 A3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24: Bad variable type (Type of attribute is OCTET STRING, not Unsigned32) mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitchA3COM-HUAWEI-LswINF-MIB::hwifHybridUnTaggedVlanListHigh.24 = 0 Error in packet. Reason: inconsistentValue (The set value is illegal or unsupported in some way) Failed object: .1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 u 0 Error in packet. Reason: wrongType (The set datatype does not match the data type the agent expects) Failed object: .1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 mikael@mikn:/var/lib/mibs/ietf$ snmpset -On -v2c -cprivate testswitch1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24 i 0 Error in packet. Reason: wrongType (The set datatype does not match the data type the agent expects) Failed object: .1.3.6.1.4.1.43.45.1.2.23.1.1.3.1.5.24
The second one is the one that is supposed to be 'correct' and I'm just trying to set the OID to the same as the value before. There are a couple of other private OIDs connected to VLANs, one that is per VLAN with a hex string that you set to which ports are allowed which is only six hex groups long.
Do you have any idea what I might be doing wrong? // MVH Mikael K.
Webhallen Sverige AB Svetsarvägen 10B 171 41 Solna Tel: 08 - 673 60 00 Fax: 08 - 650 00 30 Sida:www.webhallen.com Mail:mikael@webhallen.com
On 09/08/2011 12:32 PM, trond kandal wrote:
On Sep 8, 2011, at 11:08 AM, Mikael Knutsson wrote:
Hello,
Hello, again
Yes, that is the primary thing. But also for identifying which VLAN is on which port and what VLANs are available on the status page for the switch. I'm not sure that is the PortAdmin module?
No, that information is not coming from PortAdmin and I have not written that code and I am afraid I cannot help You much with that particular code. Sorry.
Still I would advice You to take a look at the snmp-code for PortAdmin. I think it will give You some ideas how You could do this.
You will find the code in: python/nav/portadmin/snmputils.py
I am however as stated having some problems with writing to the VLAN OIDs as stated, I'm getting inconsistentValue returned no matter what I try, it feels like. I'm not sure what I'm doing wrong and if someone seasoned with SNMP could help me out with how to track down the error, that would be greatly appreciated!
I am not quite sure if I understand,- but I guess You are talking about the confusion regarding what value-type to use when writing back to the equipment. Some take an unsigned integer and some don't. A VLAN is a positive integer and in most cases you would use an unsigned integer. If You take a look at the code, You will see that we in some cases try both.
If You also want to change VLAN on a port You must also remember to remove the port from the VLAN You are moving away from.
Is this of any help to You?
Sincerely
Trond.