对trunk vlan的SoftLayer API调用失败

时间:2016-07-22 02:41:30

标签: ibm-cloud-infrastructure

以下api调用不会返回错误并且似乎有效,但vlan实际上并没有被中断。相反,我们必须手动联系SoftLayer并让他们将vlan中继到指定的设备。

这是api调用,在Python中,尽管它应该与其他语言类似:

:price

可悲的是,SoftLayer无法通过其内部票务系统研究或解决这个问题。相反,他们告诉我们在这里发布这个问题,因为这显然是他们的" api专家"出去玩。

有没有人能够分享与此api通话相关的见解?

1 个答案:

答案 0 :(得分:0)

您用来添加networkVlanTrunks的api调用正常。

如果您想检查 vlan中继是否已成功添加,则应检查上行链路组件及其 networkVlanTrunks ,如这个链接:SoftLayer_Network_Component::addNetworkVlanTrunks

尝试以下python脚本:

"""
This script Retrieve the network component linking this object to parent and
their network vlan trunks

See below references for more details.
Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Component/getUplinkComponent
http://sldn.softlayer.com/article/object-masks

@License: http://sldn.softlayer.com/article/License
@Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
from pprint import pprint as pp

# Your SoftLayer username and apiKey
user = 'set me'
api = 'set me'

# Connect to SoftLayer
client = SoftLayer.create_client_from_env(username=user, api_key=api)

# Define the network component Id
networkComponentId = 916616

# Define an object mask to get network vlan trunks
mask = 'mask[networkVlanTrunks]'

try:
    result = client['SoftLayer_Network_Component'].getUplinkComponent(mask=mask, id=networkComponentId)
    pp(result)
except SoftLayer.SoftLayerAPIError as e:
    print('Error faultCode=%s, faultString=%s'
          % (e.faultCode, e.faultString))
    exit(1)

我做了一些测试,并且验证了vlan中继线已成功添加。

我希望它有所帮助。 请让我知道任何疑问或评论。