如何使用REST API来部署Vyatta的

问题描述 投票:0回答:2

我试图使用REST API的一个SoftLayer的环境中部署Vyatta的,并希望它是如何实现的一些线索。我没有看到一个Python客户端做到这一点,但我们不能请使用选项,即Python的/ PHP / JAVA,并有专门只使用REST API的网络设备部署到SoftLayer的基础设施。

我尝试使用CLI,但它不会查询操作系统代码。


slcli virtual create
Hostname: test
Domain: test.com
Datacenter: dal09
Operating System Code:

是否任何一个知道如何使用REST API / CLI..Or我怎么可以查询操作系统代码和网络的VLAN部署Vyatta的部署Vyatta的

谢谢你,阿尼什

ibm-cloud ibm-cloud-infrastructure
2个回答
2
投票

https://softlayer-python.readthedocs.io/en/latest/cli/ordering.html

要使用slcli客户下订单,可以参考上面的文档。

不过这里是专门为订购Vyatta的网关设备的例子:

$ slcli order package-list | grep -i gateway
Network Gateway Appliance                                               NETWORK_GATEWAY_APPLIANCE                               BARE_METAL_GATEWAY                                  
Network Gateway Appliance Cluster                                       NETWORK_GATEWAY_APPLIANCE_CLUSTER                       GATEWAY_RESOURCE_GROUP                              
Network Gateway Appliance (10 Gbps)                                     2U_NETWORK_GATEWAY_APPLIANCE_1O_GBPS                    BARE_METAL_GATEWAY                                  
Virtual Router Appliance                                                VIRTUAL_ROUTER_APPLIANCE_1_GPBS                         BARE_METAL_GATEWAY                                  
Virtual Router Appliance (10 Gpbs)                                      VIRTUAL_ROUTER_APPLIANCE_10_GPBS                        BARE_METAL_GATEWAY
$ slcli order package-locations  NETWORK_GATEWAY_APPLIANCE 
:.........:.......:........................:...............:
:    id   :   dc  :      description       :    keyName    :
:.........:.......:........................:...............:
:  265592 : ams01 :   AMS01 - Amsterdam    :   AMSTERDAM   :
...
...
:  814994 : ams03 :   AMS03 - Amsterdam    :  AMSTERDAM03  :
$ slcli order item-list NETWORK_GATEWAY_APPLIANCE | grep -i vyatta
os                     OS_VYATTA_6_X_SUBSCRIPTION_EDITION_64_BIT                                 Vyatta 6.x Subscription Edition (64 bit)                                    
os                     OS_VYATTA_5600_5_X_UP_TO_1GBPS_SUBSCRIPTION_EDITION_64_BIT                Virtual Router Appliance 5.x (up to 2 Gbps) Subscription Edition (64 Bit)
$ slcli order place --verify NETWORK_GATEWAY_APPLIANCE WASHINGTON07 OS_VYATTA_5600_5_X_UP_TO_1GBPS_SUBSCRIPTION_EDITION_64_BIT ...

上面的命令是如何验证Vyatta的裁定的例子。根据不同的味道,你想订购,该命令可能会有所不同。您将需要指定,在命令中,要求每个类别如下图所示的表格。一旦您满意的命令,你可以删除--verify,它将把实际的订单。

$ slcli order category-list NETWORK_GATEWAY_APPLIANCE
:........................................:.......................:............:
:                  name                  :      categoryCode     : isRequired :
:........................................:.......................:............:
:                 Server                 :         server        :     Y      :
:               Surcharges               :        premium        :     N      :
:            Operating System            :           os          :     Y      :
:                  RAM                   :          ram          :     Y      :
:            Disk Controller             :    disk_controller    :     Y      :
:            First Hard Drive            :         disk0         :     Y      :
:           Second Hard Drive            :         disk1         :     N      :
:            Third Hard Drive            :         disk2         :     N      :
:             SRIOV Enabled              :     sriov_enabled     :     Y      :
:           Fourth Hard Drive            :         disk3         :     N      :
:            Public Bandwidth            :       bandwidth       :     Y      :
:           Uplink Port Speeds           :       port_speed      :     Y      :
:           Remote Management            :   remote_management   :     Y      :
:          Primary IP Addresses          :    pri_ip_addresses   :     Y      :
:         Primary IPv6 Addresses         :   pri_ipv6_addresses  :     Y      :
:               Monitoring               :       monitoring      :     Y      :
:              Notification              :      notification     :     Y      :
:                Response                :        response       :     Y      :
:    VPN Management - Private Network    :     vpn_management    :     Y      :
: Vulnerability Assessments & Management : vulnerability_scanner :     Y      :
:........................................:.......................:............:

1
投票

作为@Xiang Wang评论,应该可以订购使用slcli order命令。

也有一些Python的例子,去,你可以尝试:

https://softlayer.github.io/python/orderVyatta/

https://softlayer.github.io/python/order_vyatta.py/

https://softlayer.github.io/go/order_vyatta_gateway.go/

休息

以下是JSON结构,你可以用它来建立秩序的样本,考虑到价格可能因包装和位置的变化,也有一些人可能有冲突。

要检索的价格列表,你可以使用getItemsgetItemPrices

使用placeOrder代替verifyOrder当你准备点菜。

POST:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

PAYLOAD:

{
    "parameters": [{
        "orderContainers": [{
            "complexType": "SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance",
            "hardware": [
                {
                    "hostname": "gateway",
                    "domain": "softlayer.com"
                }
            ],
            "quantity": 1,
            "location": "AMSTERDAM",
            "packageId": 1055,
            "prices": [
                {
                    "id": 206251,
                    "item": { "description": "Single Intel Xeon E3-1270 v6 (4 Cores, 3.80 GHz)" }
                }, 
                {
                    "id": 209453,
                    "item": { "description": "16 GB RAM" }
                }, 
                {
                    "id": 201199,
                    "item": { "description": "Virtual Router Appliance 5.x (up to 2 Gbps) Subscription Edition (64 Bit)" }
                }, 
                {
                    "id": 32927,
                    "item": { "description": "Non-RAID" }
                }, 
                {
                    "id": 83483,
                    "item": { "description": "2.00 TB SATA" }
                }, 
                {
                    "id": 33867,
                    "item": { "description": "20000 GB Bandwidth Allotment" }
                }, 
                {
                    "id": 96817,
                    "item": { "description": "1 Gbps Public & Private Network Uplinks" }
                }, 
                {
                    "id": 80263,
                    "item": { "description": "Host Ping and TCP Service Monitoring" }
                }, 
                {
                    "id": 32627,
                    "item": { "description": "Automated Notification" }
                }, 
                {
                    "id": 35310,
                    "item": { "description": "Nessus Vulnerability Assessment & Reporting" }
                }, 
                {
                    "id": 32500,
                    "item": { "description": "Email and Ticket" }
                }, 
                {
                    "id": 25014,
                    "item": { "description": "Reboot / KVM over IP" }
                }, 
                {
                    "id": 212715,
                    "item": { "description": "SRIOV Enabled" }
                }, 
                {
                    "id": 34807,
                    "item": { "description": "1 IP Address" }
                }, 
                {
                    "id": 33483,
                    "item": { "description": "Unlimited SSL VPN Users & 1 PPTP VPN User per account" }
                }
            ]
        }]
    }]
}

如果你想要一个高可用性设备(HA),那么你需要指定在hardware参数两个硬件对象和数量必须为2。

© www.soinside.com 2019 - 2024. All rights reserved.