diff --git a/tools/tutorials/vm/cluster.json b/tools/tutorials/vm/cluster.json deleted file mode 100644 index 59dc1b3b59..0000000000 --- a/tools/tutorials/vm/cluster.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"default","nodes":[{"id":"172.17.0.4","ip":"172.17.0.4","port":9876},{"id":"172.17.0.2","ip":"172.17.0.2","port":9876},{"id":"172.17.0.3","ip":"172.17.0.3","port":9876}],"partitions":[{"id":3,"members":["172.17.0.2","172.17.0.3","172.17.0.4"]},{"id":2,"members":["172.17.0.2","172.17.0.3","172.17.0.4"]},{"id":1,"members":["172.17.0.2","172.17.0.3","172.17.0.4"]}]} diff --git a/tools/tutorials/vm/config/atomix-1.conf b/tools/tutorials/vm/config/atomix-1.conf new file mode 100644 index 0000000000..96e32510de --- /dev/null +++ b/tools/tutorials/vm/config/atomix-1.conf @@ -0,0 +1,34 @@ +cluster { + cluster-id: onos + node.id: atomix-1 + node.address: "172.17.0.2:5679" + discovery { + type: bootstrap + nodes.1 { + id: atomix-1 + address: "172.17.0.2:5679" + } + nodes.2 { + id: atomix-2 + address: "172.17.0.3:5679" + } + nodes.3 { + id: atomix-3 + address: "172.17.0.4:5679" + } + } +} + +management-group { + type: raft + partitions: 1 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} + +partition-groups.raft { + type: raft + partitions: 7 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} \ No newline at end of file diff --git a/tools/tutorials/vm/config/atomix-2.conf b/tools/tutorials/vm/config/atomix-2.conf new file mode 100644 index 0000000000..966152d577 --- /dev/null +++ b/tools/tutorials/vm/config/atomix-2.conf @@ -0,0 +1,34 @@ +cluster { + cluster-id: onos + node.id: atomix-2 + node.address: "172.17.0.3:5679" + discovery { + type: bootstrap + nodes.1 { + id: atomix-1 + address: "172.17.0.2:5679" + } + nodes.2 { + id: atomix-2 + address: "172.17.0.3:5679" + } + nodes.3 { + id: atomix-3 + address: "172.17.0.4:5679" + } + } +} + +management-group { + type: raft + partitions: 1 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} + +partition-groups.raft { + type: raft + partitions: 7 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} \ No newline at end of file diff --git a/tools/tutorials/vm/config/atomix-3.conf b/tools/tutorials/vm/config/atomix-3.conf new file mode 100644 index 0000000000..4268ee3503 --- /dev/null +++ b/tools/tutorials/vm/config/atomix-3.conf @@ -0,0 +1,34 @@ +cluster { + cluster-id: onos + node.id: atomix-3 + node.address: "172.17.0.4:5679" + discovery { + type: bootstrap + nodes.1 { + id: atomix-1 + address: "172.17.0.2:5679" + } + nodes.2 { + id: atomix-2 + address: "172.17.0.3:5679" + } + nodes.3 { + id: atomix-3 + address: "172.17.0.4:5679" + } + } +} + +management-group { + type: raft + partitions: 1 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} + +partition-groups.raft { + type: raft + partitions: 7 + storage.level: disk + members: [atomix-1, atomix-2, atomix-3] +} \ No newline at end of file diff --git a/tools/tutorials/vm/config/cluster-1.json b/tools/tutorials/vm/config/cluster-1.json new file mode 100644 index 0000000000..36dfa5d5ff --- /dev/null +++ b/tools/tutorials/vm/config/cluster-1.json @@ -0,0 +1,25 @@ +{ + "node": { + "ip": "172.17.0.5", + "id": "172.17.0.5", + "port": 9876 + }, + "storage": [ + { + "ip": "172.17.0.2", + "id": "atomix-1", + "port": 5679 + }, + { + "ip": "172.17.0.3", + "id": "atomix-2", + "port": 5679 + }, + { + "ip": "172.17.0.4", + "id": "atomix-3", + "port": 5679 + } + ], + "name": "onos" +} \ No newline at end of file diff --git a/tools/tutorials/vm/config/cluster-2.json b/tools/tutorials/vm/config/cluster-2.json new file mode 100644 index 0000000000..e05fad080b --- /dev/null +++ b/tools/tutorials/vm/config/cluster-2.json @@ -0,0 +1,25 @@ +{ + "node": { + "ip": "172.17.0.6", + "id": "172.17.0.6", + "port": 9876 + }, + "storage": [ + { + "ip": "172.17.0.2", + "id": "atomix-1", + "port": 5679 + }, + { + "ip": "172.17.0.3", + "id": "atomix-2", + "port": 5679 + }, + { + "ip": "172.17.0.4", + "id": "atomix-3", + "port": 5679 + } + ], + "name": "onos" +} \ No newline at end of file diff --git a/tools/tutorials/vm/config/cluster-3.json b/tools/tutorials/vm/config/cluster-3.json new file mode 100644 index 0000000000..04642bb1b0 --- /dev/null +++ b/tools/tutorials/vm/config/cluster-3.json @@ -0,0 +1,25 @@ +{ + "node": { + "ip": "172.17.0.7", + "id": "172.17.0.7", + "port": 9876 + }, + "storage": [ + { + "ip": "172.17.0.2", + "id": "atomix-1", + "port": 5679 + }, + { + "ip": "172.17.0.3", + "id": "atomix-2", + "port": 5679 + }, + { + "ip": "172.17.0.4", + "id": "atomix-3", + "port": 5679 + } + ], + "name": "onos" +} \ No newline at end of file diff --git a/tools/tutorials/vm/createCluster b/tools/tutorials/vm/createCluster index 392be7080d..ebdfec8a07 100755 --- a/tools/tutorials/vm/createCluster +++ b/tools/tutorials/vm/createCluster @@ -1,14 +1,23 @@ #!/bin/bash export PATH="$PATH:bin:onos/bin" -# Creates ONOS cluster using ONOS docker images -ONOS_IMAGE=onosproject/onos:1.13.1 SSH_KEY=$(cut -d\ -f2 ~/.ssh/id_rsa.pub) +# Create Atomix cluster using Atomix docker image +ATOMIX_IMAGE=atomix/atomix:3.0.5 +for i in {1..3}; do + echo "Setting up atomix-$i..." + docker container run --detach --name atomix-$i --hostname atomix-$i \ + --restart=always -v /home/sdn/bin/config:/atomix $ATOMIX_IMAGE \ + --config /atomix/atomix-$i.conf +done + +# Create ONOS cluster using ONOS docker image +ONOS_IMAGE=onosproject/onos:1.14.0 for i in {1..3}; do echo "Setting up onos-$i..." - docker container run --detach --name onos-$i --hostname onos-$i --restart always $ONOS_IMAGE - docker exec -i onos-$i /bin/bash -c "mkdir config; cat > config/cluster.json" < $(dirname $0)/cluster.json + docker container run --detach --name onos-$i --hostname onos-$i --restart=always $ONOS_IMAGE + docker exec -i onos-$i /bin/bash -c "mkdir config; cat > config/cluster.json" < $(dirname $0)/config/cluster-$i.json docker exec -it onos-$i bin/onos-user-key sdn $SSH_KEY >/dev/null 2>&1 docker exec -it onos-$i bin/onos-user-password onos rocks >/dev/null 2>&1 done @@ -26,6 +35,7 @@ function waitForStart { done } +# Extract the IP addresses of the ONOS nodes OC1=$(docker container inspect onos-1 | grep \"IPAddress | cut -d: -f2 | sort -u | tr -d '", ') OC2=$(docker container inspect onos-2 | grep \"IPAddress | cut -d: -f2 | sort -u | tr -d '", ') OC3=$(docker container inspect onos-3 | grep \"IPAddress | cut -d: -f2 | sort -u | tr -d '", ') diff --git a/tools/tutorials/vm/destroyCluster b/tools/tutorials/vm/destroyCluster index 1ef04e2227..53b359c0fb 100755 --- a/tools/tutorials/vm/destroyCluster +++ b/tools/tutorials/vm/destroyCluster @@ -1,11 +1,15 @@ #!/bin/bash -# Destroys ONOS cluster running as ONOS docker images -SSH_KEY=$(cut -d\ -f2 ~/.ssh/id_rsa.pub) - +# Destroy the ONOS cluster running as docker images for i in {1..3}; do echo "Destroying onos-$i..." docker stop onos-$i done +# Destroy Atomix cluster running as docker images +for i in {1..3}; do + echo "Destroying atomix-$i..." + docker stop atomix-$i +done + docker container prune --force diff --git a/tools/tutorials/vm/exportVM b/tools/tutorials/vm/exportVM index 792627cbfd..608c5d36ea 100755 --- a/tools/tutorials/vm/exportVM +++ b/tools/tutorials/vm/exportVM @@ -3,7 +3,7 @@ # Exports the ONOS Tutorial VM into an OVA file for publishing. # ----------------------------------------------------------------------------- -export VER=1.13.1 +export VER=1.14.0 export OVA=/tmp/onos-tutorial-$VER.ova rm -f $OVA vboxmanage export "ONOS Tutorial" --output $OVA --manifest \ diff --git a/tools/tutorials/vm/uploadToS3 b/tools/tutorials/vm/uploadToS3 index 9e60e9addc..c7392772a1 100755 --- a/tools/tutorials/vm/uploadToS3 +++ b/tools/tutorials/vm/uploadToS3 @@ -2,6 +2,6 @@ # ----------------------------------------------------------------------------- # Publishes the ONOS Tutorial OVA file. # ----------------------------------------------------------------------------- -export VER=1.13.1 +export VER=1.14.0 export OVA=/tmp/onos-tutorial-$VER.ova uploadToS3.py $OVA --secret $AWS_SECRET_ACCESS_KEY --key $AWS_ACCESS_KEY_ID --bucket onos --dest vm/