Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate gx conformant credentials for server flavors #81

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fef5c46
Update unit tests
anjastrunk Mar 26, 2024
68ad2e8
Update generator/discovery/openstack/openstack_discovery.py
anjastrunk Apr 8, 2024
f6dbf53
Update generator/discovery/openstack/openstack_discovery.py
anjastrunk Apr 8, 2024
859dd4a
Update generator/discovery/openstack/vm_images_discovery.py
anjastrunk Apr 8, 2024
fe10fc7
Update generator/discovery/openstack/server_flavor_discovery.py
anjastrunk Apr 8, 2024
3be879f
Refactor code
anjastrunk Apr 8, 2024
1b667ec
Fix typo
anjastrunk Apr 8, 2024
9257f50
Refactor OsCloud
anjastrunk Apr 8, 2024
3667c3c
incorporate scs module for flavor-name parsing
mbuechse Apr 9, 2024
fc46bfa
Minor improvements on previous commit
mbuechse Apr 10, 2024
ebb5b48
remove FIXME regarding vmware hypervisor type
mbuechse Apr 10, 2024
fbc395d
fix a few unit tests
mbuechse Apr 10, 2024
9f4fa54
Remove obsolete assigment of ram size and number of cpu from flavor name
anjastrunk Apr 10, 2024
bc1b56a
Fix unit tests
anjastrunk Apr 10, 2024
ea06af5
Increase code coverage of server_flavor_discovery.py to 100%
anjastrunk Apr 10, 2024
f974b97
Reformt files to solve flake8 errors
anjastrunk Apr 11, 2024
de072c9
Revert unintended renaming of discovery --> openstack_discovery
anjastrunk Apr 11, 2024
09f8a58
Update tests/common.py
anjastrunk Apr 11, 2024
0012be6
Simplify tests/common.py
anjastrunk Apr 11, 2024
19a0f33
Merge branch '77-generate-gx-conformant-credentials-for-server-flavor…
anjastrunk Apr 11, 2024
648541b
Fix unit tests and flake8 errors
anjastrunk Apr 11, 2024
ec08624
Merge branch 'main' into 77-generate-gx-conformant-credentials-for-se…
anjastrunk Apr 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import click
import openstack as os
import rdflib
import yaml

import generator.common.json_ld as json_ld
Expand Down Expand Up @@ -65,11 +64,10 @@ def openstack(cloud, timeout, config):
os_cloud = OsCloud(conn, Config(config_dict))

# run discovery
creds = os_cloud.discover_properties()
creds = os_cloud.discover()

props = json_ld.get_json_ld_context()
props["@graph"] = creds
json_text = json.dumps(props, indent=4, default=json_ld.to_json_ld)
print(json.dumps(props, indent=4, default=json_ld.to_json_ld))


Expand Down
261 changes: 143 additions & 118 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,121 +1,146 @@
default:
operating system:
Alpine Linux:
copyright owner: "Alpine Linux"
resource policy: "default: allow intent"
license:
- https://gitlab.alpinelinux.org/alpine/aports/-/issues/9074
Arch Linux:
copyright owner: "Judd Vinet, Aaron Griffin, Levente Polyák and others"
resource policy: "default: allow intent"
license:
- https://gitlab.archlinux.org/archlinux
CentOS Linux:
copyright owner: "The CentOS Project and others"
resource policy: "default: allow intent"
license:
- https://github.com/CentOS/
Debian:
copyright owner: "Ian Murdock and others"
resource policy: "default: allow intent"
license:
- https://www.debian.org/legal/licenses/index.en.html
Fedora:
copyright owner: "Fedora-Project"
resource policy: "default: allow intent"
license:
- https://docs.fedoraproject.org/en-US/legal/fedora-linux-license/
FreeBSD:
copyright owner: "The FreeBSD Project"
resource policy: "default: allow intent"
license:
- GPL-3.0-only
- LGPL-2.0
Gentoo Linux:
copyright owner: "Gentoo Foundation, Inc."
resource policy: "default: allow intent"
license:
- https://www.gentoo.org/glep/glep-0076.html
Mandrakelinux:
copyright owner: "Mandriva Linux"
resource policy: "default: allow intent"
license:
- GPL-3.0-only
Mandriva Linux:
copyright owner: "Mandriva S. A."
resource policy: "default: allow intent"
license:
- GPL-3.0-only
Mandriva Enterprise Server:
copyright owner: "Mandriva S. A."
resource policy: "default: allow intent"
license:
- GPL-3.0-only
MS-DOS:
copyright owner: "Microsoft Corporation"
resource policy: "default: allow intent"
license:
- https://www.microsoft.com/licensing/docs/view/Licensing-Guides
NetBSD:
copyright owner: "The NetBSD Foundation"
resource policy: "default: allow intent"
license:
- https://www.netbsd.org/about/redistribution.html
Novell NetWare:
copyright owner: "Micro Focus International"
resource policy: "default: allow intent"
license:
- https://support.novell.com/techcenter/articles/ana19960702.html
OpenBSD:
copyright owner: "OpenBSD"
resource policy: "default: allow intent"
license:
- https://www.openbsd.org/policy.html
OpenSolaris:
copyright owner: "Sun Microsystems"
resource policy: "default: allow intent"
license:
- https://opensource.apple.com/source/xnu/xnu-2050.7.9/tools/tests/libMicro/OPENSOLARIS.LICENSE.auto.html
openSUSE:
copyright owner: "openSUSE contributors & others"
resource policy: "default: allow intent"
license:
- https://en.opensuse.org/openSUSE:License
Rocky Linux:
copyright owner: "Rocky Enterprise Software Foundation"
resource policy: "default: allow intent"
license:
- https://rockylinux.org/licensing
Red Hat Enterprise Linux:
copyright owner: "Red Hat, Inc."
resource policy: "default: allow intent"
license:
- https://www.redhat.com/en/store/red-hat-enterprise-linux-server
SUSE Linux Enterprise Server:
copyright owner: "SUSE"
resource policy: "default: allow intent"
license:
- https://www.suse.com/products/terms_and_conditions.pdf
Ubuntu:
copyright owner: "Canonical"
resource policy: "default: allow intent"
license:
- https://ubuntu.com/legal/open-source-licences
Microsoft Windows:
copyright owner: "Microsoft Corporation"
resource policy: "default: allow intent"
license:
- https://www.microsoft.com/licensing
CirrOS:
copyright owner: "Canonical Ltd."
resource policy: "default: allow intent"
license:
- GPL-2.0-only
AlmaLinux:
copyright owner: "Canonical Ltd."
resource policy: "default: allow intent"
license:
- https://almalinux.org/p/the-almalinux-os-licensing-policy/
software resources:
Alpine Linux:
copyright owner: "Alpine Linux"
resource policy: "default: allow intent"
license:
- https://gitlab.alpinelinux.org/alpine/aports/-/issues/9074
Arch Linux:
copyright owner: "Judd Vinet, Aaron Griffin, Levente Polyák and others"
resource policy: "default: allow intent"
license:
- https://gitlab.archlinux.org/archlinux
CentOS Linux:
copyright owner: "The CentOS Project and others"
resource policy: "default: allow intent"
license:
- https://github.com/CentOS/
Debian:
copyright owner: "Ian Murdock and others"
resource policy: "default: allow intent"
license:
- https://www.debian.org/legal/licenses/index.en.html
Fedora:
copyright owner: "Fedora-Project"
resource policy: "default: allow intent"
license:
- https://docs.fedoraproject.org/en-US/legal/fedora-linux-license/
FreeBSD:
copyright owner: "The FreeBSD Project"
resource policy: "default: allow intent"
license:
- GPL-3.0-only
- LGPL-2.0
Gentoo Linux:
copyright owner: "Gentoo Foundation, Inc."
resource policy: "default: allow intent"
license:
- https://www.gentoo.org/glep/glep-0076.html
Mandrakelinux:
copyright owner: "Mandriva Linux"
resource policy: "default: allow intent"
license:
- GPL-3.0-only
Mandriva Linux:
copyright owner: "Mandriva S. A."
resource policy: "default: allow intent"
license:
- GPL-3.0-only
Mandriva Enterprise Server:
copyright owner: "Mandriva S. A."
resource policy: "default: allow intent"
license:
- GPL-3.0-only
MS-DOS:
copyright owner: "Microsoft Corporation"
resource policy: "default: allow intent"
license:
- https://www.microsoft.com/licensing/docs/view/Licensing-Guides
NetBSD:
copyright owner: "The NetBSD Foundation"
resource policy: "default: allow intent"
license:
- https://www.netbsd.org/about/redistribution.html
Novell NetWare:
copyright owner: "Micro Focus International"
resource policy: "default: allow intent"
license:
- https://support.novell.com/techcenter/articles/ana19960702.html
OpenBSD:
copyright owner: "OpenBSD"
resource policy: "default: allow intent"
license:
- https://www.openbsd.org/policy.html
OpenSolaris:
copyright owner: "Sun Microsystems"
resource policy: "default: allow intent"
license:
- https://opensource.apple.com/source/xnu/xnu-2050.7.9/tools/tests/libMicro/OPENSOLARIS.LICENSE.auto.html
openSUSE:
copyright owner: "openSUSE contributors & others"
resource policy: "default: allow intent"
license:
- https://en.opensuse.org/openSUSE:License
Rocky Linux:
copyright owner: "Rocky Enterprise Software Foundation"
resource policy: "default: allow intent"
license:
- https://rockylinux.org/licensing
Red Hat Enterprise Linux:
copyright owner: "Red Hat, Inc."
resource policy: "default: allow intent"
license:
- https://www.redhat.com/en/store/red-hat-enterprise-linux-server
SUSE Linux Enterprise Server:
copyright owner: "SUSE"
resource policy: "default: allow intent"
license:
- https://www.suse.com/products/terms_and_conditions.pdf
Ubuntu:
copyright owner: "Canonical"
resource policy: "default: allow intent"
license:
- https://ubuntu.com/legal/open-source-licences
Microsoft Windows:
copyright owner: "Microsoft Corporation"
resource policy: "default: allow intent"
license:
- https://www.microsoft.com/licensing
CirrOS:
copyright owner: "Canonical Ltd."
resource policy: "default: allow intent"
license:
- GPL-2.0-only
AlmaLinux:
copyright owner: "Canonical Ltd."
resource policy: "default: allow intent"
license:
- https://almalinux.org/p/the-almalinux-os-licensing-policy/
Debian 11:
copyright owner: "AlmaLinux OS Foundation"
resource policy: "default: allow intent"
license:
- https://www.debian.org/legal/licenses/
KVM:
copyright owner: "Qumranet"
resource policy: "default: allow intent"
license:
- GPL-2.0-or-later
- LGPL-3.0-or-later
Xen:
copyright owner: "The Linux Foundation"
resource policy: "default: allow intent"
license:
- GPL-2.0
vmware:
copyright owner: "Broadcom"
resource policy: "default: allow intent"
license:
- https://www.vmware.com/support/support-resources/licensing.html
hyper-v:
copyright owner: "Microsoft Corporation"
resource policy: "default: allow intent"
license:
- https://www.microsoft.com/windows-server/pricing
#cloud resources:
# own images:
# AlmaLinux 8:
Expand Down
13 changes: 13 additions & 0 deletions generator/common/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import List

from generator.common import const


def _get_value(config, keys: List[str]):
if not keys:
Expand All @@ -19,3 +21,14 @@ def __init__(self, config):

def get_value(self, keys: List[str]):
return _get_value(self.config, keys)

def get_copyright_owner(self, software: str) -> List[str]:
return self.get_value([const.CONFIG_SOFTWARE, software, const.CONFIG_COPYRIGHT])

def get_license(self, software: str) -> List[str]:
return self.get_value([const.CONFIG_SOFTWARE, software, const.CONFIG_LICENSE])

def get_resource_policy(self, software: str) -> List[str]:
return self.get_value(
[const.CONFIG_SOFTWARE, software, const.CONFIG_RESOURCE_POLICY]
)
11 changes: 11 additions & 0 deletions generator/common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

UNIT_MB = "https://qudt.org/vocab/unit/MegaBYTE"
UNIT_GB = "https://qudt.org/vocab/unit/GigaBYTE"
UNIT_GHZ = "https://qudt.org/vocab/unit/GigaHZ"

CONFIG_VM_IMAGE = "vm image"
CONFIG_RESOURCE_POLICY = "resource policy"
Expand All @@ -19,9 +20,11 @@
CONFIG_WALLETS = "wallets"
CONFIG_DEFAULT = "default"
CONFIG_CLOUD_RESOURCES = "cloud resources:"
CONFIG_SOFTWARE = "software resources"
CONFIG_FILESYSTEM_WALLET = "filesystem"
CONFIG_XFSC_WALLET = "xfsc"


CONFIG_OS_ALP = "Alpine Linux"
CONFIG_OS_ARCH = "Arch Linux"
CONFIG_OS_CENTOS = "CentOS Linux"
Expand All @@ -46,4 +49,12 @@
CONFIG_OS_CIRROS = "CirrOS"
CONFIG_OS_ALMALINUX = "AlmaLinux"

CONFIG_HV_KVM = "KVM"
CONFIG_HV_QUEMU = "quemu"
CONFIG_HV_XEN = "Xen"
CONFIG_HV_ESXI = "ESXi"
CONFIG_HV_CH = "Cloud Hypervisor"
CONFIG_HV_VMW = "vmware"
CONFIG_HV_HYV = "hyper-v"

CONFIG_FILE = "config/config.yaml"
Loading
Loading