Committed by
Gerrit Code Review
adding support for iptv
Change-Id: I903bc97581a9393ec8bb7973a722044669ae7470
Showing
1 changed file
with
19 additions
and
10 deletions
| ... | @@ -87,10 +87,13 @@ public class OLT { | ... | @@ -87,10 +87,13 @@ public class OLT { |
| 87 | @Activate | 87 | @Activate |
| 88 | public void activate() { | 88 | public void activate() { |
| 89 | appId = coreService.registerApplication("org.onosproject.mobility"); | 89 | appId = coreService.registerApplication("org.onosproject.mobility"); |
| 90 | + | ||
| 90 | deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach( | 91 | deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach( |
| 91 | port -> { | 92 | port -> { |
| 92 | if (port.isEnabled()) { | 93 | if (port.isEnabled()) { |
| 93 | - provisionVlanOnPort(port.number()); | 94 | + short vlanId = fetchVlanId(port.number()); |
| 95 | + provisionVlanOnPort(port.number(), (short) 7); | ||
| 96 | + provisionVlanOnPort(port.number(), vlanId); | ||
| 94 | } | 97 | } |
| 95 | } | 98 | } |
| 96 | ); | 99 | ); |
| ... | @@ -115,22 +118,27 @@ public class OLT { | ... | @@ -115,22 +118,27 @@ public class OLT { |
| 115 | 118 | ||
| 116 | } | 119 | } |
| 117 | 120 | ||
| 118 | - private void provisionVlanOnPort(PortNumber p) { | 121 | + |
| 119 | - long port = p.toLong() + OFFSET; | 122 | + private short fetchVlanId(PortNumber port) { |
| 120 | - if (port > 4095) { | 123 | + long p = port.toLong() + OFFSET; |
| 124 | + if (p > 4095) { | ||
| 121 | log.warn("Port Number {} exceeds vlan max", port); | 125 | log.warn("Port Number {} exceeds vlan max", port); |
| 122 | - return; | 126 | + return -1; |
| 123 | } | 127 | } |
| 128 | + return (short) p; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + | ||
| 132 | + private void provisionVlanOnPort(PortNumber p, short vlanId) { | ||
| 133 | + | ||
| 124 | 134 | ||
| 125 | TrafficSelector upstream = DefaultTrafficSelector.builder() | 135 | TrafficSelector upstream = DefaultTrafficSelector.builder() |
| 126 | - .matchVlanId( | 136 | + .matchVlanId(VlanId.vlanId(vlanId)) |
| 127 | - VlanId.vlanId((short) port)) | ||
| 128 | .matchInPort(p) | 137 | .matchInPort(p) |
| 129 | .build(); | 138 | .build(); |
| 130 | 139 | ||
| 131 | TrafficSelector downStream = DefaultTrafficSelector.builder() | 140 | TrafficSelector downStream = DefaultTrafficSelector.builder() |
| 132 | - .matchVlanId( | 141 | + .matchVlanId(VlanId.vlanId(vlanId)) |
| 133 | - VlanId.vlanId((short) port)) | ||
| 134 | .matchInPort(PortNumber.portNumber(uplinkPort)) | 142 | .matchInPort(PortNumber.portNumber(uplinkPort)) |
| 135 | .build(); | 143 | .build(); |
| 136 | 144 | ||
| ... | @@ -174,7 +182,8 @@ public class OLT { | ... | @@ -174,7 +182,8 @@ public class OLT { |
| 174 | case PORT_ADDED: | 182 | case PORT_ADDED: |
| 175 | case PORT_UPDATED: | 183 | case PORT_UPDATED: |
| 176 | if (devId.equals(event.subject().id()) && event.port().isEnabled()) { | 184 | if (devId.equals(event.subject().id()) && event.port().isEnabled()) { |
| 177 | - provisionVlanOnPort(event.port().number()); | 185 | + short vlanId = fetchVlanId(event.port().number()); |
| 186 | + provisionVlanOnPort(event.port().number(), vlanId); | ||
| 178 | } | 187 | } |
| 179 | break; | 188 | break; |
| 180 | case DEVICE_ADDED: | 189 | case DEVICE_ADDED: | ... | ... |
-
Please register or login to post a comment