summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-01-23 16:12:29 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-01-23 16:12:30 -0500
commit37d5db7675da4d70b0adcf9cc7f7091fdeabb47f (patch)
treead81742a3d475fac38a45f79a9a3b136aacd7273 /adapters/mso-adapter-utils
parent8d77d8544d88dfb91e9287b1620212cc9821bd54 (diff)
Add Neutron Port and Nova Server to Proxy
Add Neutron Port and Nova Server to Proxy Issue-ID: SO-2614 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I09e0302bbdb66dadae3dbac7bbf07a64dfc39d10
Diffstat (limited to 'adapters/mso-adapter-utils')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java27
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java12
2 files changed, 39 insertions, 0 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
index 938a888bbd..8f9dbd1f5a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
@@ -29,6 +29,7 @@ import org.springframework.stereotype.Component;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.quantum.Quantum;
import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Port;
import com.woorea.openstack.quantum.model.Subnets;
@@ -110,4 +111,30 @@ public class NeutronClientImpl extends MsoCommonUtils {
}
}
+ /**
+ * Query Networks
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @param name of the subnet
+ * @param id of the subnet
+ * @return the list of subnets in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public Port queryPortById(String cloudSiteId, String tenantId, String id)
+ throws MsoCloudSiteNotFound, NeutronClientException {
+ try {
+ Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
+ OpenStackRequest<Port> request = neutronClient.ports().show(id);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Neutron Client", e);
+ throw new NeutronClientException("Error building Neutron Client", e);
+ }
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
index 99e8b589b1..7f0f6e4a8b 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
@@ -33,6 +33,7 @@ import com.woorea.openstack.nova.model.Flavors;
import com.woorea.openstack.nova.model.HostAggregate;
import com.woorea.openstack.nova.model.HostAggregates;
import com.woorea.openstack.nova.model.QuotaSet;
+import com.woorea.openstack.nova.model.Server;
@Component
@@ -204,4 +205,15 @@ public class NovaClientImpl extends MsoCommonUtils {
throw new NovaClientException("Error building Nova Client", e);
}
}
+
+ public Server queryServerById(String cloudSiteId, String tenantId, String id) throws NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Server> request = novaClient.servers().show(id);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
}