diff options
-rw-r--r-- | build/network-environment.yaml | 65 | ||||
-rw-r--r-- | build/nics/compute_private.yaml | 93 | ||||
-rw-r--r-- | build/nics/compute_private_storage.yaml | 100 | ||||
-rw-r--r-- | build/nics/compute_storage.yaml | 93 | ||||
-rw-r--r-- | build/nics/controller_private.yaml | 123 | ||||
-rw-r--r-- | build/nics/controller_private_storage.yaml | 130 | ||||
-rw-r--r-- | build/nics/controller_storage.yaml | 123 | ||||
-rw-r--r-- | build/opnfv-apex.spec | 12 | ||||
-rwxr-xr-x | ci/deploy.sh | 66 | ||||
-rw-r--r-- | config/deploy/network/network_settings.yaml | 10 | ||||
-rw-r--r-- | lib/common-functions.sh | 58 |
11 files changed, 824 insertions, 49 deletions
diff --git a/build/network-environment.yaml b/build/network-environment.yaml index a42a54bb..01eb50ee 100644 --- a/build/network-environment.yaml +++ b/build/network-environment.yaml @@ -37,34 +37,39 @@ parameter_defaults: ExternalInterfaceDefaultRoute: 192.168.37.1 EC2MetadataIp: 192.0.2.1 DnsServers: ["8.8.8.8","8.8.4.4"] + TenantNetCidr: 172.17.0.0/24 + TenantAllocationPools: [{'start': '172.17.0.10', 'end': '172.17.0.200'}] + StorageNetCidr: 172.18.0.0/24 + StorageAllocationPools: [{'start': '172.18.0.10', 'end': '172.18.0.200'}] -# ServiceNetMap: -# NeutronTenantNetwork: tenant -# CeilometerApiNetwork: internal_api -# MongoDbNetwork: internal_api -# CinderApiNetwork: internal_api -# CinderIscsiNetwork: storage -# GlanceApiNetwork: storage -# GlanceRegistryNetwork: internal_api -# KeystoneAdminApiNetwork: internal_api -# KeystonePublicApiNetwork: internal_api -# NeutronApiNetwork: internal_api -# HeatApiNetwork: internal_api -# NovaApiNetwork: internal_api -# NovaMetadataNetwork: internal_api -# NovaVncProxyNetwork: internal_api -# SwiftMgmtNetwork: storage_mgmt -# SwiftProxyNetwork: storage -# HorizonNetwork: internal_api -# MemcachedNetwork: internal_api -# RabbitMqNetwork: internal_api -# RedisNetwork: internal_api -# MysqlNetwork: internal_api -# CephClusterNetwork: storage_mgmt -# CephPublicNetwork: storage -# # Define which network will be used for hostname resolution -# ControllerHostnameResolveNetwork: internal_api -# ComputeHostnameResolveNetwork: internal_api -# BlockStorageHostnameResolveNetwork: internal_api -# ObjectStorageHostnameResolveNetwork: internal_api -# CephStorageHostnameResolveNetwork: storage +parameters: + ServiceNetMap: + NeutronTenantNetwork: tenant + CeilometerApiNetwork: internal_api + MongoDbNetwork: internal_api + CinderApiNetwork: internal_api + CinderIscsiNetwork: storage + GlanceApiNetwork: storage + GlanceRegistryNetwork: internal_api + KeystoneAdminApiNetwork: internal_api + KeystonePublicApiNetwork: internal_api + NeutronApiNetwork: internal_api + HeatApiNetwork: internal_api + NovaApiNetwork: internal_api + NovaMetadataNetwork: internal_api + NovaVncProxyNetwork: internal_api + SwiftMgmtNetwork: storage + SwiftProxyNetwork: storage + HorizonNetwork: internal_api + MemcachedNetwork: internal_api + RabbitMqNetwork: internal_api + RedisNetwork: internal_api + MysqlNetwork: internal_api + CephClusterNetwork: storage + CephPublicNetwork: storage + # Define which network will be used for hostname resolution + ControllerHostnameResolveNetwork: internal_api + ComputeHostnameResolveNetwork: internal_api + BlockStorageHostnameResolveNetwork: internal_api + ObjectStorageHostnameResolveNetwork: internal_api + CephStorageHostnameResolveNetwork: storage diff --git a/build/nics/compute_private.yaml b/build/nics/compute_private.yaml new file mode 100644 index 00000000..746831f9 --- /dev/null +++ b/build/nics/compute_private.yaml @@ -0,0 +1,93 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the compute role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: interface + name: nic2 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: TenantIpSubnet} +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/nics/compute_private_storage.yaml b/build/nics/compute_private_storage.yaml new file mode 100644 index 00000000..d140871f --- /dev/null +++ b/build/nics/compute_private_storage.yaml @@ -0,0 +1,100 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the compute role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: interface + name: nic2 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: TenantIpSubnet} + - + type: interface + name: nic4 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: StorageIpSubnet} +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/nics/compute_storage.yaml b/build/nics/compute_storage.yaml new file mode 100644 index 00000000..6d048608 --- /dev/null +++ b/build/nics/compute_storage.yaml @@ -0,0 +1,93 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the compute role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: interface + name: nic4 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: StorageIpSubnet} +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/nics/controller_private.yaml b/build/nics/controller_private.yaml new file mode 100644 index 00000000..f1edf020 --- /dev/null +++ b/build/nics/controller_private.yaml @@ -0,0 +1,123 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the controller role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + ExternalNetworkVlanID: + default: 10 + description: Vlan ID for the external network traffic. + type: number + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + StorageMgmtNetworkVlanID: + default: 40 + description: Vlan ID for the storage mgmt network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ExternalInterfaceDefaultRoute: + default: '10.0.0.1' + description: default route for the external network + type: string + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: interface + name: nic2 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: TenantIpSubnet} + - + type: ovs_bridge + name: {get_input: bridge_name} + use_dhcp: false + addresses: + - + ip_netmask: {get_param: ExternalIpSubnet} + routes: + - + ip_netmask: 0.0.0.0/0 + next_hop: {get_param: ExternalInterfaceDefaultRoute} + members: + - + type: interface + name: nic3 + # force the MAC address of the bridge to this interface + primary: true + +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/nics/controller_private_storage.yaml b/build/nics/controller_private_storage.yaml new file mode 100644 index 00000000..dee02013 --- /dev/null +++ b/build/nics/controller_private_storage.yaml @@ -0,0 +1,130 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the controller role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + ExternalNetworkVlanID: + default: 10 + description: Vlan ID for the external network traffic. + type: number + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + StorageMgmtNetworkVlanID: + default: 40 + description: Vlan ID for the storage mgmt network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ExternalInterfaceDefaultRoute: + default: '10.0.0.1' + description: default route for the external network + type: string + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: interface + name: nic2 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: TenantIpSubnet} + - + type: ovs_bridge + name: {get_input: bridge_name} + use_dhcp: false + addresses: + - + ip_netmask: {get_param: ExternalIpSubnet} + routes: + - + ip_netmask: 0.0.0.0/0 + next_hop: {get_param: ExternalInterfaceDefaultRoute} + members: + - + type: interface + name: nic3 + # force the MAC address of the bridge to this interface + primary: true + - + type: interface + name: nic4 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: StorageIpSubnet} + +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/nics/controller_storage.yaml b/build/nics/controller_storage.yaml new file mode 100644 index 00000000..7962592a --- /dev/null +++ b/build/nics/controller_storage.yaml @@ -0,0 +1,123 @@ +heat_template_version: 2015-04-30 + +description: > + Software Config to drive os-net-config to configure multiple interfaces + for the controller role. + +parameters: + ControlPlaneIp: + default: '' + description: IP address/subnet on the ctlplane network + type: string + ExternalIpSubnet: + default: '' + description: IP address/subnet on the external network + type: string + InternalApiIpSubnet: + default: '' + description: IP address/subnet on the internal API network + type: string + StorageIpSubnet: + default: '' + description: IP address/subnet on the storage network + type: string + StorageMgmtIpSubnet: + default: '' + description: IP address/subnet on the storage mgmt network + type: string + TenantIpSubnet: + default: '' + description: IP address/subnet on the tenant network + type: string + ExternalNetworkVlanID: + default: 10 + description: Vlan ID for the external network traffic. + type: number + InternalApiNetworkVlanID: + default: 20 + description: Vlan ID for the internal_api network traffic. + type: number + StorageNetworkVlanID: + default: 30 + description: Vlan ID for the storage network traffic. + type: number + StorageMgmtNetworkVlanID: + default: 40 + description: Vlan ID for the storage mgmt network traffic. + type: number + TenantNetworkVlanID: + default: 50 + description: Vlan ID for the tenant network traffic. + type: number + ExternalInterfaceDefaultRoute: + default: '10.0.0.1' + description: default route for the external network + type: string + ControlPlaneSubnetCidr: # Override this via parameter_defaults + default: '24' + description: The subnet CIDR of the control plane network. + type: string + ControlPlaneDefaultRoute: # Override this via parameter_defaults + description: The subnet CIDR of the control plane network. + type: string + DnsServers: # Override this via parameter_defaults + default: [] + description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf. + type: json + EC2MetadataIp: # Override this via parameter_defaults + description: The IP address of the EC2 metadata server. + type: string + +resources: + OsNetConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + os_net_config: + network_config: + - + type: interface + name: nic1 + use_dhcp: false + dns_servers: {get_param: DnsServers} + addresses: + - + ip_netmask: + list_join: + - '/' + - - {get_param: ControlPlaneIp} + - {get_param: ControlPlaneSubnetCidr} + routes: + - + ip_netmask: 169.254.169.254/32 + next_hop: {get_param: EC2MetadataIp} + - + type: ovs_bridge + name: {get_input: bridge_name} + use_dhcp: false + addresses: + - + ip_netmask: {get_param: ExternalIpSubnet} + routes: + - + ip_netmask: 0.0.0.0/0 + next_hop: {get_param: ExternalInterfaceDefaultRoute} + members: + - + type: interface + name: nic3 + # force the MAC address of the bridge to this interface + primary: true + - + type: interface + name: nic4 + use_dhcp: false + addresses: + - + ip_netmask: {get_param: StorageIpSubnet} + +outputs: + OS::stack_id: + description: The OsNetConfigImpl resource. + value: {get_resource: OsNetConfigImpl} diff --git a/build/opnfv-apex.spec b/build/opnfv-apex.spec index cb9f7705..f7efaa7a 100644 --- a/build/opnfv-apex.spec +++ b/build/opnfv-apex.spec @@ -47,6 +47,12 @@ install build/default-pool.xml %{buildroot}%{_var}/opt/opnfv/ install build/network-environment.yaml %{buildroot}%{_var}/opt/opnfv/ install build/nics/controller.yaml %{buildroot}%{_var}/opt/opnfv/nics/ install build/nics/compute.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/controller_private.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/compute_private.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/controller_storage.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/compute_storage.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/controller_private_storage.yaml %{buildroot}%{_var}/opt/opnfv/nics/ +install build/nics/compute_private_storage.yaml %{buildroot}%{_var}/opt/opnfv/nics/ install build/instackenv-virt.json %{buildroot}%{_var}/opt/opnfv/ install build/instackenv.json.example %{buildroot}%{_var}/opt/opnfv/ @@ -76,6 +82,12 @@ install config/deploy/network/network_settings.yaml %{buildroot}%{_docdir}/opnfv %{_var}/opt/opnfv/network-environment.yaml %{_var}/opt/opnfv/nics/controller.yaml %{_var}/opt/opnfv/nics/compute.yaml +%{_var}/opt/opnfv/nics/controller_private.yaml +%{_var}/opt/opnfv/nics/compute_private.yaml +%{_var}/opt/opnfv/nics/controller_storage.yaml +%{_var}/opt/opnfv/nics/compute_storage.yaml +%{_var}/opt/opnfv/nics/controller_private_storage.yaml +%{_var}/opt/opnfv/nics/compute_private_storage.yaml %{_var}/opt/opnfv/instackenv-virt.json %{_var}/opt/opnfv/instackenv.json.example %{_var}/opt/opnfv/stack/overcloud-full.qcow2 diff --git a/ci/deploy.sh b/ci/deploy.sh index 9d5d9d28..ae6366f3 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -155,14 +155,25 @@ for Auto-detection${reset}" for setting in ${common_optional_network_settings}; do eval "setting_value=\${${enabled_network}_${setting}}" if [ -z "${setting_value}" ]; then - setting_value=$(eval find_${setting} ${nic_value}) + if [ -n "$nic_value" ]; then + setting_value=$(eval find_${setting} ${nic_value}) + else + setting_value='' + echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}" else # if Auto-detection fails we can auto-generate with CIDR eval "cidr=\${${enabled_network}_cidr}" - setting_value=$(eval generate_${setting} ${cidr}) + if [ -n "$cidr" ]; then + echo -e "${blue}INFO: Auto-generating: ${setting}${reset}" + setting_value=$(eval generate_${setting} ${cidr}) + else + setting_value='' + echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}" @@ -182,13 +193,23 @@ for Auto-detection${reset}" for setting in ${network_specific_settings}; do eval "setting_value=\${${enabled_network}_${setting}}" if [ -z "${setting_value}" ]; then - setting_value=$(eval find_${setting} ${nic_value}) + if [ -n "$nic_value" ]; then + setting_value=$(eval find_${setting} ${nic_value}) + else + setting_value='' + echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}" else eval "cidr=\${${enabled_network}_cidr}" - setting_value=$(eval generate_${setting} ${cidr}) + if [ -n "$cidr" ]; then + setting_value=$(eval generate_${setting} ${cidr}) + else + setting_value='' + echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}" + fi if [ -n "$setting_value" ]; then eval "${enabled_network}_${setting}=${setting_value}" echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}" @@ -586,12 +607,48 @@ function setup_virtual_baremetal { ##Set network-environment settings ##params: network-environment file to edit function configure_network_environment { + local tht_dir nic_ext + tht_dir=/usr/share/openstack-tripleo-heat-templates/network + nic_ext='' + sed -i '/ControlPlaneSubnetCidr/c\\ ControlPlaneSubnetCidr: "'${admin_network_cidr##*/}'"' $1 sed -i '/ControlPlaneDefaultRoute/c\\ ControlPlaneDefaultRoute: '${admin_network_provisioner_ip}'' $1 sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: '${public_network_cidr}'' $1 sed -i "/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${public_network_usable_ip_range%%,*}', 'end': '${public_network_usable_ip_range##*,}'}]" $1 sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: '${public_network_gateway}'' $1 sed -i '/EC2MetadataIp/c\\ EC2MetadataIp: '${admin_network_provisioner_ip}'' $1 + + # check for private network + if [[ ! -z "$private_network_enabled" && "$private_network_enabled" == "true" ]]; then + sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/tenant.yaml#' $1 + sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1 + sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1 + sed -i "/TenantAllocationPools/c\\ TenantAllocationPools: [{'start': '${private_network_usable_ip_range%%,*}', 'end': '${private_network_usable_ip_range##*,}'}]" $1 + sed -i '/TenantNetCidr/c\\ TenantNetCidr: '${private_network_cidr}'' $1 + nic_ext+=_private + else + sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/noop.yaml#' $1 + sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1 + sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1 + fi + + # check for storage network + if [[ ! -z "$storage_network_enabled" && "$storage_network_enabled" == "true" ]]; then + sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/storage.yaml#' $1 + sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 + sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1 + sed -i "/StorageAllocationPools/c\\ StorageAllocationPools: [{'start': '${storage_network_usable_ip_range%%,*}', 'end': '${storage_network_usable_ip_range##*,}'}]" $1 + sed -i '/StorageNetCidr/c\\ StorageNetCidr: '${storage_network_cidr}'' $1 + nic_ext+=_storage + else + sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/noop.yaml#' $1 + sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 + sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1 + fi + + # set nics appropriately + sed -i 's#^.*Compute::Net::SoftwareConfig:.*$# OS::TripleO::Compute::Net::SoftwareConfig: nics/compute'${nic_ext}'.yaml#' $1 + sed -i 's#^.*Controller::Net::SoftwareConfig:.*$# OS::TripleO::Controller::Net::SoftwareConfig: nics/controller'${nic_ext}'.yaml#' $1 } ##Copy over the glance images and instack json file ##params: none @@ -691,7 +748,6 @@ EOI # as well as glance api problem echo -e "${blue}INFO: Sleeping 15 seconds while services come back from restart${reset}" sleep 15 -#TODO Fill in the rest of the network-environment values for other networks } diff --git a/config/deploy/network/network_settings.yaml b/config/deploy/network/network_settings.yaml index 2560cc5d..6645a86a 100644 --- a/config/deploy/network/network_settings.yaml +++ b/config/deploy/network/network_settings.yaml @@ -13,7 +13,8 @@ admin_network: dhcp_range: 192.0.2.2,192.0.2.10 introspection_range: 192.0.2.100,192.0.2.120 private_network: - enabled: false + enabled: true + cidr: 11.0.0.0/24 public_network: enabled: true network_type: '' @@ -24,9 +25,10 @@ public_network: usable_ip_range: 192.168.37.10,192.168.37.199 provisioner_ip: 192.168.37.1 storage_network: - enabled: false + enabled: true + cidr: 12.0.0.0/24 -#admin_network: #Required network, other networks can collapse into this network if not enabled +#admin_network: #Required network, internal API network, other networks can collapse into this network if not enabled # enabled: true # network_type: bridged #Indicates if this network will be bridged to an interface, or to a bond # bridged_interface: '' #Interface to bridge to for installer VM @@ -38,7 +40,7 @@ storage_network: # cidr: 192.0.2.0/24 #subnet in CIDR format 192.168.1.0/24, if empty it will be auto-detected # dhcp_range: 192.0.2.2,192.0.2.10 #dhcp range for the admin network, if empty it will be automatically provisioned # introspection_range: 192.0.2.100,192.0.2.120 #Range used for introspection phase (examining nodes) -#private_network: #Network for internal API traffic for O/S services and internal tenant traffic +#private_network: #Network for internal tenant traffic # enabled: false #If disabled, internal api traffic will collapse to admin_network #public_network: #Network for external API traffic and external tenant traffic # enabled: true #If disabled, public_network traffic will collapse to admin network diff --git a/lib/common-functions.sh b/lib/common-functions.sh index 6738ddf4..edf06cff 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -140,6 +140,9 @@ function increment_ip { ##find_gateway em1 function find_gateway { local gw gw_interface + if [ -z "$1" ]; then + return 1 + fi gw=$(ip route | grep default | awk '{print $3}') gw_interface=$(ip route get $gw | awk '{print $3}') if [ -n "$1" ]; then @@ -153,6 +156,9 @@ function find_gateway { ##params: interface to find CIDR function find_cidr { local cidr network ip netmask short_mask + if [ -z "$1" ]; then + return 1 + fi ip=$(find_ip $1) netmask=$(find_netmask $1) if [[ -z "$ip" || -z "$netmask" ]]; then @@ -173,6 +179,9 @@ function find_cidr { ##params: interface to find IP function find_usable_ip_range { local interface_ip subnet_mask first_block_ip last_block_ip + if [ -z "$1" ]; then + return 1 + fi interface_ip=$(find_ip $1) subnet_mask=$(find_netmask $1) if [[ -z "$interface_ip" || -z "$subnet_mask" ]]; then @@ -187,7 +196,7 @@ function find_usable_ip_range { if [ -z "$last_block_ip" ]; then return 1 else - last_block_ip=$(subtract_ip ${last_block_ip} 20) + last_block_ip=$(subtract_ip ${last_block_ip} 21) echo "${first_block_ip},${last_block_ip}" fi @@ -198,13 +207,17 @@ function find_usable_ip_range { ##params: cidr function generate_usable_ip_range { local first_ip first_block_ip last_block_ip - first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + first_ip=$(ipcalc -nmpb $1 | grep NETWORK= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + first_ip=$(increment_ip ${first_ip} 1) first_block_ip=$(increment_ip ${first_ip} 20) - last_block_ip=$(ipcalc -nb $1 | grep HostMax: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #last_block_ip=$(ipcalc -nb $1 | grep HostMax: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + last_block_ip=$(ipcalc -nmpb $1 | grep BROADCAST= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + last_block_ip=$(subtract_ip ${last_block_ip} 1) if [[ -z "$first_block_ip" || -z "$last_block_ip" ]]; then return 1 else - last_block_ip=$(subtract_ip ${last_block_ip} 20) + last_block_ip=$(subtract_ip ${last_block_ip} 21) echo "${first_block_ip},${last_block_ip}" fi } @@ -214,6 +227,9 @@ function generate_usable_ip_range { ##params: interface function find_provisioner_ip { local interface_ip + if [ -z "$1" ]; then + return 1 + fi interface_ip=$(find_ip $1) if [ -z "$interface_ip" ]; then return 1 @@ -225,7 +241,13 @@ function find_provisioner_ip { ##params: cidr function generate_provisioner_ip { local provisioner_ip - provisioner_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #provisioner_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + provisioner_ip=$(ipcalc -nmpb $1 | grep NETWORK= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + if [ -z "$provisioner_ip" ]; then + return 1 + fi + provisioner_ip=$(increment_ip ${provisioner_ip} 1) + echo "$provisioner_ip" } ##finds the dhcp range available via interface @@ -233,6 +255,9 @@ function generate_provisioner_ip { ##params: interface function find_dhcp_range { local dhcp_range_start dhcp_range_end interface_ip + if [ -z "$1" ]; then + return 1 + fi interface_ip=$(find_ip $1) if [ -z "$interface_ip" ]; then return 1 @@ -247,10 +272,12 @@ function find_dhcp_range { ##params: cidr function generate_dhcp_range { local dhcp_range_start dhcp_range_end first_ip - first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + first_ip=$(ipcalc -nmpb $1 | grep NETWORK= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") if [ -z "$first_ip" ]; then return 1 fi + first_ip=$(increment_ip ${first_ip} 1) dhcp_range_start=$(increment_ip ${first_ip} 1) dhcp_range_end=$(increment_ip ${dhcp_range_start} 8) echo "${dhcp_range_start},${dhcp_range_end}" @@ -261,6 +288,9 @@ function generate_dhcp_range { ##params: interface function find_introspection_range { local inspect_range_start inspect_range_end interface_ip + if [ -z "$1" ]; then + return 1 + fi interface_ip=$(find_ip $1) if [ -z "$interface_ip" ]; then return 1 @@ -275,39 +305,47 @@ function find_introspection_range { ##params: cidr function generate_introspection_range { local inspect_range_start inspect_range_end first_ip - first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #first_ip=$(ipcalc -nb $1 | grep HostMin: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + first_ip=$(ipcalc -nmpb $1 | grep NETWORK= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") if [ -z "$first_ip" ]; then return 1 fi + first_ip=$(increment_ip ${first_ip} 1) inspect_range_start=$(increment_ip ${first_ip} 10) inspect_range_end=$(increment_ip ${inspect_range_start} 8) echo "${inspect_range_start},${inspect_range_end}" } ##finds the floating ip range available via interface -##uses last 20 IPs of a subnet +##uses last 20 IPs of a subnet, minus last IP ##params: interface function find_floating_ip_range { local float_range_start float_range_end interface_ip subnet_mask + if [ -z "$1" ]; then + return 1 + fi interface_ip=$(find_ip $1) subnet_mask=$(find_netmask $1) if [[ -z "$interface_ip" || -z "$subnet_mask" ]]; then return 1 fi float_range_end=$(find_last_ip_subnet ${interface_ip} ${subnet_mask}) + float_range_end=$(subtract_ip ${float_range_end} 1) float_range_start=$(subtract_ip ${float_range_end} 19) echo "${float_range_start},${float_range_end}" } ##generate the floating range available via CIDR -##uses last 20 IPs of subnet +##uses last 20 IPs of subnet, minus last IP ##params: cidr function generate_floating_ip_range { local float_range_start float_range_end last_ip - last_ip=$(ipcalc -nb $1 | grep HostMax: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + #last_ip=$(ipcalc -nb $1 | grep HostMax: | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + last_ip=$(ipcalc -nmpb $1 | grep BROADCAST= | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") if [ -z "$last_ip" ]; then return 1 fi + last_ip=$(subtract_ip ${last_ip} 2) float_range_start=$(subtract_ip ${last_ip} 19) float_range_end=${last_ip} echo "${float_range_start},${float_range_end}" |