Browse Source

fuel plugin onos

Change-Id: I030d45d6655a58c2a79b61ee8e2cb10dfe85a945
dongfeng 3 years ago
parent
commit
d4fb381a20

+ 202
- 0
LICENSE View File

@@ -0,0 +1,202 @@
1
+Apache License
2
+                           Version 2.0, January 2004
3
+                        http://www.apache.org/licenses/
4
+
5
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+   1. Definitions.
8
+
9
+      "License" shall mean the terms and conditions for use, reproduction,
10
+      and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+      "Licensor" shall mean the copyright owner or entity authorized by
13
+      the copyright owner that is granting the License.
14
+
15
+      "Legal Entity" shall mean the union of the acting entity and all
16
+      other entities that control, are controlled by, or are under common
17
+      control with that entity. For the purposes of this definition,
18
+      "control" means (i) the power, direct or indirect, to cause the
19
+      direction or management of such entity, whether by contract or
20
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+      outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+      "You" (or "Your") shall mean an individual or Legal Entity
24
+      exercising permissions granted by this License.
25
+
26
+      "Source" form shall mean the preferred form for making modifications,
27
+      including but not limited to software source code, documentation
28
+      source, and configuration files.
29
+
30
+      "Object" form shall mean any form resulting from mechanical
31
+      transformation or translation of a Source form, including but
32
+      not limited to compiled object code, generated documentation,
33
+      and conversions to other media types.
34
+
35
+      "Work" shall mean the work of authorship, whether in Source or
36
+      Object form, made available under the License, as indicated by a
37
+      copyright notice that is included in or attached to the work
38
+      (an example is provided in the Appendix below).
39
+
40
+      "Derivative Works" shall mean any work, whether in Source or Object
41
+      form, that is based on (or derived from) the Work and for which the
42
+      editorial revisions, annotations, elaborations, or other modifications
43
+      represent, as a whole, an original work of authorship. For the purposes
44
+      of this License, Derivative Works shall not include works that remain
45
+      separable from, or merely link (or bind by name) to the interfaces of,
46
+      the Work and Derivative Works thereof.
47
+
48
+      "Contribution" shall mean any work of authorship, including
49
+      the original version of the Work and any modifications or additions
50
+      to that Work or Derivative Works thereof, that is intentionally
51
+      submitted to Licensor for inclusion in the Work by the copyright owner
52
+      or by an individual or Legal Entity authorized to submit on behalf of
53
+      the copyright owner. For the purposes of this definition, "submitted"
54
+      means any form of electronic, verbal, or written communication sent
55
+      to the Licensor or its representatives, including but not limited to
56
+      communication on electronic mailing lists, source code control systems,
57
+      and issue tracking systems that are managed by, or on behalf of, the
58
+      Licensor for the purpose of discussing and improving the Work, but
59
+      excluding communication that is conspicuously marked or otherwise
60
+      designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+      "Contributor" shall mean Licensor and any individual or Legal Entity
63
+      on behalf of whom a Contribution has been received by Licensor and
64
+      subsequently incorporated within the Work.
65
+
66
+   2. Grant of Copyright License. Subject to the terms and conditions of
67
+      this License, each Contributor hereby grants to You a perpetual,
68
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+      copyright license to reproduce, prepare Derivative Works of,
70
+      publicly display, publicly perform, sublicense, and distribute the
71
+      Work and such Derivative Works in Source or Object form.
72
+
73
+   3. Grant of Patent License. Subject to the terms and conditions of
74
+      this License, each Contributor hereby grants to You a perpetual,
75
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+      (except as stated in this section) patent license to make, have made,
77
+      use, offer to sell, sell, import, and otherwise transfer the Work,
78
+      where such license applies only to those patent claims licensable
79
+      by such Contributor that are necessarily infringed by their
80
+      Contribution(s) alone or by combination of their Contribution(s)
81
+      with the Work to which such Contribution(s) was submitted. If You
82
+      institute patent litigation against any entity (including a
83
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+      or a Contribution incorporated within the Work constitutes direct
85
+      or contributory patent infringement, then any patent licenses
86
+      granted to You under this License for that Work shall terminate
87
+      as of the date such litigation is filed.
88
+
89
+   4. Redistribution. You may reproduce and distribute copies of the
90
+      Work or Derivative Works thereof in any medium, with or without
91
+      modifications, and in Source or Object form, provided that You
92
+      meet the following conditions:
93
+
94
+      (a) You must give any other recipients of the Work or
95
+          Derivative Works a copy of this License; and
96
+
97
+      (b) You must cause any modified files to carry prominent notices
98
+          stating that You changed the files; and
99
+
100
+      (c) You must retain, in the Source form of any Derivative Works
101
+          that You distribute, all copyright, patent, trademark, and
102
+          attribution notices from the Source form of the Work,
103
+          excluding those notices that do not pertain to any part of
104
+          the Derivative Works; and
105
+
106
+      (d) If the Work includes a "NOTICE" text file as part of its
107
+          distribution, then any Derivative Works that You distribute must
108
+          include a readable copy of the attribution notices contained
109
+          within such NOTICE file, excluding those notices that do not
110
+          pertain to any part of the Derivative Works, in at least one
111
+          of the following places: within a NOTICE text file distributed
112
+          as part of the Derivative Works; within the Source form or
113
+          documentation, if provided along with the Derivative Works; or,
114
+          within a display generated by the Derivative Works, if and
115
+          wherever such third-party notices normally appear. The contents
116
+          of the NOTICE file are for informational purposes only and
117
+          do not modify the License. You may add Your own attribution
118
+          notices within Derivative Works that You distribute, alongside
119
+          or as an addendum to the NOTICE text from the Work, provided
120
+          that such additional attribution notices cannot be construed
121
+          as modifying the License.
122
+
123
+      You may add Your own copyright statement to Your modifications and
124
+      may provide additional or different license terms and conditions
125
+      for use, reproduction, or distribution of Your modifications, or
126
+      for any such Derivative Works as a whole, provided Your use,
127
+      reproduction, and distribution of the Work otherwise complies with
128
+      the conditions stated in this License.
129
+
130
+   5. Submission of Contributions. Unless You explicitly state otherwise,
131
+      any Contribution intentionally submitted for inclusion in the Work
132
+      by You to the Licensor shall be under the terms and conditions of
133
+      this License, without any additional terms or conditions.
134
+      Notwithstanding the above, nothing herein shall supersede or modify
135
+      the terms of any separate license agreement you may have executed
136
+      with Licensor regarding such Contributions.
137
+
138
+   6. Trademarks. This License does not grant permission to use the trade
139
+      names, trademarks, service marks, or product names of the Licensor,
140
+      except as required for reasonable and customary use in describing the
141
+      origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+   7. Disclaimer of Warranty. Unless required by applicable law or
144
+      agreed to in writing, Licensor provides the Work (and each
145
+      Contributor provides its Contributions) on an "AS IS" BASIS,
146
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+      implied, including, without limitation, any warranties or conditions
148
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+      PARTICULAR PURPOSE. You are solely responsible for determining the
150
+      appropriateness of using or redistributing the Work and assume any
151
+      risks associated with Your exercise of permissions under this License.
152
+
153
+   8. Limitation of Liability. In no event and under no legal theory,
154
+      whether in tort (including negligence), contract, or otherwise,
155
+      unless required by applicable law (such as deliberate and grossly
156
+      negligent acts) or agreed to in writing, shall any Contributor be
157
+      liable to You for damages, including any direct, indirect, special,
158
+      incidental, or consequential damages of any character arising as a
159
+      result of this License or out of the use or inability to use the
160
+      Work (including but not limited to damages for loss of goodwill,
161
+      work stoppage, computer failure or malfunction, or any and all
162
+      other commercial damages or losses), even if such Contributor
163
+      has been advised of the possibility of such damages.
164
+
165
+   9. Accepting Warranty or Additional Liability. While redistributing
166
+      the Work or Derivative Works thereof, You may choose to offer,
167
+      and charge a fee for, acceptance of support, warranty, indemnity,
168
+      or other liability obligations and/or rights consistent with this
169
+      License. However, in accepting such obligations, You may act only
170
+      on Your own behalf and on Your sole responsibility, not on behalf
171
+      of any other Contributor, and only if You agree to indemnify,
172
+      defend, and hold each Contributor harmless for any liability
173
+      incurred by, or claims asserted against, such Contributor by reason
174
+      of your accepting any such warranty or additional liability.
175
+
176
+   END OF TERMS AND CONDITIONS
177
+
178
+   APPENDIX: How to apply the Apache License to your work.
179
+
180
+      To apply the Apache License to your work, attach the following
181
+      boilerplate notice, with the fields enclosed by brackets "{}"
182
+      replaced with your own identifying information. (Don't include
183
+      the brackets!)  The text should be enclosed in the appropriate
184
+      comment syntax for the file format. We also recommend that a
185
+      file or class name and description of purpose be included on the
186
+      same "printed page" as the copyright notice for easier
187
+      identification within third-party archives.
188
+
189
+   Copyright {yyyy} {name of copyright owner}
190
+
191
+   Licensed under the Apache License, Version 2.0 (the "License");
192
+   you may not use this file except in compliance with the License.
193
+   You may obtain a copy of the License at
194
+
195
+       http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+   Unless required by applicable law or agreed to in writing, software
198
+   distributed under the License is distributed on an "AS IS" BASIS,
199
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+   See the License for the specific language governing permissions and
201
+   limitations under the License.
202
+

+ 123
- 0
README.md View File

@@ -0,0 +1,123 @@
1
+#ONOS Plugin for Fuel#
2
+
3
+##Brief##
4
+
5
+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.
6
+
7
+
8
+##Notification##
9
+
10
+
11
+* Fuel opentack version should be after 6.1.
12
+* Only supports the environment with network type: Neutron.
13
+* Live migration is supported.
14
+* Cluster of onos is supported.
15
+* L3 traffic is still on the way.
16
+
17
+
18
+##Installation Guide##
19
+
20
+
21
+###ONOS plugin installation###
22
+
23
+
24
+1.  Log in Fuel Master and clone GIT repository of fuel-plugin-onos from openstack:
25
+
26
+        git clone https://github.com/openstack/fuel-plugin-onos
27
+
28
+2. Preparing an environment for plugin development
29
+in three easy steps:  
30
+A. Install the standard Linux development tools.  
31
+For Ubuntu 14.04 LTS, run:  
32
+
33
+		sudo apt-get install createrepo rpm dpkg-dev  
34
+For Centos 6.5, run:  
35
+
36
+		yum install createrepo rpm rpm-build dpkg-devel  
37
+B. Install the Fuel Plugin Builder. To do that, you should first get pip:
38
+
39
+		easy_install pip  
40
+C. Then, install Fuel Plugin Builder (fpb) itself:
41
+
42
+        pip install fuel-plugin-builder
43
+    
44
+3. Build ONOS plugin for fuel:
45
+
46
+        fpb --build fuel-plugin-onos/
47
+
48
+4. The onos rpm will be built in the folder of fuel-plugin-onos.  
49
+Notice: Above steps aren't liminited with the environment of master, you can also make it everywhere, but after the rpm is made, you shoult copy it to the master.
50
+
51
+5. Install the onos plugin:
52
+
53
+        fuel plugins --install onos*.rpm
54
+
55
+6. Check if you successfully install the plugin:
56
+
57
+        fuel plugins
58
+
59
+        id | name   | version | package_version
60
+        ---|--------|---------|----------------
61
+        1  | onos   | 0.1.1   | 2.0.0
62
+
63
+     
64
+7. Check if the plugin is enabled on the settings table.      
65
+Notice: the info of a new plugin can only be ready  when a new environment is created.
66
+
67
+
68
+##User Guide##
69
+
70
+
71
+###ONOS plugin configuration###
72
+
73
+
74
+All action is with Fuel UI wizard.   
75
+1.Create a new environment.   
76
+2.Select 'onos plugin' on Settings tab.   
77
+
78
+    ? onos plugin 
79
+
80
+3.Select a node with role 'controller' and others with role 'compute'.  
81
+Notice: In avoid of deployging failure, pay attentions to node configurations espacelly those for interfaces. 
82
+
83
+        | interfaces   | useage                 |
84
+        |--------------|------------------------|
85
+        | eht0         | Admin(PXE)             |
86
+        | eht1         | Storage and Management | 
87
+        | eht2         | Private                | 
88
+        | eht3         | Public                 | 
89
+
90
+4.Click 'Deploy changes' to enable nodes with ONOS.  
91
+
92
+
93
+
94
+###Dependencies###
95
+
96
+In order to run ONOS, the following are required:  
97
+
98
+- Java 8 JDK (Oracle Java recommended; OpenJDK is not as thoroughly tested)    
99
+- ONOS tarball( Newest version 1.3 recommended.)
100
+
101
+Notice: In case of version problems, the onos rpm uses jdk and onos packages that have been tested.
102
+
103
+###Testing###
104
+
105
+1. Web UI is recommended for ONOS controller with tuitive information of topo, devices and etc.
106
+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!
107
+
108
+	Web UI: http://horizon_ip:8181/onos/ui/index.html 
109
+2. CLI is capable of more diverse functionality by running /opt/onos/bin/onos. More about CLI can be found in [The ONOS CLI](
110
+https://wiki.onosproject.org/display/ONOS/The+ONOS+CLI).
111
+
112
+
113
+##Getting Involved##
114
+
115
+Interested in contributing? Follow [Fuel Plugins Development](
116
+https://wiki.openstack.org/wiki/Fuel/Plugins).
117
+
118
+##Contributors##
119
+
120
+?	Wu Wenbin <wuwenbin2@huawei.com>  
121
+?	Zhang Haoyu <zhanghaoyu7@huawei.com>
122
+
123
+

+ 2
- 0
deployment_scripts/puppet/manifests/install.pp View File

@@ -0,0 +1,2 @@
1
+include onos
2
+class{ 'onos::install':}

+ 23
- 0
deployment_scripts/puppet/manifests/neutron.pp View File

@@ -0,0 +1,23 @@
1
+include onos
2
+
3
+Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
4
+neutron_plugin_ml2 {
5
+  'ml2/mechanism_drivers':       value => 'onos';
6
+  'ml2/tenant_network_types':    value => 'vxlan';
7
+  'ml2_onos/password':           value => 'admin';
8
+  'ml2_onos/username':           value => 'admin';
9
+  'ml2_onos/url_path':           value => "http://${onos::manager_ip}:8181/onos/vtn";
10
+}->
11
+
12
+exec{ 'Configure Neutron3':
13
+        command  => "mysql -e 'drop database if exists neutron;';
14
+		    mysql -e 'create database neutron character set utf8;';
15
+		    mysql -e \"grant all on neutron.* to 'neutron'@'%';\";
16
+		    neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head;",
17
+} ->
18
+exec{ 'restart neutron':
19
+        command  => "service neutron-server restart",
20
+}
21
+
22
+
23
+

+ 3
- 0
deployment_scripts/puppet/manifests/onos-service.pp View File

@@ -0,0 +1,3 @@
1
+include onos
2
+class {'onos::config':} ~> 
3
+class {'onos::service':}

+ 64
- 0
deployment_scripts/puppet/manifests/ovs.pp View File

@@ -0,0 +1,64 @@
1
+include onos
2
+
3
+Exec{path => "/usr/bin:/usr/sbin:/bin:/sbin",}
4
+
5
+case $::operatingsystem{
6
+centos:{
7
+	$neutron_ovs_agent='neutron-openvswitch-agent'
8
+	$ovs_service='openvswitch'
9
+	$cmd_remove_agent='chkconfig --del neutron-openvswitch-agent'
10
+}
11
+ubuntu:{
12
+	$neutron_ovs_agent='neutron-plugin-openvswitch-agent'
13
+	$ovs_service='openvswitch-switch'
14
+	$cmd_remove_agent='update-rc.d neutron-plugin-openvswitch-agent remove'
15
+}
16
+
17
+}
18
+
19
+$roles =  $onos::roles
20
+
21
+if member($roles, 'primary-controller') {
22
+service {'neutron-server':
23
+          ensure => stopped,
24
+          enable => false,
25
+}->
26
+cs_resource { "p_${neutron_ovs_agent}":
27
+    ensure => absent,
28
+    before => Service["shut down and disable Neutron's agent services"],
29
+  }}
30
+else{
31
+exec{'remove neutron-openvswitch-agent auto start':
32
+        command => "touch /opt/service;
33
+        $cmd_remove_agent;
34
+        sed -i /neutron-openvswitch-agent/d /opt/service",
35
+        before => Service["shut down and disable Neutron's agent services"],
36
+}
37
+}
38
+
39
+
40
+firewall{'222 vxlan':
41
+      port   => [4789],
42
+      proto  => 'udp',
43
+      action => 'accept',
44
+}->
45
+service {"shut down and disable Neutron's agent services":
46
+		name => $neutron_ovs_agent,
47
+		ensure => stopped,
48
+		enable => false,
49
+}->
50
+exec{'Stop the OpenvSwitch service and clear existing OVSDB':
51
+        command =>  "service $ovs_service stop ;
52
+        rm -rf /var/log/openvswitch/* ;
53
+        rm -rf /etc/openvswitch/conf.db ;
54
+        service $ovs_service start ;"
55
+
56
+} ->
57
+exec{'Set ONOS as the manager':
58
+        command => "su -s /bin/sh -c 'ovs-vsctl set-manager tcp:${onos::manager_ip}:6640'",
59
+
60
+}
61
+
62
+
63
+
64
+

+ 22
- 0
deployment_scripts/puppet/manifests/preliminary.pp View File

@@ -0,0 +1,22 @@
1
+group { 'onos':
2
+      ensure => present,
3
+      before => [File['/opt/onos/'], User['onos']],
4
+    }
5
+
6
+
7
+user { 'onos':
8
+      ensure     => present,
9
+      home       => '/opt/onos/',
10
+      membership => 'minimum',
11
+      groups     => 'onos',
12
+      before     => File['/opt/onos/'],
13
+    }
14
+
15
+
16
+file { '/opt/onos/':
17
+        ensure  => 'directory',
18
+        recurse => true,
19
+        owner   => 'onos',
20
+        group   => 'onos',
21
+}
22
+

BIN
deployment_scripts/puppet/modules/onos/files/install_jdk8.tar View File


BIN
deployment_scripts/puppet/modules/onos/files/networking-onos.tar View File


+ 6
- 0
deployment_scripts/puppet/modules/onos/files/onos_config.sh View File

@@ -0,0 +1,6 @@
1
+#!bin/sh
2
+
3
+    echo 'export ONOS_OPTS=debug' > /opt/onos/options;
4
+    echo 'export ONOS_USER=root' >> /opt/onos/options;
5
+    mkdir /opt/onos/var;
6
+    mkdir /opt/onos/config;

+ 74
- 0
deployment_scripts/puppet/modules/onos/manifests/config.pp View File

@@ -0,0 +1,74 @@
1
+class onos::config{
2
+$onos_home = $onos::onos_home
3
+$karaf_dist = $onos::karaf_dist
4
+$onos_boot_features = $onos::onos_boot_features
5
+$onos_extra_features = $onos::onos_extra_features
6
+$roles =  $onos::roles
7
+$public_vip = hiera('public_vip')
8
+$management_vip = hiera('management_vip')
9
+$controllers_names = $onos::controllers_names
10
+$controllers_ip = $onos::controllers_ip
11
+
12
+Haproxy::Service        { use_include => true }
13
+Haproxy::Balancermember { use_include => true }
14
+  
15
+file{ '/opt/onos_config.sh':
16
+        source => "puppet:///modules/onos/onos_config.sh",
17
+} ->
18
+exec{ 'install onos config':
19
+        command => "sh /opt/onos_config.sh;
20
+	rm -rf /opt/onos_config.sh;",
21
+        path => "/usr/bin:/usr/sbin:/bin:/sbin",
22
+}->
23
+exec{ 'onos boot features':
24
+        command => "sed -i '/^featuresBoot=/c\featuresBoot=$onos_boot_features' $onos_home/$karaf_dist/etc/org.apache.karaf.features.cfg",
25
+        path => "/usr/bin:/usr/sbin:/bin:/sbin",
26
+}->
27
+file{ "${onos_home}/config/cluster.json":
28
+
29
+        ensure => file,
30
+        content => template('onos/cluster.json.erb')
31
+}
32
+
33
+file{ "${onos_home}/config/tablets.json":
34
+        ensure => file,
35
+        content => template('onos/tablets.json.erb'),
36
+}
37
+case $::operatingsystem {
38
+   ubuntu:{
39
+        file{'/etc/init/onos.conf':
40
+        ensure => file,
41
+        content => template('onos/debian/onos.conf.erb')
42
+}}
43
+    centos:{
44
+        file{'/etc/init.d/onos':
45
+        ensure => file,
46
+        content => template('onos/centos/onos.erb'),
47
+	mode => 0777
48
+	
49
+}
50
+
51
+}
52
+}
53
+
54
+
55
+if !member($roles, 'compute') {
56
+haproxy::listen { 'onos':
57
+    order => '221',
58
+    ipaddress => [$public_vip,$management_vip],
59
+    ports     => '8181',
60
+    options   => {'balance' => 'source','option' => ['httpchk /onos/ui','httplog'], 'timeout client' => '2h','timeout server' => '2h'}, 
61
+    mode      => 'http',
62
+ }
63
+
64
+haproxy::balancermember { 'onos':
65
+    order => '221',
66
+    listening_service => 'onos',
67
+    ports             => '8181',
68
+    server_names      => $controllers_names,
69
+    ipaddresses       => $controllers_ip,
70
+    options           => 'check inter 2000 rise 2 fall 5',
71
+    define_cookies    => 'true'
72
+  }
73
+}
74
+}

+ 16
- 0
deployment_scripts/puppet/modules/onos/manifests/init.pp View File

@@ -0,0 +1,16 @@
1
+class onos{
2
+$nodes = hiera('nodes')
3
+$primary_controller = filter_nodes($nodes,'role','primary-controller')
4
+$manager_ip = $primary_controller[0]['internal_address']
5
+$roles = node_roles($nodes, hiera('uid'))
6
+$controllers = concat($primary_controller, filter_nodes($nodes,'role','controller'))
7
+$controllers_ip = filter_hash($controllers, 'internal_address')
8
+$controllers_names = filter_hash($controllers, 'name')
9
+$onos_home = '/opt/onos'
10
+$onos_pkg_url = 'http://downloads.onosproject.org/release/onos-1.3.0.tar.gz'
11
+$karaf_dist = 'apache-karaf-3.0.3'
12
+$onos_pkg_name = 'onos-1.3.0.tar.gz'
13
+$jdk8_pkg_name = 'jdk-8u51-linux-x64.tar.gz'
14
+$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'
15
+$onos_extra_features = 'ovsdb,vtnrsc,vtnweb,vtn,proxyarp'
16
+}

+ 53
- 0
deployment_scripts/puppet/modules/onos/manifests/install.pp View File

@@ -0,0 +1,53 @@
1
+
2
+class onos::install{
3
+$onos_home = $onos::onos_home
4
+$onos_pkg_url = $onos::onos_pkg_url
5
+$karaf_dist = $onos::karaf_dist
6
+$onos_pkg_name = $onos::onos_pkg_name
7
+$jdk8_pkg_name = $onos::jdk8_pkg_name
8
+
9
+
10
+Exec{
11
+        path => "/usr/bin:/usr/sbin:/bin:/sbin",
12
+        timeout => 180,
13
+}
14
+
15
+
16
+
17
+
18
+file{ "/opt/$onos_pkg_name":
19
+        source => "puppet:///modules/onos/$onos_pkg_name",
20
+} ->
21
+file{ '/opt/networking-onos.tar':
22
+        source =>"puppet:///modules/onos/networking-onos.tar",
23
+} ->
24
+file{ "/opt/$jdk8_pkg_name":
25
+        source => "puppet:///modules/onos/$jdk8_pkg_name",
26
+} ->
27
+file{ '/opt/install_jdk8.tar':
28
+        source => "puppet:///modules/onos/install_jdk8.tar",
29
+} ->
30
+file{ '/root/.m2/':
31
+        ensure => 'directory',
32
+        recurse => true,
33
+} ->
34
+file{ '/root/.m2/repository.tar':
35
+        source => "puppet:///modules/onos/repository.tar",
36
+} ->
37
+exec{ "unzip packages":
38
+        command => "tar -zvxf /opt/$onos_pkg_name -C $onos_home  --strip-components 1 --no-overwrite-dir -k;
39
+        tar vxf /opt/networking-onos.tar -C /opt;
40
+        tar xf /opt/install_jdk8.tar -C /opt;
41
+        tar xf /root/.m2/repository.tar -C /root/.m2/",
42
+} ->
43
+exec{ "install driver and jdk":
44
+        command => "sh /opt/networking-onos/install_driver.sh;
45
+        sh /opt/install_jdk8/install_jdk8.sh",
46
+} ->
47
+exec{ "clean used files":
48
+        command => "rm -rf /opt/*.tar*;
49
+        rm -rf /opt/install_jdk8;
50
+        rm -rf /opt/networking-onos;
51
+        rm -rf /root/.m2/*.tar"
52
+}
53
+}

+ 40
- 0
deployment_scripts/puppet/modules/onos/manifests/service.pp View File

@@ -0,0 +1,40 @@
1
+
2
+class onos::service{
3
+
4
+
5
+Exec{
6
+        path => "/usr/bin:/usr/sbin:/bin:/sbin",
7
+        timeout => 320,
8
+	logoutput => 'true',
9
+}
10
+
11
+firewall {'221 onos':
12
+      port   => [6633, 6640, 6653, 8181, 8101,9876],
13
+      proto  => 'tcp',
14
+      action => 'accept',
15
+}->
16
+service{ 'onos':
17
+        ensure => running,
18
+        enable => true,
19
+        hasstatus => true,
20
+        hasrestart => true,
21
+}->
22
+
23
+exec{ 'sleep 100 to stablize onos':
24
+        command => 'sleep 100;'
25
+}->
26
+
27
+exec{ 'restart onos':
28
+        command => 'service onos restart',
29
+}->
30
+
31
+exec{ 'sleep 100 again to stablize onos':
32
+        command => 'sleep 100;'
33
+}->
34
+exec{ 'add onos auto start':
35
+        command => 'echo "onos">>/opt/service',
36
+}->
37
+exec{ 'stop haproxy':
38
+        command => 'service haproxy stop',
39
+}
40
+}

+ 52
- 0
deployment_scripts/puppet/modules/onos/templates/centos/onos.erb View File

@@ -0,0 +1,52 @@
1
+#!/bin/bash
2
+# chkconfig: 345 98 2
3
+# description: Open Network Operating System
4
+# onos    Startup script for onos
5
+# processname: onos
6
+
7
+prog=onos
8
+export JAVA_HOME=/usr/lib/jvm/java-8-oracle
9
+export ONOS_APPS=<%= @onos_extra_features -%>
10
+
11
+cd /opt/onos/bin/
12
+start(){
13
+        echo $"Starting $prog..."
14
+        ./onos-service &
15
+        }
16
+stop(){
17
+        PID=`ps aux | grep java | grep karaf | awk '{print $2}'`
18
+        echo $"Stopping $prog $PID"
19
+        kill -9 $PID
20
+	sleep 10
21
+        }
22
+status(){
23
+        PID=`ps aux | grep java | grep karaf | awk '{print $2}'`
24
+        if test -z $PID
25
+        then
26
+          echo "onos stop/waiting"
27
+          exit 1
28
+        else
29
+          echo "onos start/running, process $PID."
30
+          exit 0
31
+        fi
32
+        }
33
+
34
+case "$1" in
35
+  start)
36
+        start
37
+        ;;
38
+  stop)
39
+        stop
40
+        ;;
41
+  restart)
42
+        stop
43
+        start
44
+        ;;
45
+  status)
46
+        status
47
+        ;;
48
+  *)
49
+        echo "Please use: $0 {start|stop|status}"
50
+        exit 1
51
+        ;;
52
+esac

+ 20
- 0
deployment_scripts/puppet/modules/onos/templates/cluster.json.erb View File

@@ -0,0 +1,20 @@
1
+{"ipPrefix": "192.168.0.*",
2
+  "nodes": [
3
+	<% index = 1 -%>
4
+	<%- @controllers_ip.each do |ip|  -%>
5
+        <%- if index == @controllers_ip.size -%>
6
+        {
7
+        "ip": "<%= ip -%>",
8
+        "id": "<%= ip -%>",
9
+        "tcpPort": 9876
10
+        }
11
+        <%- else -%>
12
+        {
13
+        "ip": "<%= ip -%>",
14
+        "id": "<%= ip -%>",
15
+        "tcpPort": 9876
16
+   	},
17
+        <%- end -%>
18
+        <%- index = index + 1 -%>
19
+        <%- end -%>
20
+]}

+ 31
- 0
deployment_scripts/puppet/modules/onos/templates/debian/onos.conf.erb View File

@@ -0,0 +1,31 @@
1
+description  "Open Network Operating System"
2
+author       "ON.Lab"
3
+
4
+start on (net-device-up
5
+          and local-filesystems
6
+          and runlevel [2345])
7
+stop on runlevel [016]
8
+
9
+console output
10
+kill timeout 60
11
+respawn
12
+
13
+env LANG=en_US.UTF-8
14
+env JAVA_HOME=/usr/lib/jvm/java-8-oracle;
15
+pre-stop script
16
+    /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log
17
+    sleep 1
18
+end script
19
+
20
+script
21
+    export J2SDKDIR=/usr/lib/jvm/java-8-oracle;
22
+    export J2REDIR=/usr/lib/jvm/java-8-oracle/jre;
23
+    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;
24
+    export JAVA_HOME=/usr/lib/jvm/java-8-oracle;
25
+    export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db;
26
+    export ONOS_APPS=<%= @onos_extra_features %>
27
+  [ -f /opt/onos/options ] && . /opt/onos/options
28
+  start-stop-daemon --signal INT --start --chuid $ONOS_USER \
29
+    --exec /opt/onos/bin/onos-service -- $ONOS_OPTS \
30
+        >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
31
+end script

+ 69
- 0
deployment_scripts/puppet/modules/onos/templates/tablets.json.erb View File

@@ -0,0 +1,69 @@
1
+{
2
+    "nodes": [
3
+	<%- index = 1 -%>
4
+	<%- @controllers_ip.each do |ip| -%>
5
+        <%- if index == @controllers_ip.size -%>
6
+        {
7
+        "ip": "<%= ip %>",
8
+        "id": "<%= ip %>",
9
+        "tcpPort": 9876
10
+        }
11
+        <%- else -%>
12
+        {
13
+        "ip": "<%= ip %>",
14
+        "id": "<%= ip %>",
15
+        "tcpPort": 9876
16
+        },
17
+        <%- end -%>
18
+        <%- index = index + 1 -%>
19
+        <%- end -%>
20
+    	],
21
+    "partitions": {
22
+	<%- key = 1 -%>
23
+        <%- @controllers_ip.each do |ip| -%>
24
+        <%- if key == @controllers_ip.size -%>
25
+        "p<%= key -%>":[
26
+		<%- index = 1 -%>
27
+        <%- @controllers_ip.each do |ip| -%>
28
+        <%- if index == @controllers_ip.size -%>
29
+        {
30
+            "ip": "<%= ip %>",
31
+            "id": "<%= ip %>",
32
+            "tcpPort": 9876
33
+        }
34
+        <%- else -%>
35
+        {
36
+            "ip": "<%= ip %>",
37
+            "id": "<%= ip %>",
38
+            "tcpPort": 9876
39
+        },
40
+        <%- end -%>
41
+		<%- index = index + 1 -%>
42
+        <%- end -%>
43
+        ]
44
+        <%- key = key + 1 -%>
45
+        <%- else -%>
46
+        "p<%= key -%>":[
47
+        <%- index = 1 -%>
48
+        <%- @controllers_ip.each do |ip| -%>
49
+        <%- if index ==  @controllers_ip.size -%>
50
+        {
51
+                "ip": "<%= ip %>",
52
+                "id": "<%= ip %>",
53
+                "tcpPort": 9876
54
+        }
55
+        <%- else -%>
56
+        {
57
+                "ip": "<%= ip %>",
58
+                "id": "<%= ip %>",
59
+                "tcpPort": 9876
60
+        },
61
+        <%- end -%>
62
+		<%- index = index + 1 -%>
63
+        <%- end -%>
64
+        ],
65
+        <%- key = key + 1 -%>
66
+        <%- end -%>
67
+        <%- end -%>
68
+}
69
+}

+ 5
- 0
environment_config.yaml View File

@@ -0,0 +1,5 @@
1
+attributes:
2
+  metadata:
3
+    restrictions:
4
+      - "cluster:net_provider != 'neutron'": "Neutron only"
5
+

+ 36
- 0
metadata.yaml View File

@@ -0,0 +1,36 @@
1
+# Plugin name
2
+name: onos
3
+# Human-readable name for your plugin
4
+title: onos plugin
5
+# Plugin version
6
+version: '0.1.1'
7
+# Description
8
+description: Enable to use plugin onos for Neutron
9
+# Required fuel version
10
+fuel_version: ['6.1']
11
+# Specify license of your plugin
12
+licenses: ['Apache License Version 2.0']
13
+# Specify author or company name
14
+authors: ['Wenbin Wu, Huawei']
15
+# A link to the plugin's page
16
+homepage: 'https://github.com/stackforge/fuel-plugins'
17
+# Specify a group which your plugin implements, possible options:
18
+# network, storage, storage::cinder, storage::glance, hypervisor
19
+groups: ['network']
20
+
21
+# The plugin is compatible with releases in the list
22
+releases:
23
+  - os: centos
24
+    version: 2014.2-6.1
25
+    mode: ['ha', 'multinode']
26
+    deployment_scripts_path: deployment_scripts/
27
+    repository_path: repositories/centos
28
+  - os: ubuntu
29
+    version: 2014.2-6.1
30
+    mode: ['ha', 'multinode']
31
+    deployment_scripts_path: deployment_scripts/
32
+    repository_path: repositories/ubuntu
33
+  
34
+
35
+# Version of plugin package
36
+package_version: '2.0.0'

+ 15
- 0
pre_build_hook View File

@@ -0,0 +1,15 @@
1
+#!/bin/bash
2
+set -eux
3
+DIR="$(dirname `readlink -f $0`)"
4
+TARGET="${DIR}/deployment_scripts/puppet/modules/onos/files"
5
+packages=packages.tar.gz
6
+packages_url=-http://58.251.166.184:9999/OPNFV/Compass4nfv/cache/packages.tar.gz
7
+cd $TARGET
8
+if [ ! -f "$packages" ]; then
9
+  wget --no-cookies $packages_url -P $TARGET
10
+fi
11
+
12
+tar zxf packages.tar.gz -C $TARGET
13
+mv packages/onos/* ./
14
+rm -rf packages.tar.gz
15
+rm -rf packages

+ 0
- 0
repositories/centos/.gitkeep View File


+ 0
- 0
repositories/ubuntu/.gitkeep View File


+ 43
- 0
tasks.yaml View File

@@ -0,0 +1,43 @@
1
+
2
+- id: onos_pre
3
+  role: ['primary-controller','controller']
4
+  stage: pre_deployment/4450
5
+  type: puppet
6
+  parameters:
7
+    puppet_manifest: puppet/manifests/preliminary.pp
8
+    puppet_modules: puppet/modules:/etc/puppet/modules
9
+    timeout: 600
10
+- id: onos_install
11
+  role: ['primary-controller','controller']
12
+  stage: post_deployment/4455
13
+  type: puppet
14
+  parameters:
15
+    puppet_manifest: puppet/manifests/install.pp
16
+    puppet_modules: puppet/modules:/etc/puppet/modules
17
+    timeout: 600
18
+- id: onos_configure
19
+  role: ['primary-controller','controller']
20
+  stage: post_deployment/4465
21
+  type: puppet
22
+  parameters:
23
+    puppet_manifest: puppet/manifests/onos-service.pp
24
+    puppet_modules: puppet/modules:/etc/puppet/modules
25
+    timeout: 1800
26
+- id: ovs_config
27
+  role: ['primary-controller','controller','compute']
28
+  stage: post_deployment/4470
29
+  type: puppet
30
+  parameters:
31
+    puppet_manifest: puppet/manifests/ovs.pp
32
+    puppet_modules: puppet/modules:/etc/puppet/modules
33
+    timeout: 600
34
+- id: onos_config_neutron
35
+  role: ['primary-controller','controller']
36
+  stage: post_deployment/4475
37
+  type: puppet
38
+  parameters:
39
+    puppet_manifest: puppet/manifests/neutron.pp
40
+    puppet_modules: puppet/modules:/etc/puppet/modules
41
+    timeout: 600
42
+
43
+

Loading…
Cancel
Save