COMPASS-438 19/17019/3
authorCNlucius <lukai1@huawei.com>
Mon, 18 Jul 2016 03:39:07 +0000 (11:39 +0800)
committerCNlucius <lukai1@huawei.com>
Mon, 18 Jul 2016 03:49:58 +0000 (11:49 +0800)
add a task of onos-sfc

Change-Id: Iba0273652afe91e251650f3bf90339bbc4cbdaeb
Signed-off-by: CNlucius <lukai1@huawei.com>
deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/main.yml
deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/onos_controller.yml
deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/onos_sfc_controller.yml [new file with mode: 0755]
deploy/conf/hardware_environment/huawei-pod1/os-onos-sfc-ha.yml [new file with mode: 0644]
deploy/conf/hardware_environment/huawei-pod2/os-onos-sfc-ha.yml [new file with mode: 0644]
deploy/conf/hardware_environment/intel-pod8/os-onos-sfc-ha.yml [new file with mode: 0644]
deploy/conf/vm_environment/os-onos-sfc-ha.yml [new file with mode: 0644]

index e9b985c..ccc0807 100755 (executable)
 
 - name: Install ONOS Cluster on Controller
   include: onos_controller.yml
-  when: inventory_hostname in groups['onos']
+  when: inventory_hostname in groups['onos'] and onos_sfc == "Disable"
+
+- name: Install ONOS Cluster on Controller
+  include: onos_sfc_controller.yml
+  when: inventory_hostname in groups['onos'] and onos_sfc == "Enable"
 
 - name: Config ONOS Cluster
   include: openvswitch.yml
index 287adb0..9ab8d1c 100755 (executable)
 - name: download onos driver packages
   get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"  dest=/opt/
 
-- name: upload onos sfc driver package
-  get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}"  dest=/opt/
-
 - name: unarchive onos driver package
   command: su -s /bin/sh -c "tar xvf  /opt/networking-onos.tar -C /opt/"
 
-- name: upload onos sfc driver package
-  command: su -s /bin/sh -c "tar xvf  /opt/networking-sfc.tar -C /opt/"
-
 - name: install onos driver
   command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
 
-- name: install onos sfc driver
-  command: su -s /bin/sh -c "/opt/networking-sfc/install_driver.sh"
-
 - name: install onos required packages
   action: "{{ ansible_pkg_mgr }}  name={{ item }} state=present"
   with_items: packages
-  
+
 - 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: unarchive onos driver package
   command: su -s /bin/sh -c "tar xvf  /opt/install_jdk8.tar -C /opt/"
-  
+
 - name: install install_jdk8 package
-  command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" 
-  
+  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;
 ##########################################################################################################
 - name: Configure Neutron1
   shell: >
-    crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,onos_router;
+    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
diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/onos_sfc_controller.yml b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/onos_sfc_controller.yml
new file mode 100755 (executable)
index 0000000..226923e
--- /dev/null
@@ -0,0 +1,140 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+
+- name: get image http server
+  shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+  register: http_server
+
+- name: download onos driver packages
+  get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"  dest=/opt/
+
+- name: download onos sfc driver package
+  get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}"  dest=/opt/
+
+- name: unarchive onos driver package
+  command: su -s /bin/sh -c "tar xvf  /opt/networking-onos.tar -C /opt/"
+
+- name: unarchive onos sfc driver package
+  command: su -s /bin/sh -c "tar xvf  /opt/networking-sfc.tar -C /opt/"
+
+- name: install onos driver
+  command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
+
+- name: install onos sfc driver
+  command: su -s /bin/sh -c "/opt/networking-sfc/install_driver.sh"
+
+- name: install onos required packages
+  action: "{{ ansible_pkg_mgr }}  name={{ item }} state=present"
+  with_items: packages
+
+- 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: download oracle-jdk8 script file
+  get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}"  dest=/opt/
+
+- name: unarchive onos driver package
+  command: su -s /bin/sh -c "tar xvf  /opt/install_jdk8.tar -C /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"
+  ignore_errors: True
+
+- name: download jar repository
+  get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ repository }}"  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/;
+
+- 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: wait for config time
+  shell: "sleep 10"
+
+- name: start onos service
+  service: name=onos state=started enabled=yes
+
+- name: wait for onos start time
+  shell: "sleep 200"
+
+- name: add onos auto start
+  shell: >
+    echo "onos">>/opt/service
+
+##########################################################################################################
+################################    ONOS connect with OpenStack   ################################
+##########################################################################################################
+- name: Configure Neutron1
+  shell: >
+    crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,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;
+    su -s /bin/sh -c "neutron-db-manage --subproject networking-sfc upgrade head" neutron;
+
+- name: Restart neutron-server
+  service: name=neutron-server state=restarted
diff --git a/deploy/conf/hardware_environment/huawei-pod1/os-onos-sfc-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/os-onos-sfc-ha.yml
new file mode 100644 (file)
index 0000000..5b1206b
--- /dev/null
@@ -0,0 +1,62 @@
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiUser: root
+ipmiVer: '2.0'
+
+onos_sfc: "Enable"
+
+hosts:
+  - name: host1
+    mac: 'F8:4A:BF:55:A2:8D'
+    interfaces:
+       - eth1: 'F8:4A:BF:55:A2:8E'
+    ipmiIp: 172.16.130.26
+    ipmiPass: Huawei@123
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host2
+    mac: 'D8:49:0B:DA:5A:B7'
+    interfaces:
+      - eth1: 'D8:49:0B:DA:5A:B8'
+    ipmiIp: 172.16.130.27
+    ipmiPass: huawei@123
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host3
+    mac: 'D8:49:0B:DA:2A:28'
+    interfaces:
+      - eth1: 'D8:49:0B:DA:2A:29'
+    ipmiIp: 172.16.130.29
+    ipmiPass: Huawei@123
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host4
+    mac: 'D8:49:0B:DA:5B:5D'
+    interfaces:
+      - eth1: 'D8:49:0B:DA:5B:5E'
+    ipmiIp: 172.16.130.30
+    ipmiPass: Huawei@123
+    roles:
+      - compute
+
+  - name: host5
+    mac: 'D8:49:0B:DA:56:85'
+    interfaces:
+      - eth1: 'D8:49:0B:DA:56:86'
+    ipmiIp: 172.16.130.31
+    ipmiPass: Huawei@123
+    roles:
+      - compute
+
diff --git a/deploy/conf/hardware_environment/huawei-pod2/os-onos-sfc-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/os-onos-sfc-ha.yml
new file mode 100644 (file)
index 0000000..59e1274
--- /dev/null
@@ -0,0 +1,65 @@
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiVer: '2.0'
+
+onos_sfc: "Enable"
+
+hosts:
+  - name: host1
+    mac: 'EC:38:8F:79:0C:2C'
+    ipmiUser: root
+    ipmiPass: Huawei@123
+    ipmiIp: 172.16.130.20
+    interfaces:
+      - eth1: 'EC:38:8F:79:0C:2D'
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host2
+    mac: 'EC:38:8F:79:0C:48'
+    ipmiIp: 172.16.130.19
+    ipmiUser: root
+    ipmiPass: Huawei@123
+    interfaces:
+      - eth1: 'EC:38:8F:79:0C:49'
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host3
+    mac: 'EC:38:8F:79:10:CC'
+    ipmiIp: 172.16.130.18
+    ipmiUser: root
+    ipmiPass: Huawei@123
+    interfaces:
+      - eth1: 'EC:38:8F:79:10:CD'
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host4
+    mac: 'EC:38:8F:79:0C:6C'
+    ipmiIp: 172.16.130.17
+    ipmiUser: root
+    ipmiPass: Huawei@123
+    interfaces:
+      - eth1: 'EC:38:8F:79:0C:6D'
+    roles:
+      - compute
+
+  - name: host5
+    mac: 'EC:38:8F:7A:E6:ED'
+    ipmiIp: 172.16.130.16
+    ipmiUser: root
+    ipmiPass: Huawei@123
+    interfaces:
+      - eth1: 'EC:38:8F:7A:E6:EE'
+    roles:
+      - compute
diff --git a/deploy/conf/hardware_environment/intel-pod8/os-onos-sfc-ha.yml b/deploy/conf/hardware_environment/intel-pod8/os-onos-sfc-ha.yml
new file mode 100644 (file)
index 0000000..0fab6b0
--- /dev/null
@@ -0,0 +1,63 @@
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiUser: root
+ipmiPass: root
+ipmiVer: '1.0'
+
+onos_sfc: "Enable"
+
+hosts:
+  - name: host1
+    mac: '00:1E:67:D4:30:D2'
+    interfaces:
+      - eth2: '00:1E:67:C5:5B:28'
+      - eth3: '00:1E:67:C5:5B:29'
+    ipmiIp: 10.2.117.127
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host2
+    mac: '00:1E:67:D4:39:B5'
+    interfaces:
+      - eth2: '00:1E:67:C5:52:24'
+      - eth3: '00:1E:67:C5:52:25'
+    ipmiIp: 10.2.117.129
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host3
+    mac: '00:1E:67:D4:31:B2'
+    interfaces:
+      - eth2: '00:1E:67:C1:FA:E0'
+      - eth3: '00:1E:67:C1:FA:E1'
+    ipmiIp: 10.2.117.131
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host4
+    mac: '00:1E:67:D4:34:67'
+    interfaces:
+      - eth2: '00:1E:67:E2:58:80'
+      - eth3: '00:1E:67:E2:58:81'
+    ipmiIp: 10.2.117.133
+    roles:
+      - compute
+
+  - name: host5
+    mac: '00:1E:67:D4:38:42'
+    interfaces:
+      - eth2: '00:1E:67:C1:F9:2C'
+      - eth3: '00:1E:67:C1:F9:2D'
+    ipmiIp: 10.2.117.135
+    roles:
+      - compute
+
diff --git a/deploy/conf/vm_environment/os-onos-sfc-ha.yml b/deploy/conf/vm_environment/os-onos-sfc-ha.yml
new file mode 100644 (file)
index 0000000..7974312
--- /dev/null
@@ -0,0 +1,31 @@
+TYPE: virtual
+FLAVOR: cluster
+
+onos_sfc: "Enable"
+
+hosts:
+  - name: host1
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host2
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host3
+    roles:
+      - controller
+      - ha
+      - onos
+
+  - name: host4
+    roles:
+      - compute
+
+  - name: host5
+    roles:
+      - compute