Dockerfile cleanup and initial roc.py
Change-Id: I71dad8b2f75d5a34f8ad66948380f29977c92c33
diff --git a/docker/Dockerfile b/docker/Dockerfile
index b3d5835..cf51c5b 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -17,15 +17,11 @@
RUN apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
-# TODO - is this needed?
-RUN pip3 install paho-mqtt
-
WORKDIR /var/person-detection-app
COPY . .
-RUN . .venv/bin/activate && \
- pip3 install -r requirements.txt
+RUN pip3 install -r requirements.txt
ENTRYPOINT ["./bin/person_detection.sh"]
CMD ["-pt 0.75"]
diff --git a/person_detection/roc.py b/person_detection/roc.py
index 96f2fe0..ecf7e77 100644
--- a/person_detection/roc.py
+++ b/person_detection/roc.py
@@ -7,16 +7,22 @@
import json
from requests.structures import CaseInsensitiveDict
-TOKEN = '### A VALID TOKEN ###'
-#URL = "https://roc.aetherproject.org/aether-roc-api/aether/v4.0.0/connectivity-service-v4/"
-URL = "https://roc.staging.aether.onlab.us/aether-roc-api/aether/v4.0.0/connectivity-service-v4/"
+TOKEN = "### A VALID TOKEN ###"
+
+URL = "https://roc.menlo.aetherproject.org/aether-roc-api/aether/v4.0.0/connectivity-service-v4/"
+#URL = "https://roc.staging.aether.onlab.us/aether-roc-api/aether/v4.0.0/connectivity-service-v4/"
+
+cameras = "menlo-4g-cameras"
+#cameras = "cameras-4g"
+
+MBR_HIGH = 4000000
+MBR_LOW = 2000000
roc_headers = CaseInsensitiveDict()
roc_headers["Content-Type"] = "application/json"
roc_headers["Authorization"] = "Bearer " + TOKEN
-
def get_mbr(device_group):
url = URL + "vcs/vcs/vcs-{}/slice/mbr".format(device_group)
response = requests.get(url, headers=roc_headers)
@@ -24,17 +30,25 @@
mbr = json.loads(response.text)
return mbr
-
def set_mbr(device_group, mbr):
url = URL + "vcs/vcs/vcs-{}/slice/mbr".format(device_group)
response = requests.post(url, headers=roc_headers, json=mbr)
assert response.status_code == 201, "Failed to set mbr"
+def set_uplink_mbr_high():
+ mbr = {'uplink' : MBR_HIGH}
+ set_mbr(cameras, mbr)
+
+def set_uplink_mbr_low():
+ mbr = {'uplink' : MBR_LOW}
+ set_mbr(cameras, mbr)
if __name__ == '__main__':
- mbr = get_mbr("cameras-4g")
+ mbr = get_mbr(cameras)
print("uplink mbr:{}, downlink mbr: {}".format(mbr["uplink"], mbr["downlink"]))
- mbr={'downlink':mbr["downlink"],'uplink':mbr["uplink"]}
- set_mbr("cameras-4g", mbr)
- mbr = get_mbr("cameras-4g")
+ set_uplink_mbr_low()
+ mbr = get_mbr(cameras)
+ print("uplink mbr:{}, downlink mbr: {}".format(mbr["uplink"], mbr["downlink"]))
+ set_uplink_mbr_high()
+ mbr = get_mbr(cameras)
print("uplink mbr:{}, downlink mbr: {}".format(mbr["uplink"], mbr["downlink"]))