From a94e0159d98d511be4b4da9afe077e1188cc6ce6 Mon Sep 17 00:00:00 2001 From: CNlukai Date: Mon, 11 Jan 2016 17:39:55 +0800 Subject: ONOSFW-157 Add script of installer integration onos Change-Id: I0ac05b6a7ede8654af2c2573ea7ecb3e5e7a9473 Signed-off-by: CNlukai --- .../apex/opnfv-tripleo-heat-templates.patch | 1155 ++++++++++++++++++++ framework/scripts/installer/apex/puppet-onos.rar | Bin 0 -> 99785 bytes .../compass/onos_cluster/files/install_jdk8.tar | Bin 0 -> 4608 bytes .../compass/onos_cluster/files/networking-onos.tar | Bin 0 -> 153600 bytes .../compass/onos_cluster/handlers/main.yml | 3 + .../installer/compass/onos_cluster/tasks/main.yml | 44 + .../compass/onos_cluster/tasks/onos_controller.yml | 146 +++ .../compass/onos_cluster/tasks/openvswitch.yml | 83 ++ .../compass/onos_cluster/templates/cluster.json | 10 + .../compass/onos_cluster/templates/ml2_conf.sh | 7 + .../compass/onos_cluster/templates/tablets.json | 63 ++ .../installer/compass/onos_cluster/vars/Debian.yml | 6 + .../installer/compass/onos_cluster/vars/RedHat.yml | 6 + .../installer/compass/onos_cluster/vars/main.yml | 6 + .../installer/fuel/fuel-plugin-onos/LICENSE | 202 ++++ .../installer/fuel/fuel-plugin-onos/README.md | 119 ++ .../puppet/manifests/netconfig.pp | 21 + .../deployment_scripts/puppet/manifests/neutron.pp | 102 ++ .../deployment_scripts/puppet/manifests/onos-ha.pp | 1 + .../puppet/manifests/onos-install.pp | 2 + .../puppet/manifests/onos-service.pp | 6 + .../deployment_scripts/puppet/manifests/ovs.pp | 77 ++ .../puppet/modules/onos/files/networking-onos.tar | Bin 0 -> 860160 bytes .../puppet/modules/onos/files/onos_config.sh | 34 + .../puppet/modules/onos/files/onos_driver.sh | 10 + .../puppet/modules/onos/manifests/config.pp | 55 + .../puppet/modules/onos/manifests/ha/haproxy.pp | 64 ++ .../puppet/modules/onos/manifests/init.pp | 19 + .../puppet/modules/onos/manifests/install.pp | 56 + .../puppet/modules/onos/manifests/service.pp | 48 + .../puppet/modules/onos/templates/centos/onos.erb | 52 + .../puppet/modules/onos/templates/cluster.json.erb | 20 + .../modules/onos/templates/debian/onos.conf.erb | 31 + .../puppet/modules/onos/templates/netconfig.sh.erb | 6 + .../puppet/modules/onos/templates/tablets.json.erb | 69 ++ .../fuel/fuel-plugin-onos/deployment_tasks.yaml | 67 ++ .../fuel/fuel-plugin-onos/environment_config.yaml | 10 + .../installer/fuel/fuel-plugin-onos/metadata.yaml | 30 + .../fuel/fuel-plugin-onos/node_roles.yaml | 9 + .../installer/fuel/fuel-plugin-onos/pre_build_hook | 13 + .../fuel-plugin-onos/repositories/centos/.gitkeep | 0 .../fuel-plugin-onos/repositories/ubuntu/.gitkeep | 0 .../repositories/ubuntu/Packages.gz | Bin 0 -> 20 bytes .../fuel-plugin-onos/repositories/ubuntu/Release | 2 + .../installer/fuel/fuel-plugin-onos/volumes.yaml | 7 + .../installer/onos_cluster/files/install_jdk8.tar | Bin 4608 -> 0 bytes .../onos_cluster/files/networking-onos.tar | Bin 153600 -> 0 bytes .../installer/onos_cluster/handlers/main.yml | 3 - .../scripts/installer/onos_cluster/tasks/main.yml | 44 - .../onos_cluster/tasks/onos_controller.yml | 146 --- .../installer/onos_cluster/tasks/openvswitch.yml | 83 -- .../installer/onos_cluster/templates/cluster.json | 10 - .../installer/onos_cluster/templates/ml2_conf.sh | 7 - .../installer/onos_cluster/templates/tablets.json | 63 -- .../scripts/installer/onos_cluster/vars/Debian.yml | 6 - .../scripts/installer/onos_cluster/vars/RedHat.yml | 6 - .../scripts/installer/onos_cluster/vars/main.yml | 6 - 57 files changed, 2661 insertions(+), 374 deletions(-) create mode 100644 framework/scripts/installer/apex/opnfv-tripleo-heat-templates.patch create mode 100644 framework/scripts/installer/apex/puppet-onos.rar create mode 100755 framework/scripts/installer/compass/onos_cluster/files/install_jdk8.tar create mode 100644 framework/scripts/installer/compass/onos_cluster/files/networking-onos.tar create mode 100755 framework/scripts/installer/compass/onos_cluster/handlers/main.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/tasks/main.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/tasks/onos_controller.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/tasks/openvswitch.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/templates/cluster.json create mode 100755 framework/scripts/installer/compass/onos_cluster/templates/ml2_conf.sh create mode 100755 framework/scripts/installer/compass/onos_cluster/templates/tablets.json create mode 100755 framework/scripts/installer/compass/onos_cluster/vars/Debian.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/vars/RedHat.yml create mode 100755 framework/scripts/installer/compass/onos_cluster/vars/main.yml create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/LICENSE create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/README.md create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/netconfig.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/neutron.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-ha.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-install.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-service.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/ovs.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/networking-onos.tar create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_config.sh create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_driver.sh create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/centos/onos.erb create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/cluster.json.erb create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/debian/onos.conf.erb create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/netconfig.sh.erb create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/tablets.json.erb create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/deployment_tasks.yaml create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/environment_config.yaml create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/metadata.yaml create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/node_roles.yaml create mode 100755 framework/scripts/installer/fuel/fuel-plugin-onos/pre_build_hook create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/repositories/centos/.gitkeep create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/.gitkeep create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Packages.gz create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Release create mode 100644 framework/scripts/installer/fuel/fuel-plugin-onos/volumes.yaml delete mode 100755 framework/scripts/installer/onos_cluster/files/install_jdk8.tar delete mode 100644 framework/scripts/installer/onos_cluster/files/networking-onos.tar delete mode 100755 framework/scripts/installer/onos_cluster/handlers/main.yml delete mode 100755 framework/scripts/installer/onos_cluster/tasks/main.yml delete mode 100755 framework/scripts/installer/onos_cluster/tasks/onos_controller.yml delete mode 100755 framework/scripts/installer/onos_cluster/tasks/openvswitch.yml delete mode 100755 framework/scripts/installer/onos_cluster/templates/cluster.json delete mode 100755 framework/scripts/installer/onos_cluster/templates/ml2_conf.sh delete mode 100755 framework/scripts/installer/onos_cluster/templates/tablets.json delete mode 100755 framework/scripts/installer/onos_cluster/vars/Debian.yml delete mode 100755 framework/scripts/installer/onos_cluster/vars/RedHat.yml delete mode 100755 framework/scripts/installer/onos_cluster/vars/main.yml diff --git a/framework/scripts/installer/apex/opnfv-tripleo-heat-templates.patch b/framework/scripts/installer/apex/opnfv-tripleo-heat-templates.patch new file mode 100644 index 00000000..be40742e --- /dev/null +++ b/framework/scripts/installer/apex/opnfv-tripleo-heat-templates.patch @@ -0,0 +1,1155 @@ +From 63f8b6412f526ba245d86f40eb6b1ae1ee06485d Mon Sep 17 00:00:00 2001 +From: Dan Radez +Date: Sun, 13 Dec 2015 21:20:40 -0500 +Subject: [PATCH] Adds OpenDaylight support + +To enable OpenDaylight on controllers use environments/opendaylight.yaml +To enable OpenDaylight on external node use +environments/opendaylight-external.yaml + +Adds onos support +--- + environments/onos.yaml | 8 + + environments/opendaylight-external.yaml | 25 ++ + environments/opendaylight.yaml | 25 ++ + overcloud-resource-registry-puppet.yaml | 3 + + overcloud-without-mergepy.yaml | 62 +++++ + puppet/all-nodes-config.yaml | 6 + + puppet/compute.yaml | 25 ++ + puppet/controller.yaml | 35 +++ + puppet/manifests/overcloud_compute.pp | 33 ++- + puppet/manifests/overcloud_controller.pp | 80 +++++- + puppet/manifests/overcloud_controller_pacemaker.pp | 299 +++++++++++++-------- + puppet/manifests/overcloud_opendaylight.pp | 26 ++ + puppet/opendaylight-puppet.yaml | 209 ++++++++++++++ + 13 files changed, 712 insertions(+), 124 deletions(-) + create mode 100644 environments/onos.yaml + create mode 100644 environments/opendaylight-external.yaml + create mode 100644 environments/opendaylight.yaml + create mode 100644 puppet/manifests/overcloud_opendaylight.pp + create mode 100644 puppet/opendaylight-puppet.yaml + +diff --git a/environments/onos.yaml b/environments/onos.yaml +new file mode 100644 +index 0000000..510aca9 +--- /dev/null ++++ b/environments/onos.yaml +@@ -0,0 +1,8 @@ ++parameters: ++ #This a bug for odl deployment. Once bug fixed OpenDaylightCount can be remove. ++ OpenDaylightCount: 0 ++ NeutronL3HA: false ++ ExtraConfig: ++ neutron_service_plugins: ['onos_router'] ++ neutron_mechanism_drivers: ['onos_ml2'] ++ neutron_tenant_network_type: vxlan +diff --git a/environments/opendaylight-external.yaml b/environments/opendaylight-external.yaml +new file mode 100644 +index 0000000..411df21 +--- /dev/null ++++ b/environments/opendaylight-external.yaml +@@ -0,0 +1,25 @@ ++# Environment file used to enable OpenDaylight ++# Currently uses overcloud image that is assumed ++# to be virt-customized with ODL RPM already on it ++ ++# These parameters customize the OpenDaylight Node ++# The user name and password are for the ODL service ++# Defaults are included here for reference ++#parameter_defaults: ++# OpenDaylightFlavor: baremetal ++# OpenDaylightHostname: opendaylight-server ++# OpenDaylightImage: overcloud-full ++# OpenDaylightUsername: admin ++# OpenDaylightPassword: admin ++ ++parameters: ++ # increase this if you need more ODL nodes ++ OpenDaylightCount: 1 ++ NeutronL3HA: false ++ ExtraConfig: ++ neutron_mechanism_drivers: ['opendaylight'] ++ neutron_tenant_network_type: vxlan ++ # Enable this if you want OpenDaylight on the contollers ++ # reduce OpenDaylightCount to 0 if you don't want any ++ # OpenDaylight only nodes ++ #opendaylight_install: true +diff --git a/environments/opendaylight.yaml b/environments/opendaylight.yaml +new file mode 100644 +index 0000000..c8abf75 +--- /dev/null ++++ b/environments/opendaylight.yaml +@@ -0,0 +1,25 @@ ++# Environment file used to enable OpenDaylight ++# Currently uses overcloud image that is assumed ++# to be virt-customized with ODL RPM already on it ++ ++# These parameters customize the OpenDaylight Node ++# The user name and password are for the ODL service ++# Defaults are included here for reference ++#parameter_defaults: ++# OpenDaylightFlavor: baremetal ++# OpenDaylightHostname: opendaylight-server ++# OpenDaylightImage: overcloud-full ++# OpenDaylightUsername: admin ++# OpenDaylightPassword: admin ++ ++parameters: ++ # increase this if you need more ODL nodes ++ # OpenDaylightCount: 1 ++ NeutronL3HA: false ++ ExtraConfig: ++ neutron_mechanism_drivers: ['opendaylight'] ++ neutron_tenant_network_type: vxlan ++ # Enable this if you want OpenDaylight on the contollers ++ # reduce OpenDaylightCount to 0 if you don't want any ++ # OpenDaylight only nodes ++ opendaylight_install: true +diff --git a/overcloud-resource-registry-puppet.yaml b/overcloud-resource-registry-puppet.yaml +index c072c29..2413450 100644 +--- a/overcloud-resource-registry-puppet.yaml ++++ b/overcloud-resource-registry-puppet.yaml +@@ -27,6 +27,9 @@ resource_registry: + # To disable, replace with firstboot/userdata_default.yaml + OS::TripleO::NodeAdminUserData: firstboot/userdata_heat_admin.yaml + ++ # This configures OpenDaylight to drive the network ++ OS::TripleO::OpenDaylightNode: puppet/opendaylight-puppet.yaml ++ + # Hooks for operator extra config + # NodeUserData == Cloud-init additional user-data, e.g cloud-config + # ControllerExtraConfigPre == Controller configuration pre service deployment +diff --git a/overcloud-without-mergepy.yaml b/overcloud-without-mergepy.yaml +index 01c0079..210ec11 100644 +--- a/overcloud-without-mergepy.yaml ++++ b/overcloud-without-mergepy.yaml +@@ -227,6 +227,23 @@ parameters: + default: false + description: Should MongoDb journaling be disabled + type: boolean ++ OpenDaylightPort: ++ default: 8081 ++ description: Set opendaylight service port ++ type: number ++ OpenDaylightInstall: ++ default: false ++ description: Whether to install OpenDaylight on the control nodes. ++ type: boolean ++ OpenDaylightUsername: ++ default: 'admin' ++ description: The username for the opendaylight server. ++ type: string ++ OpenDaylightPassword: ++ default: 'admin' ++ type: string ++ description: The password for the opendaylight server. ++ hidden: true + PublicVirtualFixedIPs: + default: [] + description: > +@@ -650,6 +667,18 @@ parameters: + structure as ExtraConfig. + type: json + ++# OpenDaylight specific parameters ++ OpenDaylightCount: ++ type: number ++ default: 0 ++ OpenDaylightImage: ++ default: overcloud-full ++ type: string ++ OpenDaylightFlavor: ++ default: baremetal ++ description: Flavor for OpenDaylight node ++ type: string ++ + # Hostname format for each role + # Note %index% is translated into the index of the node, e.g 0/1/2 etc + # and %stackname% is replaced with OS::stack_name in the template below. +@@ -674,6 +703,10 @@ parameters: + type: string + description: Format for CephStorage node hostnames + default: '%stackname%-cephstorage-%index%' ++ OpenDaylightHostnameFormat: ++ type: string ++ description: Format for OpenDaylight node hostnames ++ default: '%stackname%-opendaylight-%index%' + + # Identifiers to trigger tasks on nodes + UpdateIdentifier: +@@ -756,6 +789,27 @@ resources: + SwiftProxyVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, SwiftProxyNetwork]}]} + PublicVirtualIP: {get_attr: [VipMap, net_ip_map, external]} + ++ OpenDaylightNode: ++ type: OS::Heat::ResourceGroup ++ depends_on: Networks ++ properties: ++ count: {get_param: OpenDaylightCount} ++ removal_policies: {get_param: ComputeRemovalPolicies} ++ resource_def: ++ type: OS::TripleO::OpenDaylightNode ++ properties: ++ UpdateIdentifier: {get_param: UpdateIdentifier} ++ OpenDaylightFlavor: {get_param: OpenDaylightFlavor} ++ OpenDaylightImage: {get_param: OpenDaylightImage} ++ OpenDaylightPort: {get_param: OpenDaylightPort} ++ OpenDaylightUsername: {get_param: OpenDaylightUsername} ++ OpenDaylightPassword: {get_param: OpenDaylightPassword} ++ OpenDaylightHostname: ++ str_replace: ++ template: {get_param: OpenDaylightHostnameFormat} ++ params: ++ '%stackname%': {get_param: 'OS::stack_name'} ++ + Controller: + type: OS::Heat::ResourceGroup + depends_on: Networks +@@ -839,6 +893,10 @@ resources: + NovaPassword: {get_param: NovaPassword} + NtpServer: {get_param: NtpServer} + MongoDbNoJournal: {get_param: MongoDbNoJournal} ++ OpenDaylightPort: {get_param: OpenDaylightPort} ++ OpenDaylightInstall: {get_param: OpenDaylightInstall} ++ OpenDaylightUsername: {get_param: OpenDaylightUsername} ++ OpenDaylightPassword: {get_param: OpenDaylightPassword} + PcsdPassword: {get_resource: PcsdPassword} + PublicVirtualInterface: {get_param: PublicVirtualInterface} + RabbitPassword: {get_param: RabbitPassword} +@@ -933,6 +991,9 @@ resources: + NovaPublicIP: {get_attr: [VipMap, net_ip_map, external]} + NovaPassword: {get_param: NovaPassword} + NtpServer: {get_param: NtpServer} ++ OpenDaylightPort: {get_param: OpenDaylightPort} ++ OpenDaylightUsername: {get_param: OpenDaylightUsername} ++ OpenDaylightPassword: {get_param: OpenDaylightPassword} + RabbitHost: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, RabbitMqNetwork]}]} + RabbitPassword: {get_param: RabbitPassword} + RabbitUserName: {get_param: RabbitUserName} +@@ -1053,6 +1114,7 @@ resources: + compute_hosts: {get_attr: [Compute, hosts_entry]} + controller_hosts: {get_attr: [Controller, hosts_entry]} + controller_ips: {get_attr: [Controller, ip_address]} ++ opendaylight_ip: {get_attr: [OpenDaylightNode, ip_address]} + block_storage_hosts: {get_attr: [BlockStorage, hosts_entry]} + object_storage_hosts: {get_attr: [ObjectStorage, hosts_entry]} + ceph_storage_hosts: {get_attr: [CephStorage, hosts_entry]} +diff --git a/puppet/all-nodes-config.yaml b/puppet/all-nodes-config.yaml +index 2bc519b..98283c2 100644 +--- a/puppet/all-nodes-config.yaml ++++ b/puppet/all-nodes-config.yaml +@@ -8,6 +8,8 @@ parameters: + type: comma_delimited_list + controller_ips: + type: comma_delimited_list ++ opendaylight_ip: ++ type: comma_delimited_list + block_storage_hosts: + type: comma_delimited_list + object_storage_hosts: +@@ -82,6 +84,10 @@ resources: + raw_data: {get_file: hieradata/RedHat.yaml} + all_nodes: + mapped_data: ++ opendaylight_controller_ip: ++ list_join: ++ - ',' ++ - {get_param: opendaylight_ip} + controller_node_ips: + list_join: + - ',' +diff --git a/puppet/compute.yaml b/puppet/compute.yaml +index e259cff..5527669 100644 +--- a/puppet/compute.yaml ++++ b/puppet/compute.yaml +@@ -213,6 +213,23 @@ parameters: + NtpServer: + type: string + default: '' ++ OpenDaylightPort: ++ default: 8081 ++ description: Set opendaylight service port ++ type: number ++ OpenDaylightUsername: ++ default: 'admin' ++ description: The username for the opendaylight server. ++ type: string ++ OpenDaylightPassword: ++ default: 'admin' ++ type: string ++ description: The password for the opendaylight server. ++ hidden: true ++ ONOSPort: ++ default: 8181 ++ description: Set onos service port ++ type: number + RabbitHost: + type: string + default: '' # Has to be here because of the ignored empty value bug +@@ -415,6 +432,10 @@ resources: + neutron::rabbit_user: {get_input: rabbit_username} + neutron::rabbit_use_ssl: {get_input: rabbit_client_use_ssl} + neutron::rabbit_port: {get_input: rabbit_client_port} ++ opendaylight_port: {get_input: opendaylight_port} ++ opendaylight_username: {get_input: opendaylight_username} ++ opendaylight_password: {get_input: opendaylight_password} ++ onos_port: {get_input: onos_port} + neutron_flat_networks: {get_input: neutron_flat_networks} + neutron_host: {get_input: neutron_host} + neutron::agents::ml2::ovs::local_ip: {get_input: neutron_local_ip} +@@ -468,6 +489,10 @@ resources: + snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName} + snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword} + glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]} ++ opendaylight_port: {get_param: OpenDaylightPort} ++ opendaylight_username: {get_param: OpenDaylightUsername} ++ opendaylight_password: {get_param: OpenDaylightPassword} ++ onos_port: {get_param: ONOSPort} + neutron_flat_networks: {get_param: NeutronFlatNetworks} + neutron_host: {get_param: NeutronHost} + neutron_local_ip: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, NeutronTenantNetwork]}]} +diff --git a/puppet/controller.yaml b/puppet/controller.yaml +index fdc1821..865a838 100644 +--- a/puppet/controller.yaml ++++ b/puppet/controller.yaml +@@ -443,6 +443,27 @@ parameters: + NtpServer: + type: string + default: '' ++ OpenDaylightPort: ++ default: 8081 ++ description: Set opendaylight service port ++ type: number ++ OpenDaylightInstall: ++ default: false ++ description: Whether to install OpenDaylight on the control nodes. ++ type: boolean ++ OpenDaylightUsername: ++ default: 'admin' ++ description: The username for the opendaylight server. ++ type: string ++ OpenDaylightPassword: ++ default: 'admin' ++ type: string ++ description: The password for the opendaylight server. ++ hidden: true ++ ONOSPort: ++ default: 8181 ++ description: Set onos service port ++ type: number + PcsdPassword: + type: string + description: The password for the 'pcsd' user. +@@ -819,6 +840,11 @@ resources: + template: tripleo-CLUSTER + params: + CLUSTER: {get_param: MysqlClusterUniquePart} ++ opendaylight_port: {get_param: OpenDaylightPort} ++ opendaylight_install: {get_param: OpenDaylightInstall} ++ opendaylight_username: {get_param: OpenDaylightUsername} ++ opendaylight_password: {get_param: OpenDaylightPassword} ++ onos_port: {get_param: ONOSPort} + neutron_flat_networks: {get_param: NeutronFlatNetworks} + neutron_metadata_proxy_shared_secret: {get_param: NeutronMetadataProxySharedSecret} + neutron_agent_mode: {get_param: NeutronAgentMode} +@@ -1151,6 +1177,15 @@ resources: + mysql_bind_host: {get_input: mysql_network} + mysql_virtual_ip: {get_input: mysql_virtual_ip} + ++ # OpenDaylight ++ opendaylight_port: {get_input: opendaylight_port} ++ opendaylight_install: {get_input: opendaylight_install} ++ opendaylight_username: {get_input: opendaylight_username} ++ opendaylight_password: {get_input: opendaylight_password} ++ ++ # ONOS ++ onos_port: {get_input: onos_port} ++ + # Neutron + neutron::bind_host: {get_input: neutron_api_network} + neutron::rabbit_password: {get_input: rabbit_password} +diff --git a/puppet/manifests/overcloud_compute.pp b/puppet/manifests/overcloud_compute.pp +index cd41cc7..b8336ee 100644 +--- a/puppet/manifests/overcloud_compute.pp ++++ b/puppet/manifests/overcloud_compute.pp +@@ -75,9 +75,36 @@ class { '::neutron::plugins::ml2': + tenant_network_types => [hiera('neutron_tenant_network_type')], + } + +-class { '::neutron::agents::ml2::ovs': +- bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), +- tunnel_types => split(hiera('neutron_tunnel_types'), ','), ++if 'opendaylight' in hiera('neutron_mechanism_drivers') { ++ ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ $controller_ips = split(hiera('controller_node_ips'), ',') ++ $opendaylight_controller_ip = $controller_ips[0] ++ } else { ++ $opendaylight_controller_ip = hiera('opendaylight_controller_ip') ++ } ++ ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ class { 'neutron::plugins::ovs::opendaylight': ++ odl_controller_ip => $opendaylight_controller_ip, ++ tunnel_ip => hiera('neutron::agents::ml2::ovs::local_ip'), ++ odl_port => hiera('opendaylight_port'), ++ odl_username => hiera('opendaylight_username'), ++ odl_password => hiera('opendaylight_password'), ++ } ++ } ++ ++} elsif 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ $controller_ips = split(hiera('controller_node_ips'), ',') ++ class {'onos::ovs_computer': ++ manager_ip => $controller_ips[0] ++ } ++ ++} else { ++ class { 'neutron::agents::ml2::ovs': ++ bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), ++ tunnel_types => split(hiera('neutron_tunnel_types'), ','), ++ } + } + + if 'cisco_n1kv' in hiera('neutron_mechanism_drivers') { +diff --git a/puppet/manifests/overcloud_controller.pp b/puppet/manifests/overcloud_controller.pp +index 1b0429b..d3f3d2d 100644 +--- a/puppet/manifests/overcloud_controller.pp ++++ b/puppet/manifests/overcloud_controller.pp +@@ -30,6 +30,20 @@ if hiera('step') >= 1 { + + if hiera('step') >= 2 { + ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ class {"opendaylight": ++ extra_features => ['odl-ovsdb-openstack'], ++ odl_rest_port => hiera('opendaylight_port'), ++ } ++ } ++ ++ if 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ # install onos and config ovs ++ class {"onos": ++ controllers_ip => $controller_node_ips ++ } ++ } ++ + if count(hiera('ntp::servers')) > 0 { + include ::ntp + } +@@ -223,9 +237,7 @@ + include ::nova::scheduler + include ::nova::scheduler::filter + +- include ::neutron + include ::neutron::server +- include ::neutron::agents::l3 + include ::neutron::agents::dhcp + include ::neutron::agents::metadata + +@@ -238,15 +250,71 @@ if hiera('step') >= 3 { + require => Package['neutron'], + } + ++ if 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ # config neutron service_plugins to onos driver ++ class { '::neutron': ++ service_plugins => [hiera('neutron_service_plugins')] ++ } ++ } else { ++ include ::neutron ++ include ::neutron::agents::l3 ++ } ++ + class { '::neutron::plugins::ml2': + flat_networks => split(hiera('neutron_flat_networks'), ','), + tenant_network_types => [hiera('neutron_tenant_network_type')], + mechanism_drivers => [hiera('neutron_mechanism_drivers')], + } +- class { '::neutron::agents::ml2::ovs': +- bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), +- tunnel_types => split(hiera('neutron_tunnel_types'), ','), ++ ++ if 'opendaylight' in hiera('neutron_mechanism_drivers') { ++ ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ $controller_ips = split(hiera('controller_node_ips'), ',') ++ $opendaylight_controller_ip = $controller_ips[0] ++ } else { ++ $opendaylight_controller_ip = hiera('opendaylight_controller_ip') ++ } ++ ++ class { 'neutron::plugins::ml2::opendaylight': ++ odl_controller_ip => $opendaylight_controller_ip, ++ odl_username => hiera('opendaylight_username'), ++ odl_password => hiera('opendaylight_password'), ++ odl_port => hiera('opendaylight_port'), ++ } ++ ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ class { 'neutron::plugins::ovs::opendaylight': ++ odl_controller_ip => $opendaylight_controller_ip, ++ tunnel_ip => hiera('neutron::agents::ml2::ovs::local_ip'), ++ odl_port => hiera('opendaylight_port'), ++ odl_username => hiera('opendaylight_username'), ++ odl_password => hiera('opendaylight_password'), ++ } ++ } ++ Service['neutron-server'] -> Service['neutron-l3'] ++ ++ } elsif 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ #config ml2_conf.ini with onos url address ++ $onos_port = hiera('onos_port') ++ $private_ip = hiera('neutron::agents::ml2::ovs::local_ip') ++ ++ neutron_plugin_ml2 { ++ 'onos/username': value => 'admin'; ++ 'onos/password': value => 'admin'; ++ 'onos/url_path': value => "http://${controller_node_ips[0]}:${onos_port}/onos/vtn"; ++ } ++ ++ } else { ++ ++ class { 'neutron::agents::ml2::ovs': ++ bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), ++ tunnel_types => split(hiera('neutron_tunnel_types'), ','), ++ } ++ ++ Service['neutron-server'] -> Service['neutron-ovs-agent-service'] ++ Service['neutron-server'] -> Service['neutron-l3'] + } ++ + if 'cisco_n1kv' in hiera('neutron_mechanism_drivers') { + include ::neutron::plugins::ml2::cisco::nexus1000v + +@@ -281,8 +349,6 @@ if hiera('step') >= 3 { + } + + Service['neutron-server'] -> Service['neutron-dhcp-service'] +- Service['neutron-server'] -> Service['neutron-l3'] +- Service['neutron-server'] -> Service['neutron-ovs-agent-service'] + Service['neutron-server'] -> Service['neutron-metadata'] + + include ::cinder +diff --git a/puppet/manifests/overcloud_controller_pacemaker.pp b/puppet/manifests/overcloud_controller_pacemaker.pp +index 863cc5f..5b1c37a 100644 +--- a/puppet/manifests/overcloud_controller_pacemaker.pp ++++ b/puppet/manifests/overcloud_controller_pacemaker.pp +@@ -380,6 +380,20 @@ if hiera('step') >= 2 { + + } + ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ class {"opendaylight": ++ extra_features => ['odl-ovsdb-openstack'], ++ odl_rest_port => hiera('opendaylight_port'), ++ } ++ } ++ ++ if 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ # install onos and config ovs ++ class {"onos": ++ controllers_ip => $controller_node_ips ++ } ++ } ++ + exec { 'galera-ready' : + command => '/usr/bin/clustercheck >/dev/null', + timeout => 30, +@@ -584,7 +598,14 @@ if hiera('step') >= 3 { + include ::nova::network::neutron + + # Neutron class definitions +- include ::neutron ++ if 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ # config neutron service_plugins to onos driver ++ class { '::neutron': ++ service_plugins => [hiera('neutron_service_plugins')] ++ } ++ } else { ++ include ::neutron ++ } + class { '::neutron::server' : + sync_db => $sync_db, + manage_service => false, +@@ -595,10 +616,6 @@ if hiera('step') >= 3 { + manage_service => false, + enabled => false, + } +- class { '::neutron::agents::l3' : +- manage_service => false, +- enabled => false, +- } + class { '::neutron::agents::metadata': + manage_service => false, + enabled => false, +@@ -610,18 +627,66 @@ if hiera('step') >= 3 { + notify => Service['neutron-dhcp-service'], + require => Package['neutron'], + } ++ + class { '::neutron::plugins::ml2': + flat_networks => split(hiera('neutron_flat_networks'), ','), + tenant_network_types => [hiera('neutron_tenant_network_type')], + mechanism_drivers => [hiera('neutron_mechanism_drivers')], + } +- class { '::neutron::agents::ml2::ovs': +- manage_service => false, +- enabled => false, +- bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), +- tunnel_types => split(hiera('neutron_tunnel_types'), ','), +- } ++ if 'opendaylight' in hiera('neutron_mechanism_drivers') { ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ $controller_ips = split(hiera('controller_node_ips'), ',') ++ $opendaylight_controller_ip = $controller_ips[0] ++ } else { ++ $opendaylight_controller_ip = hiera('opendaylight_controller_ip') ++ } ++ ++ $opendaylight_port = hiera('opendaylight_port') ++ $private_ip = hiera('neutron::agents::ml2::ovs::local_ip') ++ ++ class { 'neutron::plugins::ml2::opendaylight': ++ odl_controller_ip => $opendaylight_controller_ip, ++ odl_username => hiera('opendaylight_username'), ++ odl_password => hiera('opendaylight_password'), ++ odl_port => hiera('opendaylight_port'), ++ } ++ ++ if str2bool(hiera('opendaylight_install', 'false')) { ++ class { 'neutron::plugins::ovs::opendaylight': ++ odl_controller_ip => $opendaylight_controller_ip, ++ tunnel_ip => hiera('neutron::agents::ml2::ovs::local_ip'), ++ odl_port => hiera('opendaylight_port'), ++ odl_username => hiera('opendaylight_username'), ++ odl_password => hiera('opendaylight_password'), ++ } ++ } ++ class { '::neutron::agents::l3' : ++ manage_service => false, ++ enabled => false, ++ } ++ } elsif 'onos_ml2' in hiera('neutron_mechanism_drivers') { ++ #config ml2_conf.ini with onos url address ++ $onos_port = hiera('onos_port') ++ $private_ip = hiera('neutron::agents::ml2::ovs::local_ip') ++ ++ neutron_plugin_ml2 { ++ 'onos/username': value => 'admin'; ++ 'onos/password': value => 'admin'; ++ 'onos/url_path': value => "http://${controller_node_ips[0]}:${onos_port}/onos/vtn"; ++ } + ++ } else { ++ class { '::neutron::agents::l3' : ++ manage_service => false, ++ enabled => false, ++ } ++ class { 'neutron::agents::ml2::ovs': ++ manage_service => false, ++ enabled => false, ++ bridge_mappings => split(hiera('neutron_bridge_mappings'), ','), ++ tunnel_types => split(hiera('neutron_tunnel_types'), ','), ++ } ++ } + if 'cisco_ucsm' in hiera('neutron_mechanism_drivers') { + include ::neutron::plugins::ml2::cisco::ucsm + } +@@ -646,8 +711,10 @@ if hiera('step') >= 3 { + if hiera('neutron_enable_bigswitch_ml2', false) { + include ::neutron::plugins::ml2::bigswitch::restproxy + } +- neutron_l3_agent_config { +- 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false); ++ if !('onos_ml2' in hiera('neutron_mechanism_drivers')) { ++ neutron_l3_agent_config { ++ 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false); ++ } + } + neutron_dhcp_agent_config { + 'DEFAULT/ovs_use_veth': value => hiera('neutron_ovs_use_veth', false); +@@ -1073,62 +1140,21 @@ if hiera('step') >= 4 { + require => Pacemaker::Resource::Service[$::keystone::params::service_name] + } + } +- pacemaker::resource::service { $::neutron::params::l3_agent_service: +- clone_params => 'interleave=true', ++ if !('onos_ml2' in hiera('neutron_mechanism_drivers')) { ++ pacemaker::resource::service { $::neutron::params::l3_agent_service: ++ clone_params => 'interleave=true', ++ } + } + pacemaker::resource::service { $::neutron::params::dhcp_agent_service: + clone_params => 'interleave=true', + } +- pacemaker::resource::service { $::neutron::params::ovs_agent_service: +- clone_params => 'interleave=true', +- } + pacemaker::resource::service { $::neutron::params::metadata_agent_service: + clone_params => 'interleave=true', + } +- pacemaker::resource::ocf { $::neutron::params::ovs_cleanup_service: +- ocf_agent_name => 'neutron:OVSCleanup', +- clone_params => 'interleave=true', +- } + pacemaker::resource::ocf { 'neutron-netns-cleanup': + ocf_agent_name => 'neutron:NetnsCleanup', + clone_params => 'interleave=true', + } +- +- # neutron - one chain ovs-cleanup-->netns-cleanup-->ovs-agent +- pacemaker::constraint::base { 'neutron-ovs-cleanup-to-netns-cleanup-constraint': +- constraint_type => 'order', +- first_resource => "${::neutron::params::ovs_cleanup_service}-clone", +- second_resource => 'neutron-netns-cleanup-clone', +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Ocf[$::neutron::params::ovs_cleanup_service], +- Pacemaker::Resource::Ocf['neutron-netns-cleanup']], +- } +- pacemaker::constraint::colocation { 'neutron-ovs-cleanup-to-netns-cleanup-colocation': +- source => 'neutron-netns-cleanup-clone', +- target => "${::neutron::params::ovs_cleanup_service}-clone", +- score => 'INFINITY', +- require => [Pacemaker::Resource::Ocf[$::neutron::params::ovs_cleanup_service], +- Pacemaker::Resource::Ocf['neutron-netns-cleanup']], +- } +- pacemaker::constraint::base { 'neutron-netns-cleanup-to-openvswitch-agent-constraint': +- constraint_type => 'order', +- first_resource => 'neutron-netns-cleanup-clone', +- second_resource => "${::neutron::params::ovs_agent_service}-clone", +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Ocf['neutron-netns-cleanup'], +- Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]], +- } +- pacemaker::constraint::colocation { 'neutron-netns-cleanup-to-openvswitch-agent-colocation': +- source => "${::neutron::params::ovs_agent_service}-clone", +- target => 'neutron-netns-cleanup-clone', +- score => 'INFINITY', +- require => [Pacemaker::Resource::Ocf['neutron-netns-cleanup'], +- Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]], +- } +- +- #another chain keystone-->neutron-server-->ovs-agent-->dhcp-->l3 + pacemaker::constraint::base { 'keystone-to-neutron-server-constraint': + constraint_type => 'order', + first_resource => "${::keystone::params::service_name}-clone", +@@ -1138,65 +1164,110 @@ if hiera('step') >= 4 { + require => [Pacemaker::Resource::Service[$::keystone::params::service_name], + Pacemaker::Resource::Service[$::neutron::params::server_service]], + } +- pacemaker::constraint::base { 'neutron-server-to-openvswitch-agent-constraint': +- constraint_type => 'order', +- first_resource => "${::neutron::params::server_service}-clone", +- second_resource => "${::neutron::params::ovs_agent_service}-clone", +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Service[$::neutron::params::server_service], +- Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]], +- } +- pacemaker::constraint::base { 'neutron-openvswitch-agent-to-dhcp-agent-constraint': +- constraint_type => 'order', +- first_resource => "${::neutron::params::ovs_agent_service}-clone", +- second_resource => "${::neutron::params::dhcp_agent_service}-clone", +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]], ++ if 'openvswitch' in hiera('neutron_mechanism_drivers') { ++ pacemaker::resource::service { $::neutron::params::ovs_agent_service: ++ clone_params => "interleave=true", ++ } ++ pacemaker::resource::ocf { $::neutron::params::ovs_cleanup_service: ++ ocf_agent_name => "neutron:OVSCleanup", ++ clone_params => "interleave=true", ++ } ++ # neutron - one chain ovs-cleanup-->netns-cleanup-->ovs-agent ++ pacemaker::constraint::base { 'neutron-ovs-cleanup-to-netns-cleanup-constraint': ++ constraint_type => "order", ++ first_resource => "${::neutron::params::ovs_cleanup_service}-clone", ++ second_resource => "neutron-netns-cleanup-clone", ++ first_action => "start", ++ second_action => "start", ++ require => [Pacemaker::Resource::Ocf["${::neutron::params::ovs_cleanup_service}"], ++ Pacemaker::Resource::Ocf['neutron-netns-cleanup']], ++ } ++ pacemaker::constraint::colocation { 'neutron-ovs-cleanup-to-netns-cleanup-colocation': ++ source => "neutron-netns-cleanup-clone", ++ target => "${::neutron::params::ovs_cleanup_service}-clone", ++ score => "INFINITY", ++ require => [Pacemaker::Resource::Ocf["${::neutron::params::ovs_cleanup_service}"], ++ Pacemaker::Resource::Ocf['neutron-netns-cleanup']], ++ } ++ pacemaker::constraint::base { 'neutron-netns-cleanup-to-openvswitch-agent-constraint': ++ constraint_type => "order", ++ first_resource => "neutron-netns-cleanup-clone", ++ second_resource => "${::neutron::params::ovs_agent_service}-clone", ++ first_action => "start", ++ second_action => "start", ++ require => [Pacemaker::Resource::Ocf["neutron-netns-cleanup"], ++ Pacemaker::Resource::Service["${::neutron::params::ovs_agent_service}"]], ++ } ++ pacemaker::constraint::colocation { 'neutron-netns-cleanup-to-openvswitch-agent-colocation': ++ source => "${::neutron::params::ovs_agent_service}-clone", ++ target => "neutron-netns-cleanup-clone", ++ score => "INFINITY", ++ require => [Pacemaker::Resource::Ocf["neutron-netns-cleanup"], ++ Pacemaker::Resource::Service["${::neutron::params::ovs_agent_service}"]], ++ } + ++ #another chain keystone-->neutron-server-->ovs-agent-->dhcp-->l3 ++ pacemaker::constraint::base { 'neutron-server-to-openvswitch-agent-constraint': ++ constraint_type => "order", ++ first_resource => "${::neutron::params::server_service}-clone", ++ second_resource => "${::neutron::params::ovs_agent_service}-clone", ++ first_action => "start", ++ second_action => "start", ++ require => [Pacemaker::Resource::Service[$::neutron::params::server_service], ++ Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service]], ++ } ++ pacemaker::constraint::base { 'neutron-openvswitch-agent-to-dhcp-agent-constraint': ++ constraint_type => "order", ++ first_resource => "${::neutron::params::ovs_agent_service}-clone", ++ second_resource => "${::neutron::params::dhcp_agent_service}-clone", ++ first_action => "start", ++ second_action => "start", ++ require => [Pacemaker::Resource::Service["${::neutron::params::ovs_agent_service}"], ++ Pacemaker::Resource::Service["${::neutron::params::dhcp_agent_service}"]], ++ ++ } ++ pacemaker::constraint::colocation { 'neutron-openvswitch-agent-to-dhcp-agent-colocation': ++ source => "${::neutron::params::dhcp_agent_service}-clone", ++ target => "${::neutron::params::ovs_agent_service}-clone", ++ score => "INFINITY", ++ require => [Pacemaker::Resource::Service["${::neutron::params::ovs_agent_service}"], ++ Pacemaker::Resource::Service["${::neutron::params::dhcp_agent_service}"]], ++ } + } +- pacemaker::constraint::colocation { 'neutron-openvswitch-agent-to-dhcp-agent-colocation': +- source => "${::neutron::params::dhcp_agent_service}-clone", +- target => "${::neutron::params::ovs_agent_service}-clone", +- score => 'INFINITY', +- require => [Pacemaker::Resource::Service[$::neutron::params::ovs_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service]], +- } +- pacemaker::constraint::base { 'neutron-dhcp-agent-to-l3-agent-constraint': +- constraint_type => 'order', +- first_resource => "${::neutron::params::dhcp_agent_service}-clone", +- second_resource => "${::neutron::params::l3_agent_service}-clone", +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]], +- } +- pacemaker::constraint::colocation { 'neutron-dhcp-agent-to-l3-agent-colocation': +- source => "${::neutron::params::l3_agent_service}-clone", +- target => "${::neutron::params::dhcp_agent_service}-clone", +- score => 'INFINITY', +- require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]], +- } +- pacemaker::constraint::base { 'neutron-l3-agent-to-metadata-agent-constraint': +- constraint_type => 'order', +- first_resource => "${::neutron::params::l3_agent_service}-clone", +- second_resource => "${::neutron::params::metadata_agent_service}-clone", +- first_action => 'start', +- second_action => 'start', +- require => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]], +- } +- pacemaker::constraint::colocation { 'neutron-l3-agent-to-metadata-agent-colocation': +- source => "${::neutron::params::metadata_agent_service}-clone", +- target => "${::neutron::params::l3_agent_service}-clone", +- score => 'INFINITY', +- require => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service], +- Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]], ++ if !('onos_ml2' in hiera('neutron_mechanism_drivers')) { ++ pacemaker::constraint::base { 'neutron-dhcp-agent-to-l3-agent-constraint': ++ constraint_type => 'order', ++ first_resource => "${::neutron::params::dhcp_agent_service}-clone", ++ second_resource => "${::neutron::params::l3_agent_service}-clone", ++ first_action => 'start', ++ second_action => 'start', ++ require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service], ++ Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]], ++ } ++ pacemaker::constraint::colocation { 'neutron-dhcp-agent-to-l3-agent-colocation': ++ source => "${::neutron::params::l3_agent_service}-clone", ++ target => "${::neutron::params::dhcp_agent_service}-clone", ++ score => 'INFINITY', ++ require => [Pacemaker::Resource::Service[$::neutron::params::dhcp_agent_service], ++ Pacemaker::Resource::Service[$::neutron::params::l3_agent_service]], ++ } ++ pacemaker::constraint::base { 'neutron-l3-agent-to-metadata-agent-constraint': ++ constraint_type => 'order', ++ first_resource => "${::neutron::params::l3_agent_service}-clone", ++ second_resource => "${::neutron::params::metadata_agent_service}-clone", ++ first_action => 'start', ++ second_action => 'start', ++ require => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service], ++ Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]], ++ } ++ pacemaker::constraint::colocation { 'neutron-l3-agent-to-metadata-agent-colocation': ++ source => "${::neutron::params::metadata_agent_service}-clone", ++ target => "${::neutron::params::l3_agent_service}-clone", ++ score => 'INFINITY', ++ require => [Pacemaker::Resource::Service[$::neutron::params::l3_agent_service], ++ Pacemaker::Resource::Service[$::neutron::params::metadata_agent_service]], ++ } + } +- + # Nova + pacemaker::resource::service { $::nova::params::api_service_name : + clone_params => 'interleave=true', +diff --git a/puppet/manifests/overcloud_opendaylight.pp b/puppet/manifests/overcloud_opendaylight.pp +new file mode 100644 +index 0000000..aea6568 +--- /dev/null ++++ b/puppet/manifests/overcloud_opendaylight.pp +@@ -0,0 +1,26 @@ ++# Copyright 2015 Red Hat, Inc. ++# All Rights Reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); you may ++# not use this file except in compliance with the License. You may obtain ++# a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ++# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ++# License for the specific language governing permissions and limitations ++# under the License. ++ ++include ::tripleo::packages ++ ++if count(hiera('ntp::servers')) > 0 { ++ include ::ntp ++} ++ ++class {"opendaylight": ++ extra_features => ['odl-ovsdb-openstack'], ++ odl_rest_port => hiera('opendaylight_port'), ++} ++ +diff --git a/puppet/opendaylight-puppet.yaml b/puppet/opendaylight-puppet.yaml +new file mode 100644 +index 0000000..70f2543 +--- /dev/null ++++ b/puppet/opendaylight-puppet.yaml +@@ -0,0 +1,209 @@ ++heat_template_version: 2015-04-30 ++ ++description: > ++ OpenDaylight node configured by Puppet. ++ ++parameters: ++ OpenDaylightFlavor: ++ default: baremetal ++ description: The flavor to use for the OpenDaylight node ++ type: string ++ OpenDaylightImage: ++ default: overcloud-full ++ description: The image to use for the OpenDaylight node ++ type: string ++ OpenDaylightHostname: ++ default: opendaylight-server ++ description: The hostname to use for the OpenDaylight node ++ type: string ++ OpenDaylightUsername: ++ default: admin ++ description: The admin user for the OpenDaylight node ++ type: string ++ OpenDaylightPassword: ++ default: '' ++ description: The admin password for the OpenDaylight node ++ type: string ++ hidden: true ++ OpenDaylightPort: ++ default: 8081 ++ description: Set OpenDaylight service port ++ type: number ++ KeyName: ++ description: The keypair to use for SSH access to the node (via heat-admin user) ++ type: string ++ default: default ++ constraints: ++ - custom_constraint: nova.keypair ++ ImageUpdatePolicy: ++ default: 'REBUILD_PRESERVE_EPHEMERAL' ++ description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt. ++ type: string ++ UpdateIdentifier: ++ default: '' ++ type: string ++ description: > ++ Setting to a previously unused value during stack-update will trigger ++ package update on all nodes ++ NtpServer: ++ type: string ++ default: '' ++ PublicInterface: ++ default: nic1 ++ description: What interface to bridge onto br-ex for network nodes. ++ type: string ++ ++resources: ++ OpenDaylightNode: ++ type: OS::Nova::Server ++ properties: ++ image: {get_param: OpenDaylightImage} ++ image_update_policy: {get_param: ImageUpdatePolicy} ++ flavor: {get_param: OpenDaylightFlavor} ++ key_name: {get_param: KeyName} ++ networks: ++ - network: ctlplane ++ user_data_format: SOFTWARE_CONFIG ++ user_data: {get_resource: NodeUserData} ++ name: {get_param: OpenDaylightHostname} ++ ++ NodeUserData: ++ type: OS::TripleO::NodeUserData ++ ++ ExternalPort: ++ type: OS::TripleO::Controller::Ports::ExternalPort ++ properties: ++ ControlPlaneIP: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ ++ InternalApiPort: ++ type: OS::TripleO::Controller::Ports::InternalApiPort ++ properties: ++ ControlPlaneIP: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ ++ NetIpMap: ++ type: OS::TripleO::Network::Ports::NetIpMap ++ properties: ++ ControlPlaneIp: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ ExternalIp: {get_attr: [ExternalPort, ip_address]} ++ InternalApiIp: {get_attr: [InternalApiPort, ip_address]} ++ ++ NetIpSubnetMap: ++ type: OS::TripleO::Network::Ports::NetIpSubnetMap ++ properties: ++ ControlPlaneIp: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]} ++ InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]} ++ ++ NetworkConfig: ++ type: OS::TripleO::Controller::Net::SoftwareConfig ++ properties: ++ ControlPlaneIp: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]} ++ InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]} ++ ++ NetworkDeployment: ++ type: OS::TripleO::SoftwareDeployment ++ properties: ++ config: {get_resource: NetworkConfig} ++ server: {get_resource: OpenDaylightNode} ++ input_values: ++ bridge_name: br-ex ++ interface_name: {get_param: PublicInterface} ++ ++ OpenDaylightDeployment: ++ type: OS::TripleO::SoftwareDeployment ++ depends_on: NetworkDeployment ++ properties: ++ config: {get_resource: OpenDaylightConfig} ++ server: {get_resource: OpenDaylightNode} ++ input_values: ++ ntp_servers: ++ str_replace: ++ template: '["server"]' ++ params: ++ server: {get_param: NtpServer} ++ opendaylight_port: {get_param: OpenDaylightPort} ++ ++ OpenDaylightConfig: ++ type: OS::Heat::StructuredConfig ++ properties: ++ group: os-apply-config ++ config: ++ hiera: ++ hierarchy: ++ - '"%{::uuid}"' ++ - heat_config_%{::deploy_config_name} ++ - extraconfig ++ - bootstrap_node # provided by BootstrapNodeConfig ++ - all_nodes # provided by allNodesConfig ++ - vip_data # provided by vip-config ++ - RedHat # Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1236143 ++ - common ++ datafiles: ++ common: ++ raw_data: {get_file: hieradata/common.yaml} ++ mapped_data: ++ ntp::servers: {get_input: ntp_servers} ++ opendaylight::admin_username: {get_param: OpenDaylightUsername} ++ opendaylight::admin_password: {get_param: OpenDaylightPassword} ++ opendaylight_port: {get_input: opendaylight_port} ++ ceph: ++ raw_data: {get_file: hieradata/ceph.yaml} ++ ++ UpdateConfig: ++ type: OS::TripleO::Tasks::PackageUpdate ++ ++ UpdateDeployment: ++ type: OS::Heat::SoftwareDeployment ++ properties: ++ config: {get_resource: UpdateConfig} ++ server: {get_resource: OpenDaylightNode} ++ input_values: ++ update_identifier: ++ get_param: UpdateIdentifier ++ ++ OpenDaylightHostsConfig: ++ type: OS::Heat::SoftwareConfig ++ properties: ++ group: script ++ config: | ++ #!/usr/bin/env bash ++ echo -e "$(facter ipaddress)\t\t$(hostname -f)\t$(hostname -s)" >> /etc/hosts ++ ++ OpenDaylightHostsDeployment: ++ type: OS::Heat::StructuredDeployment ++ depends_on: OpenDaylightDeployment ++ properties: ++ server: {get_resource: OpenDaylightNode} ++ config: {get_resource: OpenDaylightHostsConfig} ++ ++ OpenDaylightPuppetConfig: ++ type: OS::Heat::SoftwareConfig ++ properties: ++ group: puppet ++ config: ++ get_file: manifests/overcloud_opendaylight.pp ++ ++ OpenDaylightPuppetDeployment: ++ depends_on: OpenDaylightHostsDeployment ++ type: OS::Heat::StructuredDeployment ++ properties: ++ server: {get_resource: OpenDaylightNode} ++ config: {get_resource: OpenDaylightPuppetConfig} ++ input_values: ++ update_identifier: {get_param: UpdateIdentifier} ++ ++outputs: ++ ip_address: ++ description: IP address of the server in the ctlplane network ++ value: {get_attr: [OpenDaylightNode, networks, ctlplane, 0]} ++ opendaylight_controller_ip: ++ description: IP address of the server on the internal network ++ value: {get_attr: [InternalApiPort, ip_address]} ++ config_identifier: ++ description: identifier which changes if the node configuration may need re-applying ++ value: ++ list_join: ++ - ',' ++ - - {get_attr: [OpenDaylightDeployment, deploy_stdout]} ++ - {get_param: UpdateIdentifier} +-- +2.5.0 + diff --git a/framework/scripts/installer/apex/puppet-onos.rar b/framework/scripts/installer/apex/puppet-onos.rar new file mode 100644 index 00000000..fcb14faa Binary files /dev/null and b/framework/scripts/installer/apex/puppet-onos.rar differ diff --git a/framework/scripts/installer/compass/onos_cluster/files/install_jdk8.tar b/framework/scripts/installer/compass/onos_cluster/files/install_jdk8.tar new file mode 100755 index 00000000..faaaeb39 Binary files /dev/null and b/framework/scripts/installer/compass/onos_cluster/files/install_jdk8.tar differ diff --git a/framework/scripts/installer/compass/onos_cluster/files/networking-onos.tar b/framework/scripts/installer/compass/onos_cluster/files/networking-onos.tar new file mode 100644 index 00000000..9358199c Binary files /dev/null and b/framework/scripts/installer/compass/onos_cluster/files/networking-onos.tar differ diff --git a/framework/scripts/installer/compass/onos_cluster/handlers/main.yml b/framework/scripts/installer/compass/onos_cluster/handlers/main.yml new file mode 100755 index 00000000..c8742dd5 --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: restart onos service + service: name=onos state=restarted enabled=yes diff --git a/framework/scripts/installer/compass/onos_cluster/tasks/main.yml b/framework/scripts/installer/compass/onos_cluster/tasks/main.yml new file mode 100755 index 00000000..3cd4421b --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/tasks/main.yml @@ -0,0 +1,44 @@ +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: remove neutron-plugin-openvswitch-agent auto start + shell: > + update-rc.d neutron-plugin-openvswitch-agent remove; + sed -i /neutron-plugin-openvswitch-agent/d /opt/service + when: groups['onos']|length !=0 + ignore_errors: True + +- name: shut down and disable Neutron's agent services + service: name=neutron-plugin-openvswitch-agent state=stopped + when: groups['onos']|length !=0 + ignore_errors: True + +- name: remove neutron-l3-agent auto start + shell: > + update-rc.d neutron-l3-agent remove; + sed -i /neutron-l3-agent/d /opt/service + when: inventory_hostname in groups['onos'] + ignore_errors: True + +- name: shut down and disable Neutron's l3 agent services + service: name=neutron-l3-agent state=stopped + when: inventory_hostname in groups['onos'] + ignore_errors: True + +- name: Stop the Open vSwitch service and clear existing OVSDB + shell: > + ovs-vsctl del-br br-int ; + ovs-vsctl del-br br-tun ; + ovs-vsctl del-manager ; + when: groups['onos']|length !=0 + ignore_errors: True + +- name: Install ONOS Cluster on Controller + include: onos_controller.yml + when: inventory_hostname in groups['onos'] + +- name: Install ONOS Cluster on Compute + include: openvswitch.yml + when: groups['onos']|length !=0 +# when: groups['onos']|length !=0 and inventory_hostname not in groups['onos'] + diff --git a/framework/scripts/installer/compass/onos_cluster/tasks/onos_controller.yml b/framework/scripts/installer/compass/onos_cluster/tasks/onos_controller.yml new file mode 100755 index 00000000..0606fad9 --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/tasks/onos_controller.yml @@ -0,0 +1,146 @@ +--- +- name: upload onos driver package + unarchive: src=networking-onos.tar dest=/opt/ + +- name: install onos driver + command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh" + +- name: install onos required packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: packages + +- name: get image http server + shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf + register: http_server + +- name: download oracle-jdk8 package file + get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }} + +- name: upload install_jdk8 scripts + unarchive: src=install_jdk8.tar dest=/opt/ + +- name: install install_jdk8 package + command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" + +- name: create JAVA_HOME environment variable + shell: > + export J2SDKDIR=/usr/lib/jvm/java-8-oracle; + export J2REDIR=/usr/lib/jvm/java-8-oracle/jre; + export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin; + export JAVA_HOME=/usr/lib/jvm/java-8-oracle; + export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db; + +- name: create onos group + group: name=onos system=yes state=present + +- name: create onos user + user: + name: onos + group: onos + home: "{{ onos_home }}" + createhome: "yes" + system: "yes" + shell: "/bin/false" + +- name: download onos package + get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_pkg_name }}" dest=/opt/{{ onos_pkg_name }} + +- name: create new jar repository + command: su -s /bin/sh -c "mkdir ~/.m2" + +- name: download jar repository + get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/repository.tar" dest=~/.m2/ + +- name: extract jar repository + command: su -s /bin/sh -c "tar xvf ~/.m2/repository.tar -C ~/.m2/" + +- name: extract onos package + command: su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" onos + +- name: configure onos service + shell: > + echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options; + echo 'export ONOS_USER=root' >> {{ onos_home }}/options; + mkdir {{ onos_home }}/var; + mkdir {{ onos_home }}/config; + sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/init/onos.conf; + cp -rf {{ onos_home }}/init/onos.conf /etc/init/; + cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/; +# notify: +# - restart onos service + +- name: configure onos boot feature + shell: > + sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg; + +#- name: create cluster json +# template: +# src: cluster.json +# dest: "{{ onos_home }}/config/cluster.json" +# notify: +# - restart onos service + +#- name: create tablets json +# template: +# src: tablets.json +# dest: "{{ onos_home }}/config/tablets.json" +# notify: +# - restart onos service + +- name: wait for config time + shell: "sleep 10" + +- name: start onos service + service: name=onos state=started enabled=yes + +- name: wait for restart time + shell: "sleep 60" + +- name: start onos service + service: name=onos state=restarted enabled=yes + +- name: wait for onos start time + shell: "sleep 60" + +- name: start onos service + service: name=onos state=restarted enabled=yes + +- name: wait for onos start time + shell: "sleep 100" + +- name: add onos auto start + shell: > + echo "onos">>/opt/service + +########################################################################################################## +################################ ONOS connect with OpenStack ################################ +########################################################################################################## +#- name: Run OpenVSwitch Script +# include: openvswitch.yml + +- name: Configure Neutron1 + shell: > + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins onos_router; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos_ml2; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan + +- name: Create ML2 Configuration File + template: + src: ml2_conf.sh + dest: "/opt/ml2_conf.sh" + mode: 0777 + +- name: Configure Neutron2 + command: su -s /bin/sh -c "/opt/ml2_conf.sh;" + + +- name: Configure Neutron3 + shell: > + mysql -e "drop database if exists neutron_ml2;"; + mysql -e "create database neutron_ml2 character set utf8;"; + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';"; + su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron; + +- name: Restart neutron-server + service: name=neutron-server state=restarted diff --git a/framework/scripts/installer/compass/onos_cluster/tasks/openvswitch.yml b/framework/scripts/installer/compass/onos_cluster/tasks/openvswitch.yml new file mode 100755 index 00000000..f8ed551f --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/tasks/openvswitch.yml @@ -0,0 +1,83 @@ +--- +#- name: remove neutron-plugin-openvswitch-agent auto start +# shell: > +# update-rc.d neutron-plugin-openvswitch-agent remove; +# sed -i /neutron-plugin-openvswitch-agent/d /opt/service + +#- name: shut down and disable Neutron's agent services +# service: name=neutron-plugin-openvswitch-agent state=stopped + +#- name: Stop the Open vSwitch service and clear existing OVSDB +# shell: > +# ovs-vsctl del-br br-int ; +# ovs-vsctl del-br br-tun ; +# ovs-vsctl del-manager ; + +#- name: get image http server +# shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf +# register: http_server +# +#- name: download ovs +# get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/openvswitch.tar" dest=/opt/openvswitch.tar +# +#- name: extract ovs +# command: su -s /bin/sh -c "tar xvf /opt/openvswitch.tar -C /opt/" +# +#- name: update ovs +# shell: > +# cd /opt/openvswitch; +# dpkg -i openvswitch-common_2.3.0-1_amd64.deb; +# dpkg -i openvswitch-switch_2.3.0-1_amd64.deb; + +- name: start up onos-external nic + command: su -s /bin/sh -c "ifconfig eth2 0 up" + +#- name: wait for onos start time +# shell: "sleep 200" + +- name: add ovsdatabase feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'"; + when: inventory_hostname == groups['onos'][0] + +- name: add openflow-base feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'"; + when: inventory_hostname == groups['onos'][0] + +- name: add openflow feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'"; + when: inventory_hostname == groups['onos'][0] + +- name: add vtn feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'"; + when: inventory_hostname == groups['onos'][0] + + +- name: set public eth card start + command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n eth2'" + when: inventory_hostname == groups['onos'][0] + +- name: Set ONOS as the manager + command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:6640;" + +- name: create public network + shell: > + export OS_PASSWORD=console; + export OS_TENANT_NAME=admin; + export OS_AUTH_URL=http://{{ internal_vip.ip }}:35357/v2.0; + export OS_USERNAME=ADMIN; + neutron net-create ext-net --shared --router:external=True; + neutron subnet-create ext-net --name ext-subnet {{ public_net_info.floating_ip_cidr }}; + when: inventory_hostname == groups['controller'][0] + +- name: set gateway mac address + shell: > + ping -c 1 {{ ansible_default_ipv4.gateway }}; + gatewayMac=`arp -a {{ ansible_default_ipv4.gateway }} | awk '{print $4}'`; + /opt/onos/bin/onos "externalgateway-update -m $gatewayMac"; + when: inventory_hostname == groups['onos'][0] + +- name: delete default gateway + shell: > + route delete default; + when: inventory_hostname not in groups['onos'] + ignore_errors: True diff --git a/framework/scripts/installer/compass/onos_cluster/templates/cluster.json b/framework/scripts/installer/compass/onos_cluster/templates/cluster.json new file mode 100755 index 00000000..5982c434 --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/templates/cluster.json @@ -0,0 +1,10 @@ +{ "ipPrefix": "{{ ip_settings[groups['onos'][0]]['mgmt']['cidr'] }}", + "nodes":[ +{% for host in groups['onos'] %} + {% if loop.last %} + { "id": "{{ ip_settings[host]['mgmt']['ip'] }}", "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", "tcpPort": 9876 } + {% else %} + { "id": "{{ ip_settings[host]['mgmt']['ip'] }}", "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", "tcpPort": 9876 }, + {% endif %} +{% endfor %} +]} diff --git a/framework/scripts/installer/compass/onos_cluster/templates/ml2_conf.sh b/framework/scripts/installer/compass/onos_cluster/templates/ml2_conf.sh new file mode 100755 index 00000000..a9e61acb --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/templates/ml2_conf.sh @@ -0,0 +1,7 @@ +cat <> /etc/neutron/plugins/ml2/ml2_conf.ini +[onos] +password = admin +username = admin +url_path = http://{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:8181/onos/vtn +EOT + diff --git a/framework/scripts/installer/compass/onos_cluster/templates/tablets.json b/framework/scripts/installer/compass/onos_cluster/templates/tablets.json new file mode 100755 index 00000000..f71be71f --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/templates/tablets.json @@ -0,0 +1,63 @@ +{ + "nodes": [ +{% for host in groups['onos'] %} + {% if loop.last %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + } + {% else %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + }, + {% endif %} +{% endfor %} + ], + "partitions": { + {% set key = 1 %} + {% for host in groups['onos'] %} + {% if loop.last %} + "p{{ key }}":[ + {% for host in groups['onos'] %} + {% if loop.last %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + } + {% else %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + }, + {% endif %} + {% endfor %} + ] + {% set key = key + 1 %} + {% else %} + "p{{ key }}":[ + {% for host in groups['onos'] %} + {% if loop.last %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + } + {% else %} + { + "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", + "id": "{{ ip_settings[host]['mgmt']['ip'] }}", + "tcpPort": 9876 + }, + {% endif %} + {% endfor %} + ], + {% set key = key + 1 %} + {% endif %} + {% endfor %} +} +} diff --git a/framework/scripts/installer/compass/onos_cluster/vars/Debian.yml b/framework/scripts/installer/compass/onos_cluster/vars/Debian.yml new file mode 100755 index 00000000..70ce4ef2 --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/vars/Debian.yml @@ -0,0 +1,6 @@ +--- +packages: + - software-properties-common + - crudini + +services: [] diff --git a/framework/scripts/installer/compass/onos_cluster/vars/RedHat.yml b/framework/scripts/installer/compass/onos_cluster/vars/RedHat.yml new file mode 100755 index 00000000..70ce4ef2 --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/vars/RedHat.yml @@ -0,0 +1,6 @@ +--- +packages: + - software-properties-common + - crudini + +services: [] diff --git a/framework/scripts/installer/compass/onos_cluster/vars/main.yml b/framework/scripts/installer/compass/onos_cluster/vars/main.yml new file mode 100755 index 00000000..f083a89c --- /dev/null +++ b/framework/scripts/installer/compass/onos_cluster/vars/main.yml @@ -0,0 +1,6 @@ +onos_pkg_url: http://downloads.onosproject.org/release/onos-1.3.0.tar.gz +onos_pkg_name: onos-1.3.0.tar.gz +onos_home: /opt/onos/ +karaf_dist: apache-karaf-3.0.3 +jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz +onos_boot_features: config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui,onos-openflow-base,onos-openflow,onos-ovsdatabase, onos-app-vtn-onosfw diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/LICENSE b/framework/scripts/installer/fuel/fuel-plugin-onos/LICENSE new file mode 100644 index 00000000..e06d2081 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/README.md b/framework/scripts/installer/fuel/fuel-plugin-onos/README.md new file mode 100644 index 00000000..b5e93c41 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/README.md @@ -0,0 +1,119 @@ +#ONOS Plugin for Fuel# + +##Brief## + +This plugin will install [ Open Network Operating System (ONOS) controller](https://wiki.onosproject.org/display/ONOS/Wiki+Home), which is a typical SDN controller, and set it as a manager of ovs. + + +##Notification## + + +* Fuel opentack version should be after 7.0. +* Only supports the environment with network type: Neutron. +* Live migration is supported. +* L2 and L3 traffic are supported. + + +##Installation Guide## + + +###ONOS plugin installation### + + +1. Log in Fuel Master and clone GIT repository of fuel-plugin-onos from openstack: + + git clone -b kilo git://git.openstack.org/openstack/fuel-plugin-onos + +2. Preparing an environment for plugin development by three easy steps: + + A. Install the standard Linux development tools. + + For Ubuntu 14.04 LTS, run: + + sudo apt-get install createrepo rpm dpkg-dev + For Centos 6.5, run: + + yum install createrepo rpm rpm-build dpkg-devel + + B. Install the Fuel Plugin Builder. To do that, you should first get pip: + + easy_install pip + + C. Then, install Fuel Plugin Builder (fpb) itself: + + + pip install fuel-plugin-builder + +3. Build ONOS plugin for fuel: + + fpb --build fuel-plugin-onos/ + +4. The onos rpm will be built in the folder of fuel-plugin-onos. + +5. Install the onos plugin: + + fuel plugins --install onos*.rpm + +6. Check if you successfully install the plugin: + + fuel plugins + + id | name | version | package_version + ---|--------|---------|---------------- + 1 | onos | 0.7.0 | 3.0.0 + + +7. Check if the plugin is enabled on the settings table. + +Notice: Step 1-4 aren't limitted with the environment of master, you can also make it everywhere, but after the rpm is made, you should copy it to the master. In addition, the info of a new plugin at settings table can only be ready when a new environment is created. + + +##User Guide## + + +###ONOS plugin configuration### + + +All described actions below are described from a Fuel GUI provisioning perspective. + +1. Create a new environment. + +2. Select 'onos plugin' on Settings tab. + + onos plugin + +3. Select three nodes with role 'controller', three with role 'compute' and one with 'onos'. + +4. Click 'Deploy changes' to enable nodes with ONOSFW. + + + +###Dependencies### + +In order to run ONOS, the following are required: + +- Java 8 JDK (Oracle Java recommended; OpenJDK is not as thoroughly tested) +- ONOS tarball( Newest version 1.3 recommended.) + +Notice: In case of version problems, the onos rpm uses jdk and onos packages that have been tested. + +###Testing### + +1. Web UI is recommended for ONOS controller with tuitive information of topo, devices and etc. +For that purpose, IP address of horizon should be ready, which can be found in fuel master after successful deployment. The web will run into the log page after inputing the path, username and password are both 'karaf'. Now enjot ONOS! + + Web UI: http://horizon_ip:8181/onos/ui/index.html +2. CLI is capable of more diverse functionality by running /opt/onos/bin/onos. More about CLI can be found in [The ONOS CLI]( +https://wiki.onosproject.org/display/ONOS/The+ONOS+CLI). + + +##Getting Involved## + +Interested in contributing? Follow [Fuel Plugins Development]( +https://wiki.openstack.org/wiki/Fuel/Plugins). + +##Contributors## + +1. Wu Wenbin +2. Zhang Haoyu + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/netconfig.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/netconfig.pp new file mode 100644 index 00000000..b875d235 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/netconfig.pp @@ -0,0 +1,21 @@ +include onos + +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + timeout => 180, + logoutput => "true", +} + +$neutron_settings = hiera_hash('quantum_settings') +$nets = $neutron_settings['predefined_networks'] +$gateway_ip = $nets['net04_ext']['L3']['gateway'] +$public_eth = $onos::public_eth + +file{ "/opt/netconfig.sh": + ensure => file, + content => template('onos/netconfig.sh.erb'), +}-> +exec{ 'set gatewaymac': + command => "sh /opt/netconfig.sh; + rm -rf /opt/netconfig.sh;", +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/neutron.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/neutron.pp new file mode 100644 index 00000000..df06bdb1 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/neutron.pp @@ -0,0 +1,102 @@ +include onos + +Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] } + +$neutron_config = hiera_hash('quantum_settings') +$nets = $neutron_config['predefined_networks'] +$net04_ext = + {"shared"=>false, + "L2"=> + {"network_type"=>"vxlan", + "router_ext"=>true, + "segment_id"=>"10000"}, + "L3"=> $nets['net04_ext']['L3'], + "tenant"=>"admin"} +$net04 = + {"shared"=>false, + "L2"=> + {"network_type"=>"vxlan", + "router_ext"=>false, + "segment_id"=>"500"}, + "L3"=> $nets['net04']['L3'], + "tenant"=>"admin"} +$roles = $onos::roles +$network_type = 'vxlan' + +if member($roles, 'primary-controller') { +cs_resource { 'p_neutron-l3-agent': + ensure => absent, + require => Exec ['stop neutron'], +}-> +exec{ 'delete Neutron db': + command => "mysql -e 'drop database if exists neutron;'; + mysql -e 'create database neutron character set utf8;'; + mysql -e \"grant all on neutron.* to 'neutron'@'%';\"; + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head;", + before => Service ['start neutron service'], +} + +} + + + +exec{ 'stop neutron': + command => "service neutron-server stop", +} +package { 'install git': + ensure => installed, + name => "git", +}-> + +file{ "/opt/networking-onos.tar": + source => "puppet:///modules/onos/networking-onos.tar", +}-> +file{ '/opt/onos_driver.sh': + source => "puppet:///modules/onos/onos_driver.sh", +} -> +exec{ 'install onos driver': + command => "sh /opt/onos_driver.sh;" +}-> + +neutron_config { 'DEFAULT/service_plugins': + value => 'onos_router,neutron.services.metering.metering_plugin.MeteringPlugin'; +}-> + + +neutron_plugin_ml2 { + 'ml2/mechanism_drivers': value => 'onos_ml2'; + 'ml2/tenant_network_types': value => 'vxlan'; + 'ml2_type_vxlan/vni_ranges': value => '100:50000'; + 'onos/password': value => 'admin'; + 'onos/username': value => 'admin'; + 'onos/url_path': value => "http://${onos::manager_ip}:8181/onos/vtn"; +}-> +service {'start neutron service': + name => "neutron-server", + ensure => running +} + + + +if member($roles, 'primary-controller') { + + Service<| title == 'start neutron service' |> -> + Openstack::Network::Create_network <||> + + Service<| title == 'start neutron service' |> -> + Openstack::Network::Create_router <||> + +openstack::network::create_network{'net04': + netdata => $net04, + segmentation_type => $network_type, +} -> + openstack::network::create_network{'net04_ext': + netdata => $net04_ext, + segmentation_type => $network_type, +} -> + openstack::network::create_router{'router04': + internal_network => 'net04', + external_network => 'net04_ext', + tenant_name => 'admin', +} +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-ha.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-ha.pp new file mode 100644 index 00000000..0c4482c7 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-ha.pp @@ -0,0 +1 @@ +class {'onos::ha::haproxy':} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-install.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-install.pp new file mode 100644 index 00000000..13994ee7 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-install.pp @@ -0,0 +1,2 @@ +include onos +class{ 'onos::install':} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-service.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-service.pp new file mode 100644 index 00000000..5aa591f3 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/onos-service.pp @@ -0,0 +1,6 @@ +include onos + +class {'onos::config':} ~> +class {'onos::service':} + + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/ovs.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/ovs.pp new file mode 100644 index 00000000..26332f3c --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/manifests/ovs.pp @@ -0,0 +1,77 @@ +include onos + + +Exec{path => "/usr/bin:/usr/sbin:/bin:/sbin",} + +case $::operatingsystem{ +centos:{ + $neutron_ovs_agent='neutron-openvswitch-agent' + $ovs_service='openvswitch' + $cmd_remove_agent='chkconfig --del neutron-openvswitch-agent' +} +ubuntu:{ + $neutron_ovs_agent='neutron-plugin-openvswitch-agent' + $ovs_service='openvswitch-switch' + $cmd_remove_agent='update-rc.d neutron-plugin-openvswitch-agent remove' +} + +} + +$roles = $onos::roles + +if member($roles, 'primary-controller') { +cs_resource { "p_${neutron_ovs_agent}": + ensure => absent, + before => Service["shut down and disable Neutron's agent services"], + }} +else{ +exec{'remove neutron-openvswitch-agent auto start': + command => "touch /opt/service; + $cmd_remove_agent; + sed -i /neutron-openvswitch-agent/d /opt/service", + before => Service["shut down and disable Neutron's agent services"], +} +} + + +firewall{'222 vxlan': + port => [4789], + proto => 'udp', + action => 'accept', +}-> +service {"shut down and disable Neutron's agent services": + name => $neutron_ovs_agent, + ensure => stopped, + enable => false, +}-> +exec{'Stop the OpenvSwitch service and clear existing OVSDB': + command => "service $ovs_service stop ; + rm -rf /var/log/openvswitch/* ; + rm -rf /etc/openvswitch/conf.db ; + service $ovs_service start ;" + +} -> +exec{'Set ONOS as the manager': + command => "su -s /bin/sh -c 'ovs-vsctl set-manager tcp:${onos::manager_ip}:6640'", + +} + + +$public_eth = $onos::public_eth +if member($roles, 'compute') { +exec{"net config": + command => "ifconfig $public_eth up", +} +} +else +{ +exec{"sleep 20 for ovsconnect": + command => "sleep 20", + require => Exec['Set ONOS as the manager'], +}-> +exec{"delete public port from ovs of controllers": + command => "ovs-vsctl del-port br-int $public_eth", +} +} + + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/networking-onos.tar b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/networking-onos.tar new file mode 100644 index 00000000..961928a5 Binary files /dev/null and b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/networking-onos.tar differ diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_config.sh b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_config.sh new file mode 100644 index 00000000..158627fd --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_config.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eux +echo 'export ONOS_OPTS=debug' > /opt/onos/options; +echo 'export ONOS_USER=root' >> /opt/onos/options; +mkdir /opt/onos/var; +mkdir /opt/onos/config; + +#jdk config + +mkdir /usr/lib/jvm/ +tar -xzf /opt/jdk-8u*-linux-x64.tar.gz -C /usr/lib/jvm/ +mv /usr/lib/jvm/jdk1.8.0_* /usr/lib/jvm/java-8-oracle + +touch /etc/profile.d/jdk.csh +cat <> /etc/profile.d/jdk.csh +setenv J2SDKDIR /usr/lib/jvm/java-8-oracle +setenv J2REDIR /usr/lib/jvm/java-8-oracle/jre +setenv PATH ${PATH}:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin +setenv JAVA_HOME /usr/lib/jvm/java-8-oracle +setenv DERBY_HOME /usr/lib/jvm/java-8-oracle/db +EOT + +touch /etc/profile.d/jdk.sh +cat <> /etc/profile.d/jdk.sh +export J2SDKDIR=/usr/lib/jvm/java-8-oracle +export J2REDIR=/usr/lib/jvm/java-8-oracle/jre +export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin +export JAVA_HOME=/usr/lib/jvm/java-8-oracle +export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db +EOT + +chmod +x /etc/profile.d/jdk* + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_driver.sh b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_driver.sh new file mode 100644 index 00000000..d3a16514 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/files/onos_driver.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eux + +cd /opt +#git clone https://github.com/openstack/networking-onos.git +tar xf networking-onos.tar +cd networking-onos +python setup.py install + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp new file mode 100644 index 00000000..457d732f --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/config.pp @@ -0,0 +1,55 @@ +class onos::config{ +$onos_home = $onos::onos_home +$karaf_dist = $onos::karaf_dist +$onos_boot_features = $onos::onos_boot_features +$onos_extra_features = $onos::onos_extra_features +$roles = $onos::roles +$public_vip = hiera('public_vip') +$management_vip = hiera('management_vip') +$manager_ip = $onos::manager_ip +$onos_names = $onos::onos_names + +$onos_pkg_name = $onos::onos_pkg_name +$jdk8_pkg_name = $onos::jdk8_pkg_name + +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + timeout => 180, + logoutput => "true", +} + +file{ '/opt/onos_config.sh': + source => "puppet:///modules/onos/onos_config.sh", +} -> +exec{ 'install onos config': + command => "sh /opt/onos_config.sh; + rm -rf /opt/onos_config.sh;", +}-> +exec{ "clean used files": + command => "rm -rf /opt/$onos_pkg_name; + rm -rf /opt/$jdk8_pkg_name + rm -rf /root/.m2/*.tar" +}-> +exec{ 'onos boot features': + command => "sed -i '/^featuresBoot=/c\featuresBoot=$onos_boot_features' $onos_home/$karaf_dist/etc/org.apache.karaf.features.cfg", + path => "/usr/bin:/usr/sbin:/bin:/sbin", +} +case $::operatingsystem { + ubuntu:{ + file{'/etc/init/onos.conf': + ensure => file, + content => template('onos/debian/onos.conf.erb') +}} + centos:{ + file{'/etc/init.d/onos': + ensure => file, + content => template('onos/centos/onos.erb'), + mode => 0777 +}}} + + +#if !member($roles, 'compute') { +# include onos::ha::haproxy +#} + +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp new file mode 100644 index 00000000..c35752d9 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/ha/haproxy.pp @@ -0,0 +1,64 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class onos::ha::haproxy { + + + Haproxy::Service { use_include => true } + Haproxy::Balancermember { use_include => true } + + $public_vip = hiera('public_vip') + $management_vip = hiera('management_vip') + $nodes_hash = hiera('nodes') + $primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller') + $onos_controllers = filter_nodes($nodes_hash,'role','onos') + + # defaults for any haproxy_service within this class + Openstack::Ha::Haproxy_service { + internal_virtual_ip => $management_vip, + ipaddresses => filter_hash($onos_controllers, 'internal_address'), + public_virtual_ip => $public_vip, + server_names => filter_hash($onos_controllers, 'name'), + public => true, + internal => true, + } + + openstack::ha::haproxy_service { 'onos': + order => '221', + listen_port => '8181', + haproxy_config_options => { + 'option' => ['httpchk /onos/ui', 'httplog'], + 'timeout client' => '2h', + 'timeout server' => '2h', + 'balance' => 'source', + 'mode' => 'http' + }, + balancermember_options => 'check inter 2000 fall 5', + } + + exec { 'haproxy reload onos': + command => 'export OCF_ROOT="/usr/lib/ocf"; (ip netns list | grep haproxy) && ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy reload', + path => '/usr/bin:/usr/sbin:/bin:/sbin', + logoutput => true, + provider => 'shell', + tries => 10, + try_sleep => 10, + returns => [0, ''], + } + + Haproxy::Listen <||> -> Exec['haproxy reload onos'] + Haproxy::Balancermember <||> -> Exec['haproxy reload onos'] +} + diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp new file mode 100644 index 00000000..839ae095 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/init.pp @@ -0,0 +1,19 @@ +class onos{ +$nodes = hiera('nodes') +$primary_controller = filter_nodes($nodes,'role','primary-controller') +$roles = node_roles($nodes, hiera('uid')) + +$onos_settings = hiera('onos') +$public_eth = $onos_settings['public_eth'] +$onos_hash = filter_nodes($nodes,'role','onos') +$manager_ip = filter_hash($onos_hash, 'internal_address') +$onos_names = filter_hash($onos_hash, 'name') + +$onos_home = '/opt/onos' +$onos_pkg_url = 'http://downloads.onosproject.org/release/onos-1.3.0.tar.gz' +$karaf_dist = 'apache-karaf-3.0.3' +$onos_pkg_name = 'onos-1.3.0.tar.gz' +$jdk8_pkg_name = 'jdk-8u51-linux-x64.tar.gz' +$onos_boot_features = 'config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui,onos-openflow-base,onos-openflow' +$onos_extra_features = 'ovsdb,vtn' +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp new file mode 100644 index 00000000..7ccb7699 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/install.pp @@ -0,0 +1,56 @@ + +class onos::install{ +$onos_home = $onos::onos_home +$onos_pkg_url = $onos::onos_pkg_url +$karaf_dist = $onos::karaf_dist +$onos_pkg_name = $onos::onos_pkg_name +$jdk8_pkg_name = $onos::jdk8_pkg_name + + +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + logoutput => "true", + timeout => 180, +} +group { 'onos': + ensure => present, + before => [File['/opt/onos/'], User['onos']], + } + + +user { 'onos': + ensure => present, + home => '/opt/onos/', + membership => 'minimum', + groups => 'onos', + before => File['/opt/onos/'], + } + + +file { '/opt/onos/': + ensure => 'directory', + recurse => true, + owner => 'onos', + group => 'onos', +}-> + + +file{ "/opt/$onos_pkg_name": + source => "puppet:///modules/onos/$onos_pkg_name", +} -> +file{ "/opt/$jdk8_pkg_name": + source => "puppet:///modules/onos/$jdk8_pkg_name", +} -> + +file{ '/root/.m2/': + ensure => 'directory', + recurse => true, +} -> +file{ '/root/.m2/repository.tar': + source => "puppet:///modules/onos/repository.tar", +} -> +exec{ "unzip packages": + command => "tar -zvxf /opt/$onos_pkg_name -C $onos_home --strip-components 1 --no-overwrite-dir -k; + tar xf /root/.m2/repository.tar -C /root/.m2/", +} +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp new file mode 100644 index 00000000..45399232 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/manifests/service.pp @@ -0,0 +1,48 @@ + +class onos::service{ + +$public_eth = $onos::public_eth +Exec{ + path => "/usr/bin:/usr/sbin:/bin:/sbin", + timeout => 320, + logoutput => 'true', +} + +firewall {'221 onos': + port => [6633, 6640, 6653, 8181, 8101,9876], + proto => 'tcp', + action => 'accept', +}-> +service{ 'onos': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, +}-> + +exec{ 'sleep 100 to stablize onos': + command => 'sleep 100;' +}-> + +exec{ 'restart onos': + command => 'service onos restart', +}-> + +exec{ 'sleep 100 again to stablize onos': + command => 'sleep 100;' +}-> +exec{ 'restart onos again': + command => 'service onos restart', +}-> + +exec{ 'sleep 60 to stablize onos': + command => 'sleep 60;' +}-> + +exec{ 'add onos auto start': + command => 'echo "onos">>/opt/service', +}-> +exec{ 'set public port': + command => "/opt/onos/bin/onos \"externalportname-set -n $public_eth\"" +} +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/centos/onos.erb b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/centos/onos.erb new file mode 100644 index 00000000..d878d4fc --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/centos/onos.erb @@ -0,0 +1,52 @@ +#!/bin/bash +# chkconfig: 345 98 2 +# description: Open Network Operating System +# onos Startup script for onos +# processname: onos + +prog=onos +export JAVA_HOME=/usr/lib/jvm/java-8-oracle +export ONOS_APPS=<%= @onos_extra_features -%> + +cd /opt/onos/bin/ +start(){ + echo $"Starting $prog..." + ./onos-service & + } +stop(){ + PID=`ps aux | grep java | grep karaf | awk '{print $2}'` + echo $"Stopping $prog $PID" + kill -9 $PID + sleep 10 + } +status(){ + PID=`ps aux | grep java | grep karaf | awk '{print $2}'` + if test -z $PID + then + echo "onos stop/waiting" + exit 1 + else + echo "onos start/running, process $PID." + exit 0 + fi + } + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + status) + status + ;; + *) + echo "Please use: $0 {start|stop|status}" + exit 1 + ;; +esac diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/cluster.json.erb b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/cluster.json.erb new file mode 100644 index 00000000..7ca41733 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/cluster.json.erb @@ -0,0 +1,20 @@ +{"ipPrefix": "192.168.0.*", + "nodes": [ + <% index = 1 -%> + <%- @manager_ip.each do |ip| -%> + <%- if index == @manager_ip.size -%> + { + "ip": "<%= ip -%>", + "id": "<%= ip -%>", + "tcpPort": 9876 + } + <%- else -%> + { + "ip": "<%= ip -%>", + "id": "<%= ip -%>", + "tcpPort": 9876 + }, + <%- end -%> + <%- index = index + 1 -%> + <%- end -%> +]} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/debian/onos.conf.erb b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/debian/onos.conf.erb new file mode 100644 index 00000000..1387a848 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/debian/onos.conf.erb @@ -0,0 +1,31 @@ +description "Open Network Operating System" +author "ON.Lab" + +start on (net-device-up + and local-filesystems + and runlevel [2345]) +stop on runlevel [016] + +console output +kill timeout 60 +respawn + +env LANG=en_US.UTF-8 +env JAVA_HOME=/usr/lib/jvm/java-8-oracle; +pre-stop script + /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log + sleep 1 +end script + +script + export J2SDKDIR=/usr/lib/jvm/java-8-oracle; + export J2REDIR=/usr/lib/jvm/java-8-oracle/jre; + export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin; + export JAVA_HOME=/usr/lib/jvm/java-8-oracle; + export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db; + export ONOS_APPS=<%= @onos_extra_features %> + [ -f /opt/onos/options ] && . /opt/onos/options + start-stop-daemon --signal INT --start --chuid $ONOS_USER \ + --exec /opt/onos/bin/onos-service -- $ONOS_OPTS \ + >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log +end script diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/netconfig.sh.erb b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/netconfig.sh.erb new file mode 100644 index 00000000..947d7947 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/netconfig.sh.erb @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eux +ping -c 5 <%= @gateway_ip %> +gatewayMac=`arp -a <%= @gateway_ip -%> | awk '{print $4}'` +/opt/onos/bin/onos "externalgateway-update -m $gatewayMac" diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/tablets.json.erb b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/tablets.json.erb new file mode 100644 index 00000000..de52967d --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_scripts/puppet/modules/onos/templates/tablets.json.erb @@ -0,0 +1,69 @@ +{ + "nodes": [ + <%- index = 1 -%> + <%- @manager_ip.each do |ip| -%> + <%- if index == @manager_ip.size -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + } + <%- else -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + }, + <%- end -%> + <%- index = index + 1 -%> + <%- end -%> + ], + "partitions": { + <%- key = 1 -%> + <%- @manager_ip.each do |ip| -%> + <%- if key == @manager_ip.size -%> + "p<%= key -%>":[ + <%- index = 1 -%> + <%- @manager_ip.each do |ip| -%> + <%- if index == @manager_ip.size -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + } + <%- else -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + }, + <%- end -%> + <%- index = index + 1 -%> + <%- end -%> + ] + <%- key = key + 1 -%> + <%- else -%> + "p<%= key -%>":[ + <%- index = 1 -%> + <%- @manager_ip.each do |ip| -%> + <%- if index == @manager_ip.size -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + } + <%- else -%> + { + "ip": "<%= ip %>", + "id": "<%= ip %>", + "tcpPort": 9876 + }, + <%- end -%> + <%- index = index + 1 -%> + <%- end -%> + ], + <%- key = key + 1 -%> + <%- end -%> + <%- end -%> +} +} diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_tasks.yaml b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_tasks.yaml new file mode 100644 index 00000000..c80e5ffb --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/deployment_tasks.yaml @@ -0,0 +1,67 @@ +# These tasks will be merged into deployment graph. Here you +# can specify new tasks for any roles, even built-in ones. + +- id: onos + type: group + role: [onos] + requires: [deploy_start] + required_for: [deploy_end, primary-controller, controller] + tasks: [fuel_pkgs, hiera, globals, tools, logging, netconfig, + hosts, firewall, deploy_start, onos_install] + parameters: + strategy: + type: parallel +- id: onos_install + type: puppet + groups: [onos] + requires: [deploy_start, hosts, firewall, globals] + required_for: [deploy_end, openstack-network] + parameters: + puppet_manifest: puppet/manifests/onos-install.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 +- id: onos_service + type: puppet + role: [onos] + requires: [post_deployment_start] + required_for: [post_deployment_end] + parameters: + puppet_manifest: puppet/manifests/onos-service.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 1400 +- id: onos_ha + type: puppet + role: ['primary-controller','controller'] + requires: [onos_service] + required_for: [post_deployment_end] + parameters: + puppet_manifest: puppet/manifests/onos-ha.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 1400 +- id: onos_config_ovs + role: ['primary-controller','controller','compute'] + requires: [onos_ha] + required_for: [post_deployment_end] + type: puppet + parameters: + puppet_manifest: puppet/manifests/ovs.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 600 +- id: onos_config_neutron + role: ['primary-controller', 'controller'] + requires: [onos_config_ovs] + required_for: [post_deployment_end] + type: puppet + parameters: + puppet_manifest: puppet/manifests/neutron.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 1800 +- id: onos_config_net + role: [onos] + requires: [onos_config_neutron] + required_for: [post_deployment_end] + type: puppet + parameters: + puppet_manifest: puppet/manifests/netconfig.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 600 diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/environment_config.yaml b/framework/scripts/installer/fuel/fuel-plugin-onos/environment_config.yaml new file mode 100644 index 00000000..e7cb4bd1 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/environment_config.yaml @@ -0,0 +1,10 @@ +attributes: + metadata: + restrictions: + - "cluster:net_provider != 'neutron'": "Neutron only" + public_eth: + description: "Please note that onos needs an independent eth for public network when interfaces of nodes are configured, or L3 traffic to internet will fail! Defualt is eth3." + type: text + label: Public Ethernet Port + weight: 20 + value: eth3 diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/metadata.yaml b/framework/scripts/installer/fuel/fuel-plugin-onos/metadata.yaml new file mode 100644 index 00000000..872a1854 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/metadata.yaml @@ -0,0 +1,30 @@ +# Plugin name +name: onos +# Human-readable name for your plugin +title: onos plugin +# Plugin version +version: '0.7.0' +# Description +description: 'Open Network Operating System (ONOS) is a typical SDN controller. Web-ui: http://horizon_ip:8181/onos/ui.' +# Required fuel version +fuel_version: ['7.0'] +# Specify license of your plugin +licenses: ['Apache License Version 2.0'] +# Specify author or company name +authors: ['Wu Wenbin, Huawei'] +# A link to the plugin's page +homepage: 'https://github.com/openstack/fuel-plugins-onos' +# Specify a group which your plugin implements, possible options: +# network, storage, storage::cinder, storage::glance, hypervisor +groups: ['network'] + +# The plugin is compatible with releases in the list +releases: + - os: ubuntu + version: 2015.1.0-7.0 + mode: ['ha'] + deployment_scripts_path: deployment_scripts/ + repository_path: repositories/ubuntu + +# Version of plugin package +package_version: '3.0.0' diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/node_roles.yaml b/framework/scripts/installer/fuel/fuel-plugin-onos/node_roles.yaml new file mode 100644 index 00000000..f36f50a0 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/node_roles.yaml @@ -0,0 +1,9 @@ +onos: + name: "onos" + description: "sdn controller" + has_primary: false + public_ip_required: false + weight: 200 + limits: + max: 1 + min: 1 diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/pre_build_hook b/framework/scripts/installer/fuel/fuel-plugin-onos/pre_build_hook new file mode 100755 index 00000000..ce39b7be --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/pre_build_hook @@ -0,0 +1,13 @@ +#!/bin/bash +set -eux +DIR="$(dirname `readlink -f $0`)" +TARGET="${DIR}/deployment_scripts/puppet/modules/onos/files" +onos=http://205.177.226.237:9999/onosfw/onos-1.3.0.tar.gz +jdk=http://205.177.226.237:9999/onosfw/jdk-8u51-linux-x64.tar.gz +repo=http://205.177.226.237:9999/onosfw/repository.tar +cd $TARGET +if [ ! -f "onos-1.3.0.tar.gz" ]; then + wget $onos -P $TARGET + wget $jdk -P $TARGET + wget $repo -P $TARGET +fi diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/centos/.gitkeep b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/centos/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/.gitkeep b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Packages.gz b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Packages.gz new file mode 100644 index 00000000..edf96f9b Binary files /dev/null and b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Packages.gz differ diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Release b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Release new file mode 100644 index 00000000..ac37f55f --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/repositories/ubuntu/Release @@ -0,0 +1,2 @@ +Label: onos +Version: 0.7 diff --git a/framework/scripts/installer/fuel/fuel-plugin-onos/volumes.yaml b/framework/scripts/installer/fuel/fuel-plugin-onos/volumes.yaml new file mode 100644 index 00000000..9b6a91c0 --- /dev/null +++ b/framework/scripts/installer/fuel/fuel-plugin-onos/volumes.yaml @@ -0,0 +1,7 @@ +volumes_roles_mapping: + # Default role mapping + onos: + - {allocate_size: "min", id: "os"} + +# Set here new volumes for your role +volumes: [] diff --git a/framework/scripts/installer/onos_cluster/files/install_jdk8.tar b/framework/scripts/installer/onos_cluster/files/install_jdk8.tar deleted file mode 100755 index faaaeb39..00000000 Binary files a/framework/scripts/installer/onos_cluster/files/install_jdk8.tar and /dev/null differ diff --git a/framework/scripts/installer/onos_cluster/files/networking-onos.tar b/framework/scripts/installer/onos_cluster/files/networking-onos.tar deleted file mode 100644 index 9358199c..00000000 Binary files a/framework/scripts/installer/onos_cluster/files/networking-onos.tar and /dev/null differ diff --git a/framework/scripts/installer/onos_cluster/handlers/main.yml b/framework/scripts/installer/onos_cluster/handlers/main.yml deleted file mode 100755 index c8742dd5..00000000 --- a/framework/scripts/installer/onos_cluster/handlers/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: restart onos service - service: name=onos state=restarted enabled=yes diff --git a/framework/scripts/installer/onos_cluster/tasks/main.yml b/framework/scripts/installer/onos_cluster/tasks/main.yml deleted file mode 100755 index 3cd4421b..00000000 --- a/framework/scripts/installer/onos_cluster/tasks/main.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: remove neutron-plugin-openvswitch-agent auto start - shell: > - update-rc.d neutron-plugin-openvswitch-agent remove; - sed -i /neutron-plugin-openvswitch-agent/d /opt/service - when: groups['onos']|length !=0 - ignore_errors: True - -- name: shut down and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=stopped - when: groups['onos']|length !=0 - ignore_errors: True - -- name: remove neutron-l3-agent auto start - shell: > - update-rc.d neutron-l3-agent remove; - sed -i /neutron-l3-agent/d /opt/service - when: inventory_hostname in groups['onos'] - ignore_errors: True - -- name: shut down and disable Neutron's l3 agent services - service: name=neutron-l3-agent state=stopped - when: inventory_hostname in groups['onos'] - ignore_errors: True - -- name: Stop the Open vSwitch service and clear existing OVSDB - shell: > - ovs-vsctl del-br br-int ; - ovs-vsctl del-br br-tun ; - ovs-vsctl del-manager ; - when: groups['onos']|length !=0 - ignore_errors: True - -- name: Install ONOS Cluster on Controller - include: onos_controller.yml - when: inventory_hostname in groups['onos'] - -- name: Install ONOS Cluster on Compute - include: openvswitch.yml - when: groups['onos']|length !=0 -# when: groups['onos']|length !=0 and inventory_hostname not in groups['onos'] - diff --git a/framework/scripts/installer/onos_cluster/tasks/onos_controller.yml b/framework/scripts/installer/onos_cluster/tasks/onos_controller.yml deleted file mode 100755 index 0606fad9..00000000 --- a/framework/scripts/installer/onos_cluster/tasks/onos_controller.yml +++ /dev/null @@ -1,146 +0,0 @@ ---- -- name: upload onos driver package - unarchive: src=networking-onos.tar dest=/opt/ - -- name: install onos driver - command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh" - -- name: install onos required packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages - -- name: get image http server - shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf - register: http_server - -- name: download oracle-jdk8 package file - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }} - -- name: upload install_jdk8 scripts - unarchive: src=install_jdk8.tar dest=/opt/ - -- name: install install_jdk8 package - command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" - -- name: create JAVA_HOME environment variable - shell: > - export J2SDKDIR=/usr/lib/jvm/java-8-oracle; - export J2REDIR=/usr/lib/jvm/java-8-oracle/jre; - export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin; - export JAVA_HOME=/usr/lib/jvm/java-8-oracle; - export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db; - -- name: create onos group - group: name=onos system=yes state=present - -- name: create onos user - user: - name: onos - group: onos - home: "{{ onos_home }}" - createhome: "yes" - system: "yes" - shell: "/bin/false" - -- name: download onos package - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_pkg_name }}" dest=/opt/{{ onos_pkg_name }} - -- name: create new jar repository - command: su -s /bin/sh -c "mkdir ~/.m2" - -- name: download jar repository - get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/repository.tar" dest=~/.m2/ - -- name: extract jar repository - command: su -s /bin/sh -c "tar xvf ~/.m2/repository.tar -C ~/.m2/" - -- name: extract onos package - command: su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" onos - -- name: configure onos service - shell: > - echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options; - echo 'export ONOS_USER=root' >> {{ onos_home }}/options; - mkdir {{ onos_home }}/var; - mkdir {{ onos_home }}/config; - sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/init/onos.conf; - cp -rf {{ onos_home }}/init/onos.conf /etc/init/; - cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/; -# notify: -# - restart onos service - -- name: configure onos boot feature - shell: > - sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg; - -#- name: create cluster json -# template: -# src: cluster.json -# dest: "{{ onos_home }}/config/cluster.json" -# notify: -# - restart onos service - -#- name: create tablets json -# template: -# src: tablets.json -# dest: "{{ onos_home }}/config/tablets.json" -# notify: -# - restart onos service - -- name: wait for config time - shell: "sleep 10" - -- name: start onos service - service: name=onos state=started enabled=yes - -- name: wait for restart time - shell: "sleep 60" - -- name: start onos service - service: name=onos state=restarted enabled=yes - -- name: wait for onos start time - shell: "sleep 60" - -- name: start onos service - service: name=onos state=restarted enabled=yes - -- name: wait for onos start time - shell: "sleep 100" - -- name: add onos auto start - shell: > - echo "onos">>/opt/service - -########################################################################################################## -################################ ONOS connect with OpenStack ################################ -########################################################################################################## -#- name: Run OpenVSwitch Script -# include: openvswitch.yml - -- name: Configure Neutron1 - shell: > - crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins onos_router; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos_ml2; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan - -- name: Create ML2 Configuration File - template: - src: ml2_conf.sh - dest: "/opt/ml2_conf.sh" - mode: 0777 - -- name: Configure Neutron2 - command: su -s /bin/sh -c "/opt/ml2_conf.sh;" - - -- name: Configure Neutron3 - shell: > - mysql -e "drop database if exists neutron_ml2;"; - mysql -e "create database neutron_ml2 character set utf8;"; - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';"; - su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron; - -- name: Restart neutron-server - service: name=neutron-server state=restarted diff --git a/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml b/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml deleted file mode 100755 index f8ed551f..00000000 --- a/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -#- name: remove neutron-plugin-openvswitch-agent auto start -# shell: > -# update-rc.d neutron-plugin-openvswitch-agent remove; -# sed -i /neutron-plugin-openvswitch-agent/d /opt/service - -#- name: shut down and disable Neutron's agent services -# service: name=neutron-plugin-openvswitch-agent state=stopped - -#- name: Stop the Open vSwitch service and clear existing OVSDB -# shell: > -# ovs-vsctl del-br br-int ; -# ovs-vsctl del-br br-tun ; -# ovs-vsctl del-manager ; - -#- name: get image http server -# shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf -# register: http_server -# -#- name: download ovs -# get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/openvswitch.tar" dest=/opt/openvswitch.tar -# -#- name: extract ovs -# command: su -s /bin/sh -c "tar xvf /opt/openvswitch.tar -C /opt/" -# -#- name: update ovs -# shell: > -# cd /opt/openvswitch; -# dpkg -i openvswitch-common_2.3.0-1_amd64.deb; -# dpkg -i openvswitch-switch_2.3.0-1_amd64.deb; - -- name: start up onos-external nic - command: su -s /bin/sh -c "ifconfig eth2 0 up" - -#- name: wait for onos start time -# shell: "sleep 200" - -- name: add ovsdatabase feature - command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'"; - when: inventory_hostname == groups['onos'][0] - -- name: add openflow-base feature - command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'"; - when: inventory_hostname == groups['onos'][0] - -- name: add openflow feature - command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'"; - when: inventory_hostname == groups['onos'][0] - -- name: add vtn feature - command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'"; - when: inventory_hostname == groups['onos'][0] - - -- name: set public eth card start - command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n eth2'" - when: inventory_hostname == groups['onos'][0] - -- name: Set ONOS as the manager - command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:6640;" - -- name: create public network - shell: > - export OS_PASSWORD=console; - export OS_TENANT_NAME=admin; - export OS_AUTH_URL=http://{{ internal_vip.ip }}:35357/v2.0; - export OS_USERNAME=ADMIN; - neutron net-create ext-net --shared --router:external=True; - neutron subnet-create ext-net --name ext-subnet {{ public_net_info.floating_ip_cidr }}; - when: inventory_hostname == groups['controller'][0] - -- name: set gateway mac address - shell: > - ping -c 1 {{ ansible_default_ipv4.gateway }}; - gatewayMac=`arp -a {{ ansible_default_ipv4.gateway }} | awk '{print $4}'`; - /opt/onos/bin/onos "externalgateway-update -m $gatewayMac"; - when: inventory_hostname == groups['onos'][0] - -- name: delete default gateway - shell: > - route delete default; - when: inventory_hostname not in groups['onos'] - ignore_errors: True diff --git a/framework/scripts/installer/onos_cluster/templates/cluster.json b/framework/scripts/installer/onos_cluster/templates/cluster.json deleted file mode 100755 index 5982c434..00000000 --- a/framework/scripts/installer/onos_cluster/templates/cluster.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "ipPrefix": "{{ ip_settings[groups['onos'][0]]['mgmt']['cidr'] }}", - "nodes":[ -{% for host in groups['onos'] %} - {% if loop.last %} - { "id": "{{ ip_settings[host]['mgmt']['ip'] }}", "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", "tcpPort": 9876 } - {% else %} - { "id": "{{ ip_settings[host]['mgmt']['ip'] }}", "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", "tcpPort": 9876 }, - {% endif %} -{% endfor %} -]} diff --git a/framework/scripts/installer/onos_cluster/templates/ml2_conf.sh b/framework/scripts/installer/onos_cluster/templates/ml2_conf.sh deleted file mode 100755 index a9e61acb..00000000 --- a/framework/scripts/installer/onos_cluster/templates/ml2_conf.sh +++ /dev/null @@ -1,7 +0,0 @@ -cat <> /etc/neutron/plugins/ml2/ml2_conf.ini -[onos] -password = admin -username = admin -url_path = http://{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:8181/onos/vtn -EOT - diff --git a/framework/scripts/installer/onos_cluster/templates/tablets.json b/framework/scripts/installer/onos_cluster/templates/tablets.json deleted file mode 100755 index f71be71f..00000000 --- a/framework/scripts/installer/onos_cluster/templates/tablets.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "nodes": [ -{% for host in groups['onos'] %} - {% if loop.last %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - } - {% else %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - }, - {% endif %} -{% endfor %} - ], - "partitions": { - {% set key = 1 %} - {% for host in groups['onos'] %} - {% if loop.last %} - "p{{ key }}":[ - {% for host in groups['onos'] %} - {% if loop.last %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - } - {% else %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - }, - {% endif %} - {% endfor %} - ] - {% set key = key + 1 %} - {% else %} - "p{{ key }}":[ - {% for host in groups['onos'] %} - {% if loop.last %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - } - {% else %} - { - "ip": "{{ ip_settings[host]['mgmt']['ip'] }}", - "id": "{{ ip_settings[host]['mgmt']['ip'] }}", - "tcpPort": 9876 - }, - {% endif %} - {% endfor %} - ], - {% set key = key + 1 %} - {% endif %} - {% endfor %} -} -} diff --git a/framework/scripts/installer/onos_cluster/vars/Debian.yml b/framework/scripts/installer/onos_cluster/vars/Debian.yml deleted file mode 100755 index 70ce4ef2..00000000 --- a/framework/scripts/installer/onos_cluster/vars/Debian.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -packages: - - software-properties-common - - crudini - -services: [] diff --git a/framework/scripts/installer/onos_cluster/vars/RedHat.yml b/framework/scripts/installer/onos_cluster/vars/RedHat.yml deleted file mode 100755 index 70ce4ef2..00000000 --- a/framework/scripts/installer/onos_cluster/vars/RedHat.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -packages: - - software-properties-common - - crudini - -services: [] diff --git a/framework/scripts/installer/onos_cluster/vars/main.yml b/framework/scripts/installer/onos_cluster/vars/main.yml deleted file mode 100755 index f083a89c..00000000 --- a/framework/scripts/installer/onos_cluster/vars/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -onos_pkg_url: http://downloads.onosproject.org/release/onos-1.3.0.tar.gz -onos_pkg_name: onos-1.3.0.tar.gz -onos_home: /opt/onos/ -karaf_dist: apache-karaf-3.0.3 -jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz -onos_boot_features: config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui,onos-openflow-base,onos-openflow,onos-ovsdatabase, onos-app-vtn-onosfw -- cgit 1.2.3-korg