parts:
charm:
- prime:
- - files/*
\ No newline at end of file
+ prime:
+ - files/*
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
charm:
# build-packages:
# - git
- prime:
- - files/*
\ No newline at end of file
+ prime:
+ - files/*
- Get pod IP with `get_pod_ip()`
"""
-
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
bases:
- build-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
run-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
parts:
charm:
# build-packages:
# - git
prime:
- - files/*
\ No newline at end of file
+ - files/*
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
bases:
- build-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
run-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
parts:
charm:
build-packages:
- git
- prime:
+ prime:
- files/*
\ No newline at end of file
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
bases:
- build-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
run-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
parts:
charm:
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 1
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
pod_ip: str,
user: str = "root",
workspace_path: str = "/debug.code-workspace",
- ) -> None:
+ ) -> str:
return f"code --remote ssh-remote+{user}@{pod_ip} {workspace_path}"
def _restart(self):
charm:
# build-packages:
# - git
- prime:
+ prime:
- files/*
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
charm:
# build-packages:
# - git
- prime:
- - files/*
\ No newline at end of file
+ prime:
+ - files/*
- Get pod IP with `get_pod_ip()`
"""
+from dataclasses import dataclass
import logging
import secrets
import socket
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 2
+LIBPATCH = 3
logger = logging.getLogger(__name__)
"""
+@dataclass
+class SubModule:
+ """Represent RO Submodules."""
+ sub_module_path: str
+ container_path: str
+
+
class HostPath:
"""Represents a hostpath."""
-
- def __init__(self, config: str, container_path: str) -> None:
+ def __init__(self, config: str, container_path: str, submodules: dict = None) -> None:
mount_path_items = config.split("-")
mount_path_items.reverse()
self.mount_path = "/" + "/".join(mount_path_items)
self.config = config
- self.container_path = container_path
- self.module_name = container_path.split("/")[-1]
-
+ self.sub_module_dict = {}
+ if submodules:
+ for submodule in submodules.keys():
+ self.sub_module_dict[submodule] = SubModule(
+ sub_module_path=self.mount_path + "/" + submodule,
+ container_path=submodules[submodule],
+ )
+ else:
+ self.container_path = container_path
+ self.module_name = container_path.split("/")[-1]
class DebugMode(Object):
"""Class to handle the debug-mode."""
# Add symlinks to mounted hostpaths
for hostpath in mounted_hostpaths:
logger.debug(f"adding symlink for {hostpath.config}")
- self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
- self.container.exec(
- [
- "ln",
- "-s",
- f"{hostpath.mount_path}/{hostpath.module_name}",
- hostpath.container_path,
- ]
- )
+ if len(hostpath.sub_module_dict) > 0:
+ for sub_module in hostpath.sub_module_dict.keys():
+ self.container.exec(["rm", "-rf", hostpath.sub_module_dict[sub_module].container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ hostpath.sub_module_dict[sub_module].sub_module_path,
+ hostpath.sub_module_dict[sub_module].container_path,
+ ]
+ )
+
+ else:
+ self.container.exec(["rm", "-rf", hostpath.container_path]).wait_output()
+ self.container.exec(
+ [
+ "ln",
+ "-s",
+ f"{hostpath.mount_path}/{hostpath.module_name}",
+ hostpath.container_path,
+ ]
+ )
def _configure_hostpaths(self, hostpaths: List[HostPath]):
client = Client()
from legacy_interfaces import MongoClient
+ro_host_paths = {
+ "NG-RO": "/usr/lib/python3/dist-packages/osm_ng_ro",
+ "RO-plugin": "/usr/lib/python3/dist-packages/osm_ro_plugin",
+ "RO-SDN-arista_cloudvision": "/usr/lib/python3/dist-packages/osm_rosdn_arista_cloudvision",
+ "RO-SDN-dpb": "/usr/lib/python3/dist-packages/osm_rosdn_dpb",
+ "RO-SDN-dynpac": "/usr/lib/python3/dist-packages/osm_rosdn_dynpac",
+ "RO-SDN-floodlight_openflow": "/usr/lib/python3/dist-packages/osm_rosdn_floodlightof",
+ "RO-SDN-ietfl2vpn": "/usr/lib/python3/dist-packages/osm_rosdn_ietfl2vpn",
+ "RO-SDN-juniper_contrail": "/usr/lib/python3/dist-packages/osm_rosdn_juniper_contrail",
+ "RO-SDN-odl_openflow": "/usr/lib/python3/dist-packages/osm_rosdn_odlof",
+ "RO-SDN-onos_vpls": "/usr/lib/python3/dist-packages/osm_rosdn_onos_vpls",
+ "RO-VIM-aws": "/usr/lib/python3/dist-packages/osm_rovim_aws",
+ "RO-VIM-azure": "/usr/lib/python3/dist-packages/osm_rovim_azure",
+ "RO-VIM-gcp": "/usr/lib/python3/dist-packages/osm_rovim_gcp",
+ "RO-VIM-openstack": "/usr/lib/python3/dist-packages/osm_rovim_openstack",
+ "RO-VIM-openvim": "/usr/lib/python3/dist-packages/osm_rovim_openvim",
+ "RO-VIM-vmware": "/usr/lib/python3/dist-packages/osm_rovim_vmware",
+}
HOSTPATHS = [
HostPath(
config="ro-hostpath",
- container_path="/usr/lib/python3/dist-packages/osm_ro",
+ container_path="/usr/lib/python3/dist-packages/",
+ submodules=ro_host_paths,
),
HostPath(
config="common-hostpath",
codespell
commands =
# uncomment the following line if this charm owns a lib
- codespell {[vars]lib_path}
+ codespell {[vars]lib_path} --ignore-words-list=Ro,RO,ro
codespell {toxinidir}/. --skip {toxinidir}/.git --skip {toxinidir}/.tox \
--skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \
- --skip {toxinidir}/.mypy_cache --skip {toxinidir}/icon.svg
+ --skip {toxinidir}/.mypy_cache --skip {toxinidir}/icon.svg --ignore-words-list=Ro,RO,ro
# pflake8 wrapper supports config from pyproject.toml
pflake8 {[vars]all_path}
isort --check-only --diff {[vars]all_path}
bases:
- build-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
run-on:
- name: "ubuntu"
- channel: "20.04"
+ channel: "22.04"
parts:
charm:
build-environment: