DCIM API 文档 / 交换机 / 交换机添加
▍概述
添加交换机
▍URL
/index.php?m=api&a=switchAdd
▍请求参数
字段名 | 变量名 | 必填 | 类型 | 描述 |
---|---|---|---|---|
交换机名称 | sname | 是 | string | 交换机名称 |
交换机标签 | sname_tag | 否 | string | 交换机内部标签 |
交换机类型 | type | 否 | int | 交换机类型(1:自用公网,2:自用ipmi,3:自用内网,4:租用,5:托管,6:机柜,7:其它),默认为自用公网 |
设备类型 | device | 否 | string | 设备类型(switch:交换机,router:路由器,firewall:防火墙,other:其他),默认为交换机 |
端口数量 | portnum | 否 | int | 交换机下端口的数量 |
分配IP | ipaddress | 否 | int | 分配的IP的ID,调用(/index.php?m=api&a=getIps,传递type参数获取IP段,type允许的值:(public,client,ipmi,intranet,other),返回一个由id(IP段ID)和ipsection(IP段)组成的二维数组,传递id参数(IP段ID)到/index.php?m=api&a=getIp,返回一个由id(IP的ID)和ipaddress(IP地址)组成的二维数组) |
机柜 | cabinet | 否 | int | 所属机柜ID,调用/index.php?m=api&a=getCabinet,获取由id(机柜ID)和name(机柜名称)组成的二维数组 |
机柜物理位置 | position_u | 否 | string | 设备物理位置 |
设备具体位置 | position_style | 否 | string | 设备具体位置 |
位置大小 | u | 否 | int | 交换机占用位置大小 |
型号 | version | 否 | string | 交换机型号 |
密码 | pwd | 否 | string | 密码 |
Telnet用户名 | telnetuname | 否 | string | Telnet用户名 |
Telnet密码 | telnetpwd | 否 | string | Telnet密码 |
VLAN | vlan | 否 | string | VLAN(用 , 分隔开,例如 12,14,15,16-22) |
SNMP团体名 | snmp | 否 | string | SNMP团体名 |
脚本执行文件 | switch_sh_file | 否 | string | 脚本执行文件,调用/index.php?m=api&a=getShFile,传递参数conn(telnet,ssh)获取脚本执行文件数组 |
连接方式 | attest | 否 | string | 连接方式(telnet,ssh) |
有无用户名 | nousername | 否 | int | 交换机有无telnet用户名(0:有,1:无) |
功能支持 | features | 否 | string | 交换机支持的功能,调用/index.php?m=api&a=getShConfig,传递参数attest(连接方式)以及switch_sh_file(脚本执行文件)获取,返回一个数组(support:功能支持,用于传递给后台,supportName:支持的功能名称组成的数组,unsupportName:不支持的功能名称组成的数组) |
控制支持 | ipmi_support | 否 | string | 交换机是否支持控制(true:支持,false:不支持) |
▍请求参数
字段名 | 变量名 | 类型 | 描述 |
---|---|---|---|
状态 | status | string | success 成功 error 失败 |
交换机ID | id | int | 添加的交换机id |
信息 | msg | string | 提示信息 |