add abiilty to optionally push a SADIS configuration
diff --git a/onos-files/dhcp-to-controller-flow.json b/onos-files/dhcp-to-controller-flow.json
deleted file mode 100644
index f2d31a2..0000000
--- a/onos-files/dhcp-to-controller-flow.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "priority": 40000,
- "timeout": 0,
- "isPermanent": true,
- "deviceId": "of:0000000000000001",
- "treatment": {
- "instructions": [
- {
- "type": "OUTPUT",
- "port": "CONTROLLER"
- }
- ]
- },
- "selector": {
- "criteria": [
- {
- "type": "IN_PORT",
- "port": 1
- },
- {
- "type": "VLAN_VID",
- "vlanId": 222
- }
- ]
- }
-}
diff --git a/onos-files/olt-onos-netcfg.json b/onos-files/olt-onos-netcfg.json
deleted file mode 100644
index 8a47b49..0000000
--- a/onos-files/olt-onos-netcfg.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "devices": {
- "of:0000aabbccddeeff": {
- "basic": {
- "driver": "voltha"
- }
- }
- },
- "apps": {
- "org.opencord.aaa": {
- "AAA": {
- "radiusIp": "10.1.5.3",
- "nasIp": "10.1.5.3",
- "radiusServerPort": "1812",
- "radiusSecret": "SECRET"
- }
- },
- "org.opencord.sadis": {
- "sadis": {
- "integration": {
- "cache": {
- "enabled": false,
- "maxsize": 50,
- "ttl": "PT0m"
- }
- },
- "entries": [
- {
- "id": "PSMO12345678",
- "cTag": 111,
- "sTag": 222,
- "nasPortId": "",
- "circuitId": "",
- "remoteId": ""
- },
- {
- "id": "10.1.4.4:50060",
- "hardwareIdentifier": "aa:bb:cc:dd:ee:ff",
- "ipAddress": "10.233.111.16",
- "nasId": "10.1.4.4:50060",
- "uplinkPort": 2
- }
- ]
- }
- },
- "org.opencord.dhcpl2relay": {
- "dhcpl2relay" : {
- "useOltUplinkForServerPktInOut": true
- }
- }
- }
-}
diff --git a/onos-files/onos-aaa.json b/onos-files/onos-aaa.json
new file mode 100644
index 0000000..82413fe
--- /dev/null
+++ b/onos-files/onos-aaa.json
@@ -0,0 +1,8 @@
+{
+ "AAA": {
+ "radiusIp": ":RADIUS_IP:",
+ "nasIp": ":RADIUS_IP:",
+ "radiusServerPort": "1812",
+ "radiusSecret": "SECRET"
+ }
+}
diff --git a/onos-files/onos-dhcpl2relay.json b/onos-files/onos-dhcpl2relay.json
new file mode 100644
index 0000000..a9162dc
--- /dev/null
+++ b/onos-files/onos-dhcpl2relay.json
@@ -0,0 +1,5 @@
+{
+ "dhcpl2relay" : {
+ "useOltUplinkForServerPktInOut": true
+ }
+}
diff --git a/onos-files/onos-kafka.json b/onos-files/onos-kafka.json
new file mode 100644
index 0000000..43eada6
--- /dev/null
+++ b/onos-files/onos-kafka.json
@@ -0,0 +1,5 @@
+{
+ "kafka": {
+ "bootstrapServers": "voltha-kafka.voltha.svc.cluster.local:9092"
+ }
+}
diff --git a/onos-files/onos-sadis-no-tp.json b/onos-files/onos-sadis-no-tp.json
new file mode 100644
index 0000000..1208325
--- /dev/null
+++ b/onos-files/onos-sadis-no-tp.json
@@ -0,0 +1,29 @@
+{
+ "sadis": {
+ "integration": {
+ "cache": {
+ "enabled": false,
+ "maxsize": 50,
+ "ttl": "PT0m"
+ }
+ },
+ "entries": [
+ {
+ "id": "BBSIMOLT000",
+ "hardwareIdentifier": "0f:f1:ce:c0:ff:ee",
+ "nasId": "BBSIMOLT000",
+ "uplinkPort": 65536
+ },
+ {
+ "id": "BBSM00000001-1",
+ "cTag": 900,
+ "sTag": 900,
+ "nasPortId": "BBSM00000001-1",
+ "circuitId": "BBSM00000001-1",
+ "remoteId": "BBSIMOLT000"
+ }
+ ]
+ }
+ }
+ }
+}
diff --git a/onos-files/onos-sadis-tp.json b/onos-files/onos-sadis-tp.json
new file mode 100644
index 0000000..5a21c85
--- /dev/null
+++ b/onos-files/onos-sadis-tp.json
@@ -0,0 +1,49 @@
+{
+ "sadis": {
+ "integration": {
+ "cache": {
+ "enabled": false,
+ "maxsize": 50,
+ "ttl": "PT0m"
+ }
+ },
+ "entries": [
+ {
+ "id": "BBSIMOLT000",
+ "hardwareIdentifier": "0f:f1:ce:c0:ff:ee",
+ "nasId": "BBSIMOLT000",
+ "uplinkPort": 65536
+ },
+ {
+ "id": "BBSM00000001-1",
+ "cTag": 900,
+ "sTag": 900,
+ "nasPortId": "BBSM00000001-1",
+ "circuitId": "BBSM00000001-1",
+ "remoteId": "BBSIMOLT000",
+ "technologyProfileId": 64,
+ "upstreamBandwidthProfile": "Default",
+ "downstreamBandwidthProfile": "Default"
+ }
+ ]
+ },
+ "bandwidthprofile": {
+ "integration": {
+ "cache": {
+ "enabled": true,
+ "maxsize": 40,
+ "ttl": "PT1m"
+ }
+ },
+ "entries": [
+ {
+ "id": "Default",
+ "cir": 1000000,
+ "cbs": 1001,
+ "eir": 1002,
+ "ebs": 1003,
+ "air": 1004
+ }
+ ]
+ }
+}
diff --git a/onos-files/radius-config.json b/onos-files/radius-config.json
deleted file mode 100644
index e8c3803..0000000
--- a/onos-files/radius-config.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "apps": {
- "org.opencord.aaa": {
- "AAA": {
- "radiusIp": ":RADIUS_IP:",
- "nasIp": ":RADIUS_IP:",
- "radiusServerPort": "1812",
- "radiusSecret": "SECRET"
- }
- }
- }
-}
diff --git a/voltha b/voltha
index 0ce23ac..376b7df 100755
--- a/voltha
+++ b/voltha
@@ -71,6 +71,7 @@
WITH_BBSIM=${WITH_BBSIM:-no}
WITH_RADIUS=${WITH_RADIUS:-no}
WITH_ONOS=${WITH_ONOS:-yes}
+CONFIG_SADIS=${CONFIG_SADIS:-no}
INSTALL_ONOS_APPS=${INSTALL_ONOS_APPS:-no}
WITH_TP=${WITH_TP:-yes}
JUST_K8S=${JUST_K8S:-no}
@@ -234,6 +235,18 @@
INSTALL_ONOS_APPS=no
fi
+# Verify CONFIG_SADIS settting and convert uniform value of yes or no
+if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$CONFIG_SADIS:") -eq 0 ]; then
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$CONFIG_SADIS value of '$CONFIG_SADIS'. Should be 'yes' or 'no'${NORMAL}"
+ exit 1
+fi
+
+if [ $(echo ":y:yes:true:1:" | grep -ic ":$CONFIG_SADIS:") -eq 1 ]; then
+ CONFIG_SADIS=yes
+else
+ CONFIG_SADIS=no
+fi
+
mkdir -p .voltha
touch .voltha/ports
HAVE=$(grep $NAME .voltha/ports)
@@ -273,31 +286,6 @@
fi
export ONOS_API_PORT ONOS_SSH_PORT
-spin() {
- PARTS="\
- \xe2\xa2\x8e\xe2\xa1\xb0 \
- \xe2\xa2\x8e\xe2\xa1\xa1 \
- \xe2\xa2\x8e\xe2\xa1\x91 \
- \xe2\xa2\x8e\xe2\xa0\xb1 \
- \xe2\xa0\x8e\xe2\xa1\xb1 \
- \xe2\xa2\x8a\xe2\xa1\xb1 \
- \xe2\xa2\x8c\xe2\xa1\xb1 \
- \xe2\xa2\x86\xe2\xa1\xb1 \
- "
- IDX=1
- echo -en $CIVIS
- while true; do
- C=$(echo $PARTS | cut '-d ' -f $IDX)
- echo -en "$C"
- IDX=$(expr $IDX + 1)
- if [ $IDX -gt 8 ]; then
- IDX=1
- fi
- sleep .15
- echo -en "\r"
- done
-}
-
IDX=1
CLOCK="TIME:"
SPIN_PARTS=
@@ -565,7 +553,8 @@
# Output install options to log
echo "OPTIONS" >> $LOG
-ALL_OPTIONS="NAME TYPE WITH_TIMINGS WITH_BBSIM WITH_RADIUS WITH_ONOS WITH_TP JUST_K8S DEPLOY_K8S \
+ALL_OPTIONS="NAME TYPE WITH_TIMINGS WITH_BBSIM WITH_RADIUS WITH_ONOS WITH_TP \
+ CONFIG_SADIS JUST_K8S DEPLOY_K8S \
INSTALL_ONOS_APPS SKIP_RESTART_API INSTALL_KUBECTL INSTALL_HELM USE_GO VOLTHA_LOG_LEVEL \
VOLTHA_CHART VOLTHA_ADAPTER_SIM_CHART VOLTHA_ADAPTER_OPEN_OLT_CHART \
VOLTHA_ADAPTER_OPEN_ONU_CHART ONOS_TAG \
@@ -586,7 +575,7 @@
local DATA=$3
bspin - "$MSG $GEAR"
- until test; do
+ while true; do
(set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/$RESOURCE --data @$DATA >>$LOG 2>&1) >>$LOG 2>&1
if [ $? -eq 0 ]; then
break
@@ -599,12 +588,15 @@
override_onos_app() {
local APP=$1
- local NAME=$(basename $APP | sed -e 's/-.*$//g')
- until test; do
+ local NAME=$(basename $APP | sed -e 's/^[0-9][0-9]*-//g' -e 's/-.*$//g')
+ while true; do
sspin -
# Attempt to delete old version (if it exists)
(set -x; curl --fail -sSL --user karaf:karaf -X DELETE http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications/$NAME >>$LOG 2>&1) >>$LOG 2>&1
sspin -
+ if [ $? -ne 0 ]; then
+ continue
+ fi
(set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @$APP >>$LOG 2>&1) >>$LOG 2>&1
if [ $? -eq 0 ]; then
break
@@ -613,6 +605,22 @@
done
}
+activate_onos_app() {
+ local MSG="$1"
+ local APP=$2
+
+ bspin - "$MSG $GO"
+ while true; do
+ sspin -
+ (set -x; curl --fail -sSL --user karaf:karaf -X POST http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications/$APP/active >>$LOG 2>&1) >>$LOG 2>&1
+ if [ $? -eq 0 ]; then
+ break
+ fi
+ sleep .2
+ done
+ espin - "$VERIFIED"
+}
+
count_pods() {
local NAMESPACE=$1; shift
local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}")
@@ -948,11 +956,15 @@
for i in $(screen -ls | grep onos-ssh-$NAME | awk '{print $1}'); do
(set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1
done
+
+
(set -x; screen -dmS onos-ssh-$NAME bash -c "while true; do kubectl port-forward service/onos-ssh $ONOS_SSH_PORT:8101; done" >>$LOG 2>&1) >>$LOG 2>&1
espin - $VERIFIED
bspin - "Verify or download ONOS configuration support files $DOWNLOAD"
+ ONOS_FILES="olt-onos-enableExtraneousRules.json olt-onos-olt-settings.json onos-aaa.json \
+ onos-dhcpl2relay.json onos-kafka.json onos-sadis-no-tp.json onos-sadis-tp.json"
(set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1
- for i in dhcp-to-controller-flow.json olt-onos-enableExtraneousRules.json olt-onos-netcfg.json olt-onos-olt-settings.json radius-config.json; do
+ for i in $ONOS_FILES; do
if [ ! -r ./onos-files/$i ]; then
(set -x; curl -o ./onos-files/$i -sSL https://raw.githubusercontent.com/ciena/kind-voltha/master/onos-files/$i >>$LOG 2>&1) >>$LOG 2>&1
fi
@@ -964,17 +976,27 @@
if [ -x onos-files/onos-apps -a $(ls -1 onos-files/onos-apps/*.oar 2>/dev/null | wc -l) -gt 0 ]; then
for OAR in $(ls -1 onos-files/onos-apps/*.oar); do
sspin - "Installing custom ONOS applications - $OAR$CEOL"
- override_onos_app $OAR
+ override_onos_app $OAR
done
espin - "$VERIFIED Installing custom ONOS applications$CEOL"
else
espin - "$NOT_VERIFIED Installing custom ONOS applications - None Found"
fi
fi
-
- push_onos_config "Push ONOS Network Configuration" "network/configuration" "onos-files/olt-onos-netcfg.json"
+
+ push_onos_config "Push ONOS Kafka Configuration" "network/configuration/apps/org.opencord.kafka" "onos-files/onos-kafka.json"
+ push_onos_config "Push ONOS DHCP L2 Relay Configuration" "network/configuration/apps/org.opencord.dhcpl2relay" "onos-files/onos-dhcpl2relay.json"
push_onos_config "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.Olt" "onos-files/olt-onos-olt-settings.json"
push_onos_config "Enabling extraneous rules for ONOS" "configuration/org.onosproject.net.flow.impl.FlowRuleManager" "onos-files/olt-onos-enableExtraneousRules.json"
+ if [ -f onos-files/onos-sadis.json ]; then
+ push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "onos-files/onos-sadis.json"
+ elif [ "$CONFIG_SADIS" == "yes" ]; then
+ SADIS_CFG=onos-files/onos-sadis-no-tp.json
+ if [ "$WITH_TP" == "yes" ]; then
+ SADIS_CFG=onos-files/onos-sadis-tp.json
+ fi
+ push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "$SADIS_CFG"
+ fi
fi
if [ "$WITH_TIMINGS" == "yes" ]; then
printtime $(expr $(date +%s) - $STIME)
@@ -1103,7 +1125,7 @@
if [ $WITH_ONOS == "yes" -a $WITH_RADIUS == "yes" ]; then
bspin "Configure ONOS RADIUS Connection $GEAR"
- (set -x; cat onos-files/radius-config.json | sed -e "s/:RADIUS_IP:/$(kubectl -n voltha get service/radius -o jsonpath={.spec.clusterIP})/g" | curl -XPOST -sSL http://karaf:karaf@localhost:8181/onos/v1/network/configuration -H Content-type:application/json -d@- >>$LOG 2>&1) >>$LOG 2>&1
+ (set -x; cat onos-files/onos-aaa.json | sed -e "s/:RADIUS_IP:/$(kubectl -n voltha get service/radius -o jsonpath={.spec.clusterIP})/g" | curl -XPOST -sSL http://karaf:karaf@localhost:8181/onos/v1/network/configuration/apps/org.opencord.aaa -H Content-type:application/json -d@- >>$LOG 2>&1) >>$LOG 2>&1
espin $VERIFIED
fi