Tacker创建,更新,删除等管理监控NFV虚拟机的代码主要在vm/plugin.py文件中。
除了对数据库的操作外, 最主要的是调用几个driver驱动来实现上述创建,更新,删除等管理监控NFV虚拟机。
从master版最新代码(2016/5/13)来看, 涉及到的driver驱动有infra_drivers(用于部署NFV), mgmt_drivers(用于配置管理NFV),monitor_drivers(用于监控NFV),以及nfvo_driver(用于配置和获取VIM信息)
VM driver
NFVO driver
infra_driver
infra driver作用在于创建,更新,删除NFV虚拟机。
从代码上看,目前支持通过heat编排模块API来管理NFV虚拟机, 或者直接通过novaAPI来管理NFV虚拟机。涉及到的主要主要API有: create, create_wait, update, update_wait, delete, delete_wait等。
mgmt_driver
mgmt driver作用在于配置NFV虚拟机。比如用户希望在启动NFV虚拟机时,通过ssh配置防火墙规则。
那么用户可以自己写mgmt driver, 实现mgmt_call等接口。 这里可以把相关防火墙配置放到上述的TOSCA YAML文件中灵活配置, 通过mgmt drvier来获取配置并通过ssh命令下发给NFV虚拟机。
主要API有: mgmt_url, mgmt_call, mgmt_create_pre, mgmt_create_post,mgmt_update_pre, mgmt_update_post, mgmt_delete_pre, mgmt_delete_post, mgmt_get_config等。
monitor_driver
monitor driver作用在于监控NVF虚拟机的健康状态。目前已经有的monitor监控驱动有ping和httpping.
ping驱动是用linux命令 ping -c count-W timeout -i interval MGMT_IP方式来监控可达性。
http_ping驱动是用python库中的urlopen URL方式来监控web页面的可达性。
主要API有: monitor_url, monitor_call, monitor_get_config等。
nfvo_driver
最近新增了nfvo_driver, 对nfvo进行操作。 目前实现了部分功能, 如对VIM(目前这里只有openstack驱动)进行创建, 更新,删除操作, 代码上看目前Openstack VIM创建就是通过keystone来注册认证OpenStack, 然后获得OpenStack的一些基本信息, 如regions列表, 存入Tacker中用于安置部署。
主要API有: create_vim, update_vim, delete_vim等。
Tacker API的定义在K版和L/master版上有一点小的命名区别, K版中的device_templates对应了L版中的vnfds, 而K版中的devices对应了L版中的vnfs。
以下为master分支上的Tacker RestFul API定义:
API versionsLists information for Tacker API version. GET / List API versions - Lists information about Tacker API version. Response: { "versions": [ { "status": "CURRENT", "id": "v1.0", "links": [ { "href": "http://10.18.160.13:8888/v1.0", "rel": "self" } ] } ] }
VnfdsGET /v1.0/vnfds List vnfds - List vnfds stored in the VNF catalog. Response: { "vnfds": [ { "service_types": [ { "service_type": "vnfd", "id": "378b774d-89f5-4634-9c65-9c49ed6f00ce" } ], "description": "OpenWRT with services", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "mgmt_driver": "openwrt", "infra_driver": "heat", "attributes": { "vnfd": "template_name: OpenWRT\r\ndescription: template_description <sample_vnfd_template>" }, "id": "247b045e-d64f-4ae0-a3b4-8441b9e5892c", "name": "openwrt_services" } ] } GET /v1.0/vnfds/{vnfd_id} Show vnfd - Show information for a specified vnfd id. Response: { "vnfd": { "service_types": [ { "service_type": "vnfd", "id": "378b774d-89f5-4634-9c65-9c49ed6f00ce" } ], "description": "OpenWRT with services", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "mgmt_driver": "openwrt", "infra_driver": "heat", "attributes": { "vnfd": "template_name: OpenWRT\r\ndescription: template_description <sample_vnfd_template>" }, "id": "247b045e-d64f-4ae0-a3b4-8441b9e5892c", "name": "openwrt_services" } } POST /v1.0/vnfds Create vnfd - Create a vnfd entry based on the vnfd template. Request: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "devstack"}}, "vnfd": {"attributes": {"vnfd": "template_name: OpenWRT \r\ndescription: OpenWRT router\r\n\r\nservice_properties:\r\n Id: sample-vnfd\r\n vendor: tacker\r\n version: 1\r\n\r\nvdus:\r\n vdu1:\r\n id: vdu1\r\n vm_image: cirros-0.3.2-x86_64-uec\r\n instance_type: m1.tiny\r\n\r\n network_interfaces:\r\n management:\r\n network: net_mgmt\r\n management: true\r\n pkt_in:\r\n network: net0\r\n pkt_out:\r\n network: net1\r\n\r\n placement_policy: \r\n availability_zone: nova\r\n\r\n auto-scaling: noop\r\n monitoring_policy: noop\r\n failure_policy: noop\r\n\r\n config:\r\n param0: key0\r\n param1: key1"}, "service_types": [{"service_type": "vnfd"}], "mgmt_driver": "noop", "infra_driver": "heat"}} Response: { "vnfd": { "service_types": [ { "service_type": "vnfd", "id": "336fe422-9fba-47c7-87fb-d48475c3e0ce" } ], "description": "OpenWRT router", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "mgmt_driver": "noop", "infra_driver": "heat", "attributes": { "vnfd": "template_name: OpenWRT \r\ndescription: template_description <sample_vnfd_template>" }, "id": "ab10a543-22ee-43af-a441-05a9d32a57da", "name": "OpenWRT" } } DELETE /v1.0/vnfds/{vnfd_id} Delete vnfd - Deletes a specified vnfd_id from the VNF catalog. This operation does not accept a request body and does not return a response body. VnfsGET /v1.0/vnfs List vnfs - Lists instantiated vnfs in VNF Manager Response: { "vnfs": [ { "status": "ACTIVE", "name": "open_wrt", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "instance_id": "f7c93726-fb8d-4036-8349-2e82f196e8f6", "mgmt_url": "{\"vdu1\": \"192.168.120.3\"}", "attributes": { "service_type": "firewall", "param_values": "", "heat_template": "description: sample_template_description type: OS::Nova::Server\n", "monitoring_policy": "noop", "failure_policy": "noop" }, "id": "c9b4f5a5-d304-473a-a57e-b665b1f9eb8f", "description": "OpenWRT with services" } ] } GET /v1.0/vnfs/{vnf_id} Show vnf - Show information for a specified vnf_id. Response: { "vnf": [ { "status": "ACTIVE", "name": "open_wrt", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "instance_id": "f7c93726-fb8d-4036-8349-2e82f196e8f6", "mgmt_url": "{\"vdu1\": \"192.168.120.3\"}", "attributes": { "service_type": "firewall", "param_values": "", "heat_template": "description: OpenWRT with services\n sample_template_description type: OS::Nova::Server\n", "monitoring_policy": "noop", "failure_policy": "noop" }, "id": "c9b4f5a5-d304-473a-a57e-b665b1f9eb8f", "description": "OpenWRT with services" } ] } POST /v1.0/vnfs Create vnf - Create a vnf based on the vnfd template id. Request: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "devstack"}}, "vnf": {"vnfd_id": "d770ddd7-6014-4191-92d8-a2cd7a6cecd8"}} Response: { "vnf": { "status": "PENDING_CREATE", "name": "", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "description": "OpenWRT with services", "instance_id": "4f0d6222-afa0-4f02-8e19-69e7e4fd7edc", "mgmt_url": null, "attributes": { "service_type": "firewall", "heat_template": "description: OpenWRT with services\n <sample_heat_template> type: OS::Nova::Server\n", "monitoring_policy": "noop", "failure_policy": "noop" }, "id": "e3158513-92f4-4587-b949-70ad0bcbb2dd", "vnfd_id": "247b045e-d64f-4ae0-a3b4-8441b9e5892c" } } PUT /v1.0/vnfs/{vnf_id} Update vnf - Update a vnf based on user config file or data. Request: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "devstack"}}, "vnf": {"attributes": {"config": "vdus:\n vdu1: <sample_vdu_config> \n\n"}}} Response: { "vnf": { "status": "PENDING_UPDATE", "name": "", "tenant_id": "4dd6c1d7b6c94af980ca886495bcfed0", "instance_id": "4f0d6222-afa0-4f02-8e19-69e7e4fd7edc", "mgmt_url": "{\"vdu1\": \"192.168.120.4\"}", "attributes": { "service_type": "firewall", "monitoring_policy": "noop", "config": "vdus:\n vdu1:\n config: {<sample_vdu_config> type: OS::Nova::Server\n", "failure_policy": "noop" }, "id": "e3158513-92f4-4587-b949-70ad0bcbb2dd", "description": "OpenWRT with services" } } DELETE /v1.0/vnfs/{vnf_id} Delete vnf - Deletes a specified vnf_id from the VNF list. |