声明:
本博客欢迎转发,但请保留原作者信息!
博客地址:http://blog.youkuaiyun.com/llg8212
内容系本人学习、研究和总结,如有雷同,不胜荣幸!
-
Neutron概念
Neutron概念
network:隔离的虚拟2层域,network也可以看作是一个虚拟(或逻辑)交换机。对应物理交换机。
subnet:是IPv4或IPv6的地址段。表示在指定的network中,哪些IP地址可以被分配给虚拟机。相当于IP池。
port:就是网络上的虚拟(或逻辑)交换机的端口。对应物理交换机的端口。
2. Neutron表结构
-
C- the attribute can be used increateoperations;
-
R- the attribute is returned in the response forshow orlistoperations;
-
U- the value of attribute can be updated;
-
D- the value of the attribute can be removed;
-
network
-
network
只能被创建的租户使用,除非被创建成shared。
Attribute | Type | Required | CRUD | DefaultValue | Validation Constraints | 描述 |
id | uuid-str | N/A | CR | Generated | UUID_PATTERN |
|
name | String | No | CRU | None | N/A | 网络名,可以重复 |
admin_state_up | Bool | No | CRU | True | {True | False } | 管理状态,默认为True。如果为False,整个网络不可用 |
status | String | N/A | R | N/A | N/A | 网络的状态。ACTIVE:可用状态;BUILD:创建中;DOWN:不可用状态,该网络上所有的port也不可用;ERROR:错误 |
subnets | list(uuid-str) | No | R | EmptyList | N/A |
|
shared | Bool | No | CRU | False | {True | False } | 是否设置成共享,如果为True,其它租户也可以访问 |
tenant_id | uuid-str | No* | CR | N/A | N/A |
|
-
subnet
-
subnet
subnet代表了可用于分配给虚拟机的IP地址集合。每个subnet必须有一个cidr,并且必须与network相关联。Ip地址可以从整个subnetcidr中或“allocation_pools”中任选,这可以由用户来指定。
subnet也可以有一个网关,DNS名称服务器的列表,以及主机路由。所有这些信息将被应用到和该subnet关联的虚拟机网口上。
Attribute | Type | Requ ired | CRUD | Default | ValidationConstraints | 描述 |
id | uuid-str | N/A | CR | Generated | UUID_PATTERN |
|
name | String | No | CRU | None | N/A | 子网名,可以重复 |
network_id | uuid-str | Yes | CR | Generated | Existingnetwork identifier. |
|
ip_version | int | Yes | CR | 4 | {4 | 6 } |
|
cidr | string | Yes | CR | N/A | ValidCIDR in the form <network_address>/ <prefix> | 子网IP的集合。例:
|
gateway_ip | stringor null | No | CRUD | First address inCIDR | ValidIP address or null | 网关,不指定默认为cidr中的第一个IP |
dns_ nameservers | list(str) | No | CRU | None | Configurablemaximum amount of nameservers per subnet. The default is 5. |
|
allocation_ pools | list(dict) | No | CR | Every address in CIDR, excluding gateway IP if configured | Start/endof range must be valid IP | 自动根据cidr创建,cidr中的所有IP和网关IP(如果指定)。 如果指定cidr为格式为
|
host_routes | list(dict) | No | CRU | Defaultroute to gateway_ip | {'destination':<CIDR>, "nexthop": <valid IP address>}.Configurable maximum amount of routes per subnet. The default is20. | 默认路由,其格式为cidr,有效的ip。例:192.168.70.0/24, 192.168.70.1 |
enable_dhcp | Bool | No | CRU | True | {True | False } |
|
tenant_id | uuid-str | No* | CR | N/A | N/A | 如果不使用keystone认证,该字段是必须的 |
-
port
-
port
port表示一个逻辑网络交换机虚拟交换机端口。虚拟机将其interface关联到port。虚拟机interface被注入通过逻辑端口还定义的MAC地址和IP地址(允许多个)。当IP地址关联到一个port,这也意味着该port与subnet相关联,因为IP地址是从特定子网的allocation_pools中分配的。
Attribute | Type | Required | CRUD | Default | Validation Constraints | 描述 |
id | uuid-str | N/A | CR | Generated | UUID_PATTERN | 子网名,可以重复 |
name | String | No | CRU | None | N/A |
|
network_id | uuid-str | Yes | CR | N/A | Existing network identifier. |
|
admin_state_ up | bool | No | CRU | True | {True | False } | 管理状态,默认为True。 如果为False, 整个端口不可用 |
status | string | N/A | R | N/A | N/A | 端口的状态,和network 的status含义一致。 ACTIVE:可用状态; BUILD:创建中; DOWN:不可用状态, 该网络上所有的port也不可用; ERROR:错误 |
mac_address | string | No | CR | Generated | ValidMAC in 6-octet form separated by colons. | 端口的MAC地址,自动生成。 |
fixed_ips | list(dict) | No | CRU | Automatically allocated from pool. | ValidIP address and existing subnet identifier. |
|
device_id | str | No | CRUD | None | Noconstraint |
|
device_owner | str | No | CRUD | None | Noconstraint |
|
tenant_id | uuid-str | No* | CR | N/A | N/A | 如果不使用keystone认证, 该字段是必须的(和subnet一致) |
-
neutron的代码结构
neutron的代码结构
|--agent:部署在Network Node上。为整个网络提供公共服务,包括如:l3-agent(实现3层网络路由的配置),dhcp-agent(提供dhcp服务)。
|--api:对外提供RestAPI访问。在neutron-server服务中提供。
|--cmd:用于发出哪些network,subnet,port,router,floatingip已经存在
|--common:neutron模块的公共
|--db:数据库
|--debug:用于测试neutron功能
|--extensions:neutron的扩展模块,如:vpnaas,l3,lbaas等
|--locale:多语言支持
|--openstack:openstack的公共模块,来源于olso-incubator
|--plugin:实现网络功能的插件。如:linuxbridge,ml2
|--agent:部署在Compute Node节点(真正干活的)。使vm能通过网络通信,如openvswitch中的agent是通过ovs-ofctl命令修改流规则。
|--scheduler:neutron的调度模块,负载均衡功能时使用。包含:dhcp-agent和l3-agent调度
|--server:启动NeutronApiService服务
|--service:
|--tests: