You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by se...@apache.org on 2013/07/17 10:55:14 UTC
git commit: updated refs/heads/sdnextensions to c341161
Updated Branches:
refs/heads/sdnextensions 2b8389584 -> c34116119
add two tables for gre controller
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c3411611
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c3411611
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c3411611
Branch: refs/heads/sdnextensions
Commit: c341161199dd3a19f44706463945893abf5e911e
Parents: 2b83895
Author: tuna <ng...@gmail.com>
Authored: Wed Jul 17 15:37:38 2013 +0700
Committer: Sebastien Goasguen <ru...@gmail.com>
Committed: Wed Jul 17 04:55:03 2013 -0400
----------------------------------------------------------------------
.../com/cloud/network/ovs/dao/OvsDeviceDao.java | 26 ++++++
.../cloud/network/ovs/dao/OvsDeviceDaoImpl.java | 49 +++++++++++
.../com/cloud/network/ovs/dao/OvsDeviceVO.java | 88 ++++++++++++++++++++
.../cloud/network/ovs/dao/OvsNicMappingDao.java | 24 ++++++
.../network/ovs/dao/OvsNicMappingDaoImpl.java | 47 +++++++++++
.../cloud/network/ovs/dao/OvsNicMappingVO.java | 83 ++++++++++++++++++
6 files changed, 317 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDao.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDao.java
new file mode 100644
index 0000000..794e45e
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDao.java
@@ -0,0 +1,26 @@
+// 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.ovs.dao;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface OvsDeviceDao extends GenericDao<OvsDeviceVO, Long> {
+
+ List<OvsDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDaoImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDaoImpl.java
new file mode 100644
index 0000000..11a4d48
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceDaoImpl.java
@@ -0,0 +1,49 @@
+// 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.ovs.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+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;
+
+@Component
+@Local(value=OvsDeviceDao.class)
+public class OvsDeviceDaoImpl extends GenericDaoBase<OvsDeviceVO, Long> implements OvsDeviceDao {
+
+ protected final SearchBuilder<OvsDeviceVO> physicalNetworkIdSearch;
+
+ public OvsDeviceDaoImpl() {
+ physicalNetworkIdSearch = createSearchBuilder();
+ physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+ physicalNetworkIdSearch.done();
+ }
+
+ @Override
+ public List<OvsDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+ SearchCriteria<OvsDeviceVO> sc = physicalNetworkIdSearch.create();
+ sc.setParameters("physicalNetworkId", physicalNetworkId);
+ return search(sc, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceVO.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceVO.java
new file mode 100644
index 0000000..cab63f6
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsDeviceVO.java
@@ -0,0 +1,88 @@
+// 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.ovs.dao;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="ovs_devices")
+public class OvsDeviceVO implements InternalIdentity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="uuid")
+ private String uuid;
+
+ @Column(name="host_id")
+ private long hostId;
+
+ @Column(name="physical_network_id")
+ private long physicalNetworkId;
+
+ @Column(name="device_name")
+ private String deviceName;
+
+
+ public OvsDeviceVO() {
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public OvsDeviceVO(long hostId, long physicalNetworkId,
+ String deviceName) {
+ super();
+ this.hostId = hostId;
+ this.physicalNetworkId = physicalNetworkId;
+ this.deviceName = deviceName;
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ public long getHostId() {
+ return hostId;
+ }
+
+ public String getDeviceName() {
+ return deviceName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDao.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDao.java
new file mode 100644
index 0000000..b2128eb
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDao.java
@@ -0,0 +1,24 @@
+// 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.ovs.dao;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface OvsNicMappingDao extends GenericDao<OvsNicMappingVO, Long> {
+
+ public OvsNicMappingVO findByNicUuid(String nicUuid);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDaoImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDaoImpl.java
new file mode 100644
index 0000000..87e41b7
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingDaoImpl.java
@@ -0,0 +1,47 @@
+// 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.ovs.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+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;
+
+@Component
+@Local(value=OvsNicMappingDao.class)
+public class OvsNicMappingDaoImpl extends GenericDaoBase<OvsNicMappingVO, Long> implements OvsNicMappingDao{
+
+ protected final SearchBuilder<OvsNicMappingVO> nicSearch;
+
+ public OvsNicMappingDaoImpl() {
+ nicSearch = createSearchBuilder();
+ nicSearch.and("nicUuid", nicSearch.entity().getNicUuid(), Op.EQ);
+ nicSearch.done();
+ }
+
+ @Override
+ public OvsNicMappingVO findByNicUuid(String nicUuid) {
+ SearchCriteria<OvsNicMappingVO> sc = nicSearch.create();
+ sc.setParameters("nicUuid", nicUuid);
+ return findOneBy(sc);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3411611/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingVO.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingVO.java
new file mode 100644
index 0000000..dc4a931
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsNicMappingVO.java
@@ -0,0 +1,83 @@
+// 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.ovs.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;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="ovs_nic_map")
+public class OvsNicMappingVO implements InternalIdentity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="logicalswitch")
+ private String logicalSwitchUuid;
+
+ @Column(name="logicalswitchport")
+ private String logicalSwitchPortUuid;
+
+ @Column(name="nic")
+ private String nicUuid;
+
+ public OvsNicMappingVO() {
+
+ }
+
+ public OvsNicMappingVO (String logicalSwitchUuid, String logicalSwitchPortUuid, String nicUuid) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ this.logicalSwitchPortUuid = logicalSwitchPortUuid;
+ this.nicUuid = nicUuid;
+ }
+
+ public String getLogicalSwitchUuid() {
+ return logicalSwitchUuid;
+ }
+
+ public void setLogicalSwitchUuid(String logicalSwitchUuid) {
+ this.logicalSwitchUuid = logicalSwitchUuid;
+ }
+
+ public String getLogicalSwitchPortUuid() {
+ return logicalSwitchPortUuid;
+ }
+
+ public void setLogicalSwitchPortUuid(String logicalSwitchPortUuid) {
+ this.logicalSwitchPortUuid = logicalSwitchPortUuid;
+ }
+
+ public String getNicUuid() {
+ return nicUuid;
+ }
+
+ public void setNicUuid(String nicUuid) {
+ this.nicUuid = nicUuid;
+ }
+
+ public long getId() {
+ return id;
+ }
+}