我正在使用API从Network Gateway vsrx取消关联特定的VLAN [路由的VLAN ID 2634795]
func(r Network_Gateway_Vlan)DeleteObjects(templateObjects [] datatypes.Network_Gateway_Vlan)(resp bool,err错误)
然后我立即使用API将多个VLAN关联在一起,这些VLAN也包括[VLAN ID 2634795路由通过]到网络网关vsrx
func(r Network_Gateway_Vlan)CreateObjects(templateObjects []数据类型。Network_Gateway_Vlan)(resp []数据类型。Network_Gateway_Vlan,错误,错误)
有时我会出错
无法创建关联:\ n-\ nSoftLayer_Exception_Public:VLAN ID 2634795是网关的内部VLAN
答案 0 :(得分:0)
尝试使用以下REST调用示例:
解除关联VLAN:
方法:开机自检
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Network_Gateway_Vlan/deleteObjects
身体:杰森
{"parameters": [
[
{
"id":11111
}
]
]}
为您的insideVlan ID更改“ 11111”数据。
要在虚拟局域网中获取网关,可以使用以下rest调用:
方法:GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Network_Gateway/[networkGatewayId]/getObject?objectMask=mask[insideVlans[networkVlan]]
输出:
{
"accountId": 302354,
"id": 25465,
"insideVlans": [
{
"id": 11111,
"networkGatewayId": 3321548,
"networkVlanId": 412451,
"networkGateway": {
"accountId": 302354,
"id": 24587
}
} ]
}
关联Vlan
方法:开机自检
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Network_Gateway_Vlan/createObject
身体:杰森
{"parameters":[
{
"bypassFlag":true,
"networkGatewayId":22222,
"networkVlanId":33333
}
]
}
更改networkGatewayId和networkVlanId的“ 22222”和“ 33333”数据。
要获取可能的内部vlans(networkVlanId)关联至网关,可以使用以下rest api调用:
方法:GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Gateway/[networkGatewayId]/getPossibleInsideVlans?objectMask=mask[networkSpace]
输出:
[
{
"accountId": 31214,
"id": 33333,
"modifyDate": "2018-09-28T21:32:16+08:00",
"name": "test-ams01",
"primarySubnetId": 54547,
"vlanNumber": 1454,
"networkSpace": "PUBLIC"
}
]