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