From 5af79e6b2b820a9dbbe4dc3a3d63ebae3422b0c4 Mon Sep 17 00:00:00 2001 From: Benjamin Weder Date: Sat, 18 Nov 2023 14:25:12 +0100 Subject: [PATCH] Open SSH port (#44) * Add functionality to open ports in OpenStack IA * Open SSh port as default --- .../files/OpenStack_CloudProviderInterface.war | 4 ++-- .../OpenStackCloudProviderInterfaceEndpoint.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/files/OpenStack_CloudProviderInterface.war b/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/files/OpenStack_CloudProviderInterface.war index e534e5d..ddf6ae7 100644 --- a/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/files/OpenStack_CloudProviderInterface.war +++ b/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/files/OpenStack_CloudProviderInterface.war @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b4fffd6c8bb816ca186d2e10f991fa48014de1ff88f9f87b9c0448f1b234f2c -size 34360551 +oid sha256:406d46e7c4b0c44e74f87cd873730355bee70ec0ec9013b3dfe9eecb82e4f86d +size 34360571 diff --git a/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/source/src/main/java/org/opentosca/artifacttemplates/openstack/OpenStackCloudProviderInterfaceEndpoint.java b/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/source/src/main/java/org/opentosca/artifacttemplates/openstack/OpenStackCloudProviderInterfaceEndpoint.java index c88d99f..f8a1b64 100644 --- a/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/source/src/main/java/org/opentosca/artifacttemplates/openstack/OpenStackCloudProviderInterfaceEndpoint.java +++ b/artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/OpenStack_CloudProviderInterfaceIA-w2/source/src/main/java/org/opentosca/artifacttemplates/openstack/OpenStackCloudProviderInterfaceEndpoint.java @@ -167,9 +167,13 @@ public void createVM(@RequestPayload CreateVMRequest request, MessageContext mes logger.info("Created new security group with name: {}", securityGroup); // open ports within security group - String[] ports = request.getVMOpenPorts().split(","); - logger.info("Opening {} ports...", ports.length); - for (String port :ports){ + List ports = Arrays.asList(request.getVMOpenPorts().split(",")); + if (ports.contains("22")){ + // add SSH port if not defined + ports.add("22"); + } + logger.info("Opening {} ports...", ports.size()); + for (String port : ports){ logger.info("Opening port: {}", port); osClient.compute().securityGroups() .createRule(Builders.secGroupRule()