【问题标题】:How to deploy vyatta using Rest API如何使用 Rest API 部署vyatta
【发布时间】:2019-01-31 15:50:46
【问题描述】:

我正在尝试使用 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:

有谁知道如何使用 RestAPI/CLI 部署vyatta..或者我如何查询操作系统代码和网络vlan 来部署vyatta

谢谢你, 阿尼什

【问题讨论】:

    标签: ibm-cloud ibm-cloud-infrastructure


    【解决方案1】:

    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      :
    :........................................:.......................:............:
    

    【讨论】:

    • 谢谢你的命令。你有什么类似的REST API ....................
    • 它失败并出现错误。 slcli order place --verify NETWORK_GATEWAY_APPLIANCE WASHINGTON07 OS_VYATTA_5600_5_X_UP_TO_1GBPS_SUBSCRIPTION_EDITION_64_BIT 必须在订单中指定复杂类型。我认为还有其他需要指定的参数,我尝试了一些组合,但失败并出现类似的错误。
    • 在末尾添加--complex-type SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance,这与此处的示例softlayer-python.readthedocs.io/en/latest/cli/…类似
    • 我更新了我的答案,它有一个可以用来构建订单的 REST 结构示例
    【解决方案2】:

    正如@Xiang Wang 所说,应该可以使用slcli order 命令订购。

    python和go中也有一些例子可以试试:

    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。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-05
      • 2017-09-06
      • 1970-01-01
      相关资源
      最近更新 更多