You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ka...@apache.org on 2013/06/25 08:33:16 UTC

[2/2] git commit: updated refs/heads/master to 2d6369c

CLOUDSTACK-2756: Stratosphere SSP plugin

Stratosphere SSP is an SDN solution which creates virtual L2
networks backed by vxlan and vlan. SSP will ask hypervisor to set a
specific vlan, then SSP will interact with openflow switches and
put vxlan/vlan translation flow rules.

This plugin provides SSP as "connctivity" service provider.

Signed-off-by: Hiroaki KAWAI <ka...@stratosphere.co.jp>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2d6369c8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2d6369c8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2d6369c8

Branch: refs/heads/master
Commit: 2d6369c826790d4979383a0b1e350b2fd031425d
Parents: ed5697f
Author: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Authored: Tue Jun 25 14:16:29 2013 +0900
Committer: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Committed: Tue Jun 25 15:31:40 2013 +0900

----------------------------------------------------------------------
 api/src/com/cloud/network/PhysicalNetwork.java  |   3 +-
 client/tomcatconf/componentContext.xml.in       |  15 +
 .../network-elements/stratosphere-ssp/pom.xml   |  33 +
 .../src/com/cloud/api/commands/AddSspCmd.java   | 138 +++++
 .../com/cloud/api/commands/DeleteSspCmd.java    |  74 +++
 .../src/com/cloud/api/response/SspResponse.java |  77 +++
 .../com/cloud/network/dao/SspCredentialDao.java |  33 +
 .../cloud/network/dao/SspCredentialDaoImpl.java |  42 ++
 .../com/cloud/network/dao/SspCredentialVO.java  |  67 ++
 .../src/com/cloud/network/dao/SspTenantDao.java |  34 +
 .../com/cloud/network/dao/SspTenantDaoImpl.java |  48 ++
 .../src/com/cloud/network/dao/SspTenantVO.java  |  55 ++
 .../src/com/cloud/network/dao/SspUuidDao.java   |  36 ++
 .../com/cloud/network/dao/SspUuidDaoImpl.java   | 116 ++++
 .../src/com/cloud/network/dao/SspUuidVO.java    |  73 +++
 .../com/cloud/network/element/SspClient.java    | 272 ++++++++
 .../com/cloud/network/element/SspElement.java   | 617 +++++++++++++++++++
 .../com/cloud/network/element/SspManager.java   |  71 +++
 .../com/cloud/network/element/SspService.java   |  46 ++
 .../cloud/network/guru/SspGuestNetworkGuru.java | 171 +++++
 .../stratosphere-ssp/sspmock/sspmock.py         |  68 ++
 .../cloud/network/element/SspClientTest.java    |  92 +++
 .../cloud/network/element/SspElementTest.java   | 152 +++++
 plugins/pom.xml                                 |   1 +
 setup/db/db/schema-410to420.sql                 |  22 +
 ui/scripts/ui-custom/zoneWizard.js              |   7 +-
 26 files changed, 2360 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/api/src/com/cloud/network/PhysicalNetwork.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index c521dc4..f6cb1a6 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -38,7 +38,8 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
         GRE,
         STT,
         VNS,
-        MIDO;
+        MIDO,
+        SSP;
     }
 
     public enum BroadcastDomainRange {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 7563d69..61bca48 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -70,6 +70,19 @@
     <property name="name" value="MidoNetElement"/>
   </bean>
 
+  <!--
+    Stratosphere SSP support components
+  -->
+  <bean id="sspCredentialDaoImpl" class="com.cloud.network.dao.SspCredentialDaoImpl"/>
+  <bean id="sspTenantDaoImpl" class="com.cloud.network.dao.SspTenantDaoImpl"/>
+  <bean id="sspUuidDaoImpl" class="com.cloud.network.dao.SspUuidDaoImpl"/>
+  <bean id="SspGuestNetworkGuru" class="com.cloud.network.guru.SspGuestNetworkGuru">
+    <property name="name" value="SspGuestNetworkGuru"/>
+  </bean>
+  <bean id="StratosphereSsp" class="com.cloud.network.element.SspElement">
+    <property name="name" value="StratosphereSsp"/>
+  </bean>
+
 <!--
 
   Deployment configurations of various adapters
@@ -221,6 +234,7 @@
           <ref bean="PrivateNetworkGuru"/>
           <ref bean="NiciraNvpGuestNetworkGuru"/>
           <ref bean="MidoNetGuestNetworkGuru"/>
+          <ref bean="SspGuestNetworkGuru"/>
       </list>
     </property>
   </bean>
@@ -234,6 +248,7 @@
           <ref bean="VpcVirtualRouter"/>
           <ref bean="NiciraNvp" />
           <ref bean="MidoNetElement"/>
+          <ref bean="StratosphereSsp"/>
           <ref bean="InternalLbVm"/>
           <ref bean="BareMetalDhcp"/>
           <ref bean="BareMetalPxe"/>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/pom.xml b/plugins/network-elements/stratosphere-ssp/pom.xml
new file mode 100644
index 0000000..a8d7ce5
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/pom.xml
@@ -0,0 +1,33 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>jp.co.stratosphere.cloudstack</groupId>
+  <artifactId>cloud-plugin-network-ssp</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache Cloudstack Plugin - Stratosphere SSP</name>
+  <url>http://www.stratosphere.co.jp/</url>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.2.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/AddSspCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/AddSspCmd.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/AddSspCmd.java
new file mode 100644
index 0000000..3034f9b
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/AddSspCmd.java
@@ -0,0 +1,138 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.log4j.Logger;
+
+import com.cloud.api.response.SspResponse;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.host.Host;
+import com.cloud.network.element.SspService;
+import com.cloud.user.UserContext;
+
+
+@APICommand(name="addStratosphereSsp", responseObject=SspResponse.class, description="Adds stratosphere ssp server")
+public class AddSspCmd extends BaseCmd {
+    private static final Logger s_logger = Logger.getLogger(AddSspCmd.class.getName());
+    @Inject
+    SspService _service;
+    @Inject
+    DataCenterDao _dcDao;
+
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
+            required=true, description="the zone ID")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="stratosphere ssp server url")
+    private String url;
+
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=false, description="stratosphere ssp api username")
+    private String username;
+
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=false, description="stratosphere ssp api password")
+    private String password;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="stratosphere ssp api name")
+    private String name; // required because HostVO name field defined as NOT NULL.
+
+    @Parameter(name="tenantuuid", type=CommandType.STRING, required=false, description="stratosphere ssp tenant uuid")
+    private String tenantUuid; // required in creating ssp tenant_network
+
+    @Override
+    public String getCommandName() {
+        return getClass().getAnnotation(APICommand.class).name();
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return UserContext.current().getCaller().getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException,
+    InsufficientCapacityException, ConcurrentOperationException,
+    ResourceAllocationException, NetworkRuleConflictException {
+        s_logger.trace("execute");
+        Host host = _service.addSspHost(this);
+        SspResponse response = new SspResponse();
+        response.setResponseName(getCommandName());
+        response.setObjectName("ssphost");
+        response.setUrl(this.getUrl());
+        response.setZoneId(_dcDao.findById(getZoneId()).getUuid());
+        response.setHostId(host.getUuid());
+        this.setResponseObject(response);
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(Long zoneId) {
+        this.zoneId = zoneId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTenantUuid() {
+        return tenantUuid;
+    }
+
+    public void setTenantUuid(String tenantUuid) {
+        this.tenantUuid = tenantUuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/DeleteSspCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/DeleteSspCmd.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/DeleteSspCmd.java
new file mode 100644
index 0000000..1f3bba6
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/commands/DeleteSspCmd.java
@@ -0,0 +1,74 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.element.SspService;
+import com.cloud.user.UserContext;
+
+@APICommand(name="deleteStratosphereSsp", responseObject=SuccessResponse.class, description="Removes stratosphere ssp server")
+public class DeleteSspCmd extends BaseCmd {
+    private static final Logger s_logger = Logger.getLogger(AddSspCmd.class.getName());
+    @Inject
+    SspService _service;
+
+    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.UUID, entityType=HostResponse.class,
+            required=true, description="the host ID of ssp server")
+    private Long hostId;
+
+    @Override
+    public String getCommandName() {
+        return getClass().getAnnotation(APICommand.class).name();
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return UserContext.current().getCaller().getId();
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException,
+    InsufficientCapacityException, ConcurrentOperationException,
+    ResourceAllocationException, NetworkRuleConflictException {
+        s_logger.trace("execute");
+        SuccessResponse resp = new SuccessResponse();
+        resp.setSuccess(_service.deleteSspHost(this));
+        this.setResponseObject(resp);
+    }
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public void setHostId(Long hostId) {
+        this.hostId = hostId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/response/SspResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/response/SspResponse.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/response/SspResponse.java
new file mode 100644
index 0000000..ac9dee7
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/api/response/SspResponse.java
@@ -0,0 +1,77 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.host.HostVO;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value=HostVO.class)
+public class SspResponse extends BaseResponse {
+    @SerializedName(ApiConstants.HOST_ID)
+    @Param(description="server id of the stratosphere ssp server")
+    private String hostId;
+
+    @SerializedName(ApiConstants.ZONE_ID)
+    @Param(description="zone which this ssp controls")
+    private String zoneId;
+
+    @SerializedName(ApiConstants.URL)
+    @Param(description="url of ssp endpoint")
+    private String url;
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description="name")
+    private String name;
+
+
+    public String getHostId() {
+        return hostId;
+    }
+
+    public void setHostId(String hostId) {
+        this.hostId = hostId;
+    }
+
+    public String getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(String zoneId) {
+        this.zoneId = zoneId;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDao.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDao.java
new file mode 100644
index 0000000..213b817
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDao.java
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface SspCredentialDao extends GenericDao<SspCredentialVO, Long> {
+    /**
+     * Find an ssp credential for a specific cloudstack zone.
+     *
+     * For now, credential is a pair of username and password.
+     * We might want to fetch different pairs for each cloudstack users
+     * in future work.
+     *
+     * @param zoneId zone Id
+     * @return credential object
+     */
+    public SspCredentialVO findByZone(long zoneId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDaoImpl.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDaoImpl.java
new file mode 100644
index 0000000..0206dee
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialDaoImpl.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import javax.ejb.Local;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Local(SspCredentialDao.class)
+public class SspCredentialDaoImpl extends GenericDaoBase<SspCredentialVO, Long> implements SspCredentialDao {
+    private final SearchBuilder<SspCredentialVO> PnetSearch;
+
+    public SspCredentialDaoImpl() {
+        PnetSearch = createSearchBuilder();
+        PnetSearch.and("dataCenterId", PnetSearch.entity().getZoneId(), Op.EQ);
+        PnetSearch.done();
+    }
+
+    @Override
+    public SspCredentialVO findByZone(long zoneId) {
+        SearchCriteria<SspCredentialVO> sc = PnetSearch.create();
+        sc.setParameters("dataCenterId", zoneId);
+        return findOneBy(sc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialVO.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialVO.java
new file mode 100644
index 0000000..9511e84
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspCredentialVO.java
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="external_stratosphere_ssp_credentials")
+public class SspCredentialVO {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="data_center_id")
+    private long dataCenterId; // Actually, this is zoneId
+
+    // XXX: We might want to restrict access to this by cloudstack privileges.
+    @Column(name="username")
+    private String username;
+
+    @Column(name="password")
+    private String password;
+
+    public long getZoneId() {
+        return dataCenterId;
+    }
+
+    public void setZoneId(long zoneId) {
+        this.dataCenterId = zoneId;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDao.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDao.java
new file mode 100644
index 0000000..2a3bfdc
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDao.java
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface SspTenantDao extends GenericDao<SspTenantVO, Long> {
+    /**
+     * Find an ssp tenant uuid for a specific cloudstack zone.
+     *
+     * The ssp tenant uuid will be used in ssp tenant_network creation.
+     * For now, we map ssp tenant to cloudstack zone. Instead, we might
+     * want to map ssp tenant to cloudstack domain, or ssp tenant to
+     * cloudstack project in future.
+     *
+     * @param zoneId zone id
+     * @return tenant uuid string
+     */
+    public String findUuidByZone(long zoneId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDaoImpl.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDaoImpl.java
new file mode 100644
index 0000000..7018ce5
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantDaoImpl.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import javax.ejb.Local;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Local(SspTenantDao.class)
+public class SspTenantDaoImpl extends GenericDaoBase<SspTenantVO, Long>
+        implements SspTenantDao {
+
+    private final SearchBuilder<SspTenantVO> zoneSearch;
+
+    public SspTenantDaoImpl(){
+        zoneSearch = createSearchBuilder();
+        zoneSearch.and("zoneId", zoneSearch.entity().getZoneId(), Op.EQ);
+        zoneSearch.done();
+    }
+
+    @Override
+    public String findUuidByZone(long zoneId) {
+        SearchCriteria<SspTenantVO> sc = zoneSearch.create();
+        sc.setParameters("zoneId", zoneId);
+        SspTenantVO ret = findOneBy(sc);
+        if(ret != null){
+            return ret.getUuid();
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantVO.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantVO.java
new file mode 100644
index 0000000..026d338
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspTenantVO.java
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="external_stratosphere_ssp_tenants")
+public class SspTenantVO {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="zone_id")
+    private long zoneId;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    public long getZoneId() {
+        return zoneId;
+    }
+
+    public void setZoneId(long zoneId) {
+        this.zoneId = zoneId;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDao.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDao.java
new file mode 100644
index 0000000..325ba66
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDao.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.Network;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.vm.NicProfile;
+
+/**
+ * Mapping for SSP UUID and cloudstack entities
+ */
+public interface SspUuidDao extends GenericDao<SspUuidVO, Long> {
+    public String findUuidByNetwork(Network network);
+    public String findUuidByNicProfile(NicProfile nicProfile);
+    public Long findNetworkIdByUuid(String uuid);
+    public Long findNicProfileIdByUuid(String uuid);
+    public int removeUuid(String uuid);
+
+    public List<SspUuidVO> listUUidVoByNicProfile(NicProfile nicProfile);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDaoImpl.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDaoImpl.java
new file mode 100644
index 0000000..85c8491
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidDaoImpl.java
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.network.Network;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.vm.NicProfile;
+
+@Local(SspUuidDao.class)
+public class SspUuidDaoImpl extends GenericDaoBase<SspUuidVO, Long> implements SspUuidDao {
+
+    private static final Logger s_logger = Logger.getLogger(SspUuidDaoImpl.class);
+
+    protected final SearchBuilder<SspUuidVO> native2uuid;
+    protected final SearchBuilder<SspUuidVO> uuid2native;
+    protected final SearchBuilder<SspUuidVO> uuidfetch;
+
+    public SspUuidDaoImpl() {
+        native2uuid = createSearchBuilder();
+        native2uuid.and("obj_class", native2uuid.entity().getObjClass(), Op.EQ);
+        native2uuid.and("obj_id", native2uuid.entity().getObjId(), Op.EQ);
+        native2uuid.done();
+
+        uuid2native = createSearchBuilder();
+        uuid2native.and("obj_class", uuid2native.entity().getObjClass(), Op.EQ);
+        uuid2native.and("uuid", uuid2native.entity().getUuid(), Op.EQ);
+        uuid2native.done();
+
+        uuidfetch = createSearchBuilder();
+        uuidfetch.and("uuid", uuidfetch.entity().getUuid(), Op.EQ);
+        uuidfetch.done();
+    }
+
+    @Override
+    public String findUuidByNetwork(Network network) {
+        SearchCriteria<SspUuidVO> cs = native2uuid.create();
+        cs.setParameters("obj_class", SspUuidVO.objClassNetwork);
+        cs.setParameters("obj_id", network.getId());
+        SspUuidVO vo = findOneBy(cs);
+        if(vo != null){
+            return vo.getUuid();
+        }
+        return null;
+    }
+
+    @Override
+    public String findUuidByNicProfile(NicProfile nicProfile) {
+        SearchCriteria<SspUuidVO> cs = native2uuid.create();
+        cs.setParameters("obj_class", SspUuidVO.objClassNicProfile);
+        cs.setParameters("obj_id", nicProfile.getId());
+        SspUuidVO vo = findOneBy(cs);
+        if(vo != null){
+            return vo.getUuid();
+        }
+        return null;
+    }
+
+    @Override
+    public List<SspUuidVO> listUUidVoByNicProfile(NicProfile nicProfile) {
+        SearchCriteria<SspUuidVO> cs = native2uuid.create();
+        cs.setParameters("obj_class", SspUuidVO.objClassNicProfile);
+        cs.setParameters("obj_id", nicProfile.getId());
+        return listBy(cs);
+    }
+
+    @Override
+    public Long findNetworkIdByUuid(String uuid) {
+        return findByUuid(SspUuidVO.objClassNetwork, uuid);
+    }
+
+    @Override
+    public Long findNicProfileIdByUuid(String uuid) {
+        return findByUuid(SspUuidVO.objClassNicProfile, uuid);
+    }
+
+    private Long findByUuid(String clazz, String uuid){
+        SearchCriteria<SspUuidVO> cs = uuid2native.create();
+        cs.setParameters("obj_class", clazz);
+        cs.setParameters("uuid", uuid);
+        SspUuidVO vo = findOneBy(cs);
+        if(vo != null){
+            return vo.getObjId();
+        }
+        return null;
+    }
+
+
+    public int removeUuid(String uuid){
+        SearchCriteria<SspUuidVO> cs = uuidfetch.create();
+        cs.setParameters("uuid", uuid);
+        return this.remove(cs);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidVO.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidVO.java
new file mode 100644
index 0000000..83c9fea
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/dao/SspUuidVO.java
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.dao;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="external_stratosphere_ssp_uuids")
+public class SspUuidVO {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="obj_class")
+    private String objClass;
+
+    @Column(name="obj_id")
+    private long objId;
+
+    static public final String objClassNetwork = "net";
+    static public final String objClassNicProfile = "nic";
+
+    @Column(name="reservation_id")
+    private String reservationId;
+
+    public String getUuid() {
+        return uuid;
+    }
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+    public String getObjClass() {
+        return objClass;
+    }
+    public void setObjClass(String objClass) {
+        this.objClass = objClass;
+    }
+    public long getObjId() {
+        return objId;
+    }
+    public void setObjId(long objId) {
+        this.objId = objId;
+    }
+    public String getReservationId() {
+        return reservationId;
+    }
+    public void setReservationId(String reservationId) {
+        this.reservationId = reservationId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspClient.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspClient.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspClient.java
new file mode 100644
index 0000000..5c9c003
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspClient.java
@@ -0,0 +1,272 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.element;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.params.HttpClientParams;
+import org.apache.log4j.Logger;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Stratosphere sdn platform api client
+ */
+public class SspClient {
+    private static final Logger s_logger = Logger.getLogger(SspClient.class);
+    private static final HttpConnectionManager s_httpclient_manager = new MultiThreadedHttpConnectionManager();
+    private static final HttpClientParams s_httpclient_params = new HttpClientParams();
+    static {
+        s_httpclient_params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
+    }
+
+    private final String apiUrl;
+    private final String username;
+    private final String password;
+
+    protected HttpClient client;
+    protected PostMethod postMethod;
+    protected DeleteMethod deleteMethod;
+    protected PutMethod putMethod;
+
+    public SspClient(String apiUrl, String username, String password) {
+        super();
+        this.apiUrl = apiUrl;
+        this.username = username;
+        this.password = password;
+        client = new HttpClient(s_httpclient_params, s_httpclient_manager);
+        postMethod = new PostMethod(apiUrl);
+        deleteMethod = new DeleteMethod(apiUrl);
+        putMethod = new PutMethod(apiUrl);
+    }
+
+    public boolean login(){
+        PostMethod method = postMethod;
+        method.setPath("/ws.v1/login"); // NOTE: /ws.v1/login is correct
+        method.addParameter("username", username);
+        method.addParameter("password", password);
+
+        try {
+            client.executeMethod(method);
+        } catch (HttpException e) {
+            s_logger.info("Login "+username+" to "+apiUrl+" failed", e);
+            return false;
+        } catch (IOException e) {
+            s_logger.info("Login "+username+" to "+apiUrl+" failed", e);
+            return false;
+        } finally {
+            method.releaseConnection();
+        }
+        String apiCallPath = null;
+        try {
+            apiCallPath = method.getName() + " " + method.getURI().toString();
+        } catch (URIException e) {
+            s_logger.error("method getURI failed", e);
+        }
+        s_logger.info("ssp api call:" + apiCallPath + " user="+username+" status="+method.getStatusLine());
+        if(method.getStatusCode() == HttpStatus.SC_OK){
+            return true;
+        }
+        return false;
+    }
+
+    private String executeMethod(HttpMethod method){
+        String apiCallPath = null;
+        try {
+            apiCallPath = method.getName() + " " + method.getURI().toString();
+        } catch (URIException e) {
+            s_logger.error("method getURI failed", e);
+        }
+
+        String response = null;
+        try {
+            client.executeMethod(method);
+            response = method.getResponseBodyAsString();
+        } catch (HttpException e) {
+            s_logger.error("ssp api call failed "+apiCallPath, e);
+            return null;
+        } catch (IOException e) {
+            s_logger.error("ssp api call failed "+apiCallPath, e);
+            return null;
+        } finally {
+            method.releaseConnection();
+        }
+
+        if(method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED){
+            if(!login()){
+                return null;
+            }
+
+            try {
+                client.executeMethod(method);
+                response = method.getResponseBodyAsString();
+            } catch (HttpException e) {
+                s_logger.error("ssp api call failed "+apiCallPath, e);
+                return null;
+            } catch (IOException e) {
+                s_logger.error("ssp api call failed "+apiCallPath, e);
+                return null;
+            } finally {
+                method.releaseConnection();
+            }
+        }
+        s_logger.info("ssp api call:" + apiCallPath + " user="+username+" status="+method.getStatusLine());
+        if(method instanceof EntityEnclosingMethod){
+            EntityEnclosingMethod emethod = (EntityEnclosingMethod)method;
+            RequestEntity reqEntity = emethod.getRequestEntity();
+            if(reqEntity instanceof StringRequestEntity){
+                StringRequestEntity strReqEntity = (StringRequestEntity)reqEntity;
+                s_logger.debug("ssp api request body:"+strReqEntity.getContent());
+            }else{
+                s_logger.debug("ssp api request body:"+emethod.getRequestEntity());
+            }
+        }
+        s_logger.debug("ssp api response body:" + response);
+        return response;
+    }
+
+    public class TenantNetwork {
+        public String uuid;
+        public String name;
+        @SerializedName("tenant_uuid")
+        public String tenantUuid;
+    }
+
+    public TenantNetwork createTenantNetwork(String tenantUuid, String networkName){
+        TenantNetwork req = new TenantNetwork();
+        req.name = networkName;
+        req.tenantUuid = tenantUuid;
+
+        PostMethod method = postMethod;
+        method.setPath("/ssp.v1/tenant-networks");
+        StringRequestEntity entity = null;
+        try {
+            entity = new StringRequestEntity(new Gson().toJson(req), "application/json", "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            s_logger.error("failed creating http request body", e);
+            return null;
+        }
+        method.setRequestEntity(entity);
+
+        String response = executeMethod(method);
+        if(response != null && method.getStatusCode() == HttpStatus.SC_CREATED){
+            return new Gson().fromJson(response, TenantNetwork.class);
+        }
+        return null;
+    }
+
+    public boolean deleteTenantNetwork(String tenantNetworkUuid){
+        DeleteMethod method = deleteMethod;
+        method.setPath("/ssp.v1/tenant-networks/"+tenantNetworkUuid);
+
+        executeMethod(method);
+        if(method.getStatusCode() == HttpStatus.SC_NO_CONTENT){
+            return true;
+        }
+        return false;
+    }
+
+    public class TenantPort {
+        public String uuid;
+        public String name;
+        @SerializedName("network_uuid")
+        public String networkUuid;
+        @SerializedName("attachment_type")
+        public String attachmentType;
+        @SerializedName("attachment_ip_address")
+        public String hypervisorIpAddress;
+        @SerializedName("vlan_id")
+        public Integer vlanId;
+    }
+
+    public TenantPort createTenantPort(String tenantNetworkUuid){
+        TenantPort req = new TenantPort();
+        req.networkUuid = tenantNetworkUuid;
+        req.attachmentType = "NoAttachment";
+
+        PostMethod method = postMethod;
+        method.setPath("/ssp.v1/tenant-ports");
+        StringRequestEntity entity = null;
+        try {
+            entity = new StringRequestEntity(new Gson().toJson(req), "application/json", "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            s_logger.error("failed creating http request body", e);
+            return null;
+        }
+        method.setRequestEntity(entity);
+
+        String response = executeMethod(method);
+        if(response != null && method.getStatusCode() == HttpStatus.SC_CREATED){
+            return new Gson().fromJson(response, TenantPort.class);
+        }
+        return null;
+    }
+
+    public boolean deleteTenantPort(String tenantPortUuid){
+        DeleteMethod method = deleteMethod;
+        method.setPath("/ssp.v1/tenant-ports/"+tenantPortUuid);
+
+        executeMethod(method);
+        if(method.getStatusCode() == HttpStatus.SC_NO_CONTENT){
+            return true;
+        }
+        return false;
+    }
+
+    public TenantPort updateTenantVifBinding(String portUuid, String hypervisorIpAddress){
+        TenantPort req = new TenantPort();
+        if(hypervisorIpAddress != null){
+            req.attachmentType = "VifAttachment";
+            req.hypervisorIpAddress = hypervisorIpAddress;
+        }else{
+            req.attachmentType = "NoAttachment";
+        }
+
+        PutMethod method = putMethod;
+        method.setPath("/ssp.v1/tenant-ports/"+portUuid);
+        StringRequestEntity entity = null;
+        try {
+            entity = new StringRequestEntity(new Gson().toJson(req), "application/json", "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            s_logger.error("failed creating http request body", e);
+            return null;
+        }
+        method.setRequestEntity(entity);
+
+        String response = executeMethod(method);
+        if(response != null && method.getStatusCode() == HttpStatus.SC_OK){
+            return new Gson().fromJson(response, TenantPort.class);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspElement.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspElement.java
new file mode 100644
index 0000000..016ae14
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspElement.java
@@ -0,0 +1,617 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.element;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.commands.AddSspCmd;
+import com.cloud.api.commands.DeleteSspCmd;
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.deploy.DeployDestination;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.network.Network;
+import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.NetworkManager;
+import com.cloud.network.NetworkMigrationResponder;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PhysicalNetworkServiceProvider.State;
+import com.cloud.network.dao.NetworkServiceMapDao;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
+import com.cloud.network.dao.SspCredentialDao;
+import com.cloud.network.dao.SspCredentialVO;
+import com.cloud.network.dao.SspTenantDao;
+import com.cloud.network.dao.SspTenantVO;
+import com.cloud.network.dao.SspUuidDao;
+import com.cloud.network.dao.SspUuidVO;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.resource.ResourceManager;
+
+/**
+ * Stratosphere sdn platform network element
+ *
+ * This class will be called per network setup operations.
+ * This class also have ssp specific methods.
+ *
+ * Current implementation use HostVO for storage of api endpoint information,
+ * but note this is not necessary. The other way is create our own database
+ * table for that information.
+ */
+@Local(value={NetworkElement.class, SspManager.class})
+public class SspElement extends AdapterBase implements ConnectivityProvider, SspManager, SspService, NetworkMigrationResponder {
+    private static final Logger s_logger = Logger.getLogger(SspElement.class);
+    public static final String s_SSP_NAME = "StratosphereSsp";
+
+    @Inject
+    NetworkServiceMapDao _ntwkSrvcDao;
+    @Inject
+    NetworkModel _networkModel;
+    @Inject
+    NetworkManager _networkMgr;
+    @Inject
+    ResourceManager _resourceMgr;
+    @Inject
+    PhysicalNetworkDao _physicalNetworkDao;
+    @Inject
+    PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
+    @Inject
+    SspCredentialDao _sspCredentialDao;
+    @Inject
+    SspTenantDao _sspTenantDao;
+    @Inject
+    SspUuidDao _sspUuidDao;
+    @Inject
+    DataCenterDao _dcDao;
+    @Inject
+    HostDao _hostDao;
+    @Inject
+    ConfigurationDao _configDao;
+    @Inject
+    NicDao _nicDao = null;
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params)
+            throws ConfigurationException {
+        return super.configure(name, params);
+    }
+
+    @Override
+    public Map<Service, Map<Capability, String>> getCapabilities() {
+        Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
+        capabilities.put(Service.Connectivity, new HashMap<Capability,String>()); // XXX: We might need some more category here.
+        return capabilities;
+    }
+
+    @Override
+    public Provider getProvider() {
+        Provider provider = null;
+        synchronized(s_SSP_NAME){
+            provider = Provider.getProvider(s_SSP_NAME);
+            if(provider==null){
+                provider = new Provider(s_SSP_NAME, true);
+                s_logger.debug("registering Network.Provider "+s_SSP_NAME);
+            }
+        }
+        return provider;
+    }
+
+    private List<SspClient> fetchSspClients(Long physicalNetworkId, Long dataCenterId, boolean enabled_only){
+        ArrayList<SspClient> clients = new ArrayList<SspClient>();
+
+        boolean provider_found = false;
+        PhysicalNetworkServiceProviderVO provider = _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetworkId, s_SSP_NAME);
+        if(enabled_only){
+            if(provider != null && provider.getState() == State.Enabled){
+                provider_found = true;
+            }
+        }else{
+            provider_found = true;
+        }
+
+        if(physicalNetworkId != null && provider_found){
+            SspCredentialVO credential = _sspCredentialDao.findByZone(dataCenterId);
+            List<HostVO> hosts = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.L2Networking, dataCenterId);
+            for(HostVO host : hosts){
+                assert(credential != null);
+                _hostDao.loadDetails(host);
+                if("v1Api".equals(host.getDetail("sspHost"))){
+                    clients.add(new SspClient(host.getDetail("url"), credential.getUsername(), credential.getPassword()));
+                }
+            }
+        }
+        if(clients.size()==0){
+            String global_apiUrl = _configDao.getValueAndInitIfNotExist("ssp.url", "Network", null);
+            String global_username = _configDao.getValueAndInitIfNotExist("ssp.username", "Network", null);
+            String global_password = _configDao.getValueAndInitIfNotExist("ssp.password", "Network", null);
+            if(global_apiUrl != null && global_username != null && global_password != null){
+                clients.add(new SspClient(global_apiUrl, global_username, global_password));
+            }
+        }
+        return clients;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.element.NetworkElement#isReady(com.cloud.network.PhysicalNetworkServiceProvider)
+     */
+    @Override
+    public boolean isReady(PhysicalNetworkServiceProvider provider) {
+        PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(provider.getPhysicalNetworkId());
+        assert(physicalNetwork!=null);
+        if(physicalNetwork != null){
+            if(fetchSspClients(physicalNetwork.getId(), physicalNetwork.getDataCenterId(), false).size() > 0){
+                return true;
+            }
+            s_logger.warn("Ssp api endpoint not found. "+physicalNetwork.toString());
+        }else{
+            s_logger.warn("PhysicalNetwork is NULL.");
+        }
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * If this element is ready, then it can be enabled.
+     * @see com.cloud.network.element.SspManager#isEnabled(com.cloud.network.PhysicalNetwork)
+     */
+    @Override
+    public boolean canHandle(PhysicalNetwork physicalNetwork){
+        if(physicalNetwork != null){
+            if(fetchSspClients(physicalNetwork.getId(), physicalNetwork.getDataCenterId(), true).size() > 0){
+                return true;
+            }
+            s_logger.warn("enabled Ssp api endpoint not found. "+physicalNetwork.toString());
+        }else{
+            s_logger.warn("PhysicalNetwork is NULL.");
+        }
+        return false;
+    }
+
+    private boolean canHandle(Network network){
+        if(canHandle(_physicalNetworkDao.findById(network.getPhysicalNetworkId()))){
+            if(!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), Service.Connectivity, getProvider())){
+                s_logger.info("SSP is implicitly active for "+network);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Host addSspHost(AddSspCmd cmd) {
+        SspClient client = new SspClient(cmd.getUrl(), cmd.getUsername(), cmd.getPassword());
+        if(!client.login()){
+            throw new CloudRuntimeException("Ssp login failed.");
+        }
+
+        long zoneId = cmd.getZoneId();
+        SspCredentialVO credential = _sspCredentialDao.findByZone(zoneId);
+        if(credential==null){
+            if(cmd.getUsername()==null || cmd.getPassword()==null){
+                throw new InvalidParameterValueException("Initial credential required for zone: " + zoneId);
+            }
+            credential = new SspCredentialVO();
+            credential.setZoneId(zoneId);
+            credential.setUsername(cmd.getUsername());
+            credential.setPassword(cmd.getPassword());
+            _sspCredentialDao.persist(credential);
+        }else{
+            if(cmd.getUsername()!=null || cmd.getPassword()!=null){
+                s_logger.warn("Tenant credential already configured for zone:"+zoneId);
+            }
+        }
+
+        String tenantUuid = _sspTenantDao.findUuidByZone(zoneId);
+        if(tenantUuid==null){
+            if(cmd.getTenantUuid()==null){
+                throw new InvalidParameterValueException("Initial tenant uuid required for zone: " + zoneId);
+            }
+            SspTenantVO tenant = new SspTenantVO();
+            tenant.setZoneId(zoneId);
+            tenant.setUuid(cmd.getTenantUuid());
+            _sspTenantDao.persist(tenant);
+        }else{
+            if(cmd.getTenantUuid()!=null){
+                s_logger.warn("Tenant uuid already configured for zone:"+zoneId);
+            }
+        }
+
+        String normalizedUrl = null;
+        String hostname = null;
+        try {
+            URL url = new URL(cmd.getUrl());
+            normalizedUrl = url.toString();
+            hostname = url.getHost();
+        } catch (MalformedURLException e1) {
+            throw new CloudRuntimeException("Invalid url "+cmd.getUrl());
+        }
+
+        List<HostVO> hosts = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.L2Networking, zoneId);
+        for(HostVO host : hosts){
+            assert(credential != null);
+            _hostDao.loadDetails(host);
+            if("v1Api".equals(host.getDetail("sspHost"))){
+                if(normalizedUrl.equals(host.getDetail("url"))){
+                    s_logger.warn("Ssp host already registered "+normalizedUrl);
+                    return host;
+                }
+            }
+        }
+        // SspHost HostVO will be created per zone and url.
+        HostVO host = new HostVO(UUID.randomUUID().toString());
+        host.setDataCenterId(zoneId);
+        host.setType(Host.Type.L2Networking);
+        host.setPrivateIpAddress(hostname); // db schema not null. It may be a name, not IP address.
+        //        host.setPrivateMacAddress(""); // db schema nullable
+        //        host.setPrivateNetmask(""); // db schema nullable
+        host.setVersion("1"); // strange db schema not null
+        host.setName(cmd.getName());
+
+        host.setDetails(new HashMap<String, String>());
+        host.setDetail("sspHost", "v1Api");
+        host.setDetail("url", normalizedUrl);
+        return _hostDao.persist(host);
+    }
+
+    @Override
+    public boolean deleteSspHost(DeleteSspCmd cmd) {
+        s_logger.info("deleteStratosphereSsp");
+        return _hostDao.remove(cmd.getHostId());
+    }
+
+    public boolean createNetwork(Network network, NetworkOffering offering,
+            DeployDestination dest, ReservationContext context){
+        if(_sspUuidDao.findUuidByNetwork(network) != null){
+            s_logger.info("Network already has ssp TenantNetwork uuid :"+network.toString());
+            return true;
+        }
+        if(!canHandle(network)){
+            return false;
+        }
+
+        String tenantUuid = _sspTenantDao.findUuidByZone(network.getDataCenterId());
+        if(tenantUuid==null){
+            tenantUuid = _configDao.getValueAndInitIfNotExist("ssp.tenant", "Network", null);
+        }
+
+        boolean processed = false;
+        for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+            SspClient.TenantNetwork sspNet = client.createTenantNetwork(tenantUuid, network.getName());
+            if(sspNet != null){
+                SspUuidVO uuid = new SspUuidVO();
+                uuid.setUuid(sspNet.uuid);
+                uuid.setObjClass(SspUuidVO.objClassNetwork);
+                uuid.setObjId(network.getId());
+                _sspUuidDao.persist(uuid);
+                return true;
+            }
+            processed = true;
+        }
+        if(processed){
+            s_logger.error("Could not allocate an uuid for network "+network.toString());
+            return false;
+        }else{
+            s_logger.error("Skipping #createNetwork() for "+network.toString());
+            return true;
+        }
+    }
+
+    public boolean deleteNetwork(Network network){
+        String tenantNetworkUuid = _sspUuidDao.findUuidByNetwork(network);
+        if(tenantNetworkUuid != null){
+            boolean processed = false;
+            for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+                if(client.deleteTenantNetwork(tenantNetworkUuid)){
+                    _sspUuidDao.removeUuid(tenantNetworkUuid);
+                    processed = true;
+                    break;
+                }
+            }
+            if(!processed){
+                s_logger.error("Ssp api tenant network deletion failed "+network.toString());
+            }
+        }else{
+            s_logger.debug("Silently skipping #deleteNetwork() for "+network.toString());
+        }
+        return true;
+    }
+
+    // we use context.reservationId for dedup of guru & element operations.
+    public boolean createNicEnv(Network network, NicProfile nic, DeployDestination dest, ReservationContext context){
+        String tenantNetworkUuid = _sspUuidDao.findUuidByNetwork(network);
+        if(tenantNetworkUuid == null){
+            s_logger.debug("Skipping #createNicEnv() for nic on "+network.toString());
+            return true;
+        }
+
+        String reservationId = context.getReservationId();
+        List<SspUuidVO> tenantPortUuidVos = _sspUuidDao.listUUidVoByNicProfile(nic);
+        for(SspUuidVO tenantPortUuidVo : tenantPortUuidVos){
+            if(reservationId.equals(tenantPortUuidVo.getReservationId())){
+                s_logger.info("Skipping because reservation found "+reservationId);
+                return true;
+            }
+        }
+
+        String tenantPortUuid = null;
+        for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+            SspClient.TenantPort sspPort = client.createTenantPort(tenantNetworkUuid);
+            if(sspPort != null){
+                tenantPortUuid = sspPort.uuid;
+                nic.setReservationId(reservationId);
+
+                SspUuidVO uuid = new SspUuidVO();
+                uuid.setUuid(tenantPortUuid);
+                uuid.setObjClass(SspUuidVO.objClassNicProfile);
+                uuid.setObjId(nic.getId());
+                uuid.setReservationId(reservationId);
+                _sspUuidDao.persist(uuid);
+                break;
+            }
+        }
+        if(tenantPortUuid == null){
+            s_logger.debug("#createNicEnv() failed for nic on "+network.toString());
+            return false;
+        }
+
+        for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+            SspClient.TenantPort sspPort = client.updateTenantVifBinding(tenantPortUuid, dest.getHost().getPrivateIpAddress());
+            if(sspPort != null){
+                if(sspPort.vlanId != null){
+                    nic.setBroadcastType(BroadcastDomainType.Vlan);
+                    nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(String.valueOf(sspPort.vlanId)));
+                }
+                return true;
+            }
+        }
+        s_logger.error("Updating vif failed "+nic.toString());
+        return false;
+    }
+
+    public boolean deleteNicEnv(Network network, NicProfile nic, ReservationContext context){
+        if(context==null){
+            s_logger.error("ReservationContext was null for "+nic+" "+network);
+            return false;
+        }
+        String reservationId = context.getReservationId();
+
+        SspUuidVO deleteTarget = null;
+        SspUuidVO remainingTarget = null;
+        List<SspUuidVO> tenantPortUuidVos = _sspUuidDao.listUUidVoByNicProfile(nic);
+        for(SspUuidVO tenantPortUuidVo : tenantPortUuidVos){
+            if(reservationId.equals(tenantPortUuidVo.getReservationId())){
+                deleteTarget = tenantPortUuidVo;
+            }else{
+                remainingTarget = tenantPortUuidVo;
+            }
+        }
+
+        if(deleteTarget != null){ // delete the target ssp uuid (tenant-port)
+            String tenantPortUuid = deleteTarget.getUuid();
+            boolean processed = false;
+            for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+                SspClient.TenantPort sspPort = client.updateTenantVifBinding(tenantPortUuid, null);
+                if(sspPort != null){
+                    processed = true;
+                    break;
+                }
+            }
+            if(!processed){
+                s_logger.warn("Ssp api nic detach failed "+nic.toString());
+            }
+            processed = false;
+            for(SspClient client : fetchSspClients(network.getPhysicalNetworkId(), network.getDataCenterId(), true)){
+                if(client.deleteTenantPort(tenantPortUuid)){
+                    _sspUuidDao.removeUuid(tenantPortUuid);
+                    processed = true;
+                    break;
+                }
+            }
+            if(!processed){
+                s_logger.warn("Ssp api tenant port deletion failed "+nic.toString());
+            }
+            _sspUuidDao.removeUuid(tenantPortUuid);
+        }
+        if(remainingTarget != null){
+            NicVO nicVo = _nicDao.findById(nic.getId());
+            nicVo.setReservationId(remainingTarget.getReservationId());
+            _nicDao.persist(nicVo); // persist the new reservationId
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * Implements a network using ssp element.
+     *
+     * This method will be called right after NetworkGuru#implement().
+     * see also {@link #shutdown(Network, ReservationContext, boolean)}
+     * @see com.cloud.network.element.NetworkElement#implement(com.cloud.network.Network, com.cloud.offering.NetworkOffering, com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext)
+     */
+    @Override
+    public boolean implement(Network network, NetworkOffering offering,
+            DeployDestination dest, ReservationContext context)
+                    throws ConcurrentOperationException, ResourceUnavailableException,
+                    InsufficientCapacityException {
+        s_logger.info("implement");
+        return createNetwork(network, offering, dest, context);
+    }
+
+    /* (non-Javadoc)
+     * Shutdown the network implementation
+     *
+     * This method will be called right BEFORE NetworkGuru#shutdown().
+     * The entities was acquired by {@link #implement(Network, NetworkOffering, DeployDestination, ReservationContext)}
+     * @see com.cloud.network.element.NetworkElement#shutdown(com.cloud.network.Network, com.cloud.vm.ReservationContext, boolean)
+     */
+    @Override
+    public boolean shutdown(Network network, ReservationContext context,
+            boolean cleanup) throws ConcurrentOperationException,
+            ResourceUnavailableException {
+        s_logger.trace("shutdown");
+        return deleteNetwork(network);
+    }
+
+    /* (non-Javadoc)
+     * Prepares a network environment for a VM nic.
+     *
+     * This method will be called right after NetworkGuru#reserve().
+     * The entities will be released by {@link #release(Network, NicProfile, VirtualMachineProfile, ReservationContext)}
+     * @see com.cloud.network.element.NetworkElement#prepare(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination, com.cloud.vm.ReservationContext)
+     */
+    @Override
+    public boolean prepare(Network network, NicProfile nic,
+            VirtualMachineProfile<? extends VirtualMachine> vm,
+            DeployDestination dest, ReservationContext context)
+                    throws ConcurrentOperationException, ResourceUnavailableException,
+                    InsufficientCapacityException {
+        s_logger.trace("prepare");
+        return createNicEnv(network, nic, dest, context);
+    }
+
+    /* (non-Javadoc)
+     * Release the network environment that was prepared for a VM nic.
+     *
+     * This method will be called right AFTER NetworkGuru#release().
+     * The entities was acquired in {@link #prepare(Network, NicProfile, VirtualMachineProfile, DeployDestination, ReservationContext)}
+     * @see com.cloud.network.element.NetworkElement#release(com.cloud.network.Network, com.cloud.vm.NicProfile, com.cloud.vm.VirtualMachineProfile, com.cloud.vm.ReservationContext)
+     */
+    @Override
+    public boolean release(Network network, NicProfile nic,
+            VirtualMachineProfile<? extends VirtualMachine> vm,
+            ReservationContext context) throws ConcurrentOperationException,
+            ResourceUnavailableException {
+        s_logger.trace("release");
+        return deleteNicEnv(network, nic, context);
+    }
+
+    /* (non-Javadoc)
+     * Destroy a network implementation.
+     *
+     * This method will be called right BEFORE NetworkGuru#trash() in "Expunge" phase.
+     * @see com.cloud.network.element.NetworkElement#destroy(com.cloud.network.Network)
+     */
+    @Override
+    public boolean destroy(Network network, ReservationContext context)
+            throws ConcurrentOperationException, ResourceUnavailableException {
+        s_logger.trace("destroy");
+        // nothing to do here.
+        return true;
+    }
+
+    @Override
+    public boolean shutdownProviderInstances(
+            PhysicalNetworkServiceProvider provider, ReservationContext context)
+                    throws ConcurrentOperationException, ResourceUnavailableException {
+        s_logger.trace("shutdownProviderInstances");
+        return true;
+    }
+
+    @Override
+    public boolean canEnableIndividualServices() {
+        s_logger.trace("canEnableIndividualServices");
+        return true; // because there is only Connectivity
+    }
+
+    @Override
+    public boolean verifyServicesCombination(Set<Service> services) {
+        s_logger.trace("verifyServicesCombination "+services.toString());
+        return true;
+    }
+
+    @Override
+    public boolean prepareMigration(NicProfile nic, Network network,
+            VirtualMachineProfile<? extends VirtualMachine> vm,
+            DeployDestination dest, ReservationContext context) {
+        try {
+            prepare(network, nic, vm, dest, context);
+        } catch (ConcurrentOperationException e) {
+            s_logger.error("prepareForMigration failed.", e);
+            return false;
+        } catch (ResourceUnavailableException e) {
+            s_logger.error("prepareForMigration failed.", e);
+            return false;
+        } catch (InsufficientCapacityException e) {
+            s_logger.error("prepareForMigration failed.", e);
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void rollbackMigration(NicProfile nic, Network network,
+            VirtualMachineProfile<? extends VirtualMachine> vm,
+            ReservationContext src, ReservationContext dst) {
+        try {
+            release(network, nic, vm, dst);
+        } catch (ConcurrentOperationException e) {
+            s_logger.error("rollbackMigration failed.", e);
+        } catch (ResourceUnavailableException e) {
+            s_logger.error("rollbackMigration failed.", e);
+        }
+    }
+
+    @Override
+    public void commitMigration(NicProfile nic, Network network,
+            VirtualMachineProfile<? extends VirtualMachine> vm,
+            ReservationContext src, ReservationContext dst) {
+        try {
+            release(network, nic, vm, src);
+        } catch (ConcurrentOperationException e) {
+            s_logger.error("commitMigration failed.", e);
+        } catch (ResourceUnavailableException e) {
+            s_logger.error("commitMigration failed.", e);
+        }
+    }
+
+    @Override
+    public List<Class<?>> getCommands() {
+        return Arrays.<Class<?>>asList(AddSspCmd.class, DeleteSspCmd.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspManager.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspManager.java
new file mode 100644
index 0000000..ab8b1b2
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspManager.java
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.element;
+
+import com.cloud.deploy.DeployDestination;
+import com.cloud.network.Network;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.utils.component.Manager;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.ReservationContext;
+
+public interface SspManager extends Manager {
+    /**
+     * Checks Ssp is activated or not
+     * @param physicalNetwork
+     * @return true if physicalNetworkProvider is configured
+     */
+    public boolean canHandle(PhysicalNetwork physicalNetwork);
+
+    /**
+     * Tell ssp to create a network
+     * @param network
+     * @param offering
+     * @param dest
+     * @param context
+     * @return
+     */
+    public boolean createNetwork(Network network, NetworkOffering offering,
+            DeployDestination dest, ReservationContext context);
+
+    /**
+     * Tell ssp to delete a network
+     * @param network
+     * @return
+     */
+    public boolean deleteNetwork(Network network);
+
+    /**
+     * Create a nic entry in ssp
+     * @param network
+     * @param nic
+     * @param dest
+     * @param context
+     * @return true on success
+     */
+    public boolean createNicEnv(Network network, NicProfile nic, DeployDestination dest, ReservationContext context);
+
+    /**
+     * Delete a nic entry from ssp
+     * @param network
+     * @param nic
+     * @param context
+     * @return
+     */
+    public boolean deleteNicEnv(Network network, NicProfile nic, ReservationContext context);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2d6369c8/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspService.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspService.java b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspService.java
new file mode 100644
index 0000000..a5f62cb
--- /dev/null
+++ b/plugins/network-elements/stratosphere-ssp/src/com/cloud/network/element/SspService.java
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.element;
+
+import com.cloud.api.commands.AddSspCmd;
+import com.cloud.api.commands.DeleteSspCmd;
+import com.cloud.host.Host;
+import com.cloud.utils.component.PluggableService;
+
+/**
+ * Stratosphere sdn platform plugin service.
+ */
+public interface SspService extends PluggableService {
+    /**
+     * Add an ssp api endpoint information as an host
+     *
+     * Adds a api endpoint information in database and
+     * make it usable.
+     * @param cmd
+     * @return
+     */
+    public Host addSspHost(AddSspCmd cmd);
+
+    /**
+     * Delete an ssp api endpoint information
+     *
+     * Deletes the information from database.
+     * @param cmd
+     * @return
+     */
+    public boolean deleteSspHost(DeleteSspCmd cmd);
+}