VOL-1532: BBSim OLT preprovisioning test case
VOL-1533: BBSim OLT/ONU Discovery

Fix issus with pod list no longer printing to console

Change-Id: I9309aee43306e8ca36d0b59e6942db51a929eca7
diff --git a/tests/atests/build/Makefile b/tests/atests/build/Makefile
index 06d53a5..6bbe23c 100644
--- a/tests/atests/build/Makefile
+++ b/tests/atests/build/Makefile
@@ -23,7 +23,8 @@
 
 KAFKA_CHART_VERSION  ?= 0.8.8
 
-/all: $(M)/voltha_ponsim_running
+ponsim: $(M)/voltha-running $(M)/adapter-ponsim $(M)/voltha-adapter-running
+bbsim:  $(M)/voltha-running $(M)/adapter-bbsim $(M)/voltha-adapter-running
 
 $(M)/setup: 
 	echo "MYDIR = ${MYDIR}"
@@ -111,13 +112,19 @@
 	$(HOME)/cord/helm-charts/scripts/wait_for_pods.sh voltha
 	touch $@
 
-$(M)/ponsim: | $(M)/voltha-running
+$(M)/adapter-bbsim: | $(M)/voltha-running
+	cd $(HOME)/cord/helm-charts; helm upgrade --install ponnet ponnet
+	$(HOME)/cord/helm-charts/scripts/wait_for_pods.sh kube-system
+	cd $(HOME)/cord/helm-charts; helm upgrade --install bbsim bbsim -f configs/seba-ponsim.yaml --set images.bbsim.repository=voltha/voltha-bbsim,images.bbsim.tag=latest,images.bbsim.pullPolicy=Never
+	touch $@
+
+$(M)/adapter-ponsim: | $(M)/voltha-running
 	cd $(HOME)/cord/helm-charts; helm upgrade --install ponnet ponnet
 	$(HOME)/cord/helm-charts/scripts/wait_for_pods.sh kube-system
 	cd $(HOME)/cord/helm-charts; helm upgrade --install ponsimv2 ponsimv2 -f configs/seba-ponsim.yaml --set images.olt.repository=voltha-ponsim,images.olt.tag=latest,images.olt.pullPolicy=Never,images.onu.repository=voltha-ponsim,images.onu.tag=latest,images.onu.pullPolicy=Never,images.rg.repository=voltha-tester,images.rg.tag=latest,images.rg.pullPolicy=Never
 	touch $@
 
-$(M)/pon0_fwd: | $(M)/ponsim
+$(M)/pon0-fwd: | $(M)/voltha-running
 	echo 8 > /tmp/pon0_group_fwd_mask
 	until sudo cp /tmp/pon0_group_fwd_mask /sys/class/net/pon0/bridge/group_fwd_mask; \
 	do \
@@ -127,7 +134,7 @@
 	rm /tmp/pon0_group_fwd_mask
 	touch $@
 	
-$(M)/voltha_ponsim_running: | $(M)/pon0_fwd
+$(M)/voltha-adapter-running: | $(M)/pon0-fwd
 	$(HOME)/cord/helm-charts/scripts/wait_for_pods.sh
 	until http -a karaf:karaf --ignore-stdin --check-status GET http://127.0.0.1:30120/onos/v1/configuration/org.opencord.olt.impl.Olt; \
 	do \
@@ -139,35 +146,12 @@
 	touch $@
 	echo "Voltha Test Framework Ready!"
 
-$(M)/authenticate: $(M)/voltha_ponsim_running
-	timeout 60s bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |jq '.items[0].authentication_state'|grep AWAITING; do echo 'waiting for att-workflow-driver to be in AWAITING state'; sleep 5; done"
-	kubectl -n voltha exec $(shell kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1) -- wpa_supplicant -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf -B
-	timeout 60s bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |jq '.items[0].authentication_state'|grep APPROVED; do echo 'waiting for att-workflow-driver to be in APPROVED state'; sleep 5; done"
-	touch $@
-	
-$(M)/dhclient: $(M)/authenticate
-	sudo iptables -P FORWARD ACCEPT
-	timeout 60s bash -c "until http -a admin@opencord.org:letmein GET http://127.0.0.1:30001/xosapi/v1/fabric-crossconnect/fabriccrossconnectserviceinstances |jq '.items[0].backend_status'|grep OK; do echo 'waiting for fabric-crossconnect to be synchronized';sleep 5; done"
-	kubectl -n voltha exec $(shell kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1) -- dhclient
-	kubectl -n voltha exec $(shell kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1) -- dhclient -r
-	kubectl -n voltha exec $(shell kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1) -- dhclient
-	touch $@
-
-$(M)/pingtest: $(M)/dhclient
-	kubectl -n voltha exec $(shell kubectl -n voltha get pod|grep "^rg-"|cut -d' ' -f1) -- ping -c 3 172.18.0.10
-	touch $@
-
-run-tests: $(M)/pingtest
-
 remove-chart-milestones:
 	cd $(M); sudo rm -f setup kafka kafka-running onos voltha etcd-operator-ready etcd-cluster \
-		voltha-running ponsim pon0_fwd voltha_ponsim_running
+		voltha-running adapter-ponsim adapter-bbsim pon0-fwd voltha-adapter-running
 remove-kube-milestones:
 	cd $(M); sudo rm -f kubeadm helm-init
 
-remove-test-milestones:
-	cd $(M); sudo rm -f authenticate dhclient pingtest
-
 teardown-charts: remove-chart-milestones
 	helm delete --purge $(shell helm ls -q)
 
diff --git a/tests/atests/build/devices_json b/tests/atests/build/devices_json
index 74c0aca..302403b 100644
--- a/tests/atests/build/devices_json
+++ b/tests/atests/build/devices_json
@@ -61,5 +61,23 @@
       "uplink":"0",
       "vlan":"2"
     }
+  },
+  "of:0000626273696d76":{
+    "basic":{
+      "driver":"voltha"
+    },
+    "accessDevice":{
+      "uplink":"0",
+      "vlan":"2"
+    }
+  },
+  "of:0001626273696d76":{
+    "basic":{
+      "driver":"voltha"
+    },
+    "accessDevice":{
+      "uplink":"0",
+      "vlan":"2"
+    }
   }
 }
diff --git a/tests/atests/build/sadis_json b/tests/atests/build/sadis_json
index fcded75..901bfb6 100644
--- a/tests/atests/build/sadis_json
+++ b/tests/atests/build/sadis_json
@@ -15,7 +15,151 @@
           "sTag":44,
           "nasPortId":"PSMO12345678"
         },
-        {  
+        {
+          "id":"BBSM00000100",
+          "cTag":55,
+          "sTag":66,
+          "nasPortId":"BBSM00000100",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000101",
+          "cTag":56,
+          "sTag":66,
+          "nasPortId":"BBSM00000101",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000102",
+          "cTag":57,
+          "sTag":66,
+          "nasPortId":"BBSM00000102",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000103",
+          "cTag":58,
+          "sTag":66,
+          "nasPortId":"BBSM00000103",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000104",
+          "cTag":60,
+          "sTag":77,
+          "nasPortId":"BBSM00000104",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000105",
+          "cTag":61,
+          "sTag":77,
+          "nasPortId":"BBSM00000105",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000106",
+          "cTag":62,
+          "sTag":77,
+          "nasPortId":"BBSM00000106",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000107",
+          "cTag":63,
+          "sTag":77,
+          "nasPortId":"BBSM00000107",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000108",
+          "cTag":70,
+          "sTag":88,
+          "nasPortId":"BBSM00000108",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM00000109",
+          "cTag":71,
+          "sTag":88,
+          "nasPortId":"BBSM00000109",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010a",
+          "cTag":72,
+          "sTag":88,
+          "nasPortId":"BBSM0000010a",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010b",
+          "cTag":73,
+          "sTag":88,
+          "nasPortId":"BBSM0000010b",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010c",
+          "cTag":80,
+          "sTag":99,
+          "nasPortId":"BBSM0000010c",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010d",
+          "cTag":81,
+          "sTag":99,
+          "nasPortId":"BBSM0000010d",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010e",
+          "cTag":82,
+          "sTag":99,
+          "nasPortId":"BBSM0000010e",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
+          "id":"BBSM0000010f",
+          "cTag":83,
+          "sTag":99,
+          "nasPortId":"BBSM0000010f",
+          "technologyProfileId":64,
+          "upstreamBandwidthProfile":"High-Speed-Internet",
+          "downstreamBandwidthProfile":"User1-Specific"
+        },
+        {
           "id":"1d1d1d1d1d1d11",
           "hardwareIdentifier":"00:1b:22:00:b1:78",
           "ipAddress":"192.168.1.252",
@@ -24,6 +168,45 @@
         {  
           "id":"olt.voltha.svc:50060",
           "uplinkPort":2
+        },
+        {
+          "id":"BBSIMOLT000",
+          "uplinkPort":65536
+        }
+      ]
+    },
+    "bandwidthprofile":{
+      "integration":{
+        "cache":{
+          "enabled":true,
+          "maxsize":40,
+          "ttl":"PT1m"
+        }
+      },
+      "entries":[
+        {
+          "id":"High-Speed-Internet",
+          "cir":200000000,
+          "cbs":348000,
+          "eir":10000000,
+          "ebs":348000,
+          "air":10000000
+        },
+        {
+          "id":"User1-Specific",
+          "cir":300000000,
+           "cbs":348000,
+          "eir":20000000,
+          "ebs":348000,
+         "air":30000000
+        },
+        {
+          "id":"Default",
+          "cir":300000000,
+          "cbs":348000,
+          "eir":20000000,
+          "ebs":348000,
+          "air":30000000
         }
       ]
     }