HIGUCHI Yuta | 2d01158 | 2013-06-15 01:47:11 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.core.internal; |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 2 | |
Pankaj Berde | 6debb04 | 2013-01-16 18:04:32 -0800 | [diff] [blame] | 3 | import java.util.ArrayList; |
Jonathan Hart | b7e3d2c | 2013-01-15 18:45:19 -0800 | [diff] [blame] | 4 | import java.util.List; |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 5 | |
Jonathan Hart | b7e3d2c | 2013-01-15 18:45:19 -0800 | [diff] [blame] | 6 | import net.floodlightcontroller.routing.Link; |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 7 | import net.onrc.onos.graph.DBOperation; |
HIGUCHI Yuta | 2d01158 | 2013-06-15 01:47:11 -0700 | [diff] [blame] | 8 | import net.onrc.onos.ofcontroller.core.ILinkStorage; |
pingping-lin | 0092603 | 2013-12-18 12:13:08 +0800 | [diff] [blame] | 9 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject; |
HIGUCHI Yuta | 2051490 | 2013-06-12 11:24:16 -0700 | [diff] [blame] | 10 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject; |
| 11 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject; |
HIGUCHI Yuta | a56fbde | 2013-06-17 14:26:05 -0700 | [diff] [blame] | 12 | import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo; |
Jonathan Hart | b7e3d2c | 2013-01-15 18:45:19 -0800 | [diff] [blame] | 13 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 14 | import org.openflow.util.HexString; |
| 15 | import org.slf4j.Logger; |
| 16 | import org.slf4j.LoggerFactory; |
| 17 | |
Masayoshi Kobayashi | 536d72e | 2014-01-06 13:15:52 -0800 | [diff] [blame] | 18 | import com.tinkerpop.blueprints.impls.ramcloud.PerfMon; |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 19 | import net.onrc.onos.graph.GraphDBManager; |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 20 | |
Naoki Shiota | 1c393ce | 2013-06-28 22:55:14 -0700 | [diff] [blame] | 21 | /** |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 22 | * This is the class for storing the information of links into GraphDB |
Naoki Shiota | 1c393ce | 2013-06-28 22:55:14 -0700 | [diff] [blame] | 23 | */ |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 24 | public class LinkStorageImpl implements ILinkStorage { |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 25 | |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 26 | protected final static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class); |
| 27 | protected DBOperation dbop; |
Masayoshi Kobayashi | 536d72e | 2014-01-06 13:15:52 -0800 | [diff] [blame] | 28 | private static PerfMon pm = PerfMon.getInstance(); |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 29 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Initialize the object. Open LinkStorage using given configuration file. |
| 32 | * @param conf Path (absolute path for now) to configuration file. |
| 33 | */ |
| 34 | @Override |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 35 | public void init(final String dbStore, final String conf) { |
Yoshi Muroi | 5804ce9 | 2014-02-08 03:58:04 -0800 | [diff] [blame^] | 36 | this.dbop = GraphDBManager.getDBOperation(); |
yoshi | d38cd31 | 2013-12-02 19:54:44 -0800 | [diff] [blame] | 37 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 38 | } |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 39 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 40 | // Method designing policy: |
| 41 | // op.commit() and op.rollback() MUST called in public (first-class) methods. |
| 42 | // A first-class method MUST NOT call other first-class method. |
| 43 | // Routine process should be implemented in private method. |
| 44 | // A private method MUST NOT call commit or rollback. |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 45 | |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 46 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 47 | /** |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 48 | * Update a record in the LinkStorage in a way provided by dmop. |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 49 | * @param link Record of a link to be updated. |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 50 | * @param linkinfo Meta-information of a link to be updated. |
| 51 | * @param dmop Operation to be done. |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 52 | */ |
| 53 | @Override |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 54 | public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION dmop) { |
| 55 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 56 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 57 | switch (dmop) { |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 58 | case CREATE: |
| 59 | case INSERT: |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 60 | if (link != null) { |
| 61 | try { |
| 62 | if (addLinkImpl(link)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 63 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 64 | success = true; |
| 65 | } |
| 66 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 67 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 68 | e.printStackTrace(); |
| 69 | log.error("LinkStorageImpl:update {} link:{} failed", dmop, link); |
| 70 | } |
| 71 | } |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 72 | break; |
| 73 | case UPDATE: |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 74 | if (link != null && linkinfo != null) { |
| 75 | try { |
| 76 | if (setLinkInfoImpl(link, linkinfo)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 77 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 78 | success = true; |
| 79 | } |
| 80 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 81 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 82 | e.printStackTrace(); |
| 83 | log.error("LinkStorageImpl:update {} link:{} failed", dmop, link); |
| 84 | } |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 85 | } |
| 86 | break; |
| 87 | case DELETE: |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 88 | if (link != null) { |
| 89 | try { |
| 90 | if (deleteLinkImpl(link)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 91 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 92 | success = true; |
| 93 | log.debug("LinkStorageImpl:update {} link:{} succeeded", dmop, link); |
| 94 | } else { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 95 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 96 | log.debug("LinkStorageImpl:update {} link:{} failed", dmop, link); |
| 97 | } |
| 98 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 99 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 100 | e.printStackTrace(); |
| 101 | log.error("LinkStorageImpl:update {} link:{} failed", dmop, link); |
| 102 | } |
| 103 | } |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 104 | break; |
| 105 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 106 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 107 | return success; |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 108 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 109 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 110 | @Override |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 111 | public boolean addLink(Link link) { |
| 112 | return addLink(link, null); |
| 113 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 114 | |
pingping-lin | 0092603 | 2013-12-18 12:13:08 +0800 | [diff] [blame] | 115 | private void deleteDeviceOnPort(Long dpid, Short number) |
| 116 | { |
Masayoshi Kobayashi | 1015e36 | 2013-12-17 22:54:49 -0800 | [diff] [blame] | 117 | IPortObject srcPortObject = dbop.searchPort(HexString.toHexString(dpid), number); |
Yuta HIGUCHI | d489ced | 2014-01-08 15:46:28 -0800 | [diff] [blame] | 118 | if (srcPortObject == null) |
| 119 | return; |
| 120 | Iterable<IDeviceObject> devices = srcPortObject.getDevices(); |
| 121 | if (devices == null) |
| 122 | return; |
| 123 | if (devices.iterator().hasNext()) { |
pingping-lin | 0092603 | 2013-12-18 12:13:08 +0800 | [diff] [blame] | 124 | for (IDeviceObject deviceObject: srcPortObject.getDevices()) { |
| 125 | srcPortObject.removeDevice(deviceObject); |
| 126 | log.debug("delete Device "+ deviceObject.getMACAddress() + |
| 127 | " from sw: {} port: {} due to a new link added", |
| 128 | dpid, number); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 133 | @Override |
| 134 | public boolean addLink(Link link, LinkInfo linfo) { |
| 135 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 136 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 137 | try { |
pingping-lin | 0092603 | 2013-12-18 12:13:08 +0800 | [diff] [blame] | 138 | //delete the Device attachment points for the related switch and port |
| 139 | deleteDeviceOnPort(link.getSrc(),link.getSrcPort()); |
| 140 | deleteDeviceOnPort(link.getDst(),link.getDstPort()); |
| 141 | |
Masayoshi Kobayashi | 536d72e | 2014-01-06 13:15:52 -0800 | [diff] [blame] | 142 | pm.addlink_start(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 143 | if (addLinkImpl(link)) { |
| 144 | // Set LinkInfo only if linfo is non-null. |
| 145 | if (linfo != null && (! setLinkInfoImpl(link, linfo))) { |
Jonathan Hart | 13ccdca | 2013-10-30 15:23:28 -0700 | [diff] [blame] | 146 | log.debug("Adding linkinfo failed: {}", link); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 147 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 148 | } |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 149 | dbop.commit(); |
Masayoshi Kobayashi | 536d72e | 2014-01-06 13:15:52 -0800 | [diff] [blame] | 150 | pm.addlink_end(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 151 | success = true; |
| 152 | } else { |
Yuta HIGUCHI | 1df3815 | 2014-01-08 13:26:29 -0800 | [diff] [blame] | 153 | pm.addlink_end(); |
Jonathan Hart | 13ccdca | 2013-10-30 15:23:28 -0700 | [diff] [blame] | 154 | // If we fail here that's because the ports aren't added |
| 155 | // before we try to add the link |
| 156 | log.debug("Adding link failed: {}", link); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 157 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 158 | } |
| 159 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 160 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 161 | e.printStackTrace(); |
| 162 | log.error("LinkStorageImpl:addLink link:{} linfo:{} failed", link, linfo); |
| 163 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 164 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 165 | return success; |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 166 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 167 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 168 | /** |
| 169 | * Update multiple records in the LinkStorage in a way provided by op. |
| 170 | * @param links List of records to be updated. |
| 171 | * @param op Operation to be done. |
| 172 | */ |
| 173 | @Override |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 174 | public boolean addLinks(List<Link> links) { |
| 175 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 176 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 177 | for (Link lt: links) { |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 178 | if (! addLinkImpl(lt)) { |
| 179 | return false; |
| 180 | } |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 181 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 182 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 183 | try { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 184 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 185 | success = true; |
| 186 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 187 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 188 | e.printStackTrace(); |
| 189 | log.error("LinkStorageImpl:addLinks link:s{} failed", links); |
| 190 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 191 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 192 | return success; |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 193 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 194 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 195 | /** |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 196 | * Delete a record in the LinkStorage. |
| 197 | * @param lt Record to be deleted. |
| 198 | */ |
| 199 | @Override |
| 200 | public boolean deleteLink(Link lt) { |
| 201 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 202 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 203 | log.debug("LinkStorageImpl:deleteLink(): {}", lt); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 204 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 205 | try { |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 206 | if (deleteLinkImpl(lt)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 207 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 208 | success = true; |
| 209 | log.debug("LinkStorageImpl:deleteLink(): deleted edges {}", lt); |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 210 | } else { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 211 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 212 | log.error("LinkStorageImpl:deleteLink(): failed invalid vertices {}", lt); |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 213 | } |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 214 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 215 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 216 | log.error("LinkStorageImpl:deleteLink(): failed {} {}", |
| 217 | new Object[]{lt, e.toString()}); |
| 218 | e.printStackTrace(); |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 219 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 220 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 221 | return success; |
| 222 | } |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 223 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 224 | /** |
| 225 | * Delete multiple records in LinkStorage. |
| 226 | * @param links List of records to be deleted. |
| 227 | */ |
| 228 | @Override |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 229 | public boolean deleteLinks(List<Link> links) { |
| 230 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 231 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 232 | try { |
| 233 | for (Link lt : links) { |
| 234 | if (! deleteLinkImpl(lt)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 235 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 236 | return false; |
| 237 | } |
| 238 | } |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 239 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 240 | success = true; |
| 241 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 242 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 243 | e.printStackTrace(); |
| 244 | log.error("LinkStorageImpl:deleteLinks failed invalid vertices {}", links); |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 245 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 246 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 247 | return success; |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 248 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 249 | |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 250 | /** |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 251 | * Get list of all links connected to the port specified by given DPID and port number. |
| 252 | * @param dpid DPID of desired port. |
| 253 | * @param port Port number of desired port. |
| 254 | * @return List of links. Empty list if no port was found. |
| 255 | */ |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 256 | @Override |
| 257 | public List<Link> getLinks(Long dpid, short port) { |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 258 | List<Link> links = new ArrayList<Link>(); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 259 | IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port); |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 260 | if (srcPort == null) |
| 261 | return links; |
| 262 | ISwitchObject srcSw = srcPort.getSwitch(); |
| 263 | if (srcSw == null) |
| 264 | return links; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 265 | |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 266 | for(IPortObject dstPort : srcPort.getLinkedPorts()) { |
| 267 | ISwitchObject dstSw = dstPort.getSwitch(); |
| 268 | if (dstSw != null) { |
Pavlin Radoslavov | 0aad60c | 2013-11-05 08:33:57 -0800 | [diff] [blame] | 269 | Link link = new Link(dpid, port, |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 270 | HexString.toLong(dstSw.getDPID()), |
| 271 | dstPort.getNumber()); |
| 272 | links.add(link); |
| 273 | } |
| 274 | } |
| 275 | return links; |
Pavlin Radoslavov | 43781cd | 2013-11-04 18:19:10 -0800 | [diff] [blame] | 276 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 277 | |
Pavlin Radoslavov | 43781cd | 2013-11-04 18:19:10 -0800 | [diff] [blame] | 278 | /** |
| 279 | * Get list of all reverse links connected to the port specified by given DPID and port number. |
| 280 | * @param dpid DPID of desired port. |
| 281 | * @param port Port number of desired port. |
| 282 | * @return List of reverse links. Empty list if no port was found. |
| 283 | */ |
| 284 | @Override |
| 285 | public List<Link> getReverseLinks(Long dpid, short port) { |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 286 | List<Link> links = new ArrayList<Link>(); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 287 | |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 288 | IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port); |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 289 | if (srcPort == null) |
| 290 | return links; |
| 291 | ISwitchObject srcSw = srcPort.getSwitch(); |
| 292 | if (srcSw == null) |
| 293 | return links; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 294 | |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 295 | for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) { |
| 296 | ISwitchObject dstSw = dstPort.getSwitch(); |
| 297 | if (dstSw != null) { |
| 298 | Link link = new Link(HexString.toLong(dstSw.getDPID()), |
| 299 | dstPort.getNumber(), |
Pavlin Radoslavov | 0aad60c | 2013-11-05 08:33:57 -0800 | [diff] [blame] | 300 | dpid, port); |
Pavlin Radoslavov | d822679 | 2013-11-04 20:28:07 -0800 | [diff] [blame] | 301 | links.add(link); |
| 302 | } |
| 303 | } |
| 304 | return links; |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 305 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 306 | |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 307 | /** |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 308 | * Delete records of the links connected to the port specified by given DPID and port number. |
| 309 | * @param dpid DPID of desired port. |
| 310 | * @param port Port number of desired port. |
| 311 | */ |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 312 | @Override |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 313 | public boolean deleteLinksOnPort(Long dpid, short port) { |
| 314 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 315 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 316 | List<Link> linksToDelete = getLinks(dpid, port); |
| 317 | try { |
| 318 | for(Link l : linksToDelete) { |
| 319 | if (! deleteLinkImpl(l)) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 320 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 321 | log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port); |
| 322 | return false; |
| 323 | } |
| 324 | } |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 325 | dbop.commit(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 326 | success = true; |
| 327 | } catch (Exception e) { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 328 | dbop.rollback(); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 329 | e.printStackTrace(); |
| 330 | log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port); |
mininet | 403d589 | 2013-06-05 03:48:17 -0700 | [diff] [blame] | 331 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 332 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 333 | return success; |
Umesh Krishnaswamy | f962d64 | 2013-01-23 19:04:23 -0800 | [diff] [blame] | 334 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 335 | |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 336 | /** |
| 337 | * Get list of all links connected to the switch specified by given DPID. |
| 338 | * @param dpid DPID of desired switch. |
| 339 | * @return List of links. Empty list if no port was found. |
| 340 | */ |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame] | 341 | @Override |
| 342 | public List<Link> getLinks(String dpid) { |
mininet | 403d589 | 2013-06-05 03:48:17 -0700 | [diff] [blame] | 343 | List<Link> links = new ArrayList<Link>(); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 344 | ISwitchObject srcSw = dbop.searchSwitch(dpid); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 345 | |
Naoki Shiota | 93ec171 | 2013-06-13 15:49:36 -0700 | [diff] [blame] | 346 | if(srcSw != null) { |
| 347 | for(IPortObject srcPort : srcSw.getPorts()) { |
| 348 | for(IPortObject dstPort : srcPort.getLinkedPorts()) { |
| 349 | ISwitchObject dstSw = dstPort.getSwitch(); |
| 350 | if(dstSw != null) { |
Pavlin Radoslavov | 0aad60c | 2013-11-05 08:33:57 -0800 | [diff] [blame] | 351 | Link link = new Link(HexString.toLong(dpid), |
Naoki Shiota | 93ec171 | 2013-06-13 15:49:36 -0700 | [diff] [blame] | 352 | srcPort.getNumber(), |
| 353 | HexString.toLong(dstSw.getDPID()), |
Pavlin Radoslavov | 0aad60c | 2013-11-05 08:33:57 -0800 | [diff] [blame] | 354 | dstPort.getNumber()); |
Naoki Shiota | 93ec171 | 2013-06-13 15:49:36 -0700 | [diff] [blame] | 355 | links.add(link); |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 360 | |
mininet | 403d589 | 2013-06-05 03:48:17 -0700 | [diff] [blame] | 361 | return links; |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame] | 362 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 363 | |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 364 | /** |
Pavlin Radoslavov | c934b4a | 2013-11-02 14:53:52 -0700 | [diff] [blame] | 365 | * Get list of all reverse links connected to the switch specified by |
| 366 | * given DPID. |
| 367 | * @param dpid DPID of desired switch. |
| 368 | * @return List of reverse links. Empty list if no port was found. |
| 369 | */ |
| 370 | @Override |
| 371 | public List<Link> getReverseLinks(String dpid) { |
| 372 | List<Link> links = new ArrayList<Link>(); |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 373 | |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 374 | ISwitchObject srcSw = dbop.searchSwitch(dpid); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 375 | |
Pavlin Radoslavov | c934b4a | 2013-11-02 14:53:52 -0700 | [diff] [blame] | 376 | if(srcSw != null) { |
| 377 | for(IPortObject srcPort : srcSw.getPorts()) { |
| 378 | for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) { |
| 379 | ISwitchObject dstSw = dstPort.getSwitch(); |
| 380 | if(dstSw != null) { |
| 381 | Link link = new Link( |
| 382 | HexString.toLong(dstSw.getDPID()), |
| 383 | dstPort.getNumber(), |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 384 | |
Pavlin Radoslavov | 0aad60c | 2013-11-05 08:33:57 -0800 | [diff] [blame] | 385 | HexString.toLong(dpid), |
Pavlin Radoslavov | c934b4a | 2013-11-02 14:53:52 -0700 | [diff] [blame] | 386 | srcPort.getNumber()); |
| 387 | links.add(link); |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 392 | |
Pavlin Radoslavov | c934b4a | 2013-11-02 14:53:52 -0700 | [diff] [blame] | 393 | return links; |
| 394 | } |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 395 | |
Pavlin Radoslavov | c934b4a | 2013-11-02 14:53:52 -0700 | [diff] [blame] | 396 | /** |
Naoki Shiota | 1151671 | 2013-06-05 22:36:01 -0700 | [diff] [blame] | 397 | * Get list of all links whose state is ACTIVE. |
| 398 | * @return List of active links. Empty list if no port was found. |
| 399 | */ |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 400 | @Override |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame] | 401 | public List<Link> getActiveLinks() { |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 402 | Iterable<ISwitchObject> switches = dbop.getActiveSwitches(); |
yoshi | 2fd4c7e | 2013-11-22 15:47:55 -0800 | [diff] [blame] | 403 | |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 404 | List<Link> links = new ArrayList<Link>(); |
| 405 | |
Naoki Shiota | 826e84a | 2013-06-18 13:13:25 -0700 | [diff] [blame] | 406 | for (ISwitchObject srcSw : switches) { |
| 407 | for(IPortObject srcPort : srcSw.getPorts()) { |
| 408 | for(IPortObject dstPort : srcPort.getLinkedPorts()) { |
| 409 | ISwitchObject dstSw = dstPort.getSwitch(); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 410 | |
Naoki Shiota | 826e84a | 2013-06-18 13:13:25 -0700 | [diff] [blame] | 411 | if(dstSw != null && dstSw.getState().equals("ACTIVE")) { |
| 412 | links.add(new Link(HexString.toLong(srcSw.getDPID()), |
| 413 | srcPort.getNumber(), |
| 414 | HexString.toLong(dstSw.getDPID()), |
| 415 | dstPort.getNumber())); |
| 416 | } |
| 417 | } |
Pankaj Berde | 5024ec1 | 2013-01-31 17:07:29 -0800 | [diff] [blame] | 418 | } |
Pankaj Berde | 5024ec1 | 2013-01-31 17:07:29 -0800 | [diff] [blame] | 419 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 420 | |
Pankaj Berde | 5024ec1 | 2013-01-31 17:07:29 -0800 | [diff] [blame] | 421 | return links; |
Pankaj Berde | ff42180 | 2013-01-29 20:28:52 -0800 | [diff] [blame] | 422 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 423 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 424 | @Override |
| 425 | public LinkInfo getLinkInfo(Link link) { |
| 426 | // TODO implement this |
| 427 | return null; |
| 428 | } |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 429 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 430 | /** |
| 431 | * Finalize the object. |
| 432 | */ |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 433 | @Override |
Yuta HIGUCHI | 67a7a3e | 2014-01-03 14:51:34 -0800 | [diff] [blame] | 434 | protected void finalize() { |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 435 | close(); |
| 436 | } |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 437 | |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 438 | /** |
| 439 | * Close LinkStorage. |
| 440 | */ |
| 441 | @Override |
| 442 | public void close() { |
| 443 | // TODO Auto-generated method stub |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 444 | // graph.shutdown(); |
Naoki Shiota | b2d17e8 | 2013-10-18 18:08:16 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 447 | /** |
| 448 | * Update a record of link with meta-information in the LinkStorage. |
| 449 | * @param link Record of a link to update. |
| 450 | * @param linkinfo Meta-information of a link to be updated. |
| 451 | */ |
| 452 | private boolean setLinkInfoImpl(Link link, LinkInfo linkinfo) { |
| 453 | // TODO implement this |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 454 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 455 | return false; |
| 456 | } |
| 457 | |
| 458 | private boolean addLinkImpl(Link lt) { |
| 459 | boolean success = false; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 460 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 461 | IPortObject vportSrc = null, vportDst = null; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 462 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 463 | // get source port vertex |
| 464 | String dpid = HexString.toHexString(lt.getSrc()); |
| 465 | short port = lt.getSrcPort(); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 466 | log.debug("addLinkImpl Src dpid : {} port : {}", dpid, port); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 467 | vportSrc = dbop.searchPort(dpid, port); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 468 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 469 | // get dest port vertex |
| 470 | dpid = HexString.toHexString(lt.getDst()); |
| 471 | port = lt.getDstPort(); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 472 | log.debug("addLinkImpl Dst dpid : {} port : {}", dpid, port); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 473 | vportDst = dbop.searchPort(dpid, port); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 474 | |
| 475 | log.debug("addLinkImpl vportSrc : {} vportDst : {}", vportSrc, vportDst); |
| 476 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 477 | if (vportSrc != null && vportDst != null) { |
| 478 | IPortObject portExist = null; |
| 479 | // check if the link exists |
| 480 | for (IPortObject V : vportSrc.getLinkedPorts()) { |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 481 | log.debug("vportSrc.getLinkedPorts() :{}", V); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 482 | if (V.equals(vportDst)) { |
| 483 | portExist = V; |
| 484 | break; |
| 485 | } |
| 486 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 487 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 488 | if (portExist == null) { |
| 489 | vportSrc.setLinkPort(vportDst); |
| 490 | success = true; |
| 491 | } else { |
Yuta HIGUCHI | 1df3815 | 2014-01-08 13:26:29 -0800 | [diff] [blame] | 492 | log.error("LinkStorageImpl:addLinkImpl failed link exists {} {} src {} dst {}", |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 493 | new Object[]{dbop, lt, vportSrc, vportDst}); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 494 | } |
Naoki Shiota | f74d5f3 | 2014-01-09 21:29:38 -0800 | [diff] [blame] | 495 | } else { |
| 496 | log.error("Ports not found : {}", lt); |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 497 | } |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 498 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 499 | return success; |
| 500 | } |
| 501 | |
| 502 | private boolean deleteLinkImpl(Link lt) { |
| 503 | boolean success = false; |
| 504 | IPortObject vportSrc = null, vportDst = null; |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 505 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 506 | // get source port vertex |
| 507 | String dpid = HexString.toHexString(lt.getSrc()); |
| 508 | short port = lt.getSrcPort(); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 509 | vportSrc = dbop.searchPort(dpid, port); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 510 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 511 | // get dst port vertex |
| 512 | dpid = HexString.toHexString(lt.getDst()); |
| 513 | port = lt.getDstPort(); |
yoshi | 0fee3de | 2013-11-23 09:13:37 -0800 | [diff] [blame] | 514 | vportDst = dbop.searchPort(dpid, port); |
Yuta HIGUCHI | aa5e4a7 | 2014-01-06 21:55:25 -0800 | [diff] [blame] | 515 | |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 516 | // FIXME: This needs to remove all edges |
Yuta HIGUCHI | 5302ddf | 2014-01-06 12:53:35 -0800 | [diff] [blame] | 517 | if (vportSrc != null && vportDst != null) { |
| 518 | vportSrc.removeLink(vportDst); |
| 519 | log.debug("deleteLinkImpl(): deleted edge {} src {} dst {}", new Object[]{ |
| 520 | lt, vportSrc, vportDst}); |
| 521 | success = true; |
| 522 | } |
| 523 | |
| 524 | return success; |
Naoki Shiota | 987a572 | 2013-10-23 11:59:36 -0700 | [diff] [blame] | 525 | } |
Umesh Krishnaswamy | b676ca2 | 2013-01-11 12:39:25 -0800 | [diff] [blame] | 526 | } |