Fixing an issue with OpticalLinkProvider and reverting some topo changes.
Change-Id: If57d529127323d0d2b0f8778ce68527de6284c77
Showing
4 changed files
with
44 additions
and
49 deletions
| ... | @@ -20,8 +20,11 @@ import org.apache.felix.scr.annotations.Component; | ... | @@ -20,8 +20,11 @@ import org.apache.felix.scr.annotations.Component; |
| 20 | import org.apache.felix.scr.annotations.Deactivate; | 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Reference; | 21 | import org.apache.felix.scr.annotations.Reference; |
| 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 23 | +import org.onlab.onos.net.ConnectPoint; | ||
| 23 | import org.onlab.onos.net.Device; | 24 | import org.onlab.onos.net.Device; |
| 25 | +import org.onlab.onos.net.DeviceId; | ||
| 24 | import org.onlab.onos.net.Link; | 26 | import org.onlab.onos.net.Link; |
| 27 | +import org.onlab.onos.net.Port; | ||
| 25 | import org.onlab.onos.net.device.DeviceEvent; | 28 | import org.onlab.onos.net.device.DeviceEvent; |
| 26 | import org.onlab.onos.net.device.DeviceListener; | 29 | import org.onlab.onos.net.device.DeviceListener; |
| 27 | import org.onlab.onos.net.device.DeviceService; | 30 | import org.onlab.onos.net.device.DeviceService; |
| ... | @@ -91,7 +94,9 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide | ... | @@ -91,7 +94,9 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide |
| 91 | if (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || | 94 | if (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || |
| 92 | type == DeviceEvent.Type.DEVICE_ADDED || | 95 | type == DeviceEvent.Type.DEVICE_ADDED || |
| 93 | type == DeviceEvent.Type.DEVICE_UPDATED) { | 96 | type == DeviceEvent.Type.DEVICE_UPDATED) { |
| 94 | - processLinks(device); | 97 | + processDeviceLinks(device); |
| 98 | + } else if (type == DeviceEvent.Type.PORT_UPDATED) { | ||
| 99 | + processPortLinks(device, event.port()); | ||
| 95 | } | 100 | } |
| 96 | } | 101 | } |
| 97 | } | 102 | } |
| ... | @@ -109,7 +114,7 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide | ... | @@ -109,7 +114,7 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide |
| 109 | } | 114 | } |
| 110 | } | 115 | } |
| 111 | 116 | ||
| 112 | - private void processLinks(Device device) { | 117 | + private void processDeviceLinks(Device device) { |
| 113 | for (Link link : linkService.getDeviceLinks(device.id())) { | 118 | for (Link link : linkService.getDeviceLinks(device.id())) { |
| 114 | if (link.isDurable() && link.type() == OPTICAL) { | 119 | if (link.isDurable() && link.type() == OPTICAL) { |
| 115 | processLink(link); | 120 | processLink(link); |
| ... | @@ -117,9 +122,25 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide | ... | @@ -117,9 +122,25 @@ public class OpticalLinkProvider extends AbstractProvider implements LinkProvide |
| 117 | } | 122 | } |
| 118 | } | 123 | } |
| 119 | 124 | ||
| 125 | + private void processPortLinks(Device device, Port port) { | ||
| 126 | + ConnectPoint connectPoint = new ConnectPoint(device.id(), port.number()); | ||
| 127 | + for (Link link : linkService.getLinks(connectPoint)) { | ||
| 128 | + if (link.isDurable() && link.type() == OPTICAL) { | ||
| 129 | + processLink(link); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 120 | private void processLink(Link link) { | 134 | private void processLink(Link link) { |
| 121 | - boolean active = deviceService.isAvailable(link.src().deviceId()) && | 135 | + DeviceId srcId = link.src().deviceId(); |
| 122 | - deviceService.isAvailable(link.dst().deviceId()); | 136 | + DeviceId dstId = link.dst().deviceId(); |
| 137 | + Port srcPort = deviceService.getPort(srcId, link.src().port()); | ||
| 138 | + Port dstPort = deviceService.getPort(dstId, link.dst().port()); | ||
| 139 | + | ||
| 140 | + boolean active = deviceService.isAvailable(srcId) && | ||
| 141 | + deviceService.isAvailable(dstId) && | ||
| 142 | + srcPort.isEnabled() && dstPort.isEnabled(); | ||
| 143 | + | ||
| 123 | LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL); | 144 | LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL); |
| 124 | if (active) { | 145 | if (active) { |
| 125 | providerService.linkDetected(desc); | 146 | providerService.linkDetected(desc); | ... | ... |
| ... | @@ -144,13 +144,6 @@ | ... | @@ -144,13 +144,6 @@ |
| 144 | { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | 144 | { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 145 | { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | 145 | { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 146 | { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | 146 | { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 147 | - { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | 147 | + { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } } |
| 148 | - | ||
| 149 | - { "src": "of:0000ffffffff0001/3", "dst": "of:0000ffffffffff01/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | ||
| 150 | - { "src": "of:0000ffffffff0002/3", "dst": "of:0000ffffffffff04/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | ||
| 151 | - { "src": "of:0000ffffffff0003/3", "dst": "of:0000ffffffffff06/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | ||
| 152 | - { "src": "of:0000ffffffff0004/3", "dst": "of:0000ffffffffff07/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | ||
| 153 | - { "src": "of:0000ffffffff0005/3", "dst": "of:0000ffffffffff09/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, | ||
| 154 | - { "src": "of:0000ffffffff0006/3", "dst": "of:0000ffffffffff0A/11", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } } | ||
| 155 | ] | 148 | ] |
| 156 | } | 149 | } | ... | ... |
| ... | @@ -64,19 +64,12 @@ class OpticalTopo(Topo): | ... | @@ -64,19 +64,12 @@ class OpticalTopo(Topo): |
| 64 | self.addIntf(s5,'tap33') | 64 | self.addIntf(s5,'tap33') |
| 65 | self.addIntf(s6,'tap34') | 65 | self.addIntf(s6,'tap34') |
| 66 | 66 | ||
| 67 | - self.addIntf(s1,'tap35') | ||
| 68 | - self.addIntf(s2,'tap36') | ||
| 69 | - self.addIntf(s3,'tap37') | ||
| 70 | - self.addIntf(s4,'tap38') | ||
| 71 | - self.addIntf(s5,'tap39') | ||
| 72 | - self.addIntf(s6,'tap40') | ||
| 73 | - | ||
| 74 | # if you use, sudo mn --custom custom/optical.py, then register the topo: | 67 | # if you use, sudo mn --custom custom/optical.py, then register the topo: |
| 75 | topos = {'optical': ( lambda: OpticalTopo() )} | 68 | topos = {'optical': ( lambda: OpticalTopo() )} |
| 76 | 69 | ||
| 77 | 70 | ||
| 78 | def run(): | 71 | def run(): |
| 79 | - c = RemoteController('c','192.168.56.101',6633) | 72 | + c = RemoteController('c','127.0.0.1',6633) |
| 80 | net = Mininet( topo=OpticalTopo(),controller=None,autoSetMacs=True) | 73 | net = Mininet( topo=OpticalTopo(),controller=None,autoSetMacs=True) |
| 81 | net.addController(c) | 74 | net.addController(c) |
| 82 | net.start() | 75 | net.start() | ... | ... |
| ... | @@ -35,13 +35,7 @@ | ... | @@ -35,13 +35,7 @@ |
| 35 | {port,31,[{interface,"tap31"}]}, | 35 | {port,31,[{interface,"tap31"}]}, |
| 36 | {port,32,[{interface,"tap32"}]}, | 36 | {port,32,[{interface,"tap32"}]}, |
| 37 | {port,33,[{interface,"tap33"}]}, | 37 | {port,33,[{interface,"tap33"}]}, |
| 38 | - {port,34,[{interface,"tap34"}]}, | 38 | + {port,34,[{interface,"tap34"}]}]}, |
| 39 | - {port,35,[{interface,"tap35"}]}, | ||
| 40 | - {port,36,[{interface,"tap36"}]}, | ||
| 41 | - {port,37,[{interface,"tap37"}]}, | ||
| 42 | - {port,38,[{interface,"tap38"}]}, | ||
| 43 | - {port,39,[{interface,"tap39"}]}, | ||
| 44 | - {port,40,[{interface,"tap40"}]}]}, | ||
| 45 | {capable_switch_queues,[]}, | 39 | {capable_switch_queues,[]}, |
| 46 | {optical_links, | 40 | {optical_links, |
| 47 | [{{1,50},{2,30}}, | 41 | [{{1,50},{2,30}}, |
| ... | @@ -62,18 +56,17 @@ | ... | @@ -62,18 +56,17 @@ |
| 62 | [{switch,1, | 56 | [{switch,1, |
| 63 | [{backend,linc_us4_oe}, | 57 | [{backend,linc_us4_oe}, |
| 64 | {datapath_id,"00:00:ff:ff:ff:ff:ff:01"}, | 58 | {datapath_id,"00:00:ff:ff:ff:ff:ff:01"}, |
| 65 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 59 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 66 | {controllers_listener,disabled}, | 60 | {controllers_listener,disabled}, |
| 67 | {queues_status,disabled}, | 61 | {queues_status,disabled}, |
| 68 | {ports, | 62 | {ports, |
| 69 | [{port,1,[{queues,[]},{port_no,50}]}, | 63 | [{port,1,[{queues,[]},{port_no,50}]}, |
| 70 | {port,7,[{queues,[]},{port_no,20}]}, | 64 | {port,7,[{queues,[]},{port_no,20}]}, |
| 71 | - {port,29,[{queues,[]},{port_no,10}]}, | 65 | + {port,29,[{queues,[]},{port_no,10}]}]}]}, |
| 72 | - {port,35,[{queues,[]},{port_no,11}]}]}]}, | ||
| 73 | {switch,2, | 66 | {switch,2, |
| 74 | [{backend,linc_us4_oe}, | 67 | [{backend,linc_us4_oe}, |
| 75 | {datapath_id,"00:00:ff:ff:ff:ff:ff:02"}, | 68 | {datapath_id,"00:00:ff:ff:ff:ff:ff:02"}, |
| 76 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 69 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 77 | {controllers_listener,disabled}, | 70 | {controllers_listener,disabled}, |
| 78 | {queues_status,disabled}, | 71 | {queues_status,disabled}, |
| 79 | {ports, | 72 | {ports, |
| ... | @@ -83,7 +76,7 @@ | ... | @@ -83,7 +76,7 @@ |
| 83 | {switch,3, | 76 | {switch,3, |
| 84 | [{backend,linc_us4_oe}, | 77 | [{backend,linc_us4_oe}, |
| 85 | {datapath_id,"00:00:ff:ff:ff:ff:ff:03"}, | 78 | {datapath_id,"00:00:ff:ff:ff:ff:ff:03"}, |
| 86 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 79 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 87 | {controllers_listener,disabled}, | 80 | {controllers_listener,disabled}, |
| 88 | {queues_status,disabled}, | 81 | {queues_status,disabled}, |
| 89 | {ports, | 82 | {ports, |
| ... | @@ -93,18 +86,17 @@ | ... | @@ -93,18 +86,17 @@ |
| 93 | {switch,4, | 86 | {switch,4, |
| 94 | [{backend,linc_us4_oe}, | 87 | [{backend,linc_us4_oe}, |
| 95 | {datapath_id,"00:00:ff:ff:ff:ff:ff:04"}, | 88 | {datapath_id,"00:00:ff:ff:ff:ff:ff:04"}, |
| 96 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 89 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 97 | {controllers_listener,disabled}, | 90 | {controllers_listener,disabled}, |
| 98 | {queues_status,disabled}, | 91 | {queues_status,disabled}, |
| 99 | {ports, | 92 | {ports, |
| 100 | [{port,6,[{queues,[]},{port_no,50}]}, | 93 | [{port,6,[{queues,[]},{port_no,50}]}, |
| 101 | {port,13,[{queues,[]},{port_no,20}]}, | 94 | {port,13,[{queues,[]},{port_no,20}]}, |
| 102 | - {port,30,[{queues,[]},{port_no,10}]}, | 95 | + {port,30,[{queues,[]},{port_no,10}]}]}]}, |
| 103 | - {port,36,[{queues,[]},{port_no,11}]}]}]}, | ||
| 104 | {switch,5, | 96 | {switch,5, |
| 105 | [{backend,linc_us4_oe}, | 97 | [{backend,linc_us4_oe}, |
| 106 | {datapath_id,"00:00:ff:ff:ff:ff:ff:05"}, | 98 | {datapath_id,"00:00:ff:ff:ff:ff:ff:05"}, |
| 107 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 99 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 108 | {controllers_listener,disabled}, | 100 | {controllers_listener,disabled}, |
| 109 | {queues_status,disabled}, | 101 | {queues_status,disabled}, |
| 110 | {ports, | 102 | {ports, |
| ... | @@ -115,19 +107,18 @@ | ... | @@ -115,19 +107,18 @@ |
| 115 | {switch,7, | 107 | {switch,7, |
| 116 | [{backend,linc_us4_oe}, | 108 | [{backend,linc_us4_oe}, |
| 117 | {datapath_id,"00:00:ff:ff:ff:ff:ff:07"}, | 109 | {datapath_id,"00:00:ff:ff:ff:ff:ff:07"}, |
| 118 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 110 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 119 | {controllers_listener,disabled}, | 111 | {controllers_listener,disabled}, |
| 120 | {queues_status,disabled}, | 112 | {queues_status,disabled}, |
| 121 | {ports, | 113 | {ports, |
| 122 | [{port,18,[{queues,[]},{port_no,50}]}, | 114 | [{port,18,[{queues,[]},{port_no,50}]}, |
| 123 | {port,21,[{queues,[]},{port_no,20}]}, | 115 | {port,21,[{queues,[]},{port_no,20}]}, |
| 124 | {port,23,[{queues,[]},{port_no,30}]}, | 116 | {port,23,[{queues,[]},{port_no,30}]}, |
| 125 | - {port,32,[{queues,[]},{port_no,10}]}, | 117 | + {port,32,[{queues,[]},{port_no,10}]}]}]}, |
| 126 | - {port,38,[{queues,[]},{port_no,11}]}]}]}, | ||
| 127 | {switch,8, | 118 | {switch,8, |
| 128 | [{backend,linc_us4_oe}, | 119 | [{backend,linc_us4_oe}, |
| 129 | {datapath_id,"00:00:ff:ff:ff:ff:ff:08"}, | 120 | {datapath_id,"00:00:ff:ff:ff:ff:ff:08"}, |
| 130 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 121 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 131 | {controllers_listener,disabled}, | 122 | {controllers_listener,disabled}, |
| 132 | {queues_status,disabled}, | 123 | {queues_status,disabled}, |
| 133 | {ports, | 124 | {ports, |
| ... | @@ -137,29 +128,27 @@ | ... | @@ -137,29 +128,27 @@ |
| 137 | {switch,9, | 128 | {switch,9, |
| 138 | [{backend,linc_us4_oe}, | 129 | [{backend,linc_us4_oe}, |
| 139 | {datapath_id,"00:00:ff:ff:ff:ff:ff:09"}, | 130 | {datapath_id,"00:00:ff:ff:ff:ff:ff:09"}, |
| 140 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 131 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 141 | {controllers_listener,disabled}, | 132 | {controllers_listener,disabled}, |
| 142 | {queues_status,disabled}, | 133 | {queues_status,disabled}, |
| 143 | {ports, | 134 | {ports, |
| 144 | [{port,24,[{queues,[]},{port_no,50}]}, | 135 | [{port,24,[{queues,[]},{port_no,50}]}, |
| 145 | {port,27,[{queues,[]},{port_no,20}]}, | 136 | {port,27,[{queues,[]},{port_no,20}]}, |
| 146 | - {port,33,[{queues,[]},{port_no,10}]}, | 137 | + {port,33,[{queues,[]},{port_no,10}]}]}]}, |
| 147 | - {port,39,[{queues,[]},{port_no,11}]}]}]}, | ||
| 148 | {switch,10, | 138 | {switch,10, |
| 149 | [{backend,linc_us4_oe}, | 139 | [{backend,linc_us4_oe}, |
| 150 | {datapath_id,"00:00:ff:ff:ff:ff:ff:0A"}, | 140 | {datapath_id,"00:00:ff:ff:ff:ff:ff:0A"}, |
| 151 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 141 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 152 | {controllers_listener,disabled}, | 142 | {controllers_listener,disabled}, |
| 153 | {queues_status,disabled}, | 143 | {queues_status,disabled}, |
| 154 | {ports, | 144 | {ports, |
| 155 | [{port,26,[{queues,[]},{port_no,50}]}, | 145 | [{port,26,[{queues,[]},{port_no,50}]}, |
| 156 | {port,28,[{queues,[]},{port_no,20}]}, | 146 | {port,28,[{queues,[]},{port_no,20}]}, |
| 157 | - {port,34,[{queues,[]},{port_no,10}]}, | 147 | + {port,34,[{queues,[]},{port_no,10}]}]}]}, |
| 158 | - {port,40,[{queues,[]},{port_no,11}]}]}]}, | ||
| 159 | {switch,6, | 148 | {switch,6, |
| 160 | [{backend,linc_us4_oe}, | 149 | [{backend,linc_us4_oe}, |
| 161 | {datapath_id,"00:00:ff:ff:ff:ff:ff:06"}, | 150 | {datapath_id,"00:00:ff:ff:ff:ff:ff:06"}, |
| 162 | - {controllers,[{"Switch0-Controller","192.168.56.101",6633,tcp}]}, | 151 | + {controllers,[{"Switch0-Controller","10.1.8.147",6633,tcp}]}, |
| 163 | {controllers_listener,disabled}, | 152 | {controllers_listener,disabled}, |
| 164 | {queues_status,disabled}, | 153 | {queues_status,disabled}, |
| 165 | {ports, | 154 | {ports, |
| ... | @@ -167,8 +156,7 @@ | ... | @@ -167,8 +156,7 @@ |
| 167 | {port,14,[{queues,[]},{port_no,20}]}, | 156 | {port,14,[{queues,[]},{port_no,20}]}, |
| 168 | {port,16,[{queues,[]},{port_no,40}]}, | 157 | {port,16,[{queues,[]},{port_no,40}]}, |
| 169 | {port,19,[{queues,[]},{port_no,30}]}, | 158 | {port,19,[{queues,[]},{port_no,30}]}, |
| 170 | - {port,31,[{queues,[]},{port_no,10}]}, | 159 | + {port,31,[{queues,[]},{port_no,10}]}]}]}]}]}, |
| 171 | - {port,37,[{queues,[]},{port_no,11}]}]}]}]}]}, | ||
| 172 | {epcap,[{verbose,false},{stats_interval,10}]}, | 160 | {epcap,[{verbose,false},{stats_interval,10}]}, |
| 173 | {enetconf, | 161 | {enetconf, |
| 174 | [{capabilities, | 162 | [{capabilities, | ... | ... |
-
Please register or login to post a comment