Add charmcraft.yaml debug_mode to charmed-osm

- Added a debug_mode option to lcm, mon, nbi, pol, and ro charms
- Added a script to prepare pods for debugging:
  - setup .ssh/config to easily ssh from vscode to the pods
- Added a README that explains how to prepare the environment for
testing

Change-Id: Ieb56b565c15e61c68ad000b60897abd27e1eeb0e
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charm/ro/charmcraft.yaml b/installers/charm/ro/charmcraft.yaml
new file mode 100644
index 0000000..0a285a9
--- /dev/null
+++ b/installers/charm/ro/charmcraft.yaml
@@ -0,0 +1,37 @@
+# Copyright 2021 Canonical Ltd.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: legal@canonical.com
+#
+# To get in touch with the maintainers, please contact:
+# osm-charmers@lists.launchpad.net
+##
+
+type: charm
+bases:
+  - build-on:
+      - name: ubuntu
+        channel: "20.04"
+        architectures: ["amd64"]
+    run-on:
+      - name: ubuntu
+        channel: "20.04"
+        architectures:
+          - amd64
+          - aarch64
+          - arm64
+parts:
+  charm:
+    build-packages: [git]
diff --git a/installers/charm/ro/config.yaml b/installers/charm/ro/config.yaml
index 5bb0362..9828438 100644
--- a/installers/charm/ro/config.yaml
+++ b/installers/charm/ro/config.yaml
@@ -76,3 +76,13 @@
       ImagePullPolicy configuration for the pod.
       Possible values: always, ifnotpresent, never
     default: always
+  debug_mode:
+    description: |
+      If true, debug mode is activated. It means that the service will not run,
+      and instead, the command for the container will be a `sleep infinity`.
+    type: boolean
+    default: false
+  debug_pubkey:
+    description: |
+      Public SSH key that will be injected to the application pod.
+    type: string
diff --git a/installers/charm/ro/src/charm.py b/installers/charm/ro/src/charm.py
index d87007e..5212393 100755
--- a/installers/charm/ro/src/charm.py
+++ b/installers/charm/ro/src/charm.py
@@ -121,7 +121,13 @@
 
     def __init__(self, *args) -> NoReturn:
         """Prometheus Charm constructor."""
-        super().__init__(*args, oci_image="image")
+        super().__init__(
+            *args,
+            oci_image="image",
+            debug_mode_config_key="debug_mode",
+            debug_pubkey_config_key="debug_pubkey",
+            vscode_workspace=VSCODE_WORKSPACE,
+        )
 
         self.kafka_client = KafkaClient(self, "kafka")
         self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
@@ -284,5 +290,42 @@
         return pod_spec_builder.build()
 
 
+VSCODE_WORKSPACE = {
+    "folders": [
+        {"path": "/usr/lib/python3/dist-packages/osm_ng_ro"},
+        {"path": "/usr/lib/python3/dist-packages/osm_common"},
+        {"path": "/usr/lib/python3/dist-packages/osm_ro_plugin"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_arista_cloudvision"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_dpb"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_dynpac"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_floodlightof"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_ietfl2vpn"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_juniper_contrail"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_odlof"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_onos_vpls"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rosdn_onosof"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_aws"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_azure"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_fos"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_opennebula"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_openstack"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_openvim"},
+        {"path": "/usr/lib/python3/dist-packages/osm_rovim_vmware"},
+    ],
+    "launch": {
+        "configurations": [
+            {
+                "module": "osm_ng_ro.ro_main",
+                "name": "NG RO",
+                "request": "launch",
+                "type": "python",
+                "justMyCode": False,
+            }
+        ],
+        "version": "0.2.0",
+    },
+    "settings": {},
+}
+
 if __name__ == "__main__":
     main(RoCharm)
diff --git a/installers/charm/ro/tox.ini b/installers/charm/ro/tox.ini
index f207ac3..c341c8e 100644
--- a/installers/charm/ro/tox.ini
+++ b/installers/charm/ro/tox.ini
@@ -95,13 +95,15 @@
 #######################################################################################
 [testenv:build]
 passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = charmcraft
 whitelist_externals =
   charmcraft
-  cp
+  sh
 commands =
   charmcraft build
-  cp -r build release
+  sh -c 'ubuntu_version=20.04; \
+        architectures="amd64-aarch64-arm64"; \
+        charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \
+        mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm'
 
 #######################################################################################
 [flake8]