updating jenkinsfile and default config for automated build

Change-Id: Ied4098084a73ae217a61127366f2f2476e2c6f74
diff --git a/Jenkinsfile b/Jenkinsfile
index f6ac4b8..13db818 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,28 +1,37 @@
-
 node ('build') {
-   // Mark the code checkout 'stage'....
-   //stage 'Checkout'
-   // Get cord from opencord repo
-   //checkout([$class: 'RepoScm', currentBranch: true, manifestBranch: 'master', manifestRepositoryUrl: 'https://gerrit.opencord.org/manifest', quiet: true])
-   
    stage 'chdir to build'
    dir('build') {
         try {
+            stage 'Login to Maas'
+            sh "maas login maas http://10.90.0.2/MAAS/api/2.0 ${apiKey}"
+            
+            stage 'Release head node'
+            sh "maas maas machine release ${systemId}"
+            sleep 180
+            
+            stage 'Acquire head Node'
+            sh 'maas maas machines allocate'
+            
+            stage 'Deploy head node'
+            sh "maas maas machine deploy ${systemId}"
+            
+            sleep 750
+            
             stage 'Bring up vagrant box'
             sh 'vagrant up corddev'
-            
+
             stage 'Fetch build elements'
             sh 'vagrant ssh -c "cd /cord/build; ./gradlew fetch" corddev'
-            
+
             stage 'Build Images'
             sh 'vagrant ssh -c "cd /cord/build; ./gradlew buildImages" corddev'
-            
+
             stage 'Publish to headnode'
             sh 'vagrant ssh -c "cd /cord/build; ./gradlew -PtargetReg=10.90.0.251:5000 -PdeployConfig=config/onlab_develop_pod.yml publish" corddev'
-            
+
             stage 'Deploy'
             sh 'vagrant ssh -c "cd /cord/build; ./gradlew -PtargetReg=10.90.0.251:5000 -PdeployConfig=config/onlab_develop_pod.yml deploy" corddev'
-    
+
             currentBuild.result = 'SUCCESS'
         } catch (err) {
             currentBuild.result = 'FAILURE'
@@ -32,5 +41,5 @@
         }
         echo "RESULT: ${currentBuild.result}"
    }
-   
+
 }