Skip to content
Snippets Groups Projects
Commit 3ca96139 authored by garciadav's avatar garciadav
Browse files

Fix bug 1800: Add hostpath mount option in OSM charms


Change-Id: Ie5ef484759bd37d6cc8dcea0f32573e2a7dd3a11
Signed-off-by: default avatarDavid Garcia <david.garcia@canonical.com>
parent 71b7ad6f
No related branches found
No related tags found
No related merge requests found
Showing
with 361 additions and 59 deletions
......@@ -29,7 +29,7 @@ description: |
bundle: kubernetes
applications:
zookeeper:
charm: "cs:~charmed-osm/zookeeper-0"
charm: "cs:~charmed-osm/zookeeper-1"
channel: "stable"
scale: 3
series: kubernetes
......@@ -56,7 +56,7 @@ applications:
gui-x: -300
gui-y: -250
kafka:
charm: "cs:~charmed-osm/kafka-0"
charm: "cs:~charmed-osm/kafka-1"
channel: "stable"
scale: 3
series: kubernetes
......@@ -78,7 +78,7 @@ applications:
gui-x: 0
gui-y: 0
nbi:
charm: "cs:~charmed-osm/nbi-17"
charm: "cs:~charmed-osm/nbi-18"
scale: 3
series: kubernetes
options:
......@@ -89,7 +89,7 @@ applications:
gui-x: 0
gui-y: -250
ro:
charm: "cs:~charmed-osm/ro-9"
charm: "cs:~charmed-osm/ro-10"
scale: 3
series: kubernetes
options:
......@@ -98,14 +98,14 @@ applications:
gui-x: -300
gui-y: 250
ng-ui:
charm: "cs:~charmed-osm/ng-ui-24"
charm: "cs:~charmed-osm/ng-ui-25"
scale: 3
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
charm: "cs:~charmed-osm/lcm-14"
charm: "cs:~charmed-osm/lcm-15"
scale: 3
series: kubernetes
options:
......@@ -115,7 +115,7 @@ applications:
gui-x: -300
gui-y: 0
mon:
charm: "cs:~charmed-osm/mon-11"
charm: "cs:~charmed-osm/mon-12"
scale: 1
series: kubernetes
options:
......@@ -126,7 +126,7 @@ applications:
gui-x: 300
gui-y: 0
pol:
charm: "cs:~charmed-osm/pol-9"
charm: "cs:~charmed-osm/pol-10"
scale: 3
series: kubernetes
options:
......@@ -135,7 +135,7 @@ applications:
gui-x: -300
gui-y: 500
pla:
charm: "cs:~charmed-osm/pla-12"
charm: "cs:~charmed-osm/pla-13"
scale: 3
series: kubernetes
options:
......@@ -144,7 +144,7 @@ applications:
gui-x: 600
gui-y: -250
prometheus:
charm: "cs:~charmed-osm/prometheus-8"
charm: "cs:~charmed-osm/prometheus-9"
scale: 1
series: kubernetes
storage:
......@@ -155,14 +155,14 @@ applications:
gui-x: 300
gui-y: 250
grafana:
charm: "cs:~charmed-osm/grafana-9"
charm: "cs:~charmed-osm/grafana-10"
scale: 3
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
charm: "cs:~charmed-osm/keystone-15"
charm: "cs:~charmed-osm/keystone-16"
scale: 1
series: kubernetes
annotations:
......
......@@ -28,7 +28,7 @@ description: |
bundle: kubernetes
applications:
zookeeper:
charm: "cs:~charmed-osm/zookeeper-0"
charm: "cs:~charmed-osm/zookeeper-1"
scale: 1
series: kubernetes
storage:
......@@ -51,7 +51,7 @@ applications:
gui-x: -300
gui-y: -250
kafka:
charm: "cs:~charmed-osm/kafka-0"
charm: "cs:~charmed-osm/kafka-1"
scale: 1
series: kubernetes
storage:
......@@ -69,7 +69,7 @@ applications:
gui-x: 0
gui-y: 0
nbi:
charm: "cs:~charmed-osm/nbi-17"
charm: "cs:~charmed-osm/nbi-18"
scale: 1
series: kubernetes
options:
......@@ -80,7 +80,7 @@ applications:
gui-x: 0
gui-y: -250
ro:
charm: "cs:~charmed-osm/ro-9"
charm: "cs:~charmed-osm/ro-10"
scale: 1
series: kubernetes
options:
......@@ -89,14 +89,14 @@ applications:
gui-x: -300
gui-y: 250
ng-ui:
charm: "cs:~charmed-osm/ng-ui-24"
charm: "cs:~charmed-osm/ng-ui-25"
scale: 1
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
charm: "cs:~charmed-osm/lcm-14"
charm: "cs:~charmed-osm/lcm-15"
scale: 1
series: kubernetes
options:
......@@ -106,7 +106,7 @@ applications:
gui-x: -300
gui-y: 0
mon:
charm: "cs:~charmed-osm/mon-11"
charm: "cs:~charmed-osm/mon-12"
scale: 1
series: kubernetes
options:
......@@ -117,7 +117,7 @@ applications:
gui-x: 300
gui-y: 0
pol:
charm: "cs:~charmed-osm/pol-9"
charm: "cs:~charmed-osm/pol-10"
scale: 1
series: kubernetes
options:
......@@ -126,7 +126,7 @@ applications:
gui-x: -300
gui-y: 500
pla:
charm: "cs:~charmed-osm/pla-12"
charm: "cs:~charmed-osm/pla-13"
scale: 1
series: kubernetes
options:
......@@ -135,7 +135,7 @@ applications:
gui-x: 600
gui-y: -250
prometheus:
charm: "cs:~charmed-osm/prometheus-8"
charm: "cs:~charmed-osm/prometheus-9"
scale: 1
series: kubernetes
storage:
......@@ -146,14 +146,14 @@ applications:
gui-x: 300
gui-y: 250
grafana:
charm: "cs:~charmed-osm/grafana-9"
charm: "cs:~charmed-osm/grafana-10"
scale: 1
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
charm: "cs:~charmed-osm/keystone-15"
charm: "cs:~charmed-osm/keystone-16"
scale: 1
series: kubernetes
annotations:
......
......@@ -291,6 +291,27 @@ options:
description: |
Public SSH key that will be injected to the application pod.
type: string
debug_lcm_local_path:
description: |
Local full path to the LCM project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_n2vc_local_path:
description: |
Local full path to the N2VC project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_common_local_path:
description: |
Local full path to the COMMON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
security_context:
description: Enables the security context of the pods
type: boolean
......
......@@ -144,10 +144,26 @@ class LcmCharm(CharmedOsmBase):
super().__init__(
*args,
oci_image="image",
debug_mode_config_key="debug_mode",
debug_pubkey_config_key="debug_pubkey",
vscode_workspace=VSCODE_WORKSPACE,
)
if self.config.get("debug_mode"):
self.enable_debug_mode(
pubkey=self.config.get("debug_pubkey"),
hostpaths={
"LCM": {
"hostpath": self.config.get("debug_lcm_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_lcm",
},
"N2VC": {
"hostpath": self.config.get("debug_n2vc_local_path"),
"container-path": "/usr/lib/python3/dist-packages/n2vc",
},
"osm_common": {
"hostpath": self.config.get("debug_common_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_common",
},
},
)
self.kafka_client = KafkaClient(self, "kafka")
self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
self.framework.observe(self.on["kafka"].relation_broken, self.configure_pod)
......
......@@ -104,6 +104,27 @@ options:
description: |
Public SSH key that will be injected to the application pod.
type: string
debug_mon_local_path:
description: |
Local full path to the MON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_n2vc_local_path:
description: |
Local full path to the N2VC project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_common_local_path:
description: |
Local full path to the COMMON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
security_context:
description: Enables the security context of the pods
type: boolean
......
......@@ -129,11 +129,26 @@ class MonCharm(CharmedOsmBase):
super().__init__(
*args,
oci_image="image",
debug_mode_config_key="debug_mode",
debug_pubkey_config_key="debug_pubkey",
vscode_workspace=VSCODE_WORKSPACE,
)
if self.config.get("debug_mode"):
self.enable_debug_mode(
pubkey=self.config.get("debug_pubkey"),
hostpaths={
"MON": {
"hostpath": self.config.get("debug_mon_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_mon",
},
"N2VC": {
"hostpath": self.config.get("debug_n2vc_local_path"),
"container-path": "/usr/lib/python3/dist-packages/n2vc",
},
"osm_common": {
"hostpath": self.config.get("debug_common_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_common",
},
},
)
self.kafka_client = KafkaClient(self, "kafka")
self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
self.framework.observe(self.on["kafka"].relation_broken, self.configure_pod)
......
......@@ -89,6 +89,20 @@ options:
description: |
Public SSH key that will be injected to the application pod.
type: string
debug_nbi_local_path:
description: |
Local full path to the NBI project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_common_local_path:
description: |
Local full path to the COMMON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
security_context:
description: Enables the security context of the pods
type: boolean
......
......@@ -122,10 +122,22 @@ class NbiCharm(CharmedOsmBase):
super().__init__(
*args,
oci_image="image",
debug_mode_config_key="debug_mode",
debug_pubkey_config_key="debug_pubkey",
vscode_workspace=VSCODE_WORKSPACE,
)
if self.config.get("debug_mode"):
self.enable_debug_mode(
pubkey=self.config.get("debug_pubkey"),
hostpaths={
"NBI": {
"hostpath": self.config.get("debug_nbi_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_nbi",
},
"osm_common": {
"hostpath": self.config.get("debug_common_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_common",
},
},
)
self.kafka_client = KafkaClient(self, "kafka")
self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
......
......@@ -49,6 +49,20 @@ options:
description: |
Public SSH key that will be injected to the application pod.
type: string
debug_pol_local_path:
description: |
Local full path to the POL project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_common_local_path:
description: |
Local full path to the COMMON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
security_context:
description: Enables the security context of the pods
type: boolean
......
......@@ -91,11 +91,22 @@ class PolCharm(CharmedOsmBase):
super().__init__(
*args,
oci_image="image",
debug_mode_config_key="debug_mode",
debug_pubkey_config_key="debug_pubkey",
vscode_workspace=VSCODE_WORKSPACE,
)
if self.config.get("debug_mode"):
self.enable_debug_mode(
pubkey=self.config.get("debug_pubkey"),
hostpaths={
"POL": {
"hostpath": self.config.get("debug_pol_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_policy_module",
},
"osm_common": {
"hostpath": self.config.get("debug_common_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_common",
},
},
)
self.kafka_client = KafkaClient(self, "kafka")
self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
self.framework.observe(self.on["kafka"].relation_broken, self.configure_pod)
......
......@@ -87,6 +87,20 @@ options:
description: |
Public SSH key that will be injected to the application pod.
type: string
debug_ro_local_path:
description: |
Local full path to the RO project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
debug_common_local_path:
description: |
Local full path to the COMMON project.
The path will be mounted to the docker image,
which means changes during the debugging will be saved in your local path.
type: string
security_context:
description: Enables the security context of the pods
type: boolean
......
......@@ -24,7 +24,7 @@
import base64
import logging
from typing import NoReturn, Optional
from typing import Dict, NoReturn, Optional
from ops.main import main
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
......@@ -131,11 +131,19 @@ class RoCharm(CharmedOsmBase):
super().__init__(
*args,
oci_image="image",
debug_mode_config_key="debug_mode",
debug_pubkey_config_key="debug_pubkey",
vscode_workspace=VSCODE_WORKSPACE,
)
if self.config.get("debug_mode"):
self.enable_debug_mode(
pubkey=self.config.get("debug_pubkey"),
hostpaths={
"osm_common": {
"hostpath": self.config.get("debug_common_local_path"),
"container-path": "/usr/lib/python3/dist-packages/osm_common",
},
**_get_ro_host_paths(self.config.get("debug_ro_local_path")),
},
)
self.kafka_client = KafkaClient(self, "kafka")
self.framework.observe(self.on["kafka"].relation_changed, self.configure_pod)
self.framework.observe(self.on["kafka"].relation_broken, self.configure_pod)
......@@ -363,5 +371,92 @@ VSCODE_WORKSPACE = {
"settings": {},
}
def _get_ro_host_paths(ro_host_path: str) -> Dict:
"""Get RO host paths"""
return (
{
"NG-RO": {
"hostpath": f"{ro_host_path}/NG-RO",
"container-path": "/usr/lib/python3/dist-packages/osm_ng_ro",
},
"RO-plugin": {
"hostpath": f"{ro_host_path}/RO-plugin",
"container-path": "/usr/lib/python3/dist-packages/osm_ro_plugin",
},
"RO-SDN-arista_cloudvision": {
"hostpath": f"{ro_host_path}/RO-SDN-arista_cloudvision",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_arista_cloudvision",
},
"RO-SDN-dpb": {
"hostpath": f"{ro_host_path}/RO-SDN-dpb",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_dpb",
},
"RO-SDN-dynpac": {
"hostpath": f"{ro_host_path}/RO-SDN-dynpac",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_dynpac",
},
"RO-SDN-floodlight_openflow": {
"hostpath": f"{ro_host_path}/RO-SDN-floodlight_openflow",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_floodlightof",
},
"RO-SDN-ietfl2vpn": {
"hostpath": f"{ro_host_path}/RO-SDN-ietfl2vpn",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_ietfl2vpn",
},
"RO-SDN-juniper_contrail": {
"hostpath": f"{ro_host_path}/RO-SDN-juniper_contrail",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_juniper_contrail",
},
"RO-SDN-odl_openflow": {
"hostpath": f"{ro_host_path}/RO-SDN-odl_openflow",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_odlof",
},
"RO-SDN-onos_openflow": {
"hostpath": f"{ro_host_path}/RO-SDN-onos_openflow",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_onosof",
},
"RO-SDN-onos_vpls": {
"hostpath": f"{ro_host_path}/RO-SDN-onos_vpls",
"container-path": "/usr/lib/python3/dist-packages/osm_rosdn_onos_vpls",
},
"RO-VIM-aws": {
"hostpath": f"{ro_host_path}/RO-VIM-aws",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_aws",
},
"RO-VIM-azure": {
"hostpath": f"{ro_host_path}/RO-VIM-azure",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_azure",
},
"RO-VIM-gcp": {
"hostpath": f"{ro_host_path}/RO-VIM-gcp",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_gcp",
},
"RO-VIM-fos": {
"hostpath": f"{ro_host_path}/RO-VIM-fos",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_fos",
},
"RO-VIM-opennebula": {
"hostpath": f"{ro_host_path}/RO-VIM-opennebula",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_opennebula",
},
"RO-VIM-openstack": {
"hostpath": f"{ro_host_path}/RO-VIM-openstack",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_openstack",
},
"RO-VIM-openvim": {
"hostpath": f"{ro_host_path}/RO-VIM-openvim",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_openvim",
},
"RO-VIM-vmware": {
"hostpath": f"{ro_host_path}/RO-VIM-vmware",
"container-path": "/usr/lib/python3/dist-packages/osm_rovim_vmware",
},
}
if ro_host_path
else {}
)
if __name__ == "__main__":
main(RoCharm)
##
# Copyright 2019 ETSI
#
# 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.
##
charms=`cat bundles/osm/bundle.yaml | grep cs | grep -v k8s | awk '{print $2}' | tr -d \"`
for charm_uri in $charms; do
charm_without_rev=`echo $charm_uri| rev | cut -d "-" -f 2-5 | rev`
latest_revision=`charm show --channel edge $charm_without_rev | grep Revision | awk '{print $2}'`
new_charm_uri=$charm_without_rev-$latest_revision
old_uri=`echo $charm_uri | sed 's/\//\\\\\//g'`
new_uri=`echo $new_charm_uri | sed 's/\//\\\\\//g'`
sed -i "s/"$old_uri"/"$new_uri"/g" bundles/osm/bundle.yaml
done
charms=`cat bundles/osm-ha/bundle.yaml | grep cs | grep -v k8s | awk '{print $2}' | tr -d \"`
for charm_uri in $charms; do
charm_without_rev=`echo $charm_uri| rev | cut -d "-" -f 2-5 | rev`
latest_revision=`charm show --channel edge $charm_without_rev | grep Revision | awk '{print $2}'`
new_charm_uri=$charm_without_rev-$latest_revision
old_uri=`echo $charm_uri | sed 's/\//\\\\\//g'`
new_uri=`echo $new_charm_uri | sed 's/\//\\\\\//g'`
sed -i "s/"$old_uri"/"$new_uri"/g" bundles/osm-ha/bundle.yaml
done
\ No newline at end of file
......@@ -30,6 +30,7 @@ Benefits:
- Easily configure modules for debugging_mode: `juju config <module> debug_mode=True debug_pubkey="ssh-rsa ..."`.
- Debug in K8s: All pods (the debugged ones and the rest) will be running always in K8s.
- Seemless setup: VSCode will connect through SSH to the pods.
- Keep your changes save: Possibility to mount local module to the container; all the changes will be saved automatically to your local filesystem.
## Install OSM
......@@ -56,25 +57,64 @@ Install OSM from a specific tag:
Once the Charmed OSM installation has finished, you can select which applications you want to run with the debug mode.
- lcm: `juju config lcm debug_mode=True debug_pubkey="ssh-rsa ..."`
- mon: `juju config mon debug_mode=True debug_pubkey="ssh-rsa ..."`
- nbi: `juju config nbi debug_mode=True debug_pubkey="ssh-rsa ..."`
- ro: `juju config ro debug_mode=True debug_pubkey="ssh-rsa ..."`
- pol: `juju config pol debug_mode=True debug_pubkey="ssh-rsa ..."`
```bash
# LCM
juju config lcm debug_mode=True debug_pubkey="`cat ~/.ssh/id_rsa.pub`"
# MON
juju config mon debug_mode=True debug_pubkey="`cat ~/.ssh/id_rsa.pub`"
# NBI
juju config nbi debug_mode=True debug_pubkey="`cat ~/.ssh/id_rsa.pub`"
# RO
juju config ro debug_mode=True debug_pubkey="`cat ~/.ssh/id_rsa.pub`"
# POL
juju config pol debug_mode=True debug_pubkey="`cat ~/.ssh/id_rsa.pub`"
```
Enabling the debug_mode will put a `sleep infinity` as the entrypoint of the container. That way, we can later connect to the pod through SSH in VSCode, and run the entrypoint of the application from the debugger.
### Prepare pods
### Mounting local modules
The Charmed OSM Debugging mode allows you to mount local modules to the desired charms. The following commands show which modules can be mounted in each charm.
```bash
LCM_LOCAL_PATH="/path/to/LCM"
N2VC_LOCAL_PATH="/path/to/N2VC"
NBI_LOCAL_PATH="/path/to/NBI"
RO_LOCAL_PATH="/path/to/RO"
MON_LOCAL_PATH="/path/to/MON"
POL_LOCAL_PATH="/path/to/POL"
COMMON_LOCAL_PATH="/path/to/common"
# LCM
juju config lcm debug_lcm_local_path=$LCM_LOCAL_PATH
juju config lcm debug_n2vc_local_path=$N2VC_LOCAL_PATH
juju config lcm debug_common_local_path=$COMMON_LOCAL_PATH
# MON
juju config mon debug_mon_local_path=$MON_LOCAL_PATH
juju config mon debug_n2vc_local_path=$N2VC_LOCAL_PATH
juju config mon debug_common_local_path=$COMMON_LOCAL_PATH
# NBI
juju config nbi debug_nbi_local_path=$LCM_LOCAL_PATH
juju config nbi debug_common_local_path=$COMMON_LOCAL_PATH
# RO
juju config ro debug_ro_local_path=$RO_LOCAL_PATH
juju config ro debug_common_local_path=$COMMON_LOCAL_PATH
# POL
juju config pol debug_pol_local_path=$POL_LOCAL_PATH
juju config pol debug_common_local_path=$COMMON_LOCAL_PATH
```
Preparing the pods includes setting up the ~/.ssh/config so the VSCode can easily discover which ssh hosts are available
### Generate SSH config file
Preparing the pods includes setting up the `~/.ssh/config` so the VSCode can easily discover which ssh hosts are available
Just execute:
```bash
./prepare_pods.sh
./generate_ssh_config.sh
```
> NOTE: The public key that will be used will be `$HOME/.ssh/id_rsa.pub`. If you want to use a different one, add the absolute path to it as a first argument: `./prepare_pods.sh /path/to/key.pub`.
> NOTE: The public key that will be used will be `$HOME/.ssh/id_rsa.pub`. If you want to use a different one, add the absolute path to it as a first argument: `./generate_ssh_config.sh /path/to/key.pub`.
### Connect to Pods
......@@ -92,22 +132,16 @@ Right click on the host, and "Connect to host in a New Window".
### Add workspace
The `./prepare_pods.sh` script adds a workspace to the `/root` folder of each pod, with the following name: `<module>.code-workspace`.
The `./generate_ssh_config.sh` script adds a workspace to the `/root` folder of each pod, with the following name: `debug.code-workspace`.
In the window of the connected host, go to `File/Open Workspace...`. Then select the `<module>.code-workspace` file.
In the window of the connected host, go to `File/Open Workspace from File...`. Then select the `debug.code-workspace` file.
### Run and Debug
Go to extensions and install the Python extension. It will be installed in the remote pod.
Now we need to add a [debug configuration](https://code.visualstudio.com/docs/editor/debugging). For that, go to the Run and Debug tab, and click on `create a launch.json file`.
Open the `Terminal` tab, and the Python extension will be automatically downloaded. It will be installed in the remote pod.
Now you will be asked to select a folder in your workspace. Select the folder of the main component:
Go to the `Explorer (ctrl + shift + E)` to see the module folders in the charm. You can add breakpoints and start debugging.
- LCM: select osm_lcm
- MON: select osm_mon
- NBI: select osm_nbi
- RO: select osm_ng_ro
- POL: select osm_policy_module
Go to the `Run and Debug (ctrl + shift + D)` and press `F5` to start the main entrypoint of the charm.
Then select `Python` as the environment. And finally, select `Module` and enter the module of the component you are going to test (LCM example: osm_lcm.lcm)
Happy debugging!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment