示例:使用REST API创建使用端口的VLAN
此示例显示在IP地址的开关上创建以下VLAN和端口配置192.0.2.5:
VLAN 2没有关闭接口VLAN 2
创建VLAN。
$curl -noproxy 192.0.2.5 -k -x post \ -b /tmp /auth_cookie -d'{...“ name”:“ vlan2”,“ id”:2,“ type”:“ type”:“ static”,“ admin”,“ admin””:“ up” ...}'\“ https://192.0.2.5/rest/v1/system/vlans”
创建端口并配置VLAN信息。
$curl -noproxy 192.0.2.5 -k -k -x post \ -b/tmp/auth_cookie -d'{...“ name”:“ 1/1/2”,“ admin”,“ admin”:“ up”,“ interfaces”,“ interfaces”:[“/rets/v1/system/interfaces/1%2f1%2f2”],“ vlan_mode”:“ access”,“ vlan_tag”:“/rest/rest/v1/v1/v1/vlans/vlans/vlans/2”,“路由”:false。..}'\ -d-“ https://192.0.2.5/rest/v1/system/ports”