OpenIxia / IxNetwork

A central location for IxNetwork sample scripts and utilities. Please also visit http://openixia.com
MIT License
50 stars 59 forks source link

VLAN #146

Open fonsecazord23 opened 1 month ago

fonsecazord23 commented 1 month ago

I'm new to ixia. In the visual part of ixia there is a Protocols parameter and underneath DHCP Server and DHCP/PD w/Auth , and by clicking I can change the VLANs . I haven't found any way to change this using this api. Can anyone help me?

therkong commented 1 month ago

Below is ixNet LL API to set VLAN ID under DHCP Server and DHCP/PD:

from IxNetwork import IxNet ixNet = IxNet()

Connect

ixNet.connect('localhost', '-version', '10.0', '-setAttribute', 'strict')

root = ixNet.getRoot() vportList = ixNet.getList(root, 'vport') vport1 = vportList[0]

DHCP Server

ixnetwork/vport/1/protocolStack/ethernet/1/dhcpServerEndpoint/1/range/1/vlanRange/vlanIdInfo/1

ethObj = ixNet.getList(vport1+'/protocolStack', 'ethernet')[0] dhcpServerEndpointObj = ixNet.getList(ethObj, 'dhcpServerEndpoint')[0] rangeObj = ixNet.getList(dhcpServerEndpointObj, 'range')[0] vlanInfoObj = ixNet.getList(rangeObj+'/vlanRange', 'vlanIdInfo')[0] ixNet.setAttribute(vlanInfoObj, '-firstId', '99') ixNet.commit()

DHCP/PD w/Auth

ixnetwork/vport/1/protocolStack/ethernet/1/dhcpEndpoint/1/range/1/vlanRange/vlanIdInfo/1

ethObj = ixNet.getList(vport1+'/protocolStack', 'ethernet')[0] dhcpEndpointObj = ixNet.getList(ethObj, 'dhcpEndpoint')[0] rangeObj = ixNet.getList(dhcpEndpointObj, 'range')[0] vlanInfoObj = ixNet.getList(rangeObj+'/vlanRange', 'vlanIdInfo')[0] ixNet.setAttribute(vlanInfoObj, '-firstId', '120') ixNet.commit()