Adding changes to configuration in voltha

Change-Id: I17aa46165a16311d39a6a1b4c36ebb8d65ff27aa
diff --git a/Makefile b/Makefile
index cc48aa6..d41de1a 100644
--- a/Makefile
+++ b/Makefile
@@ -76,7 +76,7 @@
 
 build: protos containers
 
-containers: docker-base voltha chameleon ofagent podder netconf shovel onos tester
+containers: docker-base voltha chameleon ofagent podder netconf shovel onos tester config-push
 
 docker-base:
 	docker build -t cord/voltha-base -f docker/Dockerfile.base .
@@ -111,6 +111,9 @@
 tester:
 	docker build -t cord/tester -f docker/Dockerfile.tester docker
 
+config-push:
+	docker build -t cord/config-push -f docker/Dockerfile.configpush docker	
+
 protos:
 	make -C voltha/protos
 	make -C chameleon/protos
diff --git a/compose/docker-compose-auth-test.yml b/compose/docker-compose-auth-test.yml
index ddc294e..aeba625 100644
--- a/compose/docker-compose-auth-test.yml
+++ b/compose/docker-compose-auth-test.yml
@@ -2,18 +2,18 @@
 
 services:
 
- freeradius:
-  image: "marcelmaatkamp/freeradius"
-  ports:
-   - "1812:1812/udp"
-   - "1813:1813"
-   - "18120:18120"
-  volumes:
-   - "./data/clients.conf:/etc/raddb/clients.conf"
-   - "./data/users:/etc/raddb/users"
-  networks:
-   authnet:
-    ipv4_address: 172.25.0.100
+# freeradius:
+#  image: "marcelmaatkamp/freeradius"
+#  ports:
+#   - "1812:1812/udp"
+#   - "1813:1813"
+#   - "18120:18120"
+#  volumes:
+#   - "./data/clients.conf:/etc/raddb/clients.conf"
+#   - "./data/users:/etc/raddb/users"
+#  networks:
+#   authnet:
+#    ipv4_address: 172.25.0.100
 
  onos:
   image: "cord/onos"
@@ -27,12 +27,23 @@
     authnet:
      ipv4_address: 172.25.0.200
 
- freeradius-test:
-  image: "marcelmaatkamp/freeradius"
-  command: "radtest user password freeradius 0 SECRET"
+ onos_config_push:
+  image: onos-config-push:phase2
+  environment:
+   ONOS_CONNECTION: 'onos:8181'
+  volumes:
+   - "../docker/config/netcfg.json:/data/onos-config.json"
   networks:
    authnet:
-    ipv4_address: 172.25.0.101
+  links:
+   - "onos:onos"
+
+# freeradius-test:
+#  image: "marcelmaatkamp/freeradius"
+#  command: "radtest user password freeradius 0 SECRET"
+#  networks:
+#   authnet:
+#    ipv4_address: 172.25.0.101
 
 networks:
   authnet:
diff --git a/docker/Dockerfile.configpush b/docker/Dockerfile.configpush
new file mode 100644
index 0000000..895e0ee
--- /dev/null
+++ b/docker/Dockerfile.configpush
@@ -0,0 +1,10 @@
+FROM alpine:3.5
+
+RUN apk --update add curl
+
+COPY config/config-push /config-push
+COPY config/onos-config.json /data/onos-config.json
+
+VOLUME ["/data"]
+
+ENTRYPOINT /config-push
diff --git a/docker/Dockerfile.onos b/docker/Dockerfile.onos
index cc97524..c8a6fe5 100644
--- a/docker/Dockerfile.onos
+++ b/docker/Dockerfile.onos
@@ -19,6 +19,7 @@
 
 RUN sh $ONOS/app-install.sh
 
-RUN touch $ONOS/apps/org.onosproject.dhcp/active
+#RUN touch $ONOS/apps/org.onosproject.dhcp/active
+RUN touch $ONOS/apps/org.onosproject.hostprovider/active
 
 COPY config/netcfg.json $KARAF_ROOT/../config/network-cfg.json
diff --git a/docker/config/config-push b/docker/config/config-push
new file mode 100644
index 0000000..3dc5b06
--- /dev/null
+++ b/docker/config/config-push
@@ -0,0 +1,10 @@
+#!/bin/ash
+
+while true; do
+    curl -H "Content-Type: application/json" -sSL --fail http://${ONOS_USER:-"karaf"}:${ONOS_PASSWORD:-"karaf"}@${ONOS_CONNECTION:-"localhost:8181"}/onos/v1/network/configuration -d @/data/onos-config.json
+    if [ $? -eq 0 ]; then
+        break
+    fi
+    sleep ${ONOS_SLEEP_DELAY:-30}
+done
+echo "Configuraton pushed to ${ONOS_CONNECTION:-'localhost:8181'} at $(date)"
diff --git a/docker/config/netcfg.json b/docker/config/netcfg.json
index e5646c9..1627054 100644
--- a/docker/config/netcfg.json
+++ b/docker/config/netcfg.json
@@ -1,53 +1,33 @@
 {
   "apps": {
-    "org.onosproject.igmp": {
-      "ssmTranslate": [
-        {
-          "source": "1.2.3.4",
-          "group": "229.0.0.1"
-        },
-        {
-          "source": "2.3.4.5",
-          "group": "229.0.0.2"
-        },
-        {
-          "source": "1.2.3.4",
-          "group": "229.0.0.3"
-        },
-        {
-          "source": "1.2.3.4",
-          "group": "229.0.0.4"
-        },
-        {
-          "source": "2.3.4.5",
-          "group": "229.0.0.5"
-        }
-      ]
-    },
-    "org.onosproject.aaa": {
+    "org.opencord.aaa": {
       "AAA": {
-        "radiusIp": "172.25.0.100",
+        "radiusIp": "1.2.3.4",
+	    "nasIp": "5.6.7.8",
         "radiusServerPort": "1812",
-        "radiusSecret": "SECRET"
-      }
-    },
-    "org.onosproject.dhcp": {
-      "dhcp": {
-        "ip": "10.1.11.50",
-        "mac": "ca:fe:ca:fe:ca:fe",
-        "subnet": "255.255.252.0",
-        "broadcast": "10.1.11.255",
-        "router": "10.1.8.1",
-        "domain": "8.8.8.8",
-        "ttl": "63",
-        "lease": "300",
-        "renew": "150",
-        "rebind": "200",
-        "delay": "2",
-        "timeout": "150",
-        "startip": "10.1.11.51",
-        "endip": "10.1.11.100"
-      }
+        "radiusSecret": "letmein",
+	"bindings" : [
+		{
+		 "mac" : "de:ad:be:ef:ba:11",
+		 "s-tag" : 2,
+		 "c-tag" : 2,
+         "nas_port_id" : "location"
+		},
+                {
+         "mac" : "de:ad:be:ef:ca:fe",
+         "s-tag" : 2,
+         "c-tag" : 122,
+         "nas_port_id" : "location"
+        }
+	  ] 
+    }
+ },
+    "org.onosproject.dhcp-relay" : {
+           "dhcprelay" : {
+               "dhcpserverConnectPoint" : "of:00000cafecafecafe/4",
+               "serverip" : "11.11.11.11",
+               "gatewayip" : "9.9.9.9"
+           }
     }
   },
   "devices": {
@@ -57,7 +37,7 @@
       },
       "accessDevice": {
         "uplink": "0",
-        "vlan": "1000"
+        "vlan": "2"
       }
     },
     "of:0000000000000002": {
@@ -105,6 +85,43 @@
         "vlan": "1005"
       }
     }
+  },
+  "ports" : { 
+	"of:0000000000000001/2" : {
+           "interfaces" : [
+               {
+                   "name" : "yoyoma1",
+                   "ips"  : [ "10.0.2.1/24" ],
+                   "mac"  : "00:00:00:01:01:00"
+               }
+           ]
+        },
+	"of:00000cafecafecafe/3" : {
+           "interfaces" : [
+               {
+                   "name" : "yoyoma",
+                   "ips"  : [ "10.0.2.2/24" ],
+                   "mac"  : "00:00:00:01:02:00"
+               }
+           ]
+        },"of:00000cafecafecafe/2" : {
+           "interfaces" : [
+               {
+                   "name" : "yoyoma2",
+                   "ips"  : [ "10.0.2.3/24" ],
+                   "mac"  : "00:00:00:01:03:00"
+               }
+           ]
+        },
+	"of:00000cafecafecafe/4" : {
+           "interfaces" : [
+               {
+                   "name" : "yoyoma4",
+                   "ips"  : [ "10.0.2.4/24" ],
+                   "mac"  : "00:00:00:01:04:00"
+               }
+           ]
+        }
 
   }
 }
diff --git a/docker/config/onos-config.json b/docker/config/onos-config.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/docker/config/onos-config.json
@@ -0,0 +1 @@
+{}