IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]Neutron里的服务框架 (by quqi99)

    quqi99发表于 2015-01-15 17:26:48
    love 0

    作者:张华 发表于:2014-01-15
    版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

    ( http://blog.csdn.net/quqi99 )

    在Neutron中,在L2层有ML2, 在L4/L7层有LBaaS, FWaaS, VPNaaS, 没有一个从L2/L7层统一的服务框架。
    而网络服务在L2/L7层是都有的,例如:
    1, FWaaS应该和网络节点在一块
    2, LBaaS可能就不是一定需要和网络节点在一块,那么安装Haproxy的虚机就必须有两个port (新类型,Service Interface),一个port能访问子网的网关,一个port能访问要做LB的其他虚机
    3, 像TapaaS,是在port前面拦一下,可以做port mirror或者port monitoring, 这个可是L2层。
    另一方面,这些网络服务之间可能需要是有序的(用例:一个tenant下的两个networks, 一个network里有FWaaS, 一个network里有LBaaS,现在要求他们有序)
    主要基于上述两大原因,出现了一系列的变种BPs.
    1, Service Insertion, 在原有的Neutron Service Type的代码之上扩展serviceBase来实现,本质在于在每个network的边界neutron port处再插入service port, 缺点在于仍然只在L4/L7层,另外也不够灵活,但通用性更好,与neutron更亲和。(https://review.openstack.org/#/c/93128)
    2, Service Chain, 基于Service Insertion,让服务变得有序。
    3, Traffic Steering, 基于ovs流表截取要走“有序服务”的流量,然后通过流表控制流量在各个service的ports上做有序流转。优点更灵活一些,缺点在于仅限于ovs. (https://review.openstack.org/#/c/92477)
    4, 华为也有一个类似的BP, 和Traffic Steering类似,但不需显式指定neutron port, 粒度更粗一些显示和FW这些服务关联,FW肯定也是有neutron port的,实际上实现原理是一样的,缺点也是仅限于ovs (https://review.openstack.org/#/c/146315/)


    Service Insertion

    例:

    neutron create-service-interface --insertion-type

    uuid_of_insertion_point是指port的uuid, 可以network边缘处的neutron port插入服务port, uuid_of_service_to_be_inserted, 如FWaaS.

    此替代方案是使用serviceContext (https://review.openstack.org/#/c/62599/)

    实现时,在FWaaS, LBaaS, VPNaaS共同的基类ServiceBase里扩展下列方法:
    * get_supported_insertion_type()
    --- returns the type of interface context (neutron port, external port, or attach to service) supported, should only be one
    * create_service_interface(service_interface)
    --- create service interface
    * delete_service_interface(service_interface_id)
    --- delete service interface
    * get_service_interfaces()
    --- get the list of service interfaces for this service

    1, 对VPN DB的影响,目前VPN DB里一个叫router的属性表示一个vpn已经和一个l3 router关联了,需要删除这个属性,用新的type=SERVICE and insertion_point_id=VPN代替。
    2, 对FW DB的影响,当时每一个l3 router上都关联了一个FW, 这个可以指定FW只和具体的router关联,为和老的兼容,在DB迁移时为每个router都关联一个FW.
    3, 对LB DB的影响,目前LB的VIP表中有一个port属性指明具有VIP,需要删除这个属性,用新的type=NEUTRON_PORT and ap_id=代替。


    Service Chain

    数据模型

    ServiceChainNode (id, name, type, config, config_params)
    ServiceChainSpec (id, name, nodes)
    ServiceChainInstance (id, name, service-chain-spec, port)
    neutron servicechain-node-create --type flavor_id --config_file fw_heat_template --config_params "destion1=IP1;destination2=IP2" fw_node
    neutron servicechain-node-create --type flavor_id --config_file lb_heat_template --config_params "router=router_uuid" lb_node
    neutron servicechain-spec-create --nodes "fw_node;lb_node" fwlb_spec

    https://review.openstack.org/#/c/93524/13/specs/juno/service-chaining.rst


    Traffic Steering

    服务框架的本质就是在neutron port之上再创建service port关联相应的service嘛,traffic steering直接通过流表根据classfier截取哪些流量要用service chain功能,然后再在各个neutron port之类导流就行了。

    port chain (id, name, descrip, tenant_id, ports, classfiers, override_warning)
    classifier (id, name, descrip, tenant_id, protocol, scr_port_min, src_port_max, dst_port_min, dst_port_max, src_ip, dst_ip)


    Huawei Service Chain

    和上面的三类做同样的事情
    数据结构:
    ServiceFunctionPool (id, name, type[FW|LB])
    ServiceFunctionPoolInstance (id, pool_id, name, sf_id) (用来提供vm port的)
    MatchRule (id, name, protocol, src-port, dst-port)
    ServiceFunctionChain (id, name, chain[FW|LB], rule_id)
    用法流程:
    即从目标端口为100及源端口为50的流量应用"FW,LB"的service-chain, FW会关联neutron port, LB会关联neutron port (它没有像上面三种方法显示的关联port,但LB等肯定会有neutron port,所以是隐式的), 于是流量在这些port上有序的流动。
    neutron sf-pool-create --type FW
    neutron sf-pool-create --type LB
    neutron sf-pool-inst-associate --pool_Id fw_sfpool_uuid --sf_Id fw1_uuid
    neutron sf-pool-inst-associate --pool_Id fw_sfpool_uuid --sf_Id fw2_uuid
    neutron sf-pool-inst-associate --pool_Id lb_sfpool_uuid --sf_Id lb1_uuid
    neutron sf-pool-inst-associate --pool_Id lb_sfpool_uuid --sf_Id lb2_uuid
    neutron sf-chain-create --chain "FW,LB"
    neutron sf-matchrule-create --protocol tcp --dst-port 100
    neutron sf-matchrule-create --protocol udp --src-port 50
    neutron sf-chain-update --sf_chain_Id sf_chain_uuid --rule_Id rule_uuid1 --rule_Id rule_uuid2


    参考
    [1] https://docs.google.com/a/canonical.com/document/d/1fmCWpCxAN4g5txmCJVmBDt02GYew2kvyRsh0Wl3YF2U/edit
    [2] https://review.openstack.org/#/c/93524/13/specs/juno/service-chaining.rst
    [3] https://review.openstack.org/#/c/93128/22/specs/juno/service-base-and-insertion.rst




沪ICP备19023445号-2号
友情链接