Bug 1844: LTS Support

Updates base to Ubuntu 20.04
Updates python to 3.8
Updates pip dependencies to more recent versions
Adds apt cache to stage 2 dockerfile

Fixes bug 1844

Change-Id: I66a80d649fa5beaaf0821c9e307ca7215ede9fd4
Signed-off-by: beierlm <mark.beierl@canonical.com>
diff --git a/Dockerfile b/Dockerfile
index ebfab05..2a64fdc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,19 +21,26 @@
 #   devops-stages/stage-build.sh
 #
 
-FROM ubuntu:18.04
+FROM ubuntu:20.04
+
+ARG APT_PROXY
+RUN if [ ! -z $APT_PROXY ] ; then \
+    echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
+    echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
+    fi
 
 RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
     DEBIAN_FRONTEND=noninteractive apt-get -y install \
         debhelper \
+        dh-python \
         git \
-        python3 \
+        python3.8 \
         python3-all \
-        python3-dev \
+        python3.8-dev \
         python3-setuptools
 
-RUN python3 -m easy_install pip==21.0.1
-RUN pip3 install tox==3.22.0
+RUN python3 -m easy_install pip==21.3.1
+RUN pip install tox==3.24.5
 
 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install wget
 
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 7e2ab9b..755da60 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,4 +1,20 @@
-aiokafka==0.7.0
+# Copyright 2018 Telefonica S.A.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+aiokafka==0.7.2
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
 bitarray==1.8.1
     # via
@@ -19,9 +35,9 @@
     #   -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=master
     #   pyang
     #   pyangbind
-git+https://osm.etsi.org/gerrit/osm/common.git@master#egg=osm-common
+osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git@master
     # via -r requirements-dev.in
-git+https://osm.etsi.org/gerrit/osm/IM.git@master#egg=osm-im
+osm-im @ git+https://osm.etsi.org/gerrit/osm/IM.git@master
     # via -r requirements-dev.in
 pyang==2.4.0
     # via
@@ -31,7 +47,7 @@
     # via -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=master
 pycrypto==2.6.1
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-pymongo==3.11.3
+pymongo==3.12.3
     # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
 pyyaml==5.4.1
     # via
@@ -45,19 +61,3 @@
     # via
     #   -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=master
     #   pyangbind
-# Copyright 2018 Telefonica S.A.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
diff --git a/requirements-dist.in b/requirements-dist.in
index 11f0a2a..4f8784f 100644
--- a/requirements-dist.in
+++ b/requirements-dist.in
@@ -14,4 +14,5 @@
 # limitations under the License.
 
 stdeb
-setuptools-version-command
\ No newline at end of file
+setuptools-version-command
+setuptools<60
\ No newline at end of file
diff --git a/requirements-dist.txt b/requirements-dist.txt
index c8f13c9..fa7c05f 100644
--- a/requirements-dist.txt
+++ b/requirements-dist.txt
@@ -1,10 +1,3 @@
-setuptools-version-command==2.2
-    # via -r requirements-dist.in
-stdeb==0.10.0
-    # via -r requirements-dist.in
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools
 # Copyright 2018 Telefonica S.A.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,3 +14,13 @@
 # limitations under the License.
 
 
+setuptools-version-command==99.9
+    # via -r requirements-dist.in
+stdeb==0.10.0
+    # via -r requirements-dist.in
+
+# The following packages are considered to be unsafe in a requirements file:
+setuptools==59.8.0
+    # via
+    #   -r requirements-dist.in
+    #   setuptools-version-command
diff --git a/requirements-test.txt b/requirements-test.txt
index b4cf255..7f87751 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,47 +1,3 @@
-aiohttp==3.6.2
-    # via
-    #   -r requirements-test.in
-    #   aioresponses
-aioresponses==0.7.2
-    # via -r requirements-test.in
-async-timeout==3.0.1
-    # via aiohttp
-asynctest==0.13.0
-    # via -r requirements-test.in
-attrs==20.3.0
-    # via aiohttp
-certifi==2020.12.5
-    # via requests
-chardet==3.0.4
-    # via
-    #   aiohttp
-    #   requests
-coverage==5.5
-    # via
-    #   -r requirements-test.in
-    #   nose2
-idna==2.10
-    # via
-    #   requests
-    #   yarl
-lxml==4.6.3
-    # via pyang
-multidict==4.7.6
-    # via
-    #   aiohttp
-    #   yarl
-nose2==0.10.0
-    # via -r requirements-test.in
-pyang==2.4.0
-    # via -r requirements-test.in
-requests==2.25.1
-    # via -r requirements-test.in
-six==1.15.0
-    # via nose2
-urllib3==1.26.4
-    # via requests
-yarl==1.6.3
-    # via aiohttp
 # Copyright 2018 Telefonica S.A.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,3 +14,47 @@
 # limitations under the License.
 
 
+aiohttp==3.6.2
+    # via
+    #   -r requirements-test.in
+    #   aioresponses
+aioresponses==0.7.3
+    # via -r requirements-test.in
+async-timeout==3.0.1
+    # via aiohttp
+asynctest==0.13.0
+    # via -r requirements-test.in
+attrs==21.4.0
+    # via aiohttp
+certifi==2021.10.8
+    # via requests
+chardet==3.0.4
+    # via
+    #   aiohttp
+    #   requests
+coverage==6.2
+    # via
+    #   -r requirements-test.in
+    #   nose2
+idna==2.10
+    # via
+    #   requests
+    #   yarl
+lxml==4.7.1
+    # via pyang
+multidict==4.7.6
+    # via
+    #   aiohttp
+    #   yarl
+nose2==0.10.0
+    # via -r requirements-test.in
+pyang==2.5.2
+    # via -r requirements-test.in
+requests==2.25.1
+    # via -r requirements-test.in
+six==1.16.0
+    # via nose2
+urllib3==1.26.8
+    # via requests
+yarl==1.7.2
+    # via aiohttp
diff --git a/requirements.in b/requirements.in
index 8098683..a961d05 100644
--- a/requirements.in
+++ b/requirements.in
@@ -14,6 +14,6 @@
 CherryPy>=18.1.2
 jsonschema>=3.2.0
 python-keystoneclient
-pyyaml
+pyyaml==5.4.1
 requests
 tacacs_plus
diff --git a/requirements.txt b/requirements.txt
index 30dabd5..b8a375f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,150 +1,3 @@
-aiohttp==3.6.2
-    # via -r requirements.in
-async-timeout==3.0.1
-    # via aiohttp
-attrs==20.3.0
-    # via
-    #   aiohttp
-    #   jsonschema
-certifi==2020.12.5
-    # via requests
-chardet==3.0.4
-    # via
-    #   aiohttp
-    #   requests
-cheroot==8.5.2
-    # via cherrypy
-cherrypy==18.6.0
-    # via -r requirements.in
-debtcollector==2.2.0
-    # via
-    #   oslo.config
-    #   oslo.utils
-    #   python-keystoneclient
-idna==2.10
-    # via
-    #   requests
-    #   yarl
-iso8601==0.1.14
-    # via
-    #   keystoneauth1
-    #   oslo.utils
-jaraco.classes==3.2.1
-    # via jaraco.collections
-jaraco.collections==3.2.0
-    # via cherrypy
-jaraco.functools==3.2.1
-    # via
-    #   cheroot
-    #   jaraco.text
-    #   tempora
-jaraco.text==3.5.0
-    # via jaraco.collections
-jsonschema==3.2.0
-    # via -r requirements.in
-keystoneauth1==4.3.1
-    # via python-keystoneclient
-more-itertools==8.7.0
-    # via
-    #   cheroot
-    #   cherrypy
-    #   jaraco.classes
-    #   jaraco.functools
-msgpack==1.0.2
-    # via oslo.serialization
-multidict==4.7.6
-    # via
-    #   aiohttp
-    #   yarl
-netaddr==0.8.0
-    # via
-    #   oslo.config
-    #   oslo.utils
-netifaces==0.10.9
-    # via oslo.utils
-os-service-types==1.7.0
-    # via keystoneauth1
-oslo.config==8.5.0
-    # via python-keystoneclient
-oslo.i18n==5.0.1
-    # via
-    #   oslo.config
-    #   oslo.utils
-    #   python-keystoneclient
-oslo.serialization==4.1.0
-    # via python-keystoneclient
-oslo.utils==4.8.0
-    # via
-    #   oslo.serialization
-    #   python-keystoneclient
-packaging==20.9
-    # via oslo.utils
-pbr==5.5.1
-    # via
-    #   debtcollector
-    #   keystoneauth1
-    #   os-service-types
-    #   oslo.i18n
-    #   oslo.serialization
-    #   oslo.utils
-    #   python-keystoneclient
-    #   stevedore
-portend==2.7.1
-    # via cherrypy
-pyparsing==2.4.7
-    # via
-    #   oslo.utils
-    #   packaging
-pyrsistent==0.17.3
-    # via jsonschema
-python-keystoneclient==4.2.0
-    # via -r requirements.in
-pytz==2021.1
-    # via
-    #   oslo.serialization
-    #   oslo.utils
-    #   tempora
-pyyaml==5.4.1
-    # via
-    #   -r requirements.in
-    #   oslo.config
-requests==2.25.1
-    # via
-    #   -r requirements.in
-    #   keystoneauth1
-    #   oslo.config
-    #   python-keystoneclient
-rfc3986==1.4.0
-    # via oslo.config
-six==1.15.0
-    # via
-    #   cheroot
-    #   debtcollector
-    #   jsonschema
-    #   keystoneauth1
-    #   oslo.i18n
-    #   python-keystoneclient
-    #   tacacs-plus
-stevedore==3.3.0
-    # via
-    #   keystoneauth1
-    #   oslo.config
-    #   python-keystoneclient
-tacacs-plus==2.6
-    # via -r requirements.in
-tempora==4.0.1
-    # via portend
-urllib3==1.26.4
-    # via requests
-wrapt==1.12.1
-    # via debtcollector
-yarl==1.6.3
-    # via aiohttp
-zc.lockfile==2.0
-    # via cherrypy
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools
 # Copyright 2018 Telefonica S.A.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -158,3 +11,156 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 # implied.
 # See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+aiohttp==3.6.2
+    # via -r requirements.in
+async-timeout==3.0.1
+    # via aiohttp
+attrs==21.4.0
+    # via
+    #   aiohttp
+    #   jsonschema
+certifi==2021.10.8
+    # via requests
+chardet==3.0.4
+    # via aiohttp
+charset-normalizer==2.0.10
+    # via requests
+cheroot==8.6.0
+    # via cherrypy
+cherrypy==18.6.1
+    # via -r requirements.in
+debtcollector==2.4.0
+    # via
+    #   oslo.config
+    #   oslo.utils
+    #   python-keystoneclient
+idna==3.3
+    # via
+    #   requests
+    #   yarl
+importlib-resources==5.4.0
+    # via
+    #   jaraco.text
+    #   jsonschema
+iso8601==1.0.2
+    # via
+    #   keystoneauth1
+    #   oslo.utils
+jaraco.classes==3.2.1
+    # via jaraco.collections
+jaraco.collections==3.5.1
+    # via cherrypy
+jaraco.functools==3.5.0
+    # via
+    #   cheroot
+    #   jaraco.text
+    #   tempora
+jaraco.text==3.6.0
+    # via jaraco.collections
+jsonschema==4.4.0
+    # via -r requirements.in
+keystoneauth1==4.4.0
+    # via python-keystoneclient
+more-itertools==8.12.0
+    # via
+    #   cheroot
+    #   cherrypy
+    #   jaraco.classes
+    #   jaraco.functools
+msgpack==1.0.3
+    # via oslo.serialization
+multidict==4.7.6
+    # via
+    #   aiohttp
+    #   yarl
+netaddr==0.8.0
+    # via
+    #   oslo.config
+    #   oslo.utils
+netifaces==0.11.0
+    # via oslo.utils
+os-service-types==1.7.0
+    # via keystoneauth1
+oslo.config==8.7.1
+    # via python-keystoneclient
+oslo.i18n==5.1.0
+    # via
+    #   oslo.config
+    #   oslo.utils
+    #   python-keystoneclient
+oslo.serialization==4.2.0
+    # via python-keystoneclient
+oslo.utils==4.12.0
+    # via
+    #   oslo.serialization
+    #   python-keystoneclient
+packaging==21.3
+    # via oslo.utils
+pbr==5.8.0
+    # via
+    #   debtcollector
+    #   keystoneauth1
+    #   os-service-types
+    #   oslo.i18n
+    #   oslo.serialization
+    #   oslo.utils
+    #   python-keystoneclient
+    #   stevedore
+portend==3.1.0
+    # via cherrypy
+pyparsing==3.0.6
+    # via
+    #   oslo.utils
+    #   packaging
+pyrsistent==0.18.1
+    # via jsonschema
+python-keystoneclient==4.4.0
+    # via -r requirements.in
+pytz==2021.3
+    # via
+    #   oslo.serialization
+    #   oslo.utils
+    #   tempora
+pyyaml==5.4.1
+    # via
+    #   -r requirements.in
+    #   oslo.config
+requests==2.27.1
+    # via
+    #   -r requirements.in
+    #   keystoneauth1
+    #   oslo.config
+    #   python-keystoneclient
+rfc3986==2.0.0
+    # via oslo.config
+six==1.16.0
+    # via
+    #   cheroot
+    #   keystoneauth1
+    #   python-keystoneclient
+    #   tacacs-plus
+stevedore==3.5.0
+    # via
+    #   keystoneauth1
+    #   oslo.config
+    #   python-keystoneclient
+tacacs-plus==2.6
+    # via -r requirements.in
+tempora==5.0.0
+    # via portend
+urllib3==1.26.8
+    # via requests
+wrapt==1.13.3
+    # via debtcollector
+yarl==1.7.2
+    # via aiohttp
+zc.lockfile==2.0
+    # via cherrypy
+zipp==3.7.0
+    # via importlib-resources
+
+# The following packages are considered to be unsafe in a requirements file:
+# setuptools
diff --git a/tox.ini b/tox.ini
index 5cb66e7..7827a7e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,7 @@
 
 [testenv]
 usedevelop = True
-basepython = python3
+basepython = python3.8
 setenv = VIRTUAL_ENV={envdir}
          PYTHONDONTWRITEBYTECODE = 1
 deps =  -r{toxinidir}/requirements.txt
@@ -81,13 +81,18 @@
 
 #######################################################################################
 [testenv:pip-compile]
-deps =  pip-tools==5.5.0
+deps =  pip-tools==6.4.0
+skip_install = true
+whitelist_externals = bash
+        [
 commands =
-        - sh -c 'for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
-        out=`echo $file | sed "s/.in/.txt/"` ; \
-        head -16 tox.ini >> $out ;\
-        done'
-whitelist_externals = sh
+        - bash -c "for file in requirements*.in ; do \
+        UNSAFE="" ; \
+        if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
+        pip-compile -rU --no-header $UNSAFE $file ;\
+        out=`echo $file | sed 's/.in/.txt/'` ; \
+        sed -i -e '1 e head -16 tox.ini' $out ;\
+        done"
 
 
 #######################################################################################