-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matus Jenca <matus.jenca@dnation.cloud>
- Loading branch information
1 parent
9d19f3b
commit 19b83d3
Showing
15 changed files
with
147 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
NEUTRON_ENCRYPTION_XTRACE=$(set +o | grep xtrace) | ||
set -o xtrace | ||
function neutron_encryption_install { | ||
setup_develop /opt/stack/neutron-encryption | ||
echo "Installing Neutron encryption plugin" >> encryption-test.log | ||
} | ||
|
||
function neutron_encryption_configure { | ||
neutron_service_plugin_class_add encryption | ||
configure_l3_agent | ||
echo "Configuring Neutron encryption plugin" >> encryption-test.log | ||
} | ||
|
||
|
||
if [[ "$1" == "stack" && "$2" == "install" ]]; then | ||
neutron_encryption_install | ||
|
||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then | ||
neutron_encryption_configure | ||
fi | ||
|
||
|
||
$NEUTRON_ENCRYPTION_XTRACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Config files | ||
NEUTRON_CONF_DIR=${NEUTRON_CONF_DIR:-"/etc/neutron"} | ||
NEUTRON_ENCRYPTION_DIR=$DEST/neutron-encryption | ||
|
||
NEUTRON_ENCRYPTION_CONF_FILE=neutron_encryption.conf | ||
NEUTRON_ENCRYPTION_CONF=$NEUTRON_CONF_DIR/$NEUTRON_ENCRYPTION_CONF_FILE |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from neutron_encryption.extensions import encryption | ||
from oslo_log import log | ||
_LOG = log.getLogger(__name__) | ||
|
||
class EncryptionPluginDb(encryption.EncryptionPluginBase): | ||
pass | ||
|
||
|
||
class EncryptionPluginRpcDbMixin(object): | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
import abc | ||
from neutron_lib.plugins import constants as nconstants | ||
from neutron_lib.services import base as service_base | ||
from neutron_lib.api import extensions as api_extensions | ||
from neutron_lib.plugins import directory | ||
from neutron.api.v2 import base | ||
from neutron.quota import resource_registry | ||
from neutron_lib.db import constants as db_const | ||
from neutron.extensions import standardattrdescription as stdattr_ext | ||
from neutron.api import extensions | ||
from oslo_log import log | ||
_LOG = log.getLogger(__name__) | ||
|
||
_LOG.info("TEST: Encryption extension loaded") | ||
|
||
RESOURCE_ATTRIBUTE_MAP = { | ||
'encryptions' : { | ||
'id': {'allow_post': False, 'allow_put': False, | ||
'validate': {'type:uuid': None}, | ||
'is_visible': True, | ||
'is_filter': True, | ||
'is_sort_key': True, | ||
'primary_key': True}, | ||
'name': {'allow_post': True, 'allow_put': True, | ||
'is_visible': True, 'default': '', 'is_filter': True, | ||
'is_sort_key': True, | ||
'validate': { | ||
'type:name_not_default': db_const.NAME_FIELD_SIZE}}, | ||
} | ||
|
||
} | ||
|
||
class Encryption(api_extensions.ExtensionDescriptor): | ||
def get_plugin_interface(self): | ||
_LOG.info(f"TEST PLUGIN BASE") | ||
return EncryptionPluginBase | ||
|
||
def get_name(self): | ||
return "encryption" | ||
def get_alias(self): | ||
return "encryption" | ||
def get_description(self): | ||
return "The encryption extension." | ||
def get_updated(self): | ||
return "2022-03-14T15:00:00-00:00" | ||
def get_resources(self): | ||
"""Returns Ext Resources.""" | ||
exts = [] | ||
plugin = directory.get_plugin() | ||
resource_name = 'encryption' | ||
collection_name = "encryption" | ||
params = RESOURCE_ATTRIBUTE_MAP.get("encryptions", dict()) | ||
resource_registry.register_resource_by_name(resource_name) | ||
controller = base.create_resource(collection_name, | ||
resource_name, | ||
plugin, params, allow_bulk=True, | ||
allow_pagination=True, | ||
allow_sorting=True) | ||
|
||
ex = extensions.ResourceExtension(collection_name, | ||
controller, | ||
attr_map=params) | ||
exts.append(ex) | ||
_LOG.info("TEST: get API resources ") | ||
return exts | ||
|
||
def update_attributes_map(self, attributes): | ||
_LOG.info("TEST3: updating attributes map") | ||
super(Encryption, self).update_attributes_map( | ||
attributes, extension_attrs_map=RESOURCE_ATTRIBUTE_MAP) | ||
def get_extended_resources(self, version): | ||
return {} | ||
def get_required_extensions(self): | ||
return [stdattr_ext.Standardattrdescription.get_alias()] | ||
|
||
|
||
class EncryptionPluginBase: | ||
def get_plugin_type(self): | ||
return 'ENCRYPTION' | ||
def get_plugin_description(self): | ||
return 'Encryption service plugin' |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from neutron_encryption.db import encryption_db | ||
import inspect | ||
from oslo_log import log | ||
_LOG = log.getLogger(__name__) | ||
class EncryptionPlugin(encryption_db.EncryptionPluginDb): | ||
supported_extension_aliases = ["encryption"] | ||
path_prefix = "/encryption" | ||
|
||
|
||
class EncryptionDriverPlugin(EncryptionPlugin): | ||
def __init__(self): | ||
super(EncryptionDriverPlugin,self).__init__() | ||
_LOG.info(f"EncryptionDriverPlugin inheritance tree:\n {inspect.getmro(EncryptionDriverPlugin)}") | ||
def get_plugin_type(self): | ||
return 'ENCRYPTION' | ||
def get_plugin_description(self): | ||
return 'Encryption service plugin' |
Empty file.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters