我尝试使用softlayer api来获取/删除/添加trunk。 http://sldn.softlayer.com/reference/services/SoftLayer_Network_Component用于VLAN Trunk的Softlayer API
我们的baremetal已经被软件票树干了。我们希望先移除后备箱。然后添加主干。
我们可以使用baremetal uplinkComponent ID获取NetworkNetworkVlanTrunks。 client['SoftLayer_Network_Component'].getNetworkVlanTrunks(id=networkcomponentId)
这里就是让干线的输出:
[{'networkComponentId': <networkcomponentId>, 'networkVlanId': <vlanid-1>}, {'networkComponentId': <networkcomponentId>, 'networkVlanId': <vlanid-2>}]
现在,我们要删除的VLAN-ID-2的树干。
vlan = client['Network_Vlan'].getObject(id=<vlanid-2>) client['SoftLayer_Network_Component'].removeNetworkVlanTrunks([vlan], id=networkcomponentId)
然而,我们得到这个错误时removeNetworkVlanTrunks:
File "/usr/lib64/python2.7/site-packages/SoftLayer/transports.py", line 187, in __call__ raise _ex(ex.faultCode, ex.faultString) SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_InternalError): An internal system error has occurred.
有谁知道这是如何发生的呢? 我们是否使用正确的networkComponentID进行删除? 有谁知道如何使用addNetworkVlanTrunks?
您应该更加小心代码格式,请参阅http://stackoverflow.com/editing-help#comment-formatting –