summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
blob: 0e7c0eb6cde8e315aaa596383bf7da6c2a76df70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f
---
#- 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: set veth port
  shell:  >
    ip link add onos_port1 type veth peer name onos_port2;
    ifconfig onos_port1 up;
    ifconfig onos_port2 up;
  ignore_errors: True

- name: set veth to ovs
  shell: >
    export externamMac=`ifconfig eth1 | grep "HWaddr" | awk '{print $5}'`;
    ifconfig onos_port2 hw ether $externamMac;
    ovs-vsctl add-port br-prv onos_port1;
  ignore_errors: True

#- 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 in groups['onos']

- name: add openflow feature
  command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'";
  when: inventory_hostname in groups['onos']

- name: add vtn feature
  command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'";
  when: inventory_hostname in groups['onos']

- name: set public eth card start
  command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n onos_port2'"
  when: inventory_hostname in groups['onos']

- 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 {{ public_net_info.floating_ip_cidr }} --name ext-subnet  --allocation-pool start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }};
  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 in groups['onos']

- name: delete default gateway
  shell: >
    route delete default;
  when: inventory_hostname not in groups['onos']
  ignore_errors: True