Share via


快速入門:將 Ubuntu 虛擬機的網路服務設計 (NSD) 設計為虛擬化網路功能 (VNF)

本快速入門說明如何使用 az aosm Azure CLI 擴充功能來建立及發佈基本網路服務設計。

必要條件

需要具作用中訂用帳戶的 Azure 帳戶。 如果您沒有 Azure 訂用帳戶,請依照此處 的指示開始免費 建立帳戶,再開始。

您必須遵循快速入門:將Ubuntu虛擬機 (VM) 發佈為 虛擬網絡 函式 (VNF) 中的必要條件。

建立輸入檔

建立用於發佈網路服務設計的輸入檔。 執行下列命令來產生網路服務設計 (NSD) 的輸入組態檔。

az aosm nsd generate-config

nsd-input.jsonc當您執行此命令時,會產生檔案。

注意

編輯 nsd-input.jsonc 檔案,並將它取代為範例中顯示的值。 拿掉resource_element_type設定為ArmTemplate的區段。 這是為了將基礎結構 (例如 VNet) 新增至更複雜的 NSD,本快速入門中不需要此範例。 將檔案儲存為 input-vnf-nsd.jsonc

{
  // Azure location to use when creating resources e.g uksouth
  "location": "uksouth",
  // Name of the Publisher resource you want your definition published to.
  // Will be created if it does not exist.
  "publisher_name": "ubuntu-publisher",
  // Resource group for the Publisher resource.
  // You should create this before running the publish command.
  "publisher_resource_group_name": "ubuntu-publisher-rg",
  // Name of the ACR Artifact Store resource.
  // Will be created if it does not exist.
  "acr_artifact_store_name": "ubuntu-acr",
  // Network Service Design (NSD) name. This is the collection of Network Service Design Versions. Will be created if it does not exist.
  "nsd_name": "ubuntu-nsd",
  // Version of the NSD to be created. This should be in the format A.B.C
  "nsd_version": "1.0.0",
  // Optional. Description of the Network Service Design Version (NSDV).
  "nsdv_description": "Plain ubuntu VM",
  // List of Resource Element Templates (RETs).
  // There must be at least one NF RET.
  // ArmTemplate RETs are optional. Delete if not required.
  "resource_element_templates": [
      {
        // Type of Resource Element. Either NF or ArmTemplate
        "resource_element_type": "NF",
        "properties": {
            // The name of the existing publisher for the NSD.
            "publisher": "ubuntu-publisher",
            // The resource group that the publisher is hosted in.
            "publisher_resource_group": "ubuntu-publisher-rg",
            // The name of the existing Network Function Definition Group to deploy using this NSD.
            // This will be the same as the NF name if you published your NFDV using the CLI.
            "name": "ubuntu-vm",
            // The version of the existing Network Function Definition to base this NSD on.
            // This NSD will be able to deploy any NFDV with deployment parameters compatible with this version.
            "version": "1.0.0",
            // The region that the NFDV is published to.
            "publisher_offering_location": "uksouth",
            // Type of Network Function. Valid values are 'cnf' or 'vnf'.
            "type": "vnf"
        }
    }
  ]
}
變數 描述
publisher_name 您要發佈定義之發行者資源的名稱。 如果不存在,則建立。
publisher_resource_group_name 發行者資源的資源群組。 如果不存在,則建立。
acr_artifact_store_name Azure Container Registry (ACR) 成品存放區資源的名稱。 如果不存在,則建立。
位置 建立資源時要使用的 Azure 位置。
network-functions publisher:此網路函式定義版本 (NFDV) 發行的發行者名稱。
publisher_resource_group:發行者裝載的資源群組。
name:使用此 NSD 部署的現有網路函式定義群組名稱。
version:要以此 NSD 為基礎的現有網路函式定義版本。 此 NSD 能夠部署任何與這個版本相容的部署參數的 NFDV。
publisher_offering_location:發佈NFDV的區域。
type:網路函式的類型。 有效值為 cnf 或 vnf。
nsd_name 網路服務設計組名。 網路服務設計版本的集合。 如果不存在,則建立。
nsd_version 要建立的 NSD 版本。 格式應該是 A.B.C。
nsdv_description NSDV 的描述。

建置網路服務設計 (NSD)

使用下列指令起始網路服務設計 (NSD) 的建置程式:

az aosm nsd build --config-file input-vnf-nsd.jsonc

建置程式完成之後,請檢閱下列產生的檔案,以深入瞭解 NSD 的架構和結構。

這些檔案會在名為 nsd-cli-output 的子目錄中建立:

目錄 / 檔案 描述
nsd-cli-output/artifactManifest
deploy.bicep 用來建立成品指令清單的 Bicep 範本,並填入輸入檔中的成品
nsd-cli-output/artifacts
artifacts.json 要於發佈時上傳的成品清單(影像和 ARM 範本)。 與成品指令清單相互關聯
<nf-name.bicep> 每個網路函式 (NF) RET 提供的 Bicep 範本,用於部署 NF。 當您執行發佈命令時,此範本會轉換成 ARM 範本,並上傳至成品存放區
nsd-cli-output/base
deploy.bicep Bicep 範本,用來建立此 NSD 群組中所有 NSDV 共用的發行者、記憶體帳戶和網路服務設計群組
nsd-cli-output/nsdDefinition
deploy.bicep 建立網路服務設計版本 (NSDV) 的 Bicep 範本。 此樣本包含子資源元素範本,這些範本取自 nsd-input.jsonc 檔案中定義的已發佈 NFs 或 ARM 範本(適用於基礎結構)
config-group-schema.json 此 NSDV 中所有 NF 的合併組態群組架構。 此架構會在將 NSDV 部署為站台網路服務 (SNS) 時,定義操作員在組態群組值中必須提供的輸入。
<nf-name>-mappings.json 將運算子所提供的組態群組值對應至 NSDV 中定義的部署參數的檔案。 NSDV 中每個 NF 都有一個
nsd-cli-output
all_deploy.parameters.json 所有 NF 部署參數的超集,提供單一檔案來自定義資源名稱。 建置命令輸出至此檔案的值取自 nsd-input.jsonc 檔案。 您可以先編輯此檔案中的值,再執行發佈,例如發佈至不同的位置或使用不同的發行者名稱
index.json 發佈資源時,內部使用的檔案。 不要編輯

發佈網路服務設計 (NSD)

若要發佈網路服務設計 (NSD) 及其相關聯的成品,請發出下列命令:

az aosm nsd publish --build-output-folder nsd-cli-output

流覽至您的發行者資源群組,以觀察並檢閱所產生的資源和成品。

系統會建立這些資源:

資源名稱 資源類型
ubuntu-nsd 網路服務設計。
1.0.0 (ubuntu-nsd/1.0.0) 網路服務設計版本。
ubuntu-nsd-nsd-manifest-1-0-0 發行者成品指令清單。
ConfigGroupSchema 組態群組架構。

下一步