cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1797
Views
0
Helpful
2
Replies

SG350 -28 SNMP Creat VLAN (VB.Net)

o0oinsomniao0o
Level 1
Level 1

Hello,

I can creat VLAN with below function, wenn i use SG300-28.

But wenn i use SG350-28, i receive ErrorStatus: 8 Error Index: 3

8

wrongLength

A variable binding specifies a length incorrect for the object.

{SnmpV2Packet:
Community: config
PDU-Response
RequestId: 18481428
ErrorStatus: 8
Error Index: 3
VbList entries: 5
Vb: 1.3.6.1.2.1.17.7.1.4.3.1.5.5: (Integer32) 4
Vb: 1.3.6.1.2.1.17.7.1.4.3.1.1.5: (OctetString) VLAN5
Vb: 1.3.6.1.2.1.17.7.1.4.3.1.2.5: (OctetString) 00 00 00 00 00 00 08 00 00 00 00
Vb: 1.3.6.1.2.1.17.7.1.4.3.1.3.5: (OctetString) 00 00 00 00 00 00 00 00 00 00 00
Vb: 1.3.6.1.2.1.17.7.1.4.3.1.4.5: (OctetString) 00 00 00 00 00 00 08 00 00 00 00
}

 

Sub Create(VLANNr As Integer)
        ' Prepare target
        Dim target = New UdpTarget(New SnmpSharpNet.IpAddress("192.168.0.238"), 161, 1000, 0)
        ' Create a SET PDU
        Dim pdu = New Pdu(PduType.Set)
        '
        Dim buf As Byte() = New Byte() {&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0}
        Dim test As OctetString = New OctetString(buf, True)
        Select Case VLANNr
            Case 5
                buf(6) = &H8
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.5.5"), New Integer32(4))
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.1.5"), New OctetString("VLAN5"))
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.2.5"), test)
                buf(6) = &H0
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.3.5"), test)
                buf(6) = &H8
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.4.5"), test)
                '###################################################################################
            Case 6
                buf(6) = &H4
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.5.6"), New Integer32(4))
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.1.6"), New OctetString("VLAN6"))
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.2.6"), test)
                buf(6) = &H0
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.3.6"), test)
                buf(6) = &H4
                pdu.VbList.Add(New Oid("1.3.6.1.2.1.17.7.1.4.3.1.4.6"), test)
                '###################################################################################
            Case Else
        End Select

 ' Set Agent security parameters
        Dim aparam = New AgentParameters(SnmpVersion.Ver2, New OctetString("config"))
        ' Response packet
        Dim response As SnmpV2Packet
        Try
            ' Send request and wait for response
            response = target.Request(pdu, aparam)
        Catch ex As Exception
            ' If exception happens, it will be returned here
            Console.WriteLine(String.Format("Exception: {0}", ex.Message))
            target.Close()
            Return
        End Try
        ' Make sure we received a response
        If response Is Nothing Then
            Console.WriteLine("Error in sending SNMP request.")
        Else
            ' Check if we received an SNMP error from the agent
            If response.Pdu.ErrorStatus <> 0 Then
                Console.WriteLine(String.Format("SNMP agent returned ErrorStatus {0} on index {1}", response.Pdu.ErrorStatus, response.Pdu.ErrorIndex))
            Else
                ' Everything is ok. Agent will return the new value for the OID we changed
                Console.WriteLine(String.Format("Agent response {0}: {1}", response.Pdu(0).Oid.ToString(), response.Pdu(0).Value.ToString()))
            End If
        End If
        target.Close()
    End Sub

 

2 Replies 2

BroxiNagil
Level 1
Level 1

I have a similar Problem using the OID's o0oinsomniao0o mentioned (.1.3.6.1.2.1.17.7.1.4.3.1.2 and 4). As with any other Switches from HP, Enterasys and as well cisco SG300 it is possible to even get the VLAN-assignment as well to set the VLAN on ports using given OID's, it is not possible on SG350. 

 

Edit: this is seen on firmware 2.4.0.94 as well on 2.4.5.71

Additional Info:
on SG300 assigning a VLAN via CLI works with: switchport trunk allowed vlan add 123
on SG350 the command is executed without errors, but is not visible in the config (either running nor startup) and as well it does not change anything if you review the VLAN settings via Web-Ui