Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 1 | #!/bin/bash |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 2 | |
| 3 | # Copyright 2019 Ciena Corporation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
Matteo Scandolo | 8b4ccf9 | 2019-07-30 16:52:05 -0700 | [diff] [blame] | 17 | ONOS_ADDRESS=${ONOS_ADDRESS:-127.0.0.1} |
| 18 | |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 19 | SADIS_VER=${SADIS_VER:-3.1.0} |
Kailash | 8aa1a5d | 2019-07-30 09:32:08 -0700 | [diff] [blame] | 20 | OLT_VER=${OLT_VER:-3.0.1} |
| 21 | AAA_VER=${AAA_VER:-1.9.0} |
| 22 | DHCP_VER=${DHCP_VER:-1.6.0} |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 23 | |
Kailash | 224552b | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 24 | if [ $(expr $AAA_VER \>= 1.9.0) -eq 1 ]; then |
Kailash | 48d0baf | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 25 | AAA_NAME=aaa-app |
| 26 | else |
| 27 | AAA_NAME=aaa |
| 28 | fi |
| 29 | |
Kailash | 224552b | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 30 | if [ $(expr $DHCP_VER \>= 1.6.0) -eq 1 ]; then |
Kailash | 48d0baf | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 31 | DHCP_NAME=dhcpl2relay-app |
| 32 | else |
| 33 | DHCP_NAME=dhcpl2relay |
| 34 | fi |
| 35 | |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 36 | TYPE=${TYPE:-minimal} |
| 37 | |
| 38 | if [ "$TYPE" == "full" ]; then |
| 39 | ONOS_API_PORT=${ONOS_API_PORT:-8182} |
| 40 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102} |
| 41 | else |
| 42 | ONOS_API_PORT=${ONOS_API_PORT:-8181} |
| 43 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101} |
| 44 | fi |
| 45 | |
Matteo Scandolo | 8b4ccf9 | 2019-07-30 16:52:05 -0700 | [diff] [blame] | 46 | echo "Target ONOS is ${ONOS_ADDRESS}:${ONOS_API_PORT}" |
| 47 | |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 48 | mkdir -p onos-files/onos-apps |
| 49 | echo "Downloading ONOS applications" |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 50 | curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/sadis-app/$SADIS_VER/sadis-app-$SADIS_VER.oar -o ./onos-files/onos-apps/sadis-app-$SADIS_VER.oar |
Kailash | 4ddf241 | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 51 | curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/$AAA_NAME/$AAA_VER/$AAA_NAME-$AAA_VER.oar -o ./onos-files/onos-apps/aaa-app-$AAA_VER.oar |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 52 | curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/olt-app/$OLT_VER/olt-app-$OLT_VER.oar -o ./onos-files/onos-apps/olt-app-$OLT_VER.oar |
Kailash | 4ddf241 | 2019-07-30 09:44:12 -0700 | [diff] [blame] | 53 | curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/$DHCP_NAME/$DHCP_VER/$DHCP_NAME-$DHCP_VER.oar -o ./onos-files/onos-apps/dhcpl2relay-app-$DHCP_VER.oar |
David K. Bainbridge | 4ecc126 | 2019-07-01 13:39:11 -0700 | [diff] [blame] | 54 | |
Matteo Scandolo | 8b4ccf9 | 2019-07-30 16:52:05 -0700 | [diff] [blame] | 55 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/sadis-app-$SADIS_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'SADIS' ONOS application (v${SADIS_VER})..."; sleep 1; done |
| 56 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/olt-app-$OLT_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'OLT' ONOS application (v${OLT_VER})..."; sleep 1; done |
| 57 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/aaa-app-$AAA_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'AAA' ONOS application (v${AAA_VER})..."; sleep 1; done |
| 58 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/dhcpl2relay-app-$DHCP_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'DHCP L2 Relay' ONOS application (v${DHCP_VER})..."; sleep 1; done |
| 59 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/network/configuration --data @onos-files/olt-onos-netcfg.json 2>/dev/null | tail -1) -eq 200; do echo "Configuring VOLTHA ONOS ..."; sleep 1; done |
| 60 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/configuration/org.opencord.olt.impl.Olt --data @onos-files/olt-onos-olt-settings.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling VOLTHA ONOS DHCP provisioning..."; sleep 1; done |
| 61 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/configuration/org.onosproject.net.flow.impl.FlowRuleManager --data @onos-files/olt-onos-enableExtraneousRules.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling extraneous rules for ONOS..."; sleep 1; done |
| 62 | until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json "http://$ONOS_ADDRESS:$ONOS_API_PORT/onos/v1/flows/of:0000000000000001?appId=env.voltha" --data @onos-files/dhcp-to-controller-flow.json 2>/dev/null | tail -1) -eq 201; do echo "Establishing DHCP packet-in flow ..."; sleep 1; done |