Permalink
Browse files

Fix ONOS-4503 - allow ONOS to run in offline mode with no internet co…

…nnection

Change-Id: I7122800e2c485743313c5d963bc75f8dd0292452
  • Loading branch information...
1 parent c3aceff commit 594add7af15bdcc625143169c5fa39054a490c47 @ray-milkey ray-milkey committed with bocon13 Nov 15, 2016
Showing with 71 additions and 6 deletions.
  1. +1 −1 .buckconfig
  2. +4 −4 lib/BUCK
  3. +1 −1 lib/deps.json
  4. +63 −0 tools/package/bin/build-offline-karaf
  5. +2 −0 tools/test/scenarios/wrapup.xml
View
@@ -16,7 +16,7 @@
in_build = true
[maven_repositories]
- central = https://repo.maven.apache.org/maven2
+ central = https://repo1.maven.org/maven2
[project]
ide = intellij
View
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Thu Oct 27 21:27:03 PDT 2016. Do not edit this file manually. *****
+# ***** This file was auto-generated at Fri Nov 18 10:06:30 PST 2016. Do not edit this file manually. *****
osgi_feature_group(
name = 'COMPILE',
visibility = ['PUBLIC'],
@@ -1006,9 +1006,9 @@ remote_jar (
remote_file (
name = 'apache-karaf',
- out = 'apache-karaf-3.0.5.tar.gz',
- url = 'http://onlab.vicci.org/onos/third-party/apache-karaf-3.0.5.tar.gz',
- sha1 = '85a20b135f22362b6983f7954b58f0d97308cf63',
+ out = 'apache-karaf-3.0.5-offline-20161115.tar.gz',
+ url = 'http://onlab.vicci.org/onos/third-party/apache-karaf-3.0.5-offline-20161115.tar.gz',
+ sha1 = 'b47ddf4bc2812e9bddf9dfb4f10cb2fd31ebf430',
visibility = [ 'PUBLIC' ],
)
View
@@ -183,7 +183,7 @@
"typesafe-config": "mvn:com.typesafe:config:1.2.1",
"validation-api": "mvn:javax.validation:validation-api:1.1.0.Final",
"checkstyle": "mvn:com.puppycrawl.tools:checkstyle:6.11.2",
- "apache-karaf": "http://onlab.vicci.org/onos/third-party/apache-karaf-3.0.5.tar.gz",
+ "apache-karaf": "http://onlab.vicci.org/onos/third-party/apache-karaf-3.0.5-offline-20161115.tar.gz",
"bndlib": "mvn:biz.aQute.bnd:biz.aQute.bndlib:jar:3.1.0",
"cord-config": "mvn:org.onosproject:cord-config:1.0-b1",
"libthrift": "mvn:org.apache.thrift:libthrift:0.9.3",
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+KARAF_VERSION="3.0.5"
+KARAF_TARFILE_NAME="apache-karaf-${KARAF_VERSION}.tar"
+BOOT_FEATURES="standard,ssh,scr,war,webconsole"
+
+# fetch the standard karaf bits
+rm -f /tmp/${KARAF_TARFILE_NAME}
+curl -o /tmp/${KARAF_TARFILE_NAME}.gz http://onlab.vicci.org/onos/third-party/${KARAF_TARFILE_NAME}.gz
+
+# get a small cell
+source ${ONOS_ROOT}/tools/dev/bash_profile
+cell borrow 60 1+0
+scp /tmp/${KARAF_TARFILE_NAME}.gz sdn@${OC1}:/tmp/${KARAF_TARFILE_NAME}.gz
+
+ssh sdn@${OC1} "
+
+ # unroll the base karaf
+ rm -rf karaf
+ mkdir karaf
+ cd karaf
+ tar xf /tmp/${KARAF_TARFILE_NAME}.gz
+
+ # set the ONOS default boot features
+ perl -pi.old -e 's|^(featuresBoot=).*|\1${BOOT_FEATURES}|' apache-karaf-${KARAF_VERSION}/etc/org.apache.karaf.features.cfg
+
+ # run karaf to fill the maven repo with required artifacts
+ apache-karaf-${KARAF_VERSION}/bin/karaf server 1>/tmp/onos.out 2>/tmp/onos.err &
+
+ sleep 15
+
+ # stop karaf and capture the artifacts that were downloaded into the maven repo
+ apache-karaf-${KARAF_VERSION}/bin/karaf stop 1>/tmp/onos.out 2>/tmp/onos.err &
+ cd ~/.m2/repository
+ tar cvf ~/repo.tar *
+
+ # start with a fresh karaf and overlay the downloaded artifacts
+ cd
+ rm -rf karaf-offline
+ mkdir karaf-offline
+ cd karaf-offline
+ tar xf /tmp/${KARAF_TARFILE_NAME}.gz
+
+ # load the downloaded artifacts into the karaf system directory
+ cd apache-karaf-${KARAF_VERSION}/system
+ tar xf ~/repo.tar
+
+ # create a zipped tar ball of the updated karaf tree
+ cd ~/karaf-offline
+ tar czf ~/karaf-offline.tar.gz apache-karaf-${KARAF_VERSION}
+"
+
+# fetch the new offline karaf tar ball
+BUILD_NUMBER="apache-karaf-${KARAF_VERSION}-offline-$(date +'%Y%m%d')"
+scp sdn@${OC1}:karaf-offline.tar.gz /tmp/${BUILD_NUMBER}.tar.gz
+
+cell return
+
+
+
+
+
+
@@ -20,5 +20,7 @@
<step name="Fetch-Logs-${#}" exec="onos-fetch-logs ${OC#}"
cwd="${WORKSPACE}/tmp/stc" requires="~^"/>
</parallel>
+ <!-- FIXME Figure out how to handle a .m2 repo that exists before the test is run -->
+ <!-- <step name="Check-Maven-Repo" exec="ssh ${ONOS_USER}@${OC1} ls -l .m2 " env="!"/> -->
</group>
</scenario>

0 comments on commit 594add7

Please sign in to comment.