订购Softlayer Vlan对 [英] Ordering Softlayer Vlan pairs

查看:29
本文介绍了订购Softlayer Vlan对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经对stackoverflow进行了一些搜索,并查看了API,但似乎找不到具体的答案. 我正在用python创建一些自动化脚本,并且想知道是否有一种方法可以根据位置来获取primaryNetworkComponentprimaryBackendNetworkComponent对.有getVlans()方法,但是除非我去gui,否则不确定哪些VLAN一起使用. VLAN对上的计算机数量没有限制吗?如果没有的话,抢路由器并只接受前两个VLAN是可以接受的吗?

I've done some searching on stackoverflow and looked through the API but can't seem to find an answer specifically. I'm creating some automation scripts in python and wondering if there's a way to grab the primaryNetworkComponent and the primaryBackendNetworkComponent pairs and based on location? There's the getVlans() method but not sure which vlans go together unless i go to the gui. Is there no limit to the number of machines that can be on a vlan pair? if there isn't would it just be acceptable to grab the router and just take the first 2 vlans?

推荐答案

我成功使用了以下脚本:

I have success with the following script:

"""
List Hardware

Important manual pages:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Hardware
https://github.com/softlayer/softlayer-python/blob/master/SoftLayer/managers/hardware.py

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

# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'

# Declare the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
mgr = SoftLayer.HardwareManager(client)

globalIdentifier = '93e99548-bb97-4a18-b728-9c8ebba6s9e3'

try:
    mask = 'id, hostname, domain, hardwareStatus, globalIdentifier, remoteManagementAccounts, primaryBackendIpAddress, primaryIpAddress'
    hardware_list = mgr.list_hardware(mask=mask)
    for hardware in hardware_list:
        if globalIdentifier == hardware['globalIdentifier']:
            print(hardware['globalIdentifier'])

except SoftLayer.SoftLayerAPIError as e:
    print("Error. "
          % (e.faultCode, e.faultString))

是的,全局标识符是在订单收据中生成的,但是它们会附加到服务器上,直到供应过程完成为止.因此,有必要等到服务器的供应过程完成后再进行搜索.

You are right, the global identifiers are generated in the order receipt, but they are attached to the servers until the provision proccess finish. So, it's necessary to wait until the provision process from a server finishes, to search by this.

这篇关于订购Softlayer Vlan对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆