Prometheus 监控和 FM 接口通过 Kubernetes 集群 VNF 的自动修复支持

https://blueprints.launchpad.net/tacker/+spec/prometheus-monitoring

问题描述

可以修复作为 VNF 实例部署的 Kubernetes 集群的 Master 节点或 Worker 节点,该集群具有 ETSI NFV-SOL003 v2.6.1 中定义的 VNF 生命周期管理接口 [1],如 spec “MgmtDriver 与 Kubernetes 集群管理 OSS” 中所述 [2]

故障管理接口在 ETSI NFV-SOL 003 v3.3.1 中定义 [3],其架构是 NFVO 根据故障信息主动做出关于实施 heal 等操作的决策。

另一方面,在现有的 spec “Prometheus 与 Kubernetes 集群 VNF_sample 的告警服务器” 中 [4],目标是使用 prometheus 的自主监控机制自动扩展或修复作为 VNF 部署的 pod 或 Kubernetes 集群。

本 spec 提供故障管理接口的示例实现,包括与 Prometheus 监控数据相关的、基于 Kubernetes 集群中 Master/Worker 节点自动修复实现的数据模型转换。

故障管理接口考虑轮询模式和通知模式监控方法。前者是一种 NFVO 定期从 VNFM 查询监控信息的方法,后者是一种 VNFM 在 Subscribe/Notify 订阅模型中通知 NFVO 的方法。在任何一种情况下,都需要管理符合 SOL003 中指定的数据模型的监控信息,该信息存储在 Tacker DB 中。

注意

  • 本 spec 中的 Kubernetes 集群 VNF 基于此 spec [2]。Kubernetes 集群 VNF 是单个 Master 集群,因此目前不支持对 Master 节点的 heal 操作。未来支持 HA 后可能会支持,因此在本 spec 中,Master/Worker 节点都包含在 Prometheus 的监控目标中,以支持未来的 HA 支持。

  • 除非有特殊说明,否则本 spec 中描述的 Client 默认为 NFVO,VNFM 默认为 Tacker。

提议的变更

需要进行以下更改

  1. 添加对 SOL003 中指定的故障管理接口的支持 [3]

    • 添加 VNF 故障管理接口

      • 查询告警

        • GET /vnffm/v1/alarms 查询所有告警。

        • GET /vnffm/v1/alarms/{alarmId} 查询指定的告警。

      • 确认告警

        • PATCH /vnffm/v1/alarms/{alarmId} 将目标告警更改为已确认状态。

      • 订阅

        • POST /vnffm/v1/subscriptions 创建新的订阅。

      • 查询订阅

        • GET /vnffm/v1/subscriptions 查询所有订阅。

        • GET /vnffm/v1/subscriptions/{subscriptionId} 查询指定的订阅。

      • 删除订阅

        • DELETE /vnffm/v1/subscriptions/{subscriptionId} 删除指定的订阅。

    • 向 Client 发送请求

      • POST <Client URI from subscriptions> 通知 Client Tacker 收到告警。

      • GET <Client URI from subscriptions> 确认客户端的 URI 正确。

  2. 添加对 Tacker 和 Alertmanager 之间通信的 Modify Restful API 的支持

    • 修改 POST /alert/vnf_instances/{vnf_instance_id} 以接收 Alertmanager 发送的告警。

  3. 创建新的 DB 表

    • 将 Prometheus 特定的数据模型转换为符合 SOL003 的数据模型 [3]

    • 存储 FM 的订阅信息到 DB 中。

  4. MgmtDriver 变更

    • instantiate_end

      • Prometheus 包含在 Kubernetes 集群 VNF 中

        • 部署 Prometheus。

        • 设置 Prometheus。

        • 将监控/告警规则文件发送到 Prometheus。

        • InstantiatedVnfInfo.vnfcResourceInfo.metadata 字段中添加与每个 VM 对应的 hostname。

      • Prometheus 不包含在 Kubernetes 集群 VNF 中

        • 设置 Prometheus。

        • 将监控/告警规则文件发送到 Prometheus。

        • InstantiatedVnfInfo.vnfcResourceInfo.metadata 字段中添加与每个 VM 对应的 hostname。

    • terminate_end

      • Prometheus 不包含在 Kubernetes 集群 VNF 中

        • 删除 Prometheus 中的监控/告警规则。

    • scale_start

      • 以下内容为 scale-in 操作添加

        • 删除 Worker 节点的监控目标。

        • InstantiatedVnfInfo.vnfcResourceInfo.metadata 字段中删除与 VM 对应的 hostname。

    • scale_end

      • 以下内容为 scale-out 操作添加

        • 在新 Worker 节点中设置 Prometheus。

        • 添加 Worker 节点的新的监控目标。

        • InstantiatedVnfInfo.vnfcResourceInfo.metadata 字段中添加与 VM 对应的 hostname。

    • heal_start

      • 修复整个 VNF

        • 与 terminate_end 相同。

    • heal_end

      • 修复整个 VNF

        • 与 instantiate_end 相同。

    注意

    当 heal 指定 VNFC 时,VNFC 的 IP 地址和 hostname 不会更改,Prometheus 的设置和保存在 DB 中的 hostname 不需要更新,因此 heal_start 和 heal_end 不需要更改。

Tacker 告警服务器

Prometheus 插件是一个可选功能。Tacker 将根据配置文件中的内容决定是否启用它。配置文件的详细信息在 [4] 中描述。

实例化 Kubernetes 集群 VNF

本节描述如何使用 Prometheus 服务器进行自动修复来实例化 Kubernetes 集群。

该过程与 spec [4] 的“实例化 Kubernetes 集群 VNF”章节几乎相同。

有三个区别

  • 一个是 InstantiatedVnfInfo.vnfcResourceInfo

    • instantiate_end 中,在 metadata 字段中添加与每个 VM 对应的 hostname。 示例:"metadata": { "hostname": "worker193" }

  • 此监控不需要部署 metrics-server

  • 另一个是添加新的告警规则。

    • 以下两个示例显示了额外的告警规则,其他内容不变。

示例单个告警规则配置

alert: KubeNodeNotReady
expr: kube_node_status_condition{job="prometheus",
      condition="Ready",status="true"} == 0
for: 15m
labels:
  receiver_type: tacker
  function_type: vnffm
  vnf_instance_id: c61314d0-f583-4ab3-a457-46426bce02d3
  perceived_severity: WARNING
  event_type: EQUIPMENT_ALARM
annotations:
  probable_cause: The server cannot be connected.

(可选) 示例单个告警规则 ConfigMap

kind: ConfigMap
apiVersion: v1
metadata:
  name: tacker-samplevnf-rules
data:
  tacker-samplevnf-rules.yaml: |
    groups:
    - name: kubernetes-apps
      rules:
      - alert: KubeNodeNotReady
        annotations:
          probable_cause: The server cannot be connected.
        expr: |
          kube_node_status_condition{
            job="prometheus",condition="Ready",status="true"} == 0
        for: 15m
        labels:
          receiver_type: tacker
          function_type: vnffm
          vnf_instance_id: c61314d0-f583-4ab3-a457-46426bce02d3
          perceived_severity: WARNING
          event_type: EQUIPMENT_ALARM

在告警触发时自动修复 Worker 节点

当 Prometheus 服务器检测到 Kubernetes 集群的 Worker 节点发生故障时,它会将告警消息发送到 Tacker。在 Tacker 收到告警后,它会将告警转换为告警并将其存储在 DB 中。此时,根据 ETSI NFV-SOL 003 v3.3.1 [3] 7. VNF 故障管理接口,它支持两种自动修复模式,轮询和通知。

轮询模式下 heal 操作的设计

以下是轮询模式下 heal 的示意图

                                +------------------------+
                                |                        |
                                |   Client (NFVO etc.)   |
                                |                        |
                                +--+--------^+-----------+
                           6. Heal |        || 5. Query Alarms and return result
                            +------|--------||------------------------------------------------------------+
                            |      |        ||                                                       VNFM |
                            |  +---|--------||---------+ +---------------------------------+              |
                            |  |   |        ||  Tacker | |                      Tacker     |              |
                            |  |   |        ||  Server | |                      Conductor  |              |
                            |  |   |   +----+v------+  | |             +------------+      |   +--------+ |
                            |  |   |   | VnfFm      +------------------> VnfFm      +----------> Tacker | |
                            |  |   |   | Controller |  | |  +----------> Driver     +---------->   DB   | |
                            |  |   |   +------------+  | |  |          +------------+      |   +--------+ |
+----------------+          |  |   |                   | |  | 4. Convert alert to alarm    |              |
|                | 3. POST  |  |   |                   | |  |                              |              |
|  Alertmanager  |    alert |  |   |   +------------+  | |  |          +------------+      |              |
|                +---------------------> Prometheus +-------+    +-----> VmfLcm     |      |              |
+--+-------------+          |  |   |   | Plugin     |  | |       |     | Driver     +--+   |              |
   ^                        |  |   |   +------------+  | |       |     +---------+--+  |   |              |
   | 2. Trigger alert       |  |   |                   | |       |               |     |   |              |
   |                        |  |   |                   | |       |               |     |   |              |
   |                        |  |   |   +------------+  | |       |     +---------v--+  |   |              |
   |                        |  |   +---> Vnflcm     +------------+     | MgmtDriver |  |   |              |
   |                        |  |       | Controller |  | |             |            |  |   |              |
   |                        |  |       +------------+  | |             +-+----------+  |   |              |
+--+-------------+          |  |                       | |               |             |   |              |
|                |          |  |                       | |               |  +----------v-+ |              |
|  Prometheus    |          |  |                       | |               |  | OpenStack  | |              |
|  Server        |          |  |                       | |               |  | Infra      | |              |
|                |          |  |                       | |               |  | Driver     | |              |
+--+-------------+          |  |                       | |               |  +----+-------+ |              |
   |                        |  |                       | |               |       |         |              |
   |                        |  +-----------------------+ +---------------|-------|---------+              |
   | 1. Pull metrics        +--------------------------------------------|-------|------------------------+
   |                                                                     |       |
   |                        +--------------------------------------------|-------|------------+
   |                        |  Kubernetes Cluster VNF                    |       |            |
   |                        |                  +---------------+---------+-------+            |
   |                        | 7. Delete failed |               | 8. Create new                |
   |                        |    Worker node   |               |    Worker node               |
   |                        |         +--------v----+   +------v------+    +-------------+    |
   |                        |         | +--------+  |   | +--------+  |    | +--------+  |    |
   +----------------------------------> | Worker |  |   | | Worker |  |    | | Master |  |    |
                            |         | +--------+  |   | +--------+  |    | +--------+  |    |
                            |         |          VM |   |          VM |    |          VM |    |
                            |         +-------------+   +-------------+    +-------------+    |
                            +-----------------------------------------------------------------+
                            +-----------------------------------------------------------------+
                            |                          Hardware Resources                     |
                            +-----------------------------------------------------------------+
  1. Prometheus 服务器从 Kubernetes 集群收集指标。

  2. Alertmanager 接收来自 Prometheus 服务器的告警。

  3. Alertmanager 向具有指定 URL 的 Tacker 发送 POST 请求。

  4. Tacker 接收通知告警,将其转换为告警,并将其保存到 DB 中。

  5. Client 定期发送请求以查询 Tacker 中的告警。Tacker 使用 Client 指定的查询条件搜索 DB,并将匹配条件的告警返回给 Client。

  6. Client 从告警中识别 Worker 节点的故障,并将故障节点的 heal 请求发送到 Tacker。

  7. 触发 heal 操作,删除旧的 Worker 节点。

  8. 创建新的 Worker 节点。

注意

Alertmanager 发送到 Tacker 的 Prometheus 插件的 URL 遵循 spec [4]

轮询模式下操作的请求参数

API 详细信息在 REST API 影响 中描述。

轮询模式下操作的流程

以下描述了 Alertmanager 发送告警后 Tacker 的处理流程。

../../_images/0142.png
  1. Alertmanager 接收来自 Prometheus 服务器的告警并通知 Tacker 服务器的指定 URL。

    注意

    Prometheus 格式的告警管理在 Prometheus 服务器中定义。

  2. Prometheus 插件从 cfg.CONF.tacker.prometheus_plugin 获取值以确定是否启用此功能。

  3. Prometheus 插件根据告警中 labels 的 function_type 字段判断执行什么处理。

    • function_type 字段为 vnffm 时,执行 AutoHeal 处理。

    • function_type 字段不是 vnffm 时,执行 AutoScale 处理。

  4. Prometheus 插件根据告警中 node label 的值在 InstantiatedVnfInfo.vnfcResourceInfo 中找到相应的 computeResource。

  5. Prometheus 插件将告警转换为告警。

  6. Prometheus 插件调用 VnfFmDriver 并将告警发送给它。

  7. VnfFmDriver 将告警保存到 DB 中。

以下描述了使用轮询模式进行自动修复的 Client 的处理流程。

../../_images/0226.png
  1. Client 向 Tacker 发送请求以查询具有指定条件的告警。

  2. 查询告警同步处理。

  3. Tacker-conductor 调用 VnfFmDriver 以查询告警。

  4. VnfFmDriver 根据请求中的条件过滤出满足条件的告警,并返回结果。

  5. Client 从告警中获取 VNFC 信息后,向 Tacker 发送 heal VNFC 的请求。

  6. 从这一步开始,与默认的 heal 操作完全相同。

    • 唯一的区别是对于 InstantiatedVnfInfo.vnfcResourceInfo,在 heal_end 中,更新 metadata 字段中 VM 的 hostname。

通知模式下 heal 操作的设计

以下是通知模式下 heal 的示意图

                                +------------------------+
                                |                        |       6. Send notify alarm
                                |   Client (NFVO etc.)   <-------------------+
                                |                        |                   |
                                +--+---------+-----------+                   |
                           7. Heal |         | 1. Create subscription        |
                            +------|---------|-------------------------------|----------------------------+
                            |      |         |                               |                       VNFM |
                            |  +---|---------|---------+ +-------------------|-------------+              |
                            |  |   |         |  Tacker | |                   |  Tacker     |              |
                            |  |   |         |  Server | |                   |  Conductor  |              |
                            |  |   |   +-----v------+  | |             +-----+------+      |   +--------+ |
                            |  |   |   | VnfFm      +------------------> VnfFm      +----------> Tacker | |
                            |  |   |   | Controller |  | |  +----------> Driver     +---------->   DB   | |
                            |  |   |   +------------+  | |  |          +------------+      |   +--------+ |
+----------------+          |  |   |                   | |  | 5. Convert alert to alarm    |              |
|                | 4. POST  |  |   |                   | |  |                              |              |
|  Alertmanager  |    alert |  |   |   +------------+  | |  |          +------------+      |              |
|                +---------------------> Prometheus +-------+    +-----> VmfLcm     |      |              |
+--+-------------+          |  |   |   | Plugin     |  | |       |     | Driver     +--+   |              |
   ^                        |  |   |   +------------+  | |       |     +---------+--+  |   |              |
   | 3. Trigger alert       |  |   |                   | |       |               |     |   |              |
   |                        |  |   |                   | |       |               |     |   |              |
   |                        |  |   |   +------------+  | |       |     +---------v--+  |   |              |
   |                        |  |   +---> Vnflcm     +------------+     | MgmtDriver |  |   |              |
   |                        |  |       | Controller |  | |             |            |  |   |              |
   |                        |  |       +------------+  | |             +-+----------+  |   |              |
+--+-------------+          |  |                       | |               |             |   |              |
|                |          |  |                       | |               |  +----------v-+ |              |
|  Prometheus    |          |  |                       | |               |  | OpenStack  | |              |
|  Server        |          |  |                       | |               |  | Infra      | |              |
|                |          |  |                       | |               |  | Driver     | |              |
+--+-------------+          |  |                       | |               |  +----+-------+ |              |
   |                        |  |                       | |               |       |         |              |
   |                        |  +-----------------------+ +---------------|-------|---------+              |
   | 2. Pull metrics        +--------------------------------------------|-------|----------------------- +
   |                                                                     |       |
   |                        +--------------------------------------------|-------|------------+
   |                        |  Kubernetes Cluster VNF                    |       |            |
   |                        |                  +---------------+---------+-------+            |
   |                        | 8. Delete failed |               | 9. Create new                |
   |                        |    Worker node   |               |    Worker node               |
   |                        |         +--------v----+   +------v--- --+    +-------------+    |
   |                        |         | +--------+  |   | +--------+  |    | +--------+  |    |
   +----------------------------------> | Worker |  |   | | Worker |  |    | | Master |  |    |
                            |         | +--------+  |   | +--------+  |    | +--------+  |    |
                            |         |          VM |   |          VM |    |          VM |    |
                            |         +-------------+   +-------------+    +-------------+    |
                            +-----------------------------------------------------------------+
                            +-----------------------------------------------------------------+
                            |                          Hardware Resources                     |
                            +-----------------------------------------------------------------+
  • 1.Client 向 Tacker 发送请求以创建订阅。

    注意

    在创建订阅期间,Tacker 向 Client 的 Callback url 发送测试通知请求。Client 执行具体处理。默认情况下,Client 返回 HTTP 204 No Content 即可。

  • 2-5.处理与轮询模式的 1-4 相同。

  • 6.VnfFmDriver 找到 DB 中的所有订阅,并将告警与它们匹配。如果有一个订阅可以成功匹配,则将告警发送到 Client 的指定路径。如果匹配不成功,则处理结束。

  • 7-9.处理与轮询模式的 6-8 相同。

通知模式下操作的请求参数

API 详细信息在 REST API 影响 中描述。

通知模式下操作的流程

以下描述了使用通知模式进行自动修复的 Client 的处理流程。

../../_images/0315.png
  • 1.Client 向 Tacker 发送请求以创建订阅。Tacker 收到订阅后,将获取订阅中的 callback_uri。为了验证 callback_uri 的正确性,VnfFmDriver 向 Client 的 callback_uri 地址发送请求。在从 Client 获得正常的响应 HTTP 204 No Content 后,Tacker 将订阅保存到 DB 中。

  • 2-8.处理与轮询方法的 1-7 相同。

  • 9.VnfFmDriver 获取 DB 中的所有订阅。

  • 10.VnfFmDriver 判断告警是否可以与订阅匹配,如果不能匹配,则处理结束。

  • 11.如果匹配成功,VnfFmDriver 将 Notify Alarm 请求发送到 Client 的 callback_uri 地址。Client 收到请求并处理后,默认返回 HTTP 204 No Content。

  • 12-14.处理与轮询方法的 12-14 相同。

Kubernetes 集群的扩展

该过程与 spec [2] 的“Kubernetes 集群 VNF 的扩展/缩减 Worker 节点”章节几乎相同。

只有一个区别

  • 对于 InstantiatedVnfInfo.vnfcResourceInfo 的处理。

    • 在 scale in 时,在 scale_start 中,删除 metadata 字段中与 VM 对应的 hostname。

    • 在 scale out 时,在 scale_end 中,添加 metadata 字段中与 VM 对应的 hostname。

Kubernetes 集群的终止

该过程与 spec [4] 的“Kubernetes 集群的终止”章节几乎相同。

备选方案

数据模型影响

在 ‘Tacker’ 数据库中添加以下新数据库表。

vnf_fm_alarms

`id` varchar(36) Pri

`managed_object_id` varchar(36) NOT NULL

`faulty_resource` JSON NULL

`faulty_resource_type` varchar(32) NULL

`alarm_raised_time` datetime NOT NULL

`alarm_changed_time` datetime NULL

`alarm_cleared_time` datetime NULL

`alarm_acknowledged_time` datetime NULL

`ack_state` varchar(32) NOT NULL

`perceived_severity` varchar(32) NOT NULL

`event_time` datetime NOT NULL

`event_type` varchar(32) NOT NULL

`fault_type` varchar(255) NULL

`probable_cause` varchar(255) NOT NULL

`is_root_cause` boolean NOT NULL

`correlated_alarm_ids` text NULL

`fault_details` text NULL

`_links` JSON NOT NULL

This table will have `id` as primary key.
`managed_object_id` will be foreign
key of `vnf_instances`.`id`.

vnf_fm_subscriptions

`id` varchar(36) Pri

`fm_notifications_filter` JSON NULL

`callback_uri` varchar(255) NOT NULL

`_links` JSON NOT NULL

`subscription_authentication` JSON NULL

This table will have `id` as primary key.

REST API 影响

以下 Restful API 符合 ETSI NFV-SOL 003 v3.3.1 [3] 7.VNF 故障管理接口。

  • 添加新的 API - GET /vnffm/v1/alarms

    查询 Tacker 中的所有告警。

    允许用户根据 id, managedObjectId, rootCauseFaultyResource/faultyResourceType, eventType, perceivedSeverity, probableCause 查询参数过滤告警。

    例如,以下 URL 查询参数将匹配 perceivedSeverity=WARNING 的告警

    GET /vnffm/v1/alarms?filter=(eq,perceivedSeverity,WARNING)
    

    方法类型:GET

    正常的 http 响应代码:200 OK

    预期的错误 http 响应代码

    400 Bad Request: Shall be returned when the attribute-based filter
    expression is invalid or there are too many alarms in the query,
    the response is too big.
    
    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized to call
    this REST API.
    
    404 NotFound: Shall be returned when the URL is wrong.
    
    405 Method Not Allowed: Shall be returned when the HTTP
    method is not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 没有请求体。

    响应 - 返回 Alarms 参数,如下所示

    [
        {
            "id": "78a39661-60a8-4824-b989-88c1b0c3534a",
            "managedObjectId": "c61314d0-f583-4ab3-a457-46426bce02d3",
            "rootCauseFaultyResource": {
                "faultyResource": {
                    "vimConnectionId": "0d57e928-86a4-4445-a4bd-1634edae73f3",
                    "resourceId": "4e6ccbe1-38ec-4b1b-a278-64de09ba01b3",
                    "vimLevelResourceType": "OS::Nova::Server"
                },
                "faultyResourceType": "COMPUTE"
            },
            "alarmRaisedTime": "2021-09-03 10:21:03",
            "alarmChangedTime": "",
            "alarmClearedTime": "",
            "alarmAcknowledgedTime": "",
            "ackState": "UNACKNOWLEDGED",
            "perceivedSeverity": "WARNING",
            "eventTime": "2021-09-03 10:06:03",
            "eventType": "EQUIPMENT_ALARM",
            "faultType": "",
            "probableCause": "The server cannot be connected.",
            "isRootCause": "false",
            "correlatedAlarmIds": [],
            "faultDetails": [],
            "_links": {
                "self": "/vnffm/v1/alarms/78a39661-60a8-4824-b989-88c1b0c3534a",
                "objectInstance": ""
            }
        }
    ]
    
  • 添加新的 API - GET /vnffm/v1/alarms/{alarmId}

    查询 Tacker 中指定的告警。

    方法类型:GET

    正常的 http 响应代码:200 OK

    预期的错误 http 响应代码

    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized to call
    this REST API.
    
    404 NotFound: Shall be returned when the alarmId does not exist.
    
    405 Method Not Allowed: Shall be returned when the HTTP method
    is not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 没有请求体。

    响应 - 返回如下所示的 Alarm 参数

    {
        "id": "78a39661-60a8-4824-b989-88c1b0c3534a",
        "managedObjectId": "c61314d0-f583-4ab3-a457-46426bce02d3",
        "rootCauseFaultyResource": {
            "faultyResource": {
                    "vimConnectionId": "0d57e928-86a4-4445-a4bd-1634edae73f3",
                    "resourceId": "4e6ccbe1-38ec-4b1b-a278-64de09ba01b3",
                    "vimLevelResourceType": "OS::Nova::Server"
                },
            "faultyResourceType": "COMPUTE"
        },
        "alarmRaisedTime": "2021-09-03 10:21:03",
        "alarmChangedTime": "",
        "alarmClearedTime": "",
        "alarmAcknowledgedTime": "",
        "ackState": "UNACKNOWLEDGED",
        "perceivedSeverity": "WARNING",
        "eventTime": "2021-09-03 10:06:03",
        "eventType": "EQUIPMENT_ALARM",
        "faultType": "",
        "probableCause": "The server cannot be connected.",
        "isRootCause": "false",
        "correlatedAlarmIds": [],
        "faultDetails": [],
        "_links": {
            "self": "/vnffm/v1/alarms/78a39661-60a8-4824-b989-88c1b0c3534a",
            "objectInstance": ""
        }
    }
    
  • 添加新的 API - PATCH /vnffm/v1/alarms/{alarmId}

    修改 Tacker 中指定的告警的确认状态。

    方法类型: PATCH

    Content-Type: application/mergepatch+json

    正常的 http 响应代码:200 OK

    预期的错误 http 响应代码

    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized to call
    this REST API.
    
    404 NotFound: Shall be returned when the alarmId does not exist.
    
    405 Method Not Allowed: Shall be returned when the HTTP method
    is not supported.
    
    409 Conflict: Shall be returned when the ackState of alarm is
    already the value to be set.
    
    412 Precondition failed: Shall be returned when the ETag in the
    http header does not match.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 接收如下所示的 AlarmModifications 参数

    {
        "ackState": "ACKNOWLEDGED"
    }
    

    响应 - 返回如下所示的 AlarmModifications 参数

    {
        "ackState": "ACKNOWLEDGED"
    }
    
  • 添加新的 API - POST /vnffm/v1/subscriptions

    在 Tacker 中创建一个新的订阅。

    方法类型:POST

    正常的 http 响应代码 : 201 Created

    预期的错误 http 响应代码

    303 See Other: Shall be returned when the same callback URI and
    the same filter already exists.
    
    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized to
    call this REST API.
    
    404 NotFound: Shall be returned when the URL is wrong.
    
    405 Method Not Allowed: Shall be returned when the HTTP method is
    not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 接收如下所示的 FmSubscriptionRequest 参数

    {
        "filter": {
            "vnfInstanceSubscriptionFilter": {
                "vnfdIds": [
                    "b1db0ce7-ebca-1fb7-95ed-4840d70a9923"
                ],
                "vnfProductsFromProviders": [],
                "vnfInstanceIds": [
                    "02e46e91-2722-4f2d-af91-313f5981a199"
                ],
                "vnfInstanceNames": []
            },
            "notificationTypes": [
                "AlarmNotification"
            ],
            "faultyResourceTypes": [
                "COMPUTE"
            ],
            "perceivedSeverities": [
                "WARNING"
            ],
            "eventTypes": [
                "EQUIPMENT_ALARM"
            ],
            "probableCauses": [
                "The server cannot be connected."
            ]
        },
        "callbackUri": "/nfvo/notify/alarm",
        "authentication": {
            "authType": [
                "BASIC"
            ],
            "paramsBasic": {
                "userName": "nfvo",
                "password": "nfvopwd"
            },
            "paramsOauth2ClientCredentials": {}
        }
    }
    

    响应 - 返回如下所示的 FmSubscription 参数

    {
        "id": "fb782658-af96-47e7-9faa-90ba8416e426",
        "filter": {
            "vnfInstanceSubscriptionFilter": {
                "vnfdIds": [
                    "b1db0ce7-ebca-1fb7-95ed-4840d70a9923"
                ],
                "vnfProductsFromProviders": [],
                "vnfInstanceIds": [
                    "02e46e91-2722-4f2d-af91-313f5981a199"
                ],
                "vnfInstanceNames": []
            },
            "notificationTypes": [
                "AlarmNotification"
            ],
            "faultyResourceTypes": [
                "COMPUTE"
            ],
            "perceivedSeverities": [
                "WARNING"
            ],
            "eventTypes": [
                "EQUIPMENT_ALARM"
            ],
            "probableCauses": [
                "The server cannot be connected."
            ]
        },
        "callbackUri": "/nfvo/notify/alarm",
        "_links": {
            "self": "/vnffm/v1/subscriptions/fb782658-af96-47e7-9faa-90ba8416e426"
        }
    }
    

    注意

    当 Tacker 向 Client 的 callbackUri 发送请求时,Client 会处理它并默认返回 HTTP 204 No Content。

  • 添加新的 API - GET /vnffm/v1/subscriptions

    查询 Tacker 中的所有订阅。

    允许用户根据请求中的 FmSubscription 查询参数过滤订阅。

    例如,以下 URL 查询参数将匹配 perceivedSeverities=WARNING 的订阅

    GET /vnffm/v1/subscriptions?filter=(eq,filter/perceivedSeverity,WARNING)
    

    方法类型:GET

    正常的 http 响应代码:200 OK

    预期的错误 http 响应代码

    400 Bad Request: Shall be returned when the attribute-based
    filter expression is invalid or there are too many subscriptions
    in the query, the response is too big.
    
    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized to
    call this REST API.
    
    404 NotFound: Shall be returned when the URL is wrong.
    
    405 Method Not Allowed: Shall be returned when the HTTP method
    is not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 没有请求体。

    响应 - 返回如下所示的 FmSubscription 参数

    [
        {
            "id": "fb782658-af96-47e7-9faa-90ba8416e426",
            "filter": {
                "vnfInstanceSubscriptionFilter": {
                    "vnfdIds": [
                        "b1db0ce7-ebca-1fb7-95ed-4840d70a9923"
                    ],
                    "vnfProductsFromProviders": [],
                    "vnfInstanceIds": [
                        "02e46e91-2722-4f2d-af91-313f5981a199"
                    ],
                    "vnfInstanceNames": []
                },
                "notificationTypes": [
                    "AlarmNotification"
                ],
                "faultyResourceTypes": [
                    "COMPUTE"
                ],
                "perceivedSeverities": [
                    "WARNING"
                ],
                "eventTypes": [
                    "EQUIPMENT_ALARM"
                ],
                "probableCauses": [
                    "The server cannot be connected."
                ]
            },
            "callbackUri": "/nfvo/notify/alarm",
            "_links": {
                "self": "/vnffm/v1/subscriptions/fb782658-af96-47e7-9faa-90ba8416e426"
            }
        }
    ]
    
  • 添加新的 API - GET /vnffm/v1/subscriptions/{subscriptionId}

    查询 Tacker 中指定的订阅。

    方法类型:GET

    正常的 http 响应代码:200 OK

    预期的错误 http 响应代码

    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized
    to call this REST API.
    
    404 NotFound: Shall be returned when the subscriptionId does
    not exist.
    
    405 Method Not Allowed: Shall be returned when the HTTP method
    is not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 没有请求体。

    响应 - 返回如下所示的 FmSubscription 参数

    {
        "id": "fb782658-af96-47e7-9faa-90ba8416e426",
        "filter": {
            "vnfInstanceSubscriptionFilter": {
                "vnfdIds": [
                    "b1db0ce7-ebca-1fb7-95ed-4840d70a9923"
                ],
                "vnfProductsFromProviders": [],
                "vnfInstanceIds": [
                    "02e46e91-2722-4f2d-af91-313f5981a199"
                ],
                "vnfInstanceNames": []
            },
            "notificationTypes": [
                "AlarmNotification"
            ],
            "faultyResourceTypes": [
                "COMPUTE"
            ],
            "perceivedSeverities": [
                "WARNING"
            ],
            "eventTypes": [
                "EQUIPMENT_ALARM"
            ],
            "probableCauses": [
                "The server cannot be connected."
            ]
        },
        "callbackUri": "/nfvo/notify/alarm",
        "_links": {
            "self": "/vnffm/v1/subscriptions/fb782658-af96-47e7-9faa-90ba8416e426"
        }
    }
    
  • 添加新的 API - DELETE /vnffm/v1/subscriptions/{subscriptionId}

    删除 Tacker 中指定的订阅。

    方法类型: DELETE

    正常的 http 响应代码 : 204 No Content

    预期的错误 http 响应代码

    401 NotAuthorized: Shall be returned when authentication fails.
    
    403 Forbidden: Shall be returned when user is not authorized
    to call this REST API.
    
    404 NotFound: Shall be returned when the subscriptionId does
    not exist.
    
    405 Method Not Allowed: Shall be returned when the HTTP method
    is not supported.
    
    500 Internal Server Error: Shall be returned when an internal
    error occurs.
    

    请求 - 没有请求体。

    响应 - 没有响应体。

  • 添加新的请求 POST <Client URI from subscriptions>

    通知 Client Tacker 收到告警。

    方法类型:POST

    正常的 http 响应代码 : 204 No Content

    错误 http 响应代码由 Client 确定。

    请求 - 有两种类型的请求体。

    • AlarmNotification 如下所示

    {
        "id": "87bea1ed-6ced-403e-8640-2c631eb55d08",
        "notificationType": "AlarmNotification",
        "subscriptionId": "fb782658-af96-47e7-9faa-90ba8416e426",
        "timeStamp": "2021-09-03 10:21:03",
        "alarm": {
            "id": "78a39661-60a8-4824-b989-88c1b0c3534a",
            "managedObjectId": "c61314d0-f583-4ab3-a457-46426bce02d3",
            "rootCauseFaultyResource": {
                "faultyResource": {
                        "vimConnectionId": "0d57e928-86a4-4445-a4bd-1634edae73f3",
                        "resourceId": "4e6ccbe1-38ec-4b1b-a278-64de09ba01b3",
                        "vimLevelResourceType": "OS::Nova::Server"
                    },
                "faultyResourceType": "COMPUTE"
            },
            "alarmRaisedTime": "2021-09-03 10:21:03",
            "alarmChangedTime": "",
            "alarmClearedTime": "",
            "alarmAcknowledgedTime": "",
            "ackState": "UNACKNOWLEDGED",
            "perceivedSeverity": "WARNING",
            "eventTime": "2021-09-03 10:06:03",
            "eventType": "EQUIPMENT_ALARM",
            "faultType": "",
            "probableCause": "The server cannot be connected.",
            "isRootCause": "false",
            "correlatedAlarmIds": [],
            "faultDetails": [],
            "_links": {
                "self": {
                    "href": "/vnffm/v1/alarms/78a39661-60a8-4824-b989-88c1b0c3534a"
                },
                "objectInstance": {
                    "href": "/vnffm/v1/vnf_instances/c61314d0-f583-4ab3-a457-46426bce02d3"
                }
            }
        },
        "_links": {
            "subscription": {
                "href": "/vnffm/v1/subscriptions/fb782658-af96-47e7-9faa-90ba8416e426"
            }
        }
    }
    
    • AlarmClearedNotification 如下所示

    {
        "id": "87bea1ed-6ced-403e-8640-2c631eb55d08",
        "notificationType": "AlarmClearedNotification",
        "subscriptionId": "fb782658-af96-47e7-9faa-90ba8416e426",
        "timeStamp": "2021-09-03 10:21:03",
        "alarmId": "78a39661-60a8-4824-b989-88c1b0c3534a",
        "alarmClearedTime": "2021-09-03 10:36:03",
        "_links": {
            "subscription": {
                "href": "/vnffm/v1/subscriptions/fb782658-af96-47e7-9faa-90ba8416e426"
            },
            "alarm": {
                "href": "/vnffm/v1/alarms/78a39661-60a8-4824-b989-88c1b0c3534a"
            }
        }
    }
    

    响应 - 没有响应体。

  • 添加新的请求 GET <Client URI from subscriptions>

    确认 Client 的 URI 是否正确。

    方法类型:GET

    正常的 http 响应代码 : 204 No Content

    错误 http 响应代码由 Client 确定。

    请求 - 没有响应体。

    响应 - 没有响应体。

  • 修改 POST /alert/vnf_instances/{vnf_instance_id}

    接收从 Alertmanager 发送的告警。

    额外的处理确定是否根据告警中的信息执行 AutoScale 或 AutoHeal。

    function_type 字段为 vnffm 时,执行 AutoHeal 处理。

    function_type 字段不是 vnffm 时,执行 AutoScale 处理。

    以下是 Prometheus 格式的告警内容示例

    {
        "receiver": "example",
        "status": "firing",
        "alerts": [
            {
                "status": "firing",
                "labels": {
                    "receiver_type": "tacker",
                    "function_type": "vnffm",
                    "vnf_instance_id": "c61314d0-f583-4ab3-a457-46426bce02d3",
                    "node": "worker193",
                    "perceived_severity": "WARNING",
                    "event_type": "EQUIPMENT_ALARM"
                },
                "annotations": {
                    "probable_cause": "The server cannot be connected."
                },
                "startsAt": "0000-00-00T00:00:00.000000000Z",
                "endsAt": "0000-00-00T00:00:00.000000000Z",
                "generatorURL": ""
            }
        ],
        "groupLabels": {},
        "commonLabels": {
            "alertname": "KubeNodeNotReady",
            "instance": "example_instance",
            "job": "example_job",
            "severity": "example"
        },
        "commonAnnotations": {
            "description": "description of alert",
            "summary": "summary content"
        },
        "externalURL": "",
        "version": "",
        "groupKey": "{}:{}"
    }
    

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

开发人员影响

实现

负责人

主要负责人

Masaki Ueno <masaki.ueno.up@hco.ntt.co.jp>

野口宏文 <hirofumi.noguchi.rs@hco.ntt.co.jp>

其他贡献者

Yi Feng <fengyi@fujitsu.com>

Yoshiyuki Katada <katada.yoshiyuk@fujitsu.com>

Ayumu Ueha <ueha.ayumu@fujitsu.com>

工作项

  • 实现 Tacker 服务器以支持

    • 添加新的 Rest API GET /vnffm/v1/alarms 以查询所有告警。

    • 添加新的 Rest API GET /vnffm/v1/alarms/{alarmId} 以查询指定的告警。

    • 添加新的 Rest API PATCH /vnffm/v1/alarms/{alarmId} 以将目标告警更改为已确认。

    • 添加新的 Rest API POST /vnffm/v1/subscriptions 以创建新的订阅。

    • 添加新的 Rest API GET /vnffm/v1/subscriptions 以查询所有订阅。

    • 添加新的 Rest API GET /vnffm/v1/subscriptions/{subscriptionId} 以查询指定的订阅。

    • 添加新的 Rest API DELETE /vnffm/v1/subscriptions/{subscriptionId} 以删除指定的订阅。

    • 添加新的请求 POST <Client URI from subscriptions> 以通知 Client Tacker 收到告警。

    • 添加新的请求 GET <Client URI from subscriptions> 以确认 Client 的 URI 是否正确。

    • 修改 Rest API POST /alert/vnf_instances/{vnf_instance_id} 以接收从 Alertmanager 发送的告警。

  • 提供一个示例脚本来执行以下任务

    • 在 configure Prometheus 中添加新的告警规则。

    • InstantiatedVnfInfo.vnfcResourceInfo.metadata 字段中添加与每个 VM 对应的 hostname。

  • 添加新的单元和功能测试。

依赖项

Kubernetes集群的LCM操作取决于以下规范

  • Kubernetes 集群的实例化/扩展/修复/终止操作

    依赖于规范“具有 Kubernetes 集群管理 OSS 的 MgmtDriver” [2]

测试

将添加单元和功能测试,以涵盖规范所需的用例。

文档影响

  • 完整的用户指南将添加,以解释如何通过 Prometheus 进行监控。

  • 更新 API 文档,以说明 REST API 影响 中提到的 API 添加项。

参考资料