CORD-793 Ansible playbook for refreshing fabric config

Change-Id: Ic404c793d2e062f935fce5f36930b25b21d274bc
diff --git a/cord-fabric-pingtest.yml b/cord-fabric-pingtest.yml
new file mode 100644
index 0000000..420fde0
--- /dev/null
+++ b/cord-fabric-pingtest.yml
@@ -0,0 +1,19 @@
+---
+# Send some pings from compute nodes to head node over the fabri
+# Mainly useful for CiaB right now
+
+- name: Include vars
+  hosts: head
+  tasks:
+    - name: Include variables
+      include_vars: "{{ item }}"
+      with_items:
+        - vars/cord_defaults.yml
+        - vars/cord.yml
+        - vars/example_keystone.yml
+
+- name: Fabric ping test to gateway
+  hosts: compute
+  remote_user: ubuntu
+  roles:
+    - fabric-pingtest
diff --git a/cord-refresh-fabric.yml b/cord-refresh-fabric.yml
new file mode 100644
index 0000000..ebad1c4
--- /dev/null
+++ b/cord-refresh-fabric.yml
@@ -0,0 +1,29 @@
+---
+# Creates a fabric configuration using 'cord generate'
+# Mainly useful for CiaB right now
+
+- name: Include vars
+  hosts: head
+  tasks:
+    - name: Include variables
+      include_vars: "{{ item }}"
+      with_items:
+        - vars/cord_defaults.yml
+        - vars/cord.yml
+        - vars/example_keystone.yml
+
+- name: Prep fabric on head node
+  hosts: head
+  roles:
+    - fabric-head-prep
+
+- name: Prep fabric on compute nodes
+  hosts: compute
+  remote_user: ubuntu
+  roles:
+    - fabric-compute-prep
+
+- name: Refresh fabric config
+  hosts: head
+  roles:
+    - fabric-refresh
diff --git a/roles/fabric-compute-prep/tasks/main.yml b/roles/fabric-compute-prep/tasks/main.yml
new file mode 100644
index 0000000..a02820c
--- /dev/null
+++ b/roles/fabric-compute-prep/tasks/main.yml
@@ -0,0 +1,28 @@
+- name: Ensure no host entry for fabric interface
+  uri:
+    url: http://10.1.0.1:8181/onos/v1/hosts/{{ ansible_fabric.macaddress | replace(":", "%3A") }}/None
+    method: DELETE
+    user: onos
+    password: rocks
+  ignore_errors: true
+
+- name: Check that br-int exists
+  command: ifconfig br-int
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
+
+# Needed for CPqD switch
+- name: Turn off TCP checksum offload on fabric interface
+  become: yes
+  command: ethtool -K fabric tx off
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
+
+- name: Send ping on fabric, expected to fail b/c fabric not set up
+  command: ping -I br-int -c 3 10.6.1.254
+  ignore_errors: true
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
diff --git a/roles/fabric-head-prep/tasks/main.yml b/roles/fabric-head-prep/tasks/main.yml
new file mode 100644
index 0000000..5aa10d5
--- /dev/null
+++ b/roles/fabric-head-prep/tasks/main.yml
@@ -0,0 +1,20 @@
+- name: Check that fabric exists
+  command: ifconfig fabric
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
+
+# Needed for CPqD switch
+- name: Turn off TCP checksum offload on fabric interface
+  become: yes
+  command: ethtool -K fabric tx off
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
+
+- name: Send ping on fabric, expected to fail b/c fabric not set up
+  command: ping -I fabric -c 3 10.6.1.254
+  ignore_errors: true
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
diff --git a/roles/fabric-pingtest/tasks/main.yml b/roles/fabric-pingtest/tasks/main.yml
new file mode 100644
index 0000000..948f44b
--- /dev/null
+++ b/roles/fabric-pingtest/tasks/main.yml
@@ -0,0 +1,9 @@
+- name: Ping gateway IP addresses
+  command: ping -c 20 {{ item }}
+  with_items:
+  - 10.6.1.1
+  - 10.6.1.129
+  - 10.6.1.193
+  changed_when: false
+  tags:
+    - skip_ansible_lint # running a sub job
diff --git a/roles/fabric-refresh/tasks/main.yml b/roles/fabric-refresh/tasks/main.yml
new file mode 100644
index 0000000..0a6f93f
--- /dev/null
+++ b/roles/fabric-refresh/tasks/main.yml
@@ -0,0 +1,14 @@
+- name: Remove old ONOS fabric configuration file
+  file:
+    path: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/network-cfg-quickstart.json"
+    state: absent
+
+- name: Rebuild and reinstall ONOS fabric configuration
+  make:
+    chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}"
+    target: "{{ item }}"
+  with_items:
+  - network-cfg-quickstart.json
+  - delete_fabric_config
+  - fabric
+  - reactivate_fabric_apps
diff --git a/roles/maas-test-client-install/tasks/main.yml b/roles/maas-test-client-install/tasks/main.yml
index 6dd1c2b..5e4eb06 100644
--- a/roles/maas-test-client-install/tasks/main.yml
+++ b/roles/maas-test-client-install/tasks/main.yml
@@ -24,7 +24,7 @@
     devices:
       eth0:
         nictype: macvlan
-        parent: eth3
+        parent: fabric
         type: nic
 
 - name: Create testclient container