Add new kubectl.py functions, modify some libjuju.py functions, add unit tests

- Kubectl.py: two new functions added (get_configuration and get_default_storage_class)
  - get_configuration(): Returns a kubernetes Configuration object.
    It can be used to properly parse the kubeconfig.
  - get_default_storage_class(): Searches for the default storage class of a k8s cluster.
- Libjuju.py: modified add_k8s function and get_k8s_cloud_credential function was added.
  - add_k8s(): Improves the way of generation Cloud and CloudCredential objects for the K8s Cloud
  - get_k8s_cloud_credential(): It parses the kubeconfig to properly determine the authentication
    method type that should be used for that k8s cluster.
- Unit tests: Added unit tests for all the new functions added.
- Exceptions: Make all Juju Exceptions to inherit from N2VC Exception.
  Now Juju exceptions have the message attribute, that is useful for unit testing, to not only check that
  an exception raised, but to check the message too.
- Move get_k8s_cloud_credential() function to n2vc/utils in order to share that code between different connectors.

Change-Id: Ife9027d80663fe95f1f3ad883cb9a3376b047d0b
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/n2vc/utils.py b/n2vc/utils.py
index e8cf64d..16a4733 100644
--- a/n2vc/utils.py
+++ b/n2vc/utils.py
@@ -12,11 +12,31 @@
 #     See the License for the specific language governing permissions and
 #     limitations under the License.
 
+import base64
+import re
+import binascii
 from enum import Enum
 from juju.machine import Machine
 from juju.application import Application
 from juju.action import Action
 from juju.unit import Unit
+from n2vc.exceptions import N2VCInvalidCertificate
+
+
+def base64_to_cacert(b64string):
+    """Convert the base64-encoded string containing the VCA CACERT.
+
+    The input string....
+
+    """
+    try:
+        cacert = base64.b64decode(b64string).decode("utf-8")
+
+        cacert = re.sub(r"\\n", r"\n", cacert,)
+    except binascii.Error as e:
+        raise N2VCInvalidCertificate(message="Invalid CA Certificate: {}".format(e))
+
+    return cacert
 
 
 class N2VCDeploymentStatus(Enum):